com.ibm.ftt.resources.core
Interface IResourceSubscription

All Known Implementing Classes:
ResourceSubscription

public interface IResourceSubscription

The IResourceSubscription is an interface for the subscription to attach to the IResourcePublisher.

To subscribe to resource events,

  1. Create a class that extends ResourceSubscription, and override the notifySubscriber(com.ibm.ftt.resources.core.events.IResourceSubscriptionEvent)
  2. Create an instance of that class
  3. Call setSubscriber(java.lang.Object) to set subscriber.
  4. Pass the IResourceSubscription object to IResourcePublisher.subscribe(com.ibm.ftt.resources.core.IResourceSubscription) method
Later, when a subscription event occurs, notifySubscriber(com.ibm.ftt.resources.core.events.IResourceSubscriptionEvent) will be called by the IResourcePublisher.

ResourceSubscription.

See Also:
IResourcePublisher, ResourceSubscription

Field Summary
static String COPY_RIGHT
           
 
Method Summary
 Object getSubscriber()
          Returns the subscriber that owns this subscription.
 void notifySubscriber(IResourceSubscriptionEvent event)
          This method is called by the IResourcePublisher when an event is published.
 void setSubscriber(Object subscriber)
          Sets the subscriber that owns this subscription.
 

Field Detail

COPY_RIGHT

static final String COPY_RIGHT
See Also:
Constant Field Values
Method Detail

getSubscriber

Object getSubscriber()
Returns the subscriber that owns this subscription. A typical implementation of IResourceSubscription will update the status of the subscriber based on information contained in the event.

Returns:
the subscriber object or null.

setSubscriber

void setSubscriber(Object subscriber)
Sets the subscriber that owns this subscription. Subscriber should not be null. A typical implementation of IResourceSubscription will update the status of the subscriber based on information contained in the event.

Parameters:
subscriber - the subscriber who attached this subscription

notifySubscriber

void notifySubscriber(IResourceSubscriptionEvent event)
This method is called by the IResourcePublisher when an event is published. A typical implementation of IResourceSubscription will update the status of the subscriber based on information contained in the event.

To create an implementation of this IResourceSubscription, you can extend an abstract base class ResourceSubscription and implement this method. The following is a sample template of this method:

  public void notifySubscriber(IResourceSubscriptionEvent event) {
                Object subscriber = getSubscriber();
                if (subscriber == null) {
                        return;
                }
                switch (event.getEventType()) {
                case IResourceSubscriptionEvent.DELETE:
                        // Your code for DELETE event here ...
                        break;
                case IResourceSubscriptionEvent.RENAME:
                        break;
                case IResourceSubscriptionEvent.ADD_MEMBER:
                        break;
                case IResourceSubscriptionEvent.REMOVE_MEMBER:
                        break;
                case IResourceSubscriptionEvent.REMOVE:
                        break;
                case IResourceSubscriptionEvent.MIGRATE:
                        break;
                case IResourceSubscriptionEvent.RECALL:
                        break;
                case IResourceSubscriptionEvent.STALE:
                        break;
                case IResourceSubscriptionEvent.REFRESH:
                        break;
                default:
                        ResourcesCorePlugin.getDefault().writeMsg(Level.FINEST, "Received unknown event " + event);
                        break;
                }
        }
 

Parameters:
event - the published event
See Also:
ResourceSubscription