Class SysEvent

  • All Implemented Interfaces:
    Serializable, Comparable<SysEvent>
    Direct Known Subclasses:
    HttpEvent, NamedEvent, TimedEvent

    public class SysEvent
    extends Object
    implements Serializable, Comparable<SysEvent>
    A system event - like adding something, updating something, startup, shutdown etc.

    The Notifications interface uses these to carry information about system events. Listeners can be registered for particular system event types.

    sub-classes should define the compareTo() and hashCode methods. They should also define fields and methods appropriate to the type of event.

    For example, the ENTITY_UPDATE event should contain enough information to identify the entity, e.g. the path for a calendar or a uid for the event. It is probably NOT a good idea to have a reference to the actual entity.

    Some of these events may be persisted to ensure their survival across system restarts and their generation is considered part of the operation.

    Note that we do not modify system events once they are persisted. We retrieve them and delete them from the database.

    Author:
    Mike Douglass
    See Also:
    Serialized Form
    • Constructor Detail

      • SysEvent

        public SysEvent​(String sysCode)
        Constructor
        Parameters:
        sysCode - the system event code
    • Method Detail

      • getSysCode

        public String getSysCode()
        Returns:
        the system event code
      • addMessageAttributes

        public void addMessageAttributes​(List<SysEvent.Attribute> attrs)
        Override this to add extra attributes
        Parameters:
        attrs - List of attributes for the JMX message header
      • getMessageAttributes

        public List<SysEvent.Attribute> getMessageAttributes()
        Returns:
        List of attributes for the JMX message header
      • setDtstamp

        public void setDtstamp​(String val)
        Parameters:
        val - a date stamp
      • getDtstamp

        public String getDtstamp()
        Returns:
        String dtstamp
      • setSequence

        public void setSequence​(int val)
        Set the sequence
        Parameters:
        val - sequence number
      • getSequence

        public int getSequence()
        Get the sequence
        Returns:
        int the sequence
      • setRelated

        public void setRelated​(SysEvent val)
        This allows for linking together related events. For example a calendar change event might be triggered by an event being added.
        Parameters:
        val - the related system event
      • getRelated

        public SysEvent getRelated()
        Returns:
        the related system event
      • makeTimedEvent

        public static SysEvent makeTimedEvent​(String label,
                                              long millisecs)
        Parameters:
        label - a useful label
        millisecs - - time for stats
        Returns:
        SysEvent
      • makeStatsEvent

        public static SysEvent makeStatsEvent​(String name,
                                              Long longValue)
        Parameters:
        name - for the event
        longValue - a value - often a time
        Returns:
        SysEvent
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toStringSegment

        public void toStringSegment​(ToString ts)
        Add our stuff to the ToString object
        Parameters:
        ts - ToString for result