org.olat.core.util.event
Interface EventBus

All Known Implementing Classes:
AbstractEventBus, ClusterEventBus, SingleVMEventBus

public interface EventBus

Multiuser events

This is the center distributing the multiuser events into the system.
Classes implementing the GenericEventListener can register for an event bound to a certain OLATResourceable. A class having "news" concerning an OLATResourceable may fire Events which are sent to all listeners.
NOTE: the listeners are put in a WeakHashMap, so they need to have another reference than just the event center.

Author:
Felix Jost

Method Summary
 void deregisterFor(GenericEventListener gel, OLATResourceable ores)
          deregisters/removes a GenericEventListener to listen to events concerning the OLATResourceable ores
 void fireEventToListenersOf(MultiUserEvent event, OLATResourceable ores)
          fires an event to all listeners interested in events concerning this OLATResourceable ores.
 int getListeningIdentityCntFor(OLATResourceable ores)
          Note for cluster: this method is cluster-safe.
 java.util.Set getListeningIdentityNamesFor(OLATResourceable ores)
          returns a Set of Identities which had at the very moment controllers which were listening to the OLATResourceable ores.
 java.util.Map getUnmodifiableInfoCenter()
          For admin purposes only! gets the whole infocenter and typeInfocenter map (keys: String-form of OLATResoureable; values: EventAgencies) as a map.
 void registerFor(GenericEventListener gel, Identity identity, OLATResourceable ores)
          registers a GenericEventListener to listen to events concerning the OLATResourceable ores
 

Method Detail

registerFor

void registerFor(GenericEventListener gel,
                 Identity identity,
                 OLATResourceable ores)
registers a GenericEventListener to listen to events concerning the OLATResourceable ores

Parameters:
gel - the GenericEventListener / the class implementing it
identity - the identity to whicinfoh the listening (controller) belongs, or null if that is not known or the olat-system itself.
ores - the OLATResourceable

deregisterFor

void deregisterFor(GenericEventListener gel,
                   OLATResourceable ores)
deregisters/removes a GenericEventListener to listen to events concerning the OLATResourceable ores

Parameters:
gel -
ores -

fireEventToListenersOf

void fireEventToListenersOf(MultiUserEvent event,
                            OLATResourceable ores)
fires an event to all listeners interested in events concerning this OLATResourceable ores. The events may be fired and received synchronously or asynchronously, depending on the concrete implementation.

Parameters:
event - the OLATResourceableEvent (must be serializable!, for multiple server olat installations)
ores - the OLATResourceable

getListeningIdentityNamesFor

java.util.Set getListeningIdentityNamesFor(OLATResourceable ores)
returns a Set of Identities which had at the very moment controllers which were listening to the OLATResourceable ores. Useful to e.g. warn a power-user which wants to delete a resource (e.g. a course) that there are users using this resource right at this time. NOTE: please use only for OLAT admin tools in order to protect the privacy of users. If you would like to say "the resource you want to delete is currently used by 10 users", but not say which users, then please use method getListeningIdentityCntFor(OLATResourceable ores)..
Note for cluster: this method returns only the names of listeners within one node/vm. However, the cnt of listeners is broadcasted amongst cluster nodes - see getListeningIdentityCntFor(OLATResourceable ores);

Parameters:
ores - the OLATResourceable
Returns:
a Set of Identities which had at the very moment controllers which were listening to the OLATResourceable ores

getListeningIdentityCntFor

int getListeningIdentityCntFor(OLATResourceable ores)
Note for cluster: this method is cluster-safe. in a cluster, it takes the latest counts received from all cluster nodes and sums them up.

Parameters:
ores - the resourceable
Returns:
the number of people currently using this resource

getUnmodifiableInfoCenter

java.util.Map getUnmodifiableInfoCenter()
For admin purposes only! gets the whole infocenter and typeInfocenter map (keys: String-form of OLATResoureable; values: EventAgencies) as a map.

Returns:
the whole infocenter map