com.sun.slamd.message
Class JobCompletedMessage

java.lang.Object
  extended bycom.sun.slamd.message.Message
      extended bycom.sun.slamd.message.JobCompletedMessage

public class JobCompletedMessage
extends Message

This class defines a message that will be sent from the client to the server when work on a job has completed.


Field Summary
 
Fields inherited from class com.sun.slamd.message.Message
ASN1_TYPE_CLASS_TRANSFER_REQUEST, ASN1_TYPE_CLASS_TRANSFER_RESPONSE, ASN1_TYPE_CLIENT_HELLO, ASN1_TYPE_CLIENT_MANAGER_HELLO, ASN1_TYPE_HELLO_RESPONSE, ASN1_TYPE_JOB_COMPLETED, ASN1_TYPE_JOB_CONTROL_REQUEST, ASN1_TYPE_JOB_CONTROL_RESPONSE, ASN1_TYPE_JOB_REQUEST, ASN1_TYPE_JOB_RESPONSE, ASN1_TYPE_KEEPALIVE, ASN1_TYPE_REGISTER_STAT, ASN1_TYPE_REPORT_STAT, ASN1_TYPE_SERVER_HELLO, ASN1_TYPE_SERVER_SHUTDOWN, ASN1_TYPE_START_CLIENT_REQUEST, ASN1_TYPE_START_CLIENT_RESPONSE, ASN1_TYPE_STATUS_REQUEST, ASN1_TYPE_STATUS_RESPONSE, ASN1_TYPE_STOP_CLIENT_REQUEST, ASN1_TYPE_STOP_CLIENT_RESPONSE, messageID
 
Constructor Summary
JobCompletedMessage(int messageID, java.lang.String jobID, int jobState, java.util.Date actualStartTime, java.util.Date actualStopTime, int actualDuration, StatTracker[] statTrackers, java.lang.String[] logMessages)
          Creates a new job completed message with the provided information.
JobCompletedMessage(int messageID, java.lang.String jobID, int jobState, long actualStartTime, long actualStopTime, int actualDuration, StatTracker[] statTrackers, java.lang.String[] logMessages)
          Creates a new job completed message with the provided information.
 
Method Summary
static JobCompletedMessage decodeJobCompleted(int messageID, ASN1Element element)
          Decodes the provided ASN.1 element as a job completed message.
 ASN1Element encode()
          Encodes this message into an ASN.1 element.
 int getActualDuration()
          Retrieves the amount of time in seconds spent processing the job.
 java.util.Date getActualStartTime()
          Retrieves the time that the job actually started being processed.
 java.util.Date getActualStopTime()
          Retrieves the time that the job actually finished processing.
 java.lang.String getJobID()
          Retrieves the ID of the job being processed.
 int getJobState()
          Retrieves the state of the job being processed.
 java.lang.String[] getLogMessages()
          Retrieves the set of log messages associated with the job.
 StatTracker[] getStatTrackers()
          Retrieves the stat trackers associated with the job.
 java.lang.String toString()
          Retrieves a string representation of this message.
 
Methods inherited from class com.sun.slamd.message.Message
decode, getMessageID, getMessageType, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobCompletedMessage

public JobCompletedMessage(int messageID,
                           java.lang.String jobID,
                           int jobState,
                           java.util.Date actualStartTime,
                           java.util.Date actualStopTime,
                           int actualDuration,
                           StatTracker[] statTrackers,
                           java.lang.String[] logMessages)
Creates a new job completed message with the provided information.

Parameters:
messageID - The message ID for this message.
jobID - The ID of the job that has completed.
jobState - The state of the job when processing was complete.
actualStartTime - The time (as a Java Date) that the job actually started processing.
actualStopTime - The time (as a Java Date) that the job actually completed/was stopped.
actualDuration - The length of time in seconds that the job was being processed.
statTrackers - The set of stat trackers that were maintained for the job.
logMessages - The messages logged by the job.

JobCompletedMessage

public JobCompletedMessage(int messageID,
                           java.lang.String jobID,
                           int jobState,
                           long actualStartTime,
                           long actualStopTime,
                           int actualDuration,
                           StatTracker[] statTrackers,
                           java.lang.String[] logMessages)
Creates a new job completed message with the provided information.

Parameters:
messageID - The message ID for this message.
jobID - The ID of the job that has completed.
jobState - The state of the job when processing was complete.
actualStartTime - The time (in number of seconds since January 1, 1970) that the job actually started processing.
actualStopTime - The time (in number of seconds since January 1, 1970) that the job actually completed/was stopped.
actualDuration - The length of time in seconds that the job was being processed.
statTrackers - The set of stat trackers that were maintained for the job.
logMessages - The messages logged by the job.
Method Detail

getJobID

public java.lang.String getJobID()
Retrieves the ID of the job being processed.

Returns:
The ID of the job being processed.

getJobState

public int getJobState()
Retrieves the state of the job being processed.

Returns:
The state of the job being processed.

getActualStartTime

public java.util.Date getActualStartTime()
Retrieves the time that the job actually started being processed.

Returns:
The time that the job actually started being processed.

getActualStopTime

public java.util.Date getActualStopTime()
Retrieves the time that the job actually finished processing.

Returns:
The time that the job actually finished processing.

getActualDuration

public int getActualDuration()
Retrieves the amount of time in seconds spent processing the job.

Returns:
The amount of time in seconds spent processing the job.

getStatTrackers

public StatTracker[] getStatTrackers()
Retrieves the stat trackers associated with the job.

Returns:
The stat trackers associated with the job.

getLogMessages

public java.lang.String[] getLogMessages()
Retrieves the set of log messages associated with the job.

Returns:
The set of log messages associated with the job.

toString

public java.lang.String toString()
Retrieves a string representation of this message.

Overrides:
toString in class Message
Returns:
A string representation of this message.

decodeJobCompleted

public static JobCompletedMessage decodeJobCompleted(int messageID,
                                                     ASN1Element element)
                                              throws SLAMDException
Decodes the provided ASN.1 element as a job completed message.

Parameters:
messageID - The message ID to use for this message.
element - The ASN.1 element containing the JobCompleted sequence.
Returns:
The job completed message decoded from the ASN.1 element.
Throws:
SLAMDException - If the provided ASN.1 element cannot be decoded as a job completed message.

encode

public ASN1Element encode()
Encodes this message into an ASN.1 element. A job completed message has the following syntax:

JobCompleted ::= [APPLICATION 7] SEQUENCE { jobID OCTET STRING, jobState JobState, actualStartTime OCTET STRING, actualStopTime OCTET STRING, actualDuration INTEGER, statTrackers StatTrackers, logMessages LogMessages }

Specified by:
encode in class Message
Returns:
An ASN.1 encoded representation of this message.