xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.dbwriter
Class DbWriter

java.lang.Object
  extended by org.xmlBlaster.contrib.dbwriter.DbWriter
All Implemented Interfaces:
I_Update

public class DbWriter
extends java.lang.Object
implements I_Update

Author:
Michele Laghi mailto:michele@laghi.eu

Field Summary
static java.lang.String CASE_SENSITIVE_KEY
           
private  java.lang.String charSet
           
static java.lang.String DB_POOL_KEY
           
private  I_DbPool dbPool
           
private  I_ChangePublisher eventEngine
           
private  I_Info info
           
static java.lang.String INITIAL_UPDATE_EVENT_POST
           
static java.lang.String INITIAL_UPDATE_EVENT_PRE
           
private  boolean isAlive
           
private static java.util.logging.Logger log
           
private  I_Parser parser
           
private  boolean poolOwner
           
static java.lang.String QUOTE_COLUMN_NAMES_KEY
          dbWriter.quoteColumnNames=true: Add quotes around the column names like "COMMENT" instead of COMMENT, this is e.g.
private  I_Update registeredForUpdates
           
private  I_Writer writer
           
 
Constructor Summary
DbWriter()
          Default constructor, you need to call init(org.xmlBlaster.contrib.I_Info) thereafter.
DbWriter(I_Info info)
          Convenience constructor, creates a processor for changes, calls init(org.xmlBlaster.contrib.I_Info).
 
Method Summary
static java.util.List createDbWriters(I_Info masterInfo)
          Creates a list of DbWriter instances.
private static I_DbPool createPool(java.lang.ClassLoader cl, I_Info info)
           
static DbWriter createSingleDbWriter(I_Info masterInfo, java.lang.String loginName, java.lang.String password)
          Creates an Instance of a DbWriter with the given configuration.
 I_Info getInfo()
           
 boolean getPoolOwner()
           
 void init(I_Info info)
          Creates a processor for changes.
 void registerForUpdates(I_Update registeredForUpdates)
           
static void setPoolOwner(DbWriter writer, boolean poolOwner)
           
 void shutdown()
          Cleanup resources.
private  void shutdown(I_ContribPlugin plugin)
           
 void update(java.lang.String topic, java.io.InputStream is, java.util.Map attrMap)
          Determines wether the message is a database dump or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_UPDATE_EVENT_PRE

public static final java.lang.String INITIAL_UPDATE_EVENT_PRE
See Also:
Constant Field Values

INITIAL_UPDATE_EVENT_POST

public static final java.lang.String INITIAL_UPDATE_EVENT_POST
See Also:
Constant Field Values

log

private static java.util.logging.Logger log

DB_POOL_KEY

public static final java.lang.String DB_POOL_KEY
See Also:
Constant Field Values

CASE_SENSITIVE_KEY

public static final java.lang.String CASE_SENSITIVE_KEY
See Also:
Constant Field Values

QUOTE_COLUMN_NAMES_KEY

public static final java.lang.String QUOTE_COLUMN_NAMES_KEY
dbWriter.quoteColumnNames=true: Add quotes around the column names like "COMMENT" instead of COMMENT, this is e.g. needed for DB2 sinks running on a host (OS390). Defaults to false.

See Also:
Constant Field Values

info

private I_Info info

eventEngine

private I_ChangePublisher eventEngine

parser

private I_Parser parser

writer

private I_Writer writer

dbPool

private I_DbPool dbPool

poolOwner

private boolean poolOwner

isAlive

private boolean isAlive

registeredForUpdates

private I_Update registeredForUpdates

charSet

private java.lang.String charSet
Constructor Detail

DbWriter

public DbWriter()
Default constructor, you need to call init(org.xmlBlaster.contrib.I_Info) thereafter.


DbWriter

public DbWriter(I_Info info)
         throws java.lang.Exception
Convenience constructor, creates a processor for changes, calls init(org.xmlBlaster.contrib.I_Info).

Parameters:
info - Configuration
Throws:
java.lang.Exception - Can be of any type
Method Detail

createSingleDbWriter

public static DbWriter createSingleDbWriter(I_Info masterInfo,
                                            java.lang.String loginName,
                                            java.lang.String password)
                                     throws java.lang.Exception
Creates an Instance of a DbWriter with the given configuration. If loginName is null, then it is created with no manipulation of the mom.loginName and mom.password properties, othewise a clone of the I_Info is taken and a DbWriter instance is created with the loginName specified in the argument list.

Parameters:
masterInfo -
loginName -
password -
Returns:
Throws:
java.lang.Exception

createDbWriters

public static java.util.List createDbWriters(I_Info masterInfo)
                                      throws java.lang.Exception
Creates a list of DbWriter instances. One instance for each mom.loginName entry found. Note that the mom.loginName can contain a list of comma separated session names (or subject names). For each such name an instance is created. If the mom.password entries are less than the mom.loginName ones, the last password will be used for all undefined passwords.

Parameters:
info -
Returns:
Throws:
java.lang.Exception

setPoolOwner

public static void setPoolOwner(DbWriter writer,
                                boolean poolOwner)

getPoolOwner

public boolean getPoolOwner()

createPool

private static final I_DbPool createPool(java.lang.ClassLoader cl,
                                         I_Info info)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

init

public void init(I_Info info)
          throws java.lang.Exception
Creates a processor for changes. The alert producers need to be started later with a call to #startAlertProducers

Parameters:
info - Configuration
Throws:
java.lang.Exception - Can be of any type

getInfo

public I_Info getInfo()

shutdown

private void shutdown(I_ContribPlugin plugin)

shutdown

public void shutdown()
Cleanup resources.

Throws:
java.lang.Exception - Can be of any type

update

public void update(java.lang.String topic,
                   java.io.InputStream is,
                   java.util.Map attrMap)
            throws java.lang.Exception
Determines wether the message is a database dump or not. If it is a database dump it stores the content to a file, otherwise it processes the message according to the normal processing flow.

Specified by:
update in interface I_Update
Parameters:
topic - The topic name
attrMap - A map with attribute, can be null
Throws:
java.lang.Exception

registerForUpdates

public void registerForUpdates(I_Update registeredForUpdates)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.