com.avaje.ebean.event
Interface BeanPersistListener<T>


public interface BeanPersistListener<T>

Listens for committed bean events.

These listen events occur after a successful commit. They also occur in a background thread rather than the thread used to perform the actual insert update or delete. In this way there is a delay between the commit and when the listener is notified of the event.

For a cluster these events may need to be broadcast. Each of the inserted(), updated() and deleted() methods return true if you want those events to be broadcast to the other members of a cluster (the id values are broadcast). If these methods return false then the events are not broadcast.

It is worth noting that BeanPersistListener is different in three main ways from BeanPersistController postXXX methods.

A BeanPersistListener is either found automatically via class path search or can be added programmatically via ServerConfiguration.addEntity().


Method Summary
 boolean deleted(T bean)
          Notified that a bean has been deleted locally.
 boolean inserted(T bean)
          Notified that a bean has been inserted locally.
 void remoteDelete(Object id)
          Notify that a bean was deleted on another node of the cluster.
 void remoteInsert(Object id)
          Notify that a bean was inserted on another node of the cluster.
 void remoteUpdate(Object id)
          Notify that a bean was updated on another node of the cluster.
 boolean updated(T bean, Set<String> updatedProperties)
          Notified that a bean has been updated locally.
 

Method Detail

inserted

boolean inserted(T bean)
Notified that a bean has been inserted locally. Return true if you want the cluster to be notified of the event.

Parameters:
bean - The bean that was inserted.

updated

boolean updated(T bean,
                Set<String> updatedProperties)
Notified that a bean has been updated locally. Return true if you want the cluster to be notified of the event.

Parameters:
bean - The bean that was updated.
updatedProperties - the properties on the bean that where updated

deleted

boolean deleted(T bean)
Notified that a bean has been deleted locally. Return true if you want the cluster to be notified of the event.

Parameters:
bean - The bean that was deleted.

remoteInsert

void remoteInsert(Object id)
Notify that a bean was inserted on another node of the cluster.

Parameters:
id - the id value of the inserted bean

remoteUpdate

void remoteUpdate(Object id)
Notify that a bean was updated on another node of the cluster.

Parameters:
id - the id value of the updated bean.

remoteDelete

void remoteDelete(Object id)
Notify that a bean was deleted on another node of the cluster.

Parameters:
id - the id value of the deleted bean.


Copyright © 2010. All Rights Reserved.