Holger's
Java API

com.antelmann.db.remote
Class RemoteDBChangeNotifier

java.lang.Object
  extended by com.antelmann.db.remote.RemoteDBChangeNotifier
All Implemented Interfaces:
DatabaseChangeListener, Closeable

public class RemoteDBChangeNotifier
extends Object
implements DatabaseChangeListener, Closeable

used to propagate database changes to a remote server. As the delivery is done in an asynchronous manner, this implementation uses a ThreadWorker setup as a daemon that performs the notification. To enable notification, simply add this as a listener to a database using a DatabaseChangeMonitor.

Since:
15.11.2008, 20:11:42
Author:
Holger Antelmann
See Also:
RemoteDatabaseChangeHandler, ChangeNotificationServer

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.db.DatabaseChangeListener
DatabaseChangeListener.ClassListener, DatabaseChangeListener.LoggerListener
 
Constructor Summary
RemoteDBChangeNotifier(NetConnection con, Filter<? super DBUpdateEvent> filter)
           
RemoteDBChangeNotifier(String databaseName, String server)
           
RemoteDBChangeNotifier(String databaseName, String server, int port)
           
RemoteDBChangeNotifier(String databaseName, String server, int port, Filter<? super DBUpdateEvent> filter)
           
 
Method Summary
 void close()
           
 void committedDatabaseChanges(Database<?> db, DBUpdateEvent... events)
          called after successfully committing the given DBUpdateEvents on the database.
protected  void finalize()
           
 ThreadWorker getExecutor()
           
 Filter<? super DBUpdateEvent> getFilter()
           
 void setExecutor(ThreadWorker executor)
           
 void setFilter(Filter<? super DBUpdateEvent> filter)
          allows to set a filter, so that not every event may be propagated to the server
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteDBChangeNotifier

public RemoteDBChangeNotifier(String databaseName,
                              String server)
                       throws IOException
Throws:
IOException

RemoteDBChangeNotifier

public RemoteDBChangeNotifier(String databaseName,
                              String server,
                              int port)
                       throws IOException
Throws:
IOException

RemoteDBChangeNotifier

public RemoteDBChangeNotifier(String databaseName,
                              String server,
                              int port,
                              Filter<? super DBUpdateEvent> filter)
                       throws IOException
Throws:
IOException

RemoteDBChangeNotifier

public RemoteDBChangeNotifier(NetConnection con,
                              Filter<? super DBUpdateEvent> filter)
Method Detail

getExecutor

public ThreadWorker getExecutor()

setExecutor

public void setExecutor(ThreadWorker executor)

getFilter

public Filter<? super DBUpdateEvent> getFilter()

setFilter

public void setFilter(Filter<? super DBUpdateEvent> filter)
allows to set a filter, so that not every event may be propagated to the server


committedDatabaseChanges

public void committedDatabaseChanges(Database<?> db,
                                     DBUpdateEvent... events)
Description copied from interface: DatabaseChangeListener
called after successfully committing the given DBUpdateEvents on the database. Implementations must not begin a new transaction directly!

Specified by:
committedDatabaseChanges in interface DatabaseChangeListener
See Also:
TransactionListener.transactionCommitted(DBTransaction), DBVersionedUpdateEvent

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads