Package org.ow2.clif.storage.api
Class AbstractEvent
- java.lang.Object
-
- org.ow2.clif.storage.api.AbstractEvent
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.lang.Object>,BladeEvent
- Direct Known Subclasses:
ActionEvent,AlarmEvent,LifeCycleEvent,ProbeEvent
public abstract class AbstractEvent extends java.lang.Object implements BladeEvent
Abstract implementation of a blade event. All events managed by CLIF shall derive from this class. Each event type shall have a unique label, which must be registered using the static registerEventFieldLabels method (typically in the a static section of the event class). Events are "Comparable" on their dates.- Author:
- Bruno Dillenseger
- See Also:
registerEventFieldLabels(String, String[], EventFactory), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longdatestatic java.lang.StringDEFAULT_SEPARATOR
-
Constructor Summary
Constructors Constructor Description AbstractEvent()AbstractEvent(long date)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object obj)The order is based on dates.longgetDate()static EventFactorygetEventFactory(java.lang.String event_label)static java.lang.String[]getEventFieldLabels(java.lang.String event_label)Get field labels of a given event type.protected static voidregisterEventFieldLabels(java.lang.String event_label, java.lang.String[] field_labels, EventFactory factory)Registers the given event type label (which must be unique) and associates the fields labels for this event type.voidsetDate(long date)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ow2.clif.storage.api.BladeEvent
getFieldLabels, getFieldValue, getTypeLabel, toString
-
-
-
-
Field Detail
-
DEFAULT_SEPARATOR
public static final java.lang.String DEFAULT_SEPARATOR
- See Also:
- Constant Field Values
-
date
protected long date
-
-
Method Detail
-
registerEventFieldLabels
protected static void registerEventFieldLabels(java.lang.String event_label, java.lang.String[] field_labels, EventFactory factory)Registers the given event type label (which must be unique) and associates the fields labels for this event type.- Parameters:
event_label- the unique label designating this event typefield_labels- the array of field labels, describing the content of each field this type of event holds. These labels must be in the same order as the fields are printed when the toString() method is called on this type of event.- See Also:
BladeEvent.toString(long, String)
-
getEventFieldLabels
public static java.lang.String[] getEventFieldLabels(java.lang.String event_label)
Get field labels of a given event type.- Parameters:
event_label- label of the event type- Returns:
- the field labels of the given event type.
-
getEventFactory
public static EventFactory getEventFactory(java.lang.String event_label)
-
getDate
public long getDate()
- Specified by:
getDatein interfaceBladeEvent- Returns:
- the date of this event
-
setDate
public void setDate(long date)
-
compareTo
public int compareTo(java.lang.Object obj) throws java.lang.ClassCastExceptionThe order is based on dates. In case dates are the same, an arbitrary order is applied based on hashcodes.- Specified by:
compareToin interfacejava.lang.Comparable<java.lang.Object>- Throws:
java.lang.ClassCastException
-
-