Package com.dassault_systemes.catweb.base.event

   
Class Hookup

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catweb.base.event.Hookup
Class Location

Framework : PortalBase

Module : PLBbase

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
public static void addPublisher(Object obj)
Adds a publisher object to this Hookup.
public static void addPublisher(Object obj, EventSetDescriptor publishedEvent)
Adds a publisher that will publish the specified event.
public static 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.
public static Hookup getGlobalHookup()
Returns the static reference on the Hookup used by the Portal
public static void makePersistentEvent(String eventListener, EventObject event)
Declares an event as a persistent event.
public static void makePersistentEvent(String listenerInterface, EventObject event, String method)
Declares an event as a persistent event.
public static void removePersistentEvent(String listenerInterface, EventObject event)
Removes an event from the persistent ones.
public static void removePublisher(Object obj)
Removes a publisher from this Hookup.
public static void removePublisher(Object obj, EventSetDescriptor publishedEvent)
Removes from a publisher an event it publishes.
public static void subscribe(EventListener obj, String listenerInterface)
Subscribes an object to a specify event listener interface.
public static void unsubscribe(EventListener obj, String listenerInterface)
Unsubscribes an object to a specify event listener interface.


Field Detail

Constructor Detail

Method Detail

addPublisher

    public static 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

Parameters:
obj
- the source object that will fire the event.

addPublisher

    public static 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.

Parameters:
obj
is the source object that will fire the event
publishedEvent
is the event that will be published by this publisher

cleanAll

    public static 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.


getGlobalHookup

    public static Hookup getGlobalHookup()

Returns the static reference on the Hookup used by the Portal


makePersistentEvent

    public static 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.

Parameters:
eventListener
is the class name of the listener interface matching with the event.
event
is the persistent event.

makePersistentEvent

    public static 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.

Parameters:
eventListener
is the class name of the listener interface matching with the event.
event
is the persistent event.
method
is the name of the method to callback on the listeners

removePersistentEvent

    public static void removePersistentEvent(String listenerInterface, EventObject event)

Removes an event from the persistent ones.

Parameters:
listenerInterface
is the class name of the listener interface matching with the event.
event
is the persistent event to remove.

removePublisher

    public static 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.

Parameters:
obj
the source object that fire events

removePublisher

    public static 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.

Parameters:
obj
the source object that fire events
publishedEvent
the description of the event to remove from this publisher

subscribe

    public static void subscribe(EventListener obj, String listenerInterface)

Subscribes an object to a specify event listener interface.

Parameters:
obj
is the subscriber object which implements EventListener interface
listenerInterface
is the class name of the event Listener Interface

unsubscribe

    public static void unsubscribe(EventListener obj, String listenerInterface)

Unsubscribes an object to a specify event listener interface.

Parameters:
obj
is the unsubscriber object which implements EventListener interface
listenerInterface
is the class name of the event Listener Interface


Copyright © 2000, Dassault Systèmes. All rights reserved