org.jumpmind.symmetric.ext
Class XmlPublisherFilter

java.lang.Object
  extended by org.jumpmind.symmetric.ext.XmlPublisherFilter
All Implemented Interfaces:
IExtensionPoint, INodeGroupExtensionPoint, IPublisherFilter, IBatchListener, IDataLoaderFilter

public class XmlPublisherFilter
extends java.lang.Object
implements IPublisherFilter, INodeGroupExtensionPoint

This is an optional data loader filter/listener that is capable of translating table data to XML and publishing it to JMS for consumption by the enterprise. It uses JDOM internally to create an XML representation of SymmetricDS data.


Field Summary
protected  IPublisher publisher
           
 
Constructor Summary
XmlPublisherFilter()
           
 
Method Summary
protected  void addFormattedExtraGroupAttributes(IDataLoaderContext ctx, org.jdom.Element xml)
          Give the opportunity for the user of this publisher to add in additional attributes.
 void batchComplete(IDataLoader loader, IncomingBatchHistory hist)
          This method is called after a batch has been successfully processed.
protected  boolean doesXmlExistToPublish(IDataLoaderContext ctx)
           
 boolean filterDelete(IDataLoaderContext ctx, java.lang.String[] keys)
           
 boolean filterInsert(IDataLoaderContext ctx, java.lang.String[] data)
           
 boolean filterUpdate(IDataLoaderContext ctx, java.lang.String[] data, java.lang.String[] keys)
           
 java.lang.String[] getNodeGroupIdsToApplyTo()
           
protected  java.util.Map<java.lang.String,org.jdom.Element> getXmlCache(IDataLoaderContext ctx)
           
 boolean isAutoRegister()
          Allow the plug-in implementation to specific whether the SymmetricDS runtime should auto register it or if it will register itself.
 void setAutoRegister(boolean autoRegister)
           
 void setGroupByColumnNames(java.util.List<java.lang.String> groupByColumnNames)
          This attribute is required.
 void setLoadDataInTargetDatabase(boolean loadDataInTargetDatabase)
           
 void setNodeGroups(java.lang.String[] nodeGroups)
           
 void setPublisher(IPublisher publisher)
           
 void setTableNamesToPublishAsGroup(java.util.Set<java.lang.String> tableNamesToPublishAsGroup)
           
 void setTableNameToPublish(java.lang.String tableName)
           
 void setTimeStringGenerator(org.jumpmind.symmetric.ext.XmlPublisherFilter.ITimeGenerator timeStringGenerator)
          Used to populate the time attribute of an XML message.
 void setXmlFormat(org.jdom.output.Format xmlFormat)
           
 void setXmlTagNameToUseForGroup(java.lang.String xmlTagNameToUseForGroup)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

publisher

protected IPublisher publisher
Constructor Detail

XmlPublisherFilter

public XmlPublisherFilter()
Method Detail

isAutoRegister

public boolean isAutoRegister()
Description copied from interface: IExtensionPoint
Allow the plug-in implementation to specific whether the SymmetricDS runtime should auto register it or if it will register itself.

Specified by:
isAutoRegister in interface IExtensionPoint

getNodeGroupIdsToApplyTo

public java.lang.String[] getNodeGroupIdsToApplyTo()
Specified by:
getNodeGroupIdsToApplyTo in interface INodeGroupExtensionPoint

filterDelete

public boolean filterDelete(IDataLoaderContext ctx,
                            java.lang.String[] keys)
Specified by:
filterDelete in interface IDataLoaderFilter
Returns:
true if the row should be loaded. false if the filter has handled the row and it should be ignored.

filterUpdate

public boolean filterUpdate(IDataLoaderContext ctx,
                            java.lang.String[] data,
                            java.lang.String[] keys)
Specified by:
filterUpdate in interface IDataLoaderFilter
Returns:
true if the row should be loaded. false if the filter has handled the row and it should be ignored.

filterInsert

public boolean filterInsert(IDataLoaderContext ctx,
                            java.lang.String[] data)
Specified by:
filterInsert in interface IDataLoaderFilter
Returns:
true if the row should be loaded. false if the filter has handled the row and it should be ignored.

addFormattedExtraGroupAttributes

protected void addFormattedExtraGroupAttributes(IDataLoaderContext ctx,
                                                org.jdom.Element xml)
Give the opportunity for the user of this publisher to add in additional attributes. The default implementation adds in the nodeId from the IDataLoaderContext.

Parameters:
ctx -
xml - append XML attributes to this buffer

getXmlCache

protected java.util.Map<java.lang.String,org.jdom.Element> getXmlCache(IDataLoaderContext ctx)

doesXmlExistToPublish

protected boolean doesXmlExistToPublish(IDataLoaderContext ctx)

batchComplete

public void batchComplete(IDataLoader loader,
                          IncomingBatchHistory hist)
Description copied from interface: IBatchListener
This method is called after a batch has been successfully processed. It is called in the scope of the transaction that controls the batch commit.

Specified by:
batchComplete in interface IBatchListener

setTableNamesToPublishAsGroup

public void setTableNamesToPublishAsGroup(java.util.Set<java.lang.String> tableNamesToPublishAsGroup)

setTableNameToPublish

public void setTableNameToPublish(java.lang.String tableName)

setXmlTagNameToUseForGroup

public void setXmlTagNameToUseForGroup(java.lang.String xmlTagNameToUseForGroup)

setGroupByColumnNames

public void setGroupByColumnNames(java.util.List<java.lang.String> groupByColumnNames)
This attribute is required. It needs to identify the columns that will be used to key on rows in the specified tables that need to be grouped together in an 'XML batch.'


setLoadDataInTargetDatabase

public void setLoadDataInTargetDatabase(boolean loadDataInTargetDatabase)

setPublisher

public void setPublisher(IPublisher publisher)
Specified by:
setPublisher in interface IPublisherFilter

setNodeGroups

public void setNodeGroups(java.lang.String[] nodeGroups)

setAutoRegister

public void setAutoRegister(boolean autoRegister)

setTimeStringGenerator

public void setTimeStringGenerator(org.jumpmind.symmetric.ext.XmlPublisherFilter.ITimeGenerator timeStringGenerator)
Used to populate the time attribute of an XML message.


setXmlFormat

public void setXmlFormat(org.jdom.output.Format xmlFormat)


Copyright © 2007-2008. All Rights Reserved.