SQLFire 1.0.3

com.vmware.sqlfire.callbacks
Class DBSynchronizer

java.lang.Object
  extended by com.vmware.sqlfire.callbacks.DBSynchronizer
All Implemented Interfaces:
AsyncEventListener

public final class DBSynchronizer
extends Object
implements AsyncEventListener

DBSynchronizer class instance persists the SQLFire operations to an external DB.


Constructor Summary
DBSynchronizer()
           
 
Method Summary
 void basicClose()
           
 void close()
          This is invoked when the AsyncEventListener configuration is stopped.
static String getDeleteString(String tabName, String[] pkCols)
           
static String getInsertString(String tabName, int colCount)
           
static String getUpdateString(String tabName, String[] pkCols, String[] updatedCols)
           
 void init(String initParamStr)
          The AsyncListener implemented by the user can be initialized via this method.
 void initConnection()
           
 boolean processEvents(List<Event> events)
          Process the list of Events.
static boolean setParamsInPrepareStatement(com.vmware.sqlfire.internal.engine.ddl.wan.SqlfStatementEvent sse, PreparedStatement ps, PreparedStatement prevPS)
          Returns true if batch execution should be done, and false otherwise.
 void start()
          This is invoked just prior to starting the async invocation thread for processing the events.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBSynchronizer

public DBSynchronizer()
Method Detail

close

public void close()
Description copied from interface: AsyncEventListener
This is invoked when the AsyncEventListener configuration is stopped. User can do any necessary cleanup in this method.

Specified by:
close in interface AsyncEventListener

basicClose

public void basicClose()

init

public void init(String initParamStr)
Description copied from interface: AsyncEventListener
The AsyncListener implemented by the user can be initialized via this method. This is invoked after the creation of an instance of the class during the initialization of AsyncEventListener configuration. This can be used to populate fields which can be used during processing of the events. init is invoked only once, after configuring the AsyncEventListener.

Specified by:
init in interface AsyncEventListener
Parameters:
initParamStr - String containing initialisation parameters for the AsyncEventListener

initConnection

public void initConnection()

processEvents

public boolean processEvents(List<Event> events)
Description copied from interface: AsyncEventListener
Process the list of Events. This method will be invoked asynchronously when events are queued for processing. For AsyncEventListener, the Event.getOldRow() will always return null indicating that old value is not available. Event.getNewRow() will return the column values for a row created. For update operations it will only return meaningful values for modified columns and null for unmodified columns. The positions of columns modified can be obtained from Event.getModifiedColumns()

Specified by:
processEvents in interface AsyncEventListener
Parameters:
events - The list of Events to process
Returns:
whether the events were successfully processed. If returned false, the events will not be deleted from the internal queue.

setParamsInPrepareStatement

public static boolean setParamsInPrepareStatement(com.vmware.sqlfire.internal.engine.ddl.wan.SqlfStatementEvent sse,
                                                  PreparedStatement ps,
                                                  PreparedStatement prevPS)
                                           throws com.vmware.sqlfire.internal.iapi.error.StandardException,
                                                  SQLException
Returns true if batch execution should be done, and false otherwise.

Throws:
com.vmware.sqlfire.internal.iapi.error.StandardException
SQLException

getInsertString

public static String getInsertString(String tabName,
                                     int colCount)

getDeleteString

public static String getDeleteString(String tabName,
                                     String[] pkCols)

getUpdateString

public static String getUpdateString(String tabName,
                                     String[] pkCols,
                                     String[] updatedCols)

start

public void start()
Description copied from interface: AsyncEventListener
This is invoked just prior to starting the async invocation thread for processing the events. User can do any initialisation like creating the file handles etc , which would be used in processing of events.

Specified by:
start in interface AsyncEventListener

SQLFire 1.0.3

Copyright © 2010-2012 VMware, Inc. All rights reserved.