|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.contrib.replication.ReplicationConverter
public class ReplicationConverter
Creates a standardized XML dump from the given ResultSets. Note this class is not thread safe, in other words you must make sure the same instance of this class can not be invoked concurently from more than one thread.
I_DataConverter
,
ResultSetToXmlConverter
Field Summary | |
---|---|
private java.util.List |
allTransactions
All transactions in this message (needed to delete entries after publishing) |
private I_DbPool |
dbPool
|
private I_DbSpecific |
dbSpecific
|
private ChangeEvent |
event
|
private I_Info |
info
|
private static java.util.logging.Logger |
log
|
private long |
messageSeq
|
private java.lang.String |
messageSeqPropertyName
|
private long |
newReplKey
|
private long |
oldReplKey
|
private java.lang.String |
oldReplKeyPropertyName
|
private java.io.OutputStream |
out
|
private I_Info |
persistentInfo
|
private java.lang.String |
replPrefix
|
private boolean |
sendInitialTableContent
|
private boolean |
sendUnchangedUpdates
|
private long |
size
|
private SqlInfo |
sqlInfo
|
private java.lang.String |
transactionId
|
private I_AttributeTransformer |
transformer
|
private long |
transSeq
|
private java.lang.String |
transSeqPropertyName
|
private boolean |
useReaderCharset
|
Fields inherited from interface org.xmlBlaster.contrib.dbwatcher.convert.I_DataConverter |
---|
ALL, BASE64, IGNORE_MESSAGE, META_ONLY, ROW_ONLY |
Fields inherited from interface org.xmlBlaster.contrib.ContribConstants |
---|
FILE_DATE, FILENAME_ATTR, FILENAME_ATTR_OLD_FASHION, SUBDIR_ATTR, TIMESTAMP_ATTR, TOPIC_NAME |
Constructor Summary | |
---|---|
ReplicationConverter()
Default constructor, you need to call init(info) thereafter. |
|
ReplicationConverter(I_Info info)
Create this plugin. |
Method Summary | |
---|---|
void |
addInfo(java.sql.Connection conn,
java.sql.ResultSet rs,
int what)
Add another result set to the XML string. |
void |
addInfo(java.util.Map attributeMap)
Add a map with attributes to the XML string. |
int |
done()
This method is invoked before sending the message over the mom. |
private java.lang.String |
getContent(java.sql.ResultSet rs,
int clobPos)
|
long |
getCurrentMessageSize()
Returns the size of the message as it is at the current moment |
static I_DbSpecific |
getDbSpecific(I_Info info,
boolean forceNewIfNeeded)
This method creates every time a new instance |
private static java.util.Set |
getKeys(java.lang.String val,
java.lang.String sep)
|
java.lang.String |
getPostStatement()
Gets the statement (if any) to be executed after processing one message.In case of the DbWatcher to be used to send/publish messages on detected changes, this can be used to delete entries in a queue. |
void |
init(I_Info info)
Needs to be called after construction. |
void |
setOutputStream(java.io.OutputStream out,
java.lang.String command,
java.lang.String ident,
ChangeEvent event)
This has to be called before the first I_DataConverter.addInfo(Map)
or #addInfo(ResultSet, int) call. |
void |
shutdown()
Cleanup resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.logging.Logger log
private I_DbSpecific dbSpecific
private SqlInfo sqlInfo
private I_Info info
private I_AttributeTransformer transformer
private java.io.OutputStream out
private boolean sendInitialTableContent
private long oldReplKey
private I_Info persistentInfo
private java.lang.String oldReplKeyPropertyName
private ChangeEvent event
private java.lang.String transactionId
private java.util.List allTransactions
private java.lang.String replPrefix
private I_DbPool dbPool
private java.lang.String transSeqPropertyName
private long transSeq
private java.lang.String messageSeqPropertyName
private long messageSeq
private long newReplKey
private boolean sendUnchangedUpdates
private boolean useReaderCharset
private long size
Constructor Detail |
---|
public ReplicationConverter()
public ReplicationConverter(I_Info info) throws java.lang.Exception
info
- Possible configuration parameters you find in the class description
java.lang.Exception
- If transformer instantiation failsMethod Detail |
---|
public static I_DbSpecific getDbSpecific(I_Info info, boolean forceNewIfNeeded) throws java.lang.Exception
info
- forceNewIfNeeded
- if true and the entry is not found in the registry, a new object is created, initialized and added
to the registry, otherwise it only returns entries found in the registry (without initializing the object) or null if none is found.
java.lang.Exception
public void init(I_Info info) throws java.lang.Exception
I_DataConverter
init
in interface I_DataConverter
info
- The configuration environment
java.lang.Exception
I_DataConverter.init(I_Info)
private static java.util.Set getKeys(java.lang.String val, java.lang.String sep)
public void shutdown() throws java.lang.Exception
I_DataConverter
shutdown
in interface I_DataConverter
java.lang.Exception
- of any typeI_DataConverter.shutdown()
private final java.lang.String getContent(java.sql.ResultSet rs, int clobPos) throws java.lang.Exception
java.lang.Exception
public void addInfo(java.sql.Connection conn, java.sql.ResultSet rs, int what) throws java.lang.Exception
addInfo
in interface I_DataConverter
rs
- The JDBC result setwhat
- One of I_DataConverter.ALL
, I_DataConverter.META_ONLY
or
I_DataConverter.ROW_ONLY
.
I_DataConverter.META_ONLY
is useful for an empty table where rs access fails.
java.lang.Exception
- of any typeorg.xmlBlaster.contrib.dbwatcher.convert.I_DataConverter#addInfo(ResultSet, int)
public void addInfo(java.util.Map attributeMap) throws java.lang.Exception
I_DataConverter
I_AttributeTransformer
class.
addInfo
in interface I_DataConverter
attributeMap
- A map containing key/values to dump
java.lang.Exception
- of any typepublic int done() throws java.lang.Exception
done
in interface I_DataConverter
java.lang.Exception
- typically java.io.UnsupportedEncodingException, java.io.IOExceptionpublic void setOutputStream(java.io.OutputStream out, java.lang.String command, java.lang.String ident, ChangeEvent event) throws java.lang.Exception
I_DataConverter
I_DataConverter.addInfo(Map)
or #addInfo(ResultSet, int)
call.
setOutputStream
in interface I_DataConverter
out
- The stream to dump the converted data tocommand
- An optional command string or nullident
- the identity or optionally null.event
- The ChangeEvent associated to this invocation. Is never null.
java.lang.Exception
- of any typepublic java.lang.String getPostStatement()
I_DataConverter
getPostStatement
in interface I_DataConverter
public long getCurrentMessageSize()
I_DataConverter
getCurrentMessageSize
in interface I_DataConverter
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |