com.sun.slamd.message
Class Message

java.lang.Object
  extended bycom.sun.slamd.message.Message
Direct Known Subclasses:
ClassTransferRequestMessage, ClassTransferResponseMessage, ClientHelloMessage, ClientManagerHelloMessage, HelloResponseMessage, JobCompletedMessage, JobControlRequestMessage, JobControlResponseMessage, JobRequestMessage, JobResponseMessage, KeepAliveMessage, RegisterStatisticMessage, ReportStatisticMessage, ServerHelloMessage, ServerShutdownMessage, StartClientRequestMessage, StartClientResponseMessage, StatusRequestMessage, StatusResponseMessage, StopClientRequestMessage, StopClientResponseMessage

public abstract class Message
extends java.lang.Object

This class defines a generic message that can be sent between the client and the server to request some operation or provide information. Subclasses will define the actual messages that may be sent.


Field Summary
static byte ASN1_TYPE_CLASS_TRANSFER_REQUEST
          The ASN.1 type for a file transfer request message.
static byte ASN1_TYPE_CLASS_TRANSFER_RESPONSE
          The ASN.1 type for a file transfer response message.
static byte ASN1_TYPE_CLIENT_HELLO
          The ASN.1 type for a client hello message.
static byte ASN1_TYPE_CLIENT_MANAGER_HELLO
          The ASN.1 type for a client manager hello message.
static byte ASN1_TYPE_HELLO_RESPONSE
          The ASN.1 type for a hello response message.
static byte ASN1_TYPE_JOB_COMPLETED
          The ASN.1 type for a job completed message.
static byte ASN1_TYPE_JOB_CONTROL_REQUEST
          The ASN.1 type for a job control request message.
static byte ASN1_TYPE_JOB_CONTROL_RESPONSE
          The ASN.1 type for a job control response message.
static byte ASN1_TYPE_JOB_REQUEST
          The ASN.1 type for a job request messages.
static byte ASN1_TYPE_JOB_RESPONSE
          The ASN.1 type for a job response message.
static byte ASN1_TYPE_KEEPALIVE
          The ASN.1 type for a keepalive message.
static byte ASN1_TYPE_REGISTER_STAT
          The ASN.1 type for a register stat message.
static byte ASN1_TYPE_REPORT_STAT
          The ASN.1 type for a report stat message.
static byte ASN1_TYPE_SERVER_HELLO
          The ASN.1 type for a server hello message.
static byte ASN1_TYPE_SERVER_SHUTDOWN
          The ASN.1 type for a server shutdown message.
static byte ASN1_TYPE_START_CLIENT_REQUEST
          The ASN.1 type for a start client request.
static byte ASN1_TYPE_START_CLIENT_RESPONSE
          The ASN.1 type for a start client response.
static byte ASN1_TYPE_STATUS_REQUEST
          The ASN.1 type for a status request message.
static byte ASN1_TYPE_STATUS_RESPONSE
          The ASN.1 type for a status response message.
static byte ASN1_TYPE_STOP_CLIENT_REQUEST
          The ASN.1 type for a stop client request.
static byte ASN1_TYPE_STOP_CLIENT_RESPONSE
          The ASN.1 type for a stop client response.
protected  int messageID
           
 
Constructor Summary
protected Message(int messageID, int messageType)
          Creates a new generic message of the specified type.
 
Method Summary
static Message decode(ASN1Element element)
          Decodes the provided ASN.1 element as a message.
abstract  ASN1Element encode()
          Encodes this message into an ASN.1 element.
 int getMessageID()
          Retrieves the message ID for this message.
 int getMessageType()
          Retrieves the message type for this message.
 void send(java.io.ObjectOutputStream objectOutputStream)
          Sends this message over the provided output stream.
 java.lang.String toString()
          Retrieves a string representation of this message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ASN1_TYPE_CLIENT_HELLO

public static final byte ASN1_TYPE_CLIENT_HELLO
The ASN.1 type for a client hello message.

See Also:
Constant Field Values

ASN1_TYPE_SERVER_HELLO

public static final byte ASN1_TYPE_SERVER_HELLO
The ASN.1 type for a server hello message.

See Also:
Constant Field Values

ASN1_TYPE_HELLO_RESPONSE

public static final byte ASN1_TYPE_HELLO_RESPONSE
The ASN.1 type for a hello response message.

See Also:
Constant Field Values

ASN1_TYPE_JOB_REQUEST

public static final byte ASN1_TYPE_JOB_REQUEST
The ASN.1 type for a job request messages.

See Also:
Constant Field Values

ASN1_TYPE_JOB_RESPONSE

public static final byte ASN1_TYPE_JOB_RESPONSE
The ASN.1 type for a job response message.

