com.sun.slamd.message
Class JobResponseMessage

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

public class JobResponseMessage
extends Message

This class defines a method that will be provided in response to a job request. It specifies whether the request was accepted and, if not, the reason that it was rejected.


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
JobResponseMessage(int messageID, java.lang.String jobID, int responseCode)
          Creates a new job response message with the specified response code.
JobResponseMessage(int messageID, java.lang.String jobID, int responseCode, java.lang.String responseMessage)
          Creates a new job response message with the specified response code and message.
 
Method Summary
static JobResponseMessage decodeJobResponse(int messageID, ASN1Element element)
          Decodes the provided ASN.1 element as a job response message.
 ASN1Element encode()
          Encodes this message into an ASN.1 element.
 java.lang.String getJobID()
          Retrieves the ID of the job for which the request was made.
 int getResponseCode()
          Retrieves the response code for the job request.
 java.lang.String getResponseMessage()
          Retrieves the message associated with this job response.
 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

JobResponseMessage

public JobResponseMessage(int messageID,
                          java.lang.String jobID,
                          int responseCode)
Creates a new job response message with the specified response code. There will not be any additional message included.

Parameters:
messageID - The message ID for this message.
jobID - The ID of the job for which the request was made.
responseCode - The response code that indicates whether the operation was successful and if not provides the reason that it failed.

JobResponseMessage

public JobResponseMessage(int messageID,
                          java.lang.String jobID,
                          int responseCode,
                          java.lang.String responseMessage)
Creates a new job response message with the specified response code and message.

Parameters:
messageID - The message ID for this message.
jobID - The ID of the job for which the request was made.
responseCode - The response code that indicates whether the operation was successful and if not provides the reason that it failed.
responseMessage - A text message providing additonal information about the status of the operation.
Method Detail

getJobID

public java.lang.String getJobID()
Retrieves the ID of the job for which the request was made.

Returns:
The ID of the job for which the request was made.

getResponseCode

public int getResponseCode()
Retrieves the response code for the job request.

Returns:
The response code for the job request.

getResponseMessage

public java.lang.String getResponseMessage()
Retrieves the message associated with this job response.

Returns:
The message associated with this job response.

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.

decodeJobResponse

public static JobResponseMessage decodeJobResponse(int messageID,
                                                   ASN1Element element)
                                            throws SLAMDException
Decodes the provided ASN.1 element as a job response message.

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

encode

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

JobResponse ::= [APPLICATION 4] SEQUENCE { jobID OCTET STRING, responseCode ResponseCode, responseMessage OCTET STRING }

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