com.silverpeas.notification
Class DefaultNotificationSubscriber

java.lang.Object
  extended by com.silverpeas.notification.DefaultNotificationSubscriber
All Implemented Interfaces:
NotificationSubscriber, EventListener
Direct Known Subclasses:
AttachmentSharingListener, CommentActionListener, NodeSharingListener, PdcNotificationListener, PersonalizationNotificationListener, PublicationSharingListener

public abstract class DefaultNotificationSubscriber
extends Object
implements NotificationSubscriber

It is the default implementation of the NotificationSubscriber interface. It is dedicated to be extended by more business specific notification listener. It encapsulates the access to the underlying messaging broker for performing the actual notification subscriptions. The business specific notification subscriber extending this class must be registered within an IoC container so that it will be automatically instanciated and the subscription will be then automatically performed by the IoC container. The IoC container will inject the implementation of the messaging system used to accomplish the notification mechanism in Silverpeas.


Constructor Summary
DefaultNotificationSubscriber()
           
 
Method Summary
 String getId()
          Gets the unique identifier of this subscriber in the MOM system.
 void setId(String id)
          Sets the unique identifier for this subscriber in the underlying MOM system.
 void subscribeForNotifications(NotificationTopic onTopic)
          Subscribes to notifications received on the specified topic.
abstract  void subscribeOnTopics()
          Subscribes the topics this subscriber is interested on.
 void unsubscribeForNotifications(NotificationTopic onTopic)
          Unsubscribes from the notifications sent on the specified topic.
abstract  void unsubscribeOnTopics()
          Unsubscribes from the topics this subscriber is subscribed on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.silverpeas.notification.NotificationSubscriber
onNotification
 

Constructor Detail

DefaultNotificationSubscriber

public DefaultNotificationSubscriber()
Method Detail

subscribeOnTopics

@PostConstruct
public abstract void subscribeOnTopics()
Subscribes the topics this subscriber is interested on. This method will be automatically called by the IoC container once instantiated. This method should called the subscribeForNotifications one for each topic it is interested on.


unsubscribeOnTopics

@PreDestroy
public abstract void unsubscribeOnTopics()
Unsubscribes from the topics this subscriber is subscribed on. This method will be automatically called by the IoC container before being released. This method should called the unsubscribeForNotifications one for each topic it is subscribed on.


getId

public String getId()
Description copied from interface: NotificationSubscriber
Gets the unique identifier of this subscriber in the MOM system. The identifier is computed during the subscription into a MOM system.

Specified by:
getId in interface NotificationSubscriber
Returns:
the unique identifier of this subscriber.

setId

public void setId(String id)
Sets the unique identifier for this subscriber in the underlying MOM system. This method is called by the underlying MOM system at subscription.

Specified by:
setId in interface NotificationSubscriber
Parameters:
id - the unique identifier to set.

subscribeForNotifications

public final void subscribeForNotifications(NotificationTopic onTopic)
Description copied from interface: NotificationSubscriber
Subscribes to notifications received on the specified topic. If the topic doesn't exist, a SubscriptionException is thrown. If the subscriber is already subscribed to the specified topic, nothing is done.

Specified by:
subscribeForNotifications in interface NotificationSubscriber
Parameters:
onTopic - the topic on which this listener listens.

unsubscribeForNotifications

public final void unsubscribeForNotifications(NotificationTopic onTopic)
Description copied from interface: NotificationSubscriber
Unsubscribes from the notifications sent on the specified topic. If the subscriber isn't subscribed to the specified topic, then nothing is done.

Specified by:
unsubscribeForNotifications in interface NotificationSubscriber
Parameters:
onTopic - the topic to unsubscribe.


Copyright © 2016 Silverpeas. All Rights Reserved.