See Also:
Constant Field Values

ASN1_TYPE_JOB_CONTROL_REQUEST

public static final byte ASN1_TYPE_JOB_CONTROL_REQUEST
The ASN.1 type for a job control request message.

See Also:
Constant Field Values

ASN1_TYPE_JOB_CONTROL_RESPONSE

public static final byte ASN1_TYPE_JOB_CONTROL_RESPONSE
The ASN.1 type for a job control response message.

See Also:
Constant Field Values

ASN1_TYPE_JOB_COMPLETED

public static final byte ASN1_TYPE_JOB_COMPLETED
The ASN.1 type for a job completed message.

See Also:
Constant Field Values

ASN1_TYPE_STATUS_REQUEST

public static final byte ASN1_TYPE_STATUS_REQUEST
The ASN.1 type for a status request message.

See Also:
Constant Field Values

ASN1_TYPE_STATUS_RESPONSE

public static final byte ASN1_TYPE_STATUS_RESPONSE
The ASN.1 type for a status response message.

See Also:
Constant Field Values

ASN1_TYPE_SERVER_SHUTDOWN

public static final byte ASN1_TYPE_SERVER_SHUTDOWN
The ASN.1 type for a server shutdown message.

See Also:
Constant Field Values

ASN1_TYPE_KEEPALIVE

public static final byte ASN1_TYPE_KEEPALIVE
The ASN.1 type for a keepalive message.

See Also:
Constant Field Values

ASN1_TYPE_CLASS_TRANSFER_REQUEST

public static final byte ASN1_TYPE_CLASS_TRANSFER_REQUEST
The ASN.1 type for a file transfer request message.

See Also:
Constant Field Values

ASN1_TYPE_CLASS_TRANSFER_RESPONSE

public static final byte ASN1_TYPE_CLASS_TRANSFER_RESPONSE
The ASN.1 type for a file transfer response message.

See Also:
Constant Field Values

ASN1_TYPE_CLIENT_MANAGER_HELLO

public static final byte ASN1_TYPE_CLIENT_MANAGER_HELLO
The ASN.1 type for a client manager hello message.

See Also:
Constant Field Values

ASN1_TYPE_START_CLIENT_REQUEST

public static final byte ASN1_TYPE_START_CLIENT_REQUEST
The ASN.1 type for a start client request.

See Also:
Constant Field Values

ASN1_TYPE_START_CLIENT_RESPONSE

public static final byte ASN1_TYPE_START_CLIENT_RESPONSE
The ASN.1 type for a start client response.

See Also:
Constant Field Values

ASN1_TYPE_STOP_CLIENT_REQUEST

public static final byte ASN1_TYPE_STOP_CLIENT_REQUEST
The ASN.1 type for a stop client request.

See Also:
Constant Field Values

ASN1_TYPE_STOP_CLIENT_RESPONSE

public static final byte ASN1_TYPE_STOP_CLIENT_RESPONSE
The ASN.1 type for a stop client response.

See Also:
Constant Field Values

ASN1_TYPE_REGISTER_STAT

public static final byte ASN1_TYPE_REGISTER_STAT
The ASN.1 type for a register stat message.

See Also:
Constant Field Values

ASN1_TYPE_REPORT_STAT

public static final byte ASN1_TYPE_REPORT_STAT
The ASN.1 type for a report stat message.

See Also:
Constant Field Values

messageID

protected int messageID
Constructor Detail

Message

protected Message(int messageID,
                  int messageType)
Creates a new generic message of the specified type.

Parameters:
messageID - The message ID for this message.
messageType - The message type.
Method Detail

getMessageID

public int getMessageID()
Retrieves the message ID for this message.

Returns:
The message ID for this message.

getMessageType

public int getMessageType()
Retrieves the message type for this message.

Returns:
The message type for this message.

send

public void send(java.io.ObjectOutputStream objectOutputStream)
          throws java.io.IOException
Sends this message over the provided output stream. This can be used by either the client or the server to send the message to the other side.

Parameters:
objectOutputStream - The output stream over which to send the message.
Throws:
java.io.IOException - If there is a problem sending the message over the output stream.

toString

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

Returns:
A string representation of this message.

encode

public abstract ASN1Element encode()
Encodes this message into an ASN.1 element.

Returns:
An ASN.1 encoded representation of this message.

decode

public static Message decode(ASN1Element element)
                      throws SLAMDException
Decodes the provided ASN.1 element as a message.

Parameters:
element - The ASN.1 element to be decoded.
Returns:
The decoded version of the ASN.1 element.
Throws:
SLAMDException - If the provided element cannot be decoded to a valid message.