Attach the affected contact IDs to subscription update events.

This commit is contained in:
akwizgran
2011-10-17 23:24:23 +01:00
parent ec56b12384
commit 2f457162a5
13 changed files with 69 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
package net.sf.briar.api.db.event;
/** An event that is broadcast when a batch of messages is received. */
public class BatchReceivedEvent extends DatabaseEvent {
}

View File

@@ -2,6 +2,7 @@ package net.sf.briar.api.db.event;
import net.sf.briar.api.ContactId;
/** An event that is broadcast when a contact is added. */
public class ContactAddedEvent extends DatabaseEvent {
private final ContactId contactId;

View File

@@ -2,6 +2,7 @@ package net.sf.briar.api.db.event;
import net.sf.briar.api.ContactId;
/** An event that is broadcast when a contact is removed. */
public class ContactRemovedEvent extends ContactAddedEvent {
public ContactRemovedEvent(ContactId contactId) {

View File

@@ -1,5 +1,6 @@
package net.sf.briar.api.db.event;
/** An abstract superclass for database events. */
public abstract class DatabaseEvent {
}

View File

@@ -1,6 +1,5 @@
package net.sf.briar.api.db.event;
/** An interface for receiving notifications when database events occur. */
public interface DatabaseListener {

View File

@@ -1,5 +1,9 @@
package net.sf.briar.api.db.event;
/**
* An event that is broadcast when one or more messages are added to the
* database.
*/
public class MessagesAddedEvent extends DatabaseEvent {
}

View File

@@ -1,18 +1,27 @@
package net.sf.briar.api.db.event;
import java.util.Collection;
import java.util.Collections;
import net.sf.briar.api.ContactId;
/**
* An event that is broadcast when the set of subscriptions visible to one or
* more contacts is updated.
*/
public class SubscriptionsUpdatedEvent extends DatabaseEvent {
private final Collection<ContactId> affectedContacts;
// FIXME: Replace this constructor
public SubscriptionsUpdatedEvent() {
affectedContacts = null;
affectedContacts = Collections.emptyList();
}
public SubscriptionsUpdatedEvent(Collection<ContactId> affectedContacts) {
this.affectedContacts = affectedContacts;
}
/** Returns the contacts affected by the update. */
public Collection<ContactId> getAffectedContacts() {
return affectedContacts;
}

View File

@@ -1,5 +1,6 @@
package net.sf.briar.api.db.event;
/** An event that is broadcast when the local transports are updated. */
public class TransportsUpdatedEvent extends DatabaseEvent {
}