Class Notifier

  • All Implemented Interfaces:
    BaseMBean, NotifierMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

    public class Notifier
    extends javax.management.NotificationBroadcasterSupport
    implements NotifierMBean
    This class provides methods for sending JMX notifications.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EVT_AL_START
      Final variable used for distinguishing the type of the notification.
      static java.lang.String EVT_AL_STOP
      Final variable used for distinguishing the type of the notification.
      static java.lang.String EVT_CI_START
      Final variable used for distinguishing the type of the notification.
      static java.lang.String EVT_CI_STOP
      Final variable used for distinguishing the type of the notification.
      static java.lang.String EVT_CI_UPDATED
      Final variable used for distinguishing the type of the notification.
      static java.lang.String EVT_SRV_STOP
      Final variable used for distinguishing the type of the notification.
      static java.lang.String MBEAN_ID
      ID of the MBean.
      static java.lang.String MBEAN_TYPE
      Type of the MBean.
      static java.lang.String TYPE_ALL
      Final variable used for distinguishing the type of the notification groups.
      static java.lang.String TYPE_ASSEMBLY_LINE
      Final variable used for distinguishing the type of the notification groups.
      static java.lang.String TYPE_CONFIG_INSTANCE
      Final variable used for distinguishing the type of the notification groups.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assemblyLineFinished​(java.lang.String aAssemblyLineId)
      Sends notification for assembly line stopping.
      void assemblyLineStarted​(java.lang.String aAssemblyLineId)
      Sends notification for assembly line starting.
      void configInstanceStarted​(java.lang.String aConfigId)
      Sends notification for config instance starting.
      void configInstanceStopped​(java.lang.String aConfigId)
      Sends notification for config instance stopping.
      void configInstanceUpdated​(java.lang.String aConfigId)
      Sends notification for updating the config instance file.
      void disable()
      Disables the Notifier.
      void enable()
      Enables the Notifier.
      java.lang.String getId()
      Reads attribute "Id".
      java.lang.String getKeyPropertyList()
      Returns the MBean key property list.
      static Notifier getNotifier()
      Returns the Notifier.
      javax.management.ObjectName getObjectName()
      Gets the object name of the Notifier.
      java.lang.String getType()
      Reads attribute "Type".
      static Notifier init()
      Initializes the Notifier.
      boolean isEnabled()
      Checks if the notification is enabled.
      void sendCustomNotification​(java.lang.String aType, java.lang.String aId, java.lang.Object aData)
      Sends custom notification.
      void sendNotification​(javax.management.Notification aNotification)
      Sends a notification.
      void serverStopped​(java.util.Date aBootTime)
      Sends notification for server stopping.
      • Methods inherited from class javax.management.NotificationBroadcasterSupport

        addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MBEAN_TYPE

        public static final java.lang.String MBEAN_TYPE
        Type of the MBean.
        See Also:
        Constant Field Values
      • MBEAN_ID

        public static final java.lang.String MBEAN_ID
        ID of the MBean.
        See Also:
        Constant Field Values
      • EVT_CI_START

        public static final java.lang.String EVT_CI_START
        Final variable used for distinguishing the type of the notification. Indicates notification for config instance starting.
        See Also:
        Constant Field Values
      • EVT_CI_STOP

        public static final java.lang.String EVT_CI_STOP
        Final variable used for distinguishing the type of the notification. Indicates notification for config instance stopping.
        See Also:
        Constant Field Values
      • EVT_CI_UPDATED

        public static final java.lang.String EVT_CI_UPDATED
        Final variable used for distinguishing the type of the notification. Indicates notification for updating of the config instance file.
        See Also:
        Constant Field Values
      • EVT_AL_START

        public static final java.lang.String EVT_AL_START
        Final variable used for distinguishing the type of the notification. Indicates notification for assembly line starting.
        See Also:
        Constant Field Values
      • EVT_AL_STOP

        public static final java.lang.String EVT_AL_STOP
        Final variable used for distinguishing the type of the notification. Indicates notification for assembly line stopping.
        See Also:
        Constant Field Values
      • EVT_SRV_STOP

        public static final java.lang.String EVT_SRV_STOP
        Final variable used for distinguishing the type of the notification. Indicates notification for server stopping.
        See Also:
        Constant Field Values
      • TYPE_ALL

        public static final java.lang.String TYPE_ALL
        Final variable used for distinguishing the type of the notification groups. Indicates notification group containing all notifications.
        See Also:
        Constant Field Values
      • TYPE_CONFIG_INSTANCE

        public static final java.lang.String TYPE_CONFIG_INSTANCE
        Final variable used for distinguishing the type of the notification groups. Indicates notification group containing all notifications for config instances.
        See Also:
        Constant Field Values
      • TYPE_ASSEMBLY_LINE

        public static final java.lang.String TYPE_ASSEMBLY_LINE
        Final variable used for distinguishing the type of the notification groups. Indicates notification group containing all notifications for assembly lines.
        See Also:
        Constant Field Values
    • Method Detail

      • init

        public static Notifier init()
                             throws DIException
        Initializes the Notifier.
        Returns:
        the initialized Notifier.
        Throws:
        DIException - if the JMX notification service is already initialized.
      • getNotifier

        public static Notifier getNotifier()
                                    throws DIException
        Returns the Notifier.
        Returns:
        the Notifier object.
        Throws:
        DIException - if the JMX notification service is not initialized.
      • getObjectName

        public javax.management.ObjectName getObjectName()
        Gets the object name of the Notifier.
        Returns:
        the object name
      • isEnabled

        public boolean isEnabled()
        Checks if the notification is enabled.
        Returns:
        true if the notification is enabled, false otherwise.
      • enable

        public void enable()
        Enables the Notifier.
      • disable

        public void disable()
        Disables the Notifier.
      • assemblyLineStarted

        public void assemblyLineStarted​(java.lang.String aAssemblyLineId)
        Sends notification for assembly line starting.
        Parameters:
        aAssemblyLineId - the assembly line id.
      • assemblyLineFinished

        public void assemblyLineFinished​(java.lang.String aAssemblyLineId)
        Sends notification for assembly line stopping.
        Parameters:
        aAssemblyLineId - the assembly line id.
      • configInstanceStarted

        public void configInstanceStarted​(java.lang.String aConfigId)
        Sends notification for config instance starting.
        Parameters:
        aConfigId - the config instance id.
      • configInstanceStopped

        public void configInstanceStopped​(java.lang.String aConfigId)
        Sends notification for config instance stopping.
        Parameters:
        aConfigId - the config instance id.
      • configInstanceUpdated

        public void configInstanceUpdated​(java.lang.String aConfigId)
        Sends notification for updating the config instance file.
        Parameters:
        aConfigId - the config instance id.
      • serverStopped

        public void serverStopped​(java.util.Date aBootTime)
        Sends notification for server stopping.
        Parameters:
        aBootTime - the boot time.
      • sendCustomNotification

        public void sendCustomNotification​(java.lang.String aType,
                                           java.lang.String aId,
                                           java.lang.Object aData)
        Sends custom notification.
        Parameters:
        aType - the type of the notification.
        aId - the id of the notification. Used for building the message of the notification.
        aData - The user data object. It is used for whatever data the notification source wishes to communicate to its consumers.
      • getType

        public java.lang.String getType()
        Reads attribute "Type".

        getType() and getId() are used in a common schema for object names for all MBeans in the management package. The key properties part of the object name of each MBean is defined as "type=" + getType() + ",id=" + getId(), for example "type=AssemblyLine,id=Hello".

        Specified by:
        getType in interface BaseMBean
        Returns:
        the type of this MBean.
      • getId

        public java.lang.String getId()
        Reads attribute "Id". The "Id" value should be different for different MBeans of the same type.

        getType() and getId() are used in a common schema for object names for all MBeans in the management package. The key properties part of the object name of each MBean is defined as "type=" + getType() + ",id=" + getId(), for example "type=AssemblyLine,id=Hello".

        Specified by:
        getId in interface BaseMBean
        Returns:
        the Id of this MBean.
      • getKeyPropertyList

        public java.lang.String getKeyPropertyList()
        Returns the MBean key property list. If the MBean type is Notifier and the id is Notifier, the result of this method would be "type=Notifier,id=Notifier"
        Returns:
        string representing the MBean attributes.
      • sendNotification

        public void sendNotification​(javax.management.Notification aNotification)
        Sends a notification.
        Overrides:
        sendNotification in class javax.management.NotificationBroadcasterSupport
        Parameters:
        aNotification - The notification to send.