Class SysEvent
- java.lang.Object
-
- org.bedework.util.jms.events.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSysEvent.AttributeAn attribute for the JMX message header
-
Field Summary
Fields Modifier and Type Field Description static StringsyscodeStatsstatic StringsyscodeTimedEvent
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessageAttributes(List<SysEvent.Attribute> attrs)Override this to add extra attributesintcompareTo(SysEvent val)StringgetDtstamp()List<SysEvent.Attribute>getMessageAttributes()SysEventgetRelated()intgetSequence()Get the sequenceStringgetSysCode()inthashCode()static SysEventmakeStatsEvent(String name, Long longValue)static SysEventmakeTimedEvent(String label, long millisecs)voidsetDtstamp(String val)voidsetRelated(SysEvent val)This allows for linking together related events.voidsetSequence(int val)Set the sequenceStringtoString()voidtoStringSegment(ToString ts)Add our stuff to the ToString object
-
-
-
Field Detail
-
syscodeStats
public static final String syscodeStats
- See Also:
- Constant Field Values
-
syscodeTimedEvent
public static final String syscodeTimedEvent
- See Also:
- Constant Field Values
-
-
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 labelmillisecs- - time for stats- Returns:
- SysEvent
-
makeStatsEvent
public static SysEvent makeStatsEvent(String name, Long longValue)
- Parameters:
name- for the eventlongValue- a value - often a time- Returns:
- SysEvent
-
compareTo
public int compareTo(SysEvent val)
- Specified by:
compareToin interfaceComparable<SysEvent>
-
toStringSegment
public void toStringSegment(ToString ts)
Add our stuff to the ToString object- Parameters:
ts- ToString for result
-
-