org.modelbus.core.lib.notification
Class NotificationListenerManager

java.lang.Object
  extended by org.modelbus.core.lib.notification.NotificationListenerManager
All Implemented Interfaces:
java.util.Observer

public class NotificationListenerManager
extends java.lang.Object
implements java.util.Observer

The class manages the registration of notification listeners. ModelBus provides notifications about model creation, deletion and updating. It is possible to define an own notification listener and to register it for a specified repository location. The listener has to implement the interface INotificationListener.


Method Summary
 void addNotificationListener(INotificationListener notificationListener)
          Adds a specified notification listener, if it does not already exist in the listener list
static NotificationListenerManager getNotificationListenerManager()
          Returns an instance of a NotificationListenerManager for a specified repository location (for example "http://localhost:9191/modelbusrepository")
 NotificationLocationStatus getNotificationLocationStatus()
           
 void notify(java.lang.String url, java.lang.String mode, java.lang.String username, java.lang.String sessionID)
          Notifies each registered notification listener about model creation, deletion or updating
 void notifyChangeModelNotificationListener(java.lang.String modelUri, java.lang.String messageID, java.lang.String changeModelContent)
          Notifies each notification listener about the commit of a change set.
 void removeNotificationListener(INotificationListener notificationListener)
          Removes a specified notification listener
 boolean startModelBusTopicListener()
           
 boolean stopModelBusTopicListener()
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNotificationListenerManager

public static NotificationListenerManager getNotificationListenerManager()
Returns an instance of a NotificationListenerManager for a specified repository location (for example "http://localhost:9191/modelbusrepository")

Parameters:
repLocation - the location of the repository
Returns:
an instance of a NotificationListenerManager
Throws:
java.lang.Exception

addNotificationListener

public void addNotificationListener(INotificationListener notificationListener)
Adds a specified notification listener, if it does not already exist in the listener list

Parameters:
notificationListener -

removeNotificationListener

public void removeNotificationListener(INotificationListener notificationListener)
Removes a specified notification listener

Parameters:
notificationListener -

notify

public void notify(java.lang.String url,
                   java.lang.String mode,
                   java.lang.String username,
                   java.lang.String sessionID)
Notifies each registered notification listener about model creation, deletion or updating

Parameters:
url - the path of the model, which has changed
mode - the kind of change ("update", "delete", "create")
username - the name of the user who has changed the entry
sessionID - the ID of the user session

notifyChangeModelNotificationListener

public void notifyChangeModelNotificationListener(java.lang.String modelUri,
                                                  java.lang.String messageID,
                                                  java.lang.String changeModelContent)
Notifies each notification listener about the commit of a change set. A serialized EMF ChangeModel is delivered to registered listeners

Parameters:
modelUri - should be empty (not used)
messageID - a unique identifier
changeModelContent - a serialized EMF ChangeModel

startModelBusTopicListener

public boolean startModelBusTopicListener()

stopModelBusTopicListener

public boolean stopModelBusTopicListener()
                                  throws ModelBusException
Throws:
ModelBusException

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

getNotificationLocationStatus

public NotificationLocationStatus getNotificationLocationStatus()