Listeners for subscription changes.

This commit is contained in:
akwizgran
2011-08-02 09:22:54 +01:00
parent 0d0885bf4b
commit ff0909a0e9
7 changed files with 76 additions and 36 deletions

View File

@@ -48,11 +48,11 @@ public interface DatabaseComponent {
/** Waits for any open transactions to finish and closes the database. */
void close() throws DbException;
/** Adds a listener to be notified when new messages are available. */
void addListener(MessageListener m);
/** Adds a listener to be notified when database events occur. */
void addListener(DatabaseListener d);
/** Removes a listener. */
void removeListener(MessageListener m);
void removeListener(DatabaseListener d);
/**
* Adds a new contact to the database with the given transport details and

View File

@@ -0,0 +1,13 @@
package net.sf.briar.api.db;
/** An interface for receiving notifications when database events occur. */
public interface DatabaseListener {
static enum Event {
MESSAGES_ADDED,
SUBSCRIPTIONS_UPDATED,
TRANSPORTS_UPDATED
};
void eventOccurred(Event e);
}

View File

@@ -1,10 +0,0 @@
package net.sf.briar.api.db;
/**
* An interface for receiving notifications when the database may have new
* messages available.
*/
public interface MessageListener {
void messagesAdded();
}