|
|
Package com.dassault_systemes.catweb.base.event |
Class Hookup
|
Class Hierarchy |
java.lang.Object | +-com.dassault_systemes.catweb.base.event.Hookup
Class Location |
Class Description |
public class Hookup
This class allows to make CATlets communicating with each other without knowing themselves. The Hookup uses a publish-subscribe mechanism based on the java-beans events model. When a CATlet is interested in listening some events, it must get a reference on an object which fires these events to subscribe on it. When you don't have a reference on such object, just tell the Hookup that you are interesting in listening some particular events (this is called subscribing). On the other side, when you may fire events, tell the Hookup that you can fire these king of events (this is called publishing). This way, when the Hookup has a subscriber interested in listening events that one of its publishers fire, it will act as a third party and make this subscriber subscribes to this publisher (as defined in the java-beans event model). Up to this point, both beans are connected and when the publisher fires an event, the subscriber is notified on the corresponding listener interface (as defined in the java-beans event model). An other mechanism provided by the Hookup is the notion of persistent events. If a publisher has fired an event and decided that this event will be persistent, each time a new subscriber declares itself as being interested in this kind of events, it will automatically receive this event.
Field Summary |
Constructor Summary |
Method Summary |
Hookup | getGlobalHookup() |
void | cleanAll() |
void | addPublisher(Object obj) |
void | addPublisher(Object obj, EventSetDescriptor publishedEvent) |
void | removePublisher(Object obj) |
void | removePublisher(Object obj, EventSetDescriptor publishedEvent) |
void | subscribe(EventListener obj, String listenerInterface) |
void | unsubscribe(EventListener obj, String listenerInterface) |
void | makePersistentEvent(String eventListener, EventObject event) |
void | makePersistentEvent(String listenerInterface, EventObject event, String method) |
void | removePersistentEvent(String listenerInterface, EventObject event) |
Field Detail |
Constructor Detail |
Method Detail |
Hookup getGlobalHookup()Returns the static reference on the Hookup used by the Portal
void cleanAll()Cleans the content of the Hookup (persistent events, publishers, subscribers ...) Use this method when you start a new application (with a new Hookup) in a existing VM In the Portal desktop it is automatically done.
void addPublisher(Object obj)Adds a publisher object to this Hookup. The events fired by this publisher will be retreived from its bean info. If this publisher has already been registered but for a different set of events, the difference will be added to the publishing list of this subscriber
obj
void addPublisher(Object obj, EventSetDescriptor publishedEvent)Adds a publisher that will publish the specified event. If this publisher has already been registered to this Hookup, them the event will added to the publishing list of this subscriber.
obj
publishedEvent
void removePublisher(Object obj)Removes a publisher from this Hookup. All subscribers that were previously subscribed on events fired by this publisher will be automatically unsubscribed.
obj
void removePublisher(Object obj, EventSetDescriptor publishedEvent)Removes from a publisher an event it publishes. If this publisher publishes no more events, it is removed from the list. Any subscriber that were subscribed on this event for this publisher will be automatically unsubscribed.
obj
publishedEvent
void subscribe(EventListener obj, String listenerInterface)Subscribes an object to a specify event listener interface.
obj
listenerInterface
void unsubscribe(EventListener obj, String listenerInterface)Unsubscribes an object to a specify event listener interface.
obj
listenerInterface
void makePersistentEvent(String eventListener, EventObject event)Declares an event as a persistent event. The definition of a persistent event is : when a persistent event exists for a listener interface, each times there is a new subscription, the new subscriber will receive this persistent event. The source of the fired event is not aware of new deliveries of the event. The Hookup fires the persistent events. The listener will be callback on the first method declared in the BeanInfo class for this listener interface. A new persistent event for this interface will replace the actual persitent event.
eventListener
event
void makePersistentEvent(String listenerInterface, EventObject event, String method)Declares an event as a persistent event. The definition of a persistent event is : when a persistent event exists for a listener interface, each times there is a new subscription, the new subscriber will receive this persistent event. The source of the fired event is not aware of new deliveries of the event. The Hookup fires the persistent events. The listener will be callback on the method declared in parameter. A new persistent event for this interface will replace the actual persitent event.
eventListener
event
method
void removePersistentEvent(String listenerInterface, EventObject event)Removes an event from the persistent ones.
listenerInterface
event