mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Added new database events and simplified database locking.
This commit is contained in:
@@ -9,20 +9,20 @@ 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 {
|
||||
public class LocalSubscriptionsUpdatedEvent extends DatabaseEvent {
|
||||
|
||||
private final Collection<ContactId> affectedContacts;
|
||||
private final Collection<ContactId> affected;
|
||||
|
||||
public SubscriptionsUpdatedEvent() {
|
||||
affectedContacts = Collections.emptyList();
|
||||
public LocalSubscriptionsUpdatedEvent() {
|
||||
affected = Collections.emptyList();
|
||||
}
|
||||
|
||||
public SubscriptionsUpdatedEvent(Collection<ContactId> affectedContacts) {
|
||||
this.affectedContacts = affectedContacts;
|
||||
public LocalSubscriptionsUpdatedEvent(Collection<ContactId> affected) {
|
||||
this.affected = affected;
|
||||
}
|
||||
|
||||
/** Returns the contacts affected by the update. */
|
||||
public Collection<ContactId> getAffectedContacts() {
|
||||
return affectedContacts;
|
||||
return affected;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ package net.sf.briar.api.db.event;
|
||||
* An event that is broadcast when the local transport properties are
|
||||
* updated.
|
||||
*/
|
||||
public class TransportsUpdatedEvent extends DatabaseEvent {
|
||||
public class LocalTransportsUpdatedEvent extends DatabaseEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
|
||||
/** An event that is broadcast when a contact's subscriptions are updated. */
|
||||
public class RemoteSubscriptionsUpdatedEvent extends DatabaseEvent {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public RemoteSubscriptionsUpdatedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.protocol.TransportId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a contact's remote transport properties
|
||||
* are updated.
|
||||
*/
|
||||
public class RemoteTransportsUpdatedEvent extends DatabaseEvent {
|
||||
|
||||
private final ContactId contactId;
|
||||
private final TransportId transportId;
|
||||
|
||||
public RemoteTransportsUpdatedEvent(ContactId contactId,
|
||||
TransportId transportId) {
|
||||
this.contactId = contactId;
|
||||
this.transportId = transportId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.protocol.TransportId;
|
||||
|
||||
/** An event that is broadcast when a transport is added. */
|
||||
public class TransportAddedEvent extends DatabaseEvent {
|
||||
|
||||
private final TransportId transportId;
|
||||
|
||||
public TransportAddedEvent(TransportId transportId) {
|
||||
this.transportId = transportId;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.protocol.TransportId;
|
||||
|
||||
/** An event that is broadcast when a transport is removed. */
|
||||
public class TransportRemovedEvent extends DatabaseEvent {
|
||||
|
||||
private final TransportId transportId;
|
||||
|
||||
public TransportRemovedEvent(TransportId transportId) {
|
||||
this.transportId = transportId;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user