com.sap.mdm.notification
Class EventDispatcher

java.lang.Object
  extended bycom.sap.mdm.notification.EventDispatcher

public class EventDispatcher
extends Object

This class is responsible for dispatching all events coming from one specific MDM server to all event listeners subscribed in this dispatcher. In order to define the set of notifications available on the dispatcher it should be registered to one ore several groups of notifications (see methods registerGlobalNotifications, registerServerNotifications and registerRepositoryNotifications.

Note: MDM event notification is not a guarantee delivery system. In addition, there are known limitations and deficiency. For example, AbstractDataListener.recordAdded is not trigger if a record is created through import.


Constructor Summary
EventDispatcher(com.sap.mdm.internal.notification.InternalEventDispatcher internalED)
          For internal use only Copy constructor
EventDispatcher(String connectionTag)
          Constructor
EventDispatcher(String connectionTag, SocketFactory socketFactory)
          Constructor
 
Method Summary
 void addListener(MdmListener listener)
          Add event listener
 boolean containListener(MdmListener listener)
          Check if the specified event listener is already subscribed.
 MdmListener[] getListeners()
          Returns all event listeners.
 String getServerName()
          Returns the name of MDM server this dispatcher connected to.
 boolean isConnected()
          Verify if this dispatcher connected to MDM server
 boolean isDataNotificationsRegistered(DataEventRegistrationSet registrationSet, RepositoryIdentifier reposId)
          Check if this event dispatcher is registered for the specified set of data notifications.
 boolean isDataNotificationsRegistered(RepositoryIdentifier reposId)
          Deprecated. replaced by isDataNotificationsRegistered(DataEventRegistrationSet, RepositoryIdentifier)
 boolean isGlobalNotificationsRegistered()
          Deprecated. replaced by isGlobalNotificationsRegistered(GlobalEventRegistrationSet)
 boolean isGlobalNotificationsRegistered(GlobalEventRegistrationSet registrationSet)
          Check if this event dispatcher is registered for the specified set of global notifications.
 boolean isRepositoryNotificationsRegistered(RepositoryEventRegistrationSet registrationSet, RepositoryIdentifier reposId)
          Check if this event dispatcher is registered for the specified set of repository notifications.
 boolean isRepositoryNotificationsRegistered(RepositoryIdentifier reposId)
          Deprecated. replaced by isRepositoryNotificationsRegistered(RepositoryEventRegistrationSet, RepositoryIdentifier)
 boolean isServerNotificationsRegistered()
          Deprecated. replaced by isServerNotificationsRegistered(ServerEventRegistrationSet)
 boolean isServerNotificationsRegistered(ServerEventRegistrationSet registrationSet)
          Check if this event dispatcher is registered for the specified set of server notifications.
 void registerDataNotifications(DataEventRegistrationSet registrationSet, UserSessionContext ctx, String repositoryUserPassword)
          Register this event dispatcher for data type notifications defined in the specified registration set.
 void registerDataNotifications(String repositoryUserName, String repositoryUserPassword, RepositoryIdentifier reposId, RegionProperties dataRegion)
          Deprecated. replaced by registerDataNotifications(DataEventRegistrationSet, UserSessionContext, String)
 void registerDataNotificationsBySessionId(DataEventRegistrationSet registrationSet, UserSessionContext ctx, String sessionId)
          For internal use only Register this event dispatcher for the specified set of data type notifications After the repository is stopped or server is stopped the registration for data notifications is not refreshed automatically.
 void registerGlobalNotifications()
          Deprecated. replaced by registerGlobalNotifications(GlobalEventRegistrationSet)
 void registerGlobalNotifications(GlobalEventRegistrationSet registrationSet)
          Register this event dispatcher for global type notifications defined in the specified registration set.
 void registerRepositoryNotifications(RepositoryEventRegistrationSet registrationSet, RepositorySessionContext ctx, String repositoryUserPassword)
          Register this event dispatcher for repository type notifications defined in the specified registration set.
 void registerRepositoryNotifications(String repositoryUserName, String repositoryUserPassword, RepositoryIdentifier reposId)
          Deprecated. replaced by registerRepositoryNotifications(RepositoryEventRegistrationSet, RepositorySessionContext, String)
 void registerRepositoryNotificationsBySessionId(RepositoryEventRegistrationSet registrationSet, RepositorySessionContext ctx, String sessionId)
          For internal use only Register this event dispatcher for the specified set of repository type notifications After the repository is unmounted or the server is stopped the registration for repository notifications is not refreshed automatically.
 void registerServerNotifications(ServerEventRegistrationSet registrationSet, ServerSessionContext ctx, String serverUserPassword)
          Register this event dispatcher for server type notifications defined in the specified registration set.
 void registerServerNotifications(String serverUserName, String serverUserPassword)
          Deprecated. replaced by registerServerNotifications(ServerEventRegistrationSet, ServerSessionContext, String)
 void registerServerNotificationsBySessionId(ServerEventRegistrationSet registrationSet, ServerSessionContext ctx, String sessionId)
          For internal use only Register this event dispatcher for all server type notifications After the server is stopped the registration for server notifications is not refreshed automatically.
 void registerTrustedDataNotifications(String repositoryUserName, RepositoryIdentifier reposId, RegionProperties dataRegion)
          Deprecated. replaced by registerDataNotifications(DataEventRegistrationSet, UserSessionContext, String)
 void registerTrustedRepositoryNotifications(String repositoryUserName, RepositoryIdentifier reposId)
          Deprecated. replaced by registerRepositoryNotifications(RepositoryEventRegistrationSet, RepositorySessionContext, String)
 void registerTrustedServerNotifications(String serverUserName)
          Deprecated. replaced by registerServerNotifications(ServerEventRegistrationSet, ServerSessionContext, String)
 void removeAllListeners()
          Remove all event listeners
 void removeListener(MdmListener listener)
          Remove event listener
 void terminate()
          Terminates the event dispatcher.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventDispatcher

public EventDispatcher(String connectionTag)
                throws ConnectionException
Constructor

Parameters:
connectionTag - server name
Throws:
ConnectionException

EventDispatcher

public EventDispatcher(String connectionTag,
                       SocketFactory socketFactory)
                throws ConnectionException
Constructor

Parameters:
connectionTag - server name
socketFactory - the factory of secure socket. If null, a plain socket is used
Throws:
ConnectionException

EventDispatcher

public EventDispatcher(com.sap.mdm.internal.notification.InternalEventDispatcher internalED)
For internal use only Copy constructor

Throws:
ConnectionException
Method Detail

getServerName

public String getServerName()
Returns the name of MDM server this dispatcher connected to.

Returns:
the server name

registerGlobalNotifications

public void registerGlobalNotifications()
                                 throws ConnectionException,
                                        CommandException
Deprecated. replaced by registerGlobalNotifications(GlobalEventRegistrationSet)

Register this event dispatcher for all global type notifications.

Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerGlobalNotifications

public void registerGlobalNotifications(GlobalEventRegistrationSet registrationSet)
                                 throws ConnectionException,
                                        CommandException
Register this event dispatcher for global type notifications defined in the specified registration set.

Parameters:
registrationSet - the set of global events that should be registered.
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

isGlobalNotificationsRegistered

public boolean isGlobalNotificationsRegistered()
Deprecated. replaced by isGlobalNotificationsRegistered(GlobalEventRegistrationSet)

Check if this event dispatcher is registered for all global notifications.

Returns:
true if dispatcher is registered for global notifications, false otherwise.

isGlobalNotificationsRegistered

public boolean isGlobalNotificationsRegistered(GlobalEventRegistrationSet registrationSet)
Check if this event dispatcher is registered for the specified set of global notifications.

Parameters:
registrationSet - the set of global events which registration should be checked.
Returns:
true if dispatcher is registered for global notifications, false otherwise.

registerServerNotifications

public void registerServerNotifications(String serverUserName,
                                        String serverUserPassword)
                                 throws ConnectionException,
                                        CommandException
Deprecated. replaced by registerServerNotifications(ServerEventRegistrationSet, ServerSessionContext, String)

Register this event dispatcher for all server type notifications. After the server is stopped the registration for server notifications is refreshed automatically.

Parameters:
serverUserName - user name for the server
serverUserPassword - server password
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerServerNotifications

public void registerServerNotifications(ServerEventRegistrationSet registrationSet,
                                        ServerSessionContext ctx,
                                        String serverUserPassword)
                                 throws ConnectionException,
                                        CommandException
Register this event dispatcher for server type notifications defined in the specified registration set. After the server is stopped the registration for server notifications is refreshed automatically.

Parameters:
registrationSet - the set of server events that should be registered.
ctx - ServerSessionContext
serverUserPassword - server password
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerServerNotificationsBySessionId

public void registerServerNotificationsBySessionId(ServerEventRegistrationSet registrationSet,
                                                   ServerSessionContext ctx,
                                                   String sessionId)
                                            throws ConnectionException,
                                                   CommandException
For internal use only Register this event dispatcher for all server type notifications After the server is stopped the registration for server notifications is not refreshed automatically. This method should be called once more.

Parameters:
registrationSet - the set of server events which registration should be checked.
ctx - ServerSessionContext
sessionId - an authenticated server session ID
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerTrustedServerNotifications

public void registerTrustedServerNotifications(String serverUserName)
                                        throws ConnectionException,
                                               CommandException
Deprecated. replaced by registerServerNotifications(ServerEventRegistrationSet, ServerSessionContext, String)

Register this event dispatcher for all server type notifications for trusted connection

Parameters:
serverUserName - user name for the server
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

isServerNotificationsRegistered

public boolean isServerNotificationsRegistered()
Deprecated. replaced by isServerNotificationsRegistered(ServerEventRegistrationSet)

Check if this event dispatcher is registered for server notifications

Returns:
true if dispatcher is registered for server notifications, false otherwise.

isServerNotificationsRegistered

public boolean isServerNotificationsRegistered(ServerEventRegistrationSet registrationSet)
Check if this event dispatcher is registered for the specified set of server notifications.

Parameters:
registrationSet - the set of server events which registration should be checked.
Returns:
true if dispatcher is registered for server notifications, false otherwise.

registerRepositoryNotifications

public void registerRepositoryNotifications(String repositoryUserName,
                                            String repositoryUserPassword,
                                            RepositoryIdentifier reposId)
                                     throws CommandException,
                                            ConnectionException
Deprecated. replaced by registerRepositoryNotifications(RepositoryEventRegistrationSet, RepositorySessionContext, String)

Register this event dispatcher for all repository type notifications. After the repository is unmounted or the server is stopped the registration for repository notifications is refreshed automatically.

Parameters:
repositoryUserName - user name for repository
repositoryUserPassword - repository password
reposId - repository ID
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerRepositoryNotifications

public void registerRepositoryNotifications(RepositoryEventRegistrationSet registrationSet,
                                            RepositorySessionContext ctx,
                                            String repositoryUserPassword)
                                     throws CommandException,
                                            ConnectionException
Register this event dispatcher for repository type notifications defined in the specified registration set. After the server is stopped the registration for server notifications is refreshed automatically.

Parameters:
registrationSet - the set of repository events that should be registered.
ctx - RepositorySessionContext
repositoryUserPassword - repository password
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerRepositoryNotificationsBySessionId

public void registerRepositoryNotificationsBySessionId(RepositoryEventRegistrationSet registrationSet,
                                                       RepositorySessionContext ctx,
                                                       String sessionId)
                                                throws CommandException,
                                                       ConnectionException
For internal use only Register this event dispatcher for the specified set of repository type notifications After the repository is unmounted or the server is stopped the registration for repository notifications is not refreshed automatically. This method should be called once more.

Parameters:
registrationSet - the set of repository events which registration should be checked.
ctx - RepositorySessionContext
sessionId - an authenticated repository session ID
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerTrustedRepositoryNotifications

public void registerTrustedRepositoryNotifications(String repositoryUserName,
                                                   RepositoryIdentifier reposId)
                                            throws CommandException,
                                                   ConnectionException
Deprecated. replaced by registerRepositoryNotifications(RepositoryEventRegistrationSet, RepositorySessionContext, String)

Register this event dispatcher for all repository type notifications for trusted connection

Parameters:
repositoryUserName - user name for repository
reposId - repository ID
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

isRepositoryNotificationsRegistered

public boolean isRepositoryNotificationsRegistered(RepositoryIdentifier reposId)
Deprecated. replaced by isRepositoryNotificationsRegistered(RepositoryEventRegistrationSet, RepositoryIdentifier)

Check if this event dispatcher is registered for notifications of the specified repository.

Parameters:
reposId - repository ID
Returns:
true if dispatcher is registered for repository notifications, false otherwise.

isRepositoryNotificationsRegistered

public boolean isRepositoryNotificationsRegistered(RepositoryEventRegistrationSet registrationSet,
                                                   RepositoryIdentifier reposId)
Check if this event dispatcher is registered for the specified set of repository notifications.

Parameters:
registrationSet - the set of repository events which registration should be checked.
reposId - repository ID
Returns:
true if dispatcher is registered for repository notifications, false otherwise.

registerDataNotifications

public void registerDataNotifications(String repositoryUserName,
                                      String repositoryUserPassword,
                                      RepositoryIdentifier reposId,
                                      RegionProperties dataRegion)
                               throws CommandException,
                                      ConnectionException
Deprecated. replaced by registerDataNotifications(DataEventRegistrationSet, UserSessionContext, String)

Register this event dispatcher for all data type notifications After the repository is stopped or server is stopped the registration for data notifications is refreshed automatically.

Parameters:
repositoryUserName - user name
repositoryUserPassword - repository password
reposId - repository ID
dataRegion - region properties
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerDataNotifications

public void registerDataNotifications(DataEventRegistrationSet registrationSet,
                                      UserSessionContext ctx,
                                      String repositoryUserPassword)
                               throws CommandException,
                                      ConnectionException
Register this event dispatcher for data type notifications defined in the specified registration set. After the server is stopped the registration for server notifications is refreshed automatically.

Parameters:
registrationSet - the set of data events that should be registered.
ctx - UserSessionContext
repositoryUserPassword - repository password
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerDataNotificationsBySessionId

public void registerDataNotificationsBySessionId(DataEventRegistrationSet registrationSet,
                                                 UserSessionContext ctx,
                                                 String sessionId)
                                          throws CommandException,
                                                 ConnectionException
For internal use only Register this event dispatcher for the specified set of data type notifications After the repository is stopped or server is stopped the registration for data notifications is not refreshed automatically. This method should be called once more.

Parameters:
registrationSet - the set of data events which registration should be checked.
ctx - UserSessionContext
sessionId - an authenticated user session ID
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

registerTrustedDataNotifications

public void registerTrustedDataNotifications(String repositoryUserName,
                                             RepositoryIdentifier reposId,
                                             RegionProperties dataRegion)
                                      throws CommandException,
                                             ConnectionException
Deprecated. replaced by registerDataNotifications(DataEventRegistrationSet, UserSessionContext, String)

Register this event dispatcher for all data type notifications for trusted connection

Parameters:
repositoryUserName - user name
reposId - repository ID
dataRegion - region properties
Throws:
ConnectionException - if any connection problem occur.
CommandException - if the problem occur during any command evaluation.

isDataNotificationsRegistered

public boolean isDataNotificationsRegistered(RepositoryIdentifier reposId)
Deprecated. replaced by isDataNotificationsRegistered(DataEventRegistrationSet, RepositoryIdentifier)

Check if this event dispatcher is registered for data notifications of the specified repository.

Parameters:
reposId - repository ID
Returns:
true if dispatcher is registered for data notifications, false otherwise.

isDataNotificationsRegistered

public boolean isDataNotificationsRegistered(DataEventRegistrationSet registrationSet,
                                             RepositoryIdentifier reposId)
Check if this event dispatcher is registered for the specified set of data notifications.

Parameters:
registrationSet - the set of data events which registration should be checked.
reposId - repository ID
Returns:
true if dispatcher is registered for data notifications, false otherwise.

addListener

public void addListener(MdmListener listener)
Add event listener

Parameters:
listener -

removeListener

public void removeListener(MdmListener listener)
Remove event listener

Parameters:
listener -

removeAllListeners

public void removeAllListeners()
Remove all event listeners


containListener

public boolean containListener(MdmListener listener)
Check if the specified event listener is already subscribed.

Parameters:
listener -
Returns:
true if listener is already subscribed, false otherwise.

getListeners

public MdmListener[] getListeners()
Returns all event listeners.

Returns:
array of MdmListener instances.

terminate

public void terminate()
Terminates the event dispatcher. The event dispatch will not get farther notifications, though not immediately. This event dispatcher can not be used any more.


isConnected

public boolean isConnected()
Verify if this dispatcher connected to MDM server

Returns:
true if MDM server is running and EventDispatcher is successfully connected to it, otherwise false


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.