Version: ${maven.project.version}

org.soaplab.services.events
Class AnalysisEvent

java.lang.Object
  extended by org.soaplab.services.events.AnalysisEvent
All Implemented Interfaces:
EventConstants
Direct Known Subclasses:
HeartbeatProgressEvent, PercentProgressEvent, StateChangeEvent, StepProgressEvent, TimeProgressEvent

public class AnalysisEvent
extends java.lang.Object
implements EventConstants

A base (immutable) class for all events coming from a running analysis.

Version:
$Id: AnalysisEvent.java,v 1.4 2007/10/18 15:52:05 marsenger Exp $
Author:
Martin Senger

Field Summary
 
Fields inherited from interface org.soaplab.services.events.EventConstants
ANALYSIS_EVENT, HEARTBEAT_PROGRESS, MESSAGE, NEW_STATE, PERCENT_PROGRESS, PERCENTAGE, PREVIOUS_STATE, REMAINING, STATE_CHANGED, STEP_PROGRESS, STEPS_COMPLETED, TIME_PROGRESS, TIMESTAMP, TIMESTAMP_FORMAT, TOTAL_STEPS
 
Constructor Summary
AnalysisEvent(java.lang.Object source, java.lang.String message)
          A constructor taking a general message carried on by this event, and the source of this event.
AnalysisEvent(java.lang.String message)
          A constructor taking a general message carried on by this event.
 
Method Summary
 java.lang.String formatSource()
          Return a stringified version of this event's source.
 java.lang.String getMessage()
          Get the main contents of this event.
 java.lang.Object getSource()
          Get the event source (which may be null).
 java.util.Date getTimestamp()
          Get the event timestamp.
 boolean isOlderThan(AnalysisEvent newEvent)
          Compare this event with the 'newEvent'.
 void setTimestamp(java.util.Date timestamp)
          Set the event timestamp.
 java.lang.String toString()
          Return a stringified version of this event - in an XML format.
 org.jdom.Element toXML()
          Create an XML element representing this event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnalysisEvent

public AnalysisEvent(java.lang.Object source,
                     java.lang.String message)
A constructor taking a general message carried on by this event, and the source of this event.


AnalysisEvent

public AnalysisEvent(java.lang.String message)
A constructor taking a general message carried on by this event. The event source is unknown.

Method Detail

getMessage

public java.lang.String getMessage()
Get the main contents of this event. Use toString() to get an XML representation of this event.

Returns:
the event message. The returned message is never null - just may be empty.

getSource

public java.lang.Object getSource()
Get the event source (which may be null).


getTimestamp

public java.util.Date getTimestamp()
Get the event timestamp.

Returns:
the time when the event was created

setTimestamp

public void setTimestamp(java.util.Date timestamp)
Set the event timestamp.

Parameters:
timestamp - is time assigned to the event

formatSource

public java.lang.String formatSource()
Return a stringified version of this event's source. This is here as a separate method (and part of the toString() method) because the event source is not part of the event XML serialization.

Returns:
a formatted event source

toXML

public org.jdom.Element toXML()
Create an XML element representing this event. Note that currently the event source is not part of the XML representation.

Returns:
a jDom element that can be used for building the whole XML document

toString

public java.lang.String toString()
Return a stringified version of this event - in an XML format.

Overrides:
toString in class java.lang.Object

isOlderThan

public boolean isOlderThan(AnalysisEvent newEvent)
Compare this event with the 'newEvent'.

Parameters:
newEvent - is compared with this instance
Returns:
true if the 'newEvent' is newer (according to its timestamp) than this one

Version: ${maven.project.version}

Submit a bug or feature
Generated: Tue Jun 14 15:18:14 AST 2011