com.sun.slamd.protocol
Class ClassTransferResponse

java.lang.Object
  extended by com.sun.slamd.protocol.SLAMDMessage
      extended by com.sun.slamd.protocol.ClassTransferResponse

public class ClassTransferResponse
extends SLAMDMessage

This class defines a SLAMD message that will be sent from the server to the client whenver a client requests one or more classes. It will include a result code, and either the requested class(es) or an error message.

Author:
Neil A. Wilson

Constructor Summary
ClassTransferResponse()
          Creates a new instance of this class transfer response message which is intended for use in decoding a message transmitted between the server and the client.
ClassTransferResponse(int messageID, java.util.HashMap extraProperties, int resultCode, java.lang.String errorMessage, ClassData[] classData)
          Creates a new instance of this class transfer response message with the provided information.
 
Method Summary
 void decodeMessagePayload(ASN1Element payloadElement)
          Decodes the provided ASN.1 element and uses it as the payload for this SLAMD message.
 ASN1Element encodeMessagePayload()
          Encodes the payload component of this SLAMD message to an ASN.1 element for inclusion in the message envelope.
 ClassData[] getClassData()
          Retrieves the class data structures for the requested classes.
 java.lang.String getErrorMessage()
          Retrieves the error message for the class transfer operation.
 int getResultCode()
          Retrieves the result code for the class transfer operation.
 void payloadToString(java.lang.StringBuffer buffer, int indent)
          Appends a string representation of the payload for this SLAMD message to the provided buffer.
 void setClassData(ClassData[] classData)
          Specifies the class data structures for the requested classes.
 void setErrorMessage(java.lang.String errorMessage)
          Specifies the error message for the class transfer operation.
 void setResultCode(int resultCode)
          Specifies the result code for the class transfer operation.
 
Methods inherited from class com.sun.slamd.protocol.SLAMDMessage
decode, decodeNameValuePair, decodeNameValuePairSequence, encode, encodeNameValuePair, getExtraProperties, getExtraProperty, getMessageID, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassTransferResponse

public ClassTransferResponse()
Creates a new instance of this class transfer response message which is intended for use in decoding a message transmitted between the server and the client. It is not intended for general use.


ClassTransferResponse

public ClassTransferResponse(int messageID,
                             java.util.HashMap extraProperties,
                             int resultCode,
                             java.lang.String errorMessage,
                             ClassData[] classData)
Creates a new instance of this class transfer response message with the provided information.

Parameters:
messageID - The message ID for this SLAMD message.
extraProperties - The "extra" properties for this SLAMD message. Both the names and values for the properties must be strings.
resultCode - The result code for the class transfer operation.
errorMessage - The error message for the class transfer operation.
classData - The class data structures for the requested classes.
Method Detail

getResultCode

public int getResultCode()
Retrieves the result code for the class transfer operation.

Returns:
The result code for the class transfer operation.

setResultCode

public void setResultCode(int resultCode)
Specifies the result code for the class transfer operation.

Parameters:
resultCode - The result code for the class transfer operation.

getErrorMessage

public java.lang.String getErrorMessage()
Retrieves the error message for the class transfer operation.

Returns:
The error message for the class transfer operation, or null if none was provided.

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)
Specifies the error message for the class transfer operation.

Parameters:
errorMessage - The error message for the class transfer operation.

getClassData

public ClassData[] getClassData()
Retrieves the class data structures for the requested classes.

Returns:
The class data structures for the requested classes, or null if no class data is available.

setClassData

public void setClassData(ClassData[] classData)
Specifies the class data structures for the requested classes.

Parameters:
classData - The class data structures for the requested classes.

encodeMessagePayload

public ASN1Element encodeMessagePayload()
Encodes the payload component of this SLAMD message to an ASN.1 element for inclusion in the message envelope.

Specified by:
encodeMessagePayload in class SLAMDMessage
Returns:
The ASN.1 element containing the encoded message payload.

decodeMessagePayload

public void decodeMessagePayload(ASN1Element payloadElement)
                          throws SLAMDException
Decodes the provided ASN.1 element and uses it as the payload for this SLAMD message.

Specified by:
decodeMessagePayload in class SLAMDMessage
Parameters:
payloadElement - The ASN.1 element to decode as the payload for this SLAMD message.
Throws:
SLAMDException - If a problem occurs while attempting to decode the provided ASN.1 element as the payload for this SLAMD message.

payloadToString

public void payloadToString(java.lang.StringBuffer buffer,
                            int indent)
Appends a string representation of the payload for this SLAMD message to the provided buffer. The string representation may contain multiple lines, but the last line should not end with an end-of-line marker.

Specified by:
payloadToString in class SLAMDMessage
Parameters:
buffer - The buffer to which the string representation is to be appended.
indent - The number of spaces to indent the payload content.