org.olat.core.util.event
Class AbstractEventBus

java.lang.Object
  extended by org.olat.core.util.event.AbstractEventBus
All Implemented Interfaces:
EventBus
Direct Known Subclasses:
ClusterEventBus, SingleVMEventBus

public abstract class AbstractEventBus
extends java.lang.Object
implements EventBus

abstract class for common services of the system bus

Author:
Felix Jost

Constructor Summary
AbstractEventBus()
           
 
Method Summary
 void deregisterFor(GenericEventListener gel, OLATResourceable ores)
          deregisters/removes a GenericEventListener to listen to events concerning the OLATResourceable ores
abstract  void fireEventToListenersOf(MultiUserEvent event, OLATResourceable ores)
          fires an event to all listeners interested in events concerning this OLATResourceable ores.
abstract  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<java.lang.String,org.olat.core.util.event.EventAgency> getUnmodifiableInfoCenter()
          used only for monitoring purposes
 void registerFor(GenericEventListener gel, Identity identity, OLATResourceable ores)
          registers a GenericEventListener to listen to events concerning the OLATResourceable ores
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractEventBus

public AbstractEventBus()
Method Detail

registerFor

public void registerFor(GenericEventListener gel,
                        Identity identity,
                        OLATResourceable ores)
Description copied from interface: EventBus
registers a GenericEventListener to listen to events concerning the OLATResourceable ores

Specified by:
registerFor in interface EventBus
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

public void deregisterFor(GenericEventListener gel,
                          OLATResourceable ores)
Description copied from interface: EventBus
deregisters/removes a GenericEventListener to listen to events concerning the OLATResourceable ores

Specified by:
deregisterFor in interface EventBus

getListeningIdentityNamesFor

public java.util.Set getListeningIdentityNamesFor(OLATResourceable ores)
Description copied from interface: EventBus
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);

Specified by:
getListeningIdentityNamesFor in interface EventBus
Parameters:
ores - the OLATResourceable
Returns:
the listening names on a resource - only use for admin purposes!

getListeningIdentityCntFor

public abstract int getListeningIdentityCntFor(OLATResourceable ores)
Description copied from interface: EventBus
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.

Specified by:
getListeningIdentityCntFor in interface EventBus
Parameters:
ores - the resourceable
Returns:
the number of people currently using this resource

fireEventToListenersOf

public abstract void fireEventToListenersOf(MultiUserEvent event,
                                            OLATResourceable ores)
Description copied from interface: EventBus
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.

Specified by:
fireEventToListenersOf in interface EventBus
Parameters:
event - the OLATResourceableEvent (must be serializable!, for multiple server olat installations)
ores - the OLATResourceable

getUnmodifiableInfoCenter

public java.util.Map<java.lang.String,org.olat.core.util.event.EventAgency> getUnmodifiableInfoCenter()
used only for monitoring purposes

Specified by:
getUnmodifiableInfoCenter in interface EventBus
Returns:
the whole infocenter map

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object