context.arch.comm.language
Class ParserObject

java.lang.Object
  |
  +--context.arch.comm.language.ParserObject

public class ParserObject
extends java.lang.Object

This class handles the encoding and decoding for the BaseObject class.


Field Summary
static java.lang.String AELFRED_XML_DECODER
          The AELFRED SAX XML decoder class is "context.arch.comm.language.SAX_XMLDecoder".
static java.lang.String DEFAULT_DECODER
          The default decoder class to use is "context.arch.comm.language.SAX_XMLDecoder".
static java.lang.String DEFAULT_ENCODER
          The default encoder class to use is "context.arch.comm.language.XMLEncoder".
static java.lang.String XML_ENCODER
          The XML encoder class is "context.arch.comm.language.XMLEncoder".
 
Constructor Summary
ParserObject()
          Basic constructor for ParserObject using the default encoder and decoder
ParserObject(java.lang.String encoderClass)
          Constructor for ParserObject using the given encoder and default decoder
ParserObject(java.lang.String encoderClass, java.lang.String decoderClass)
          Constructor for ParserObject using the given encoder and decoder class.
 
Method Summary
 DataObject decodeData(java.io.Reader message)
          This method tries to create a DecoderInterface object and decode the given message in the Reader.
 DataObject decodeData(java.lang.String className, java.io.Reader message)
          This method tries to create a DecoderInterface object using the given class name and decode the given message in the Reader.
 java.lang.String encodeData(DataObject message)
          This method tries to create a EncoderInterface object and encode the given message in the DataObject.
 java.lang.String encodeData(java.lang.String className, DataObject message)
          This method tries to create a EncoderInterface object using the given class and encode the given message in the DataObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DECODER

public static final java.lang.String DEFAULT_DECODER
The default decoder class to use is "context.arch.comm.language.SAX_XMLDecoder".

AELFRED_XML_DECODER

public static final java.lang.String AELFRED_XML_DECODER
The AELFRED SAX XML decoder class is "context.arch.comm.language.SAX_XMLDecoder".

DEFAULT_ENCODER

public static final java.lang.String DEFAULT_ENCODER
The default encoder class to use is "context.arch.comm.language.XMLEncoder".

XML_ENCODER

public static final java.lang.String XML_ENCODER
The XML encoder class is "context.arch.comm.language.XMLEncoder".
Constructor Detail

ParserObject

public ParserObject()
Basic constructor for ParserObject using the default encoder and decoder
See Also:
DEFAULT_ENCODER, DEFAULT_DECODER

ParserObject

public ParserObject(java.lang.String encoderClass)
Constructor for ParserObject using the given encoder and default decoder
Parameters:
encoderClass - class to use for encoding
See Also:
DEFAULT_DECODER

ParserObject

public ParserObject(java.lang.String encoderClass,
                    java.lang.String decoderClass)
Constructor for ParserObject using the given encoder and decoder class. If either parameter is null, the DEFAULT_ENCODER or DEFAULT_DECODER is used.
Parameters:
encoderClass - Encoder class to use for encoding
encoderClass - Decoder class to use for decoding
See Also:
DEFAULT_ENCODER, DEFAULT_DECODER
Method Detail

decodeData

public DataObject decodeData(java.io.Reader message)
                      throws DecodeException,
                             InvalidDecoderException
This method tries to create a DecoderInterface object and decode the given message in the Reader.
Parameters:
message - Reader containing a message to be decoded
Returns:
decoded message in a DataObject
Throws:
DecodeException - if the message can't be decoded
InvalidDecoderException - if the decoder can't be created
See Also:
DecoderInterface.decodeData(Reader)

decodeData

public DataObject decodeData(java.lang.String className,
                             java.io.Reader message)
                      throws DecodeException,
                             InvalidDecoderException
This method tries to create a DecoderInterface object using the given class name and decode the given message in the Reader.
Parameters:
className - Class to use to instantiate a decoder
message - Reader containing a message to be decoded
Returns:
decoded message in a DataObject
Throws:
DecodeException - if the message can't be decoded
InvalidDecoderException - if the decoder can't be created
See Also:
DecoderInterface.decodeData(Reader)

encodeData

public java.lang.String encodeData(DataObject message)
                            throws EncodeException,
                                   InvalidEncoderException
This method tries to create a EncoderInterface object and encode the given message in the DataObject.
Parameters:
message - DataObject containing a message to be encoded
Returns:
encoded message as a String
Throws:
EncodeException - if the message can't be encoded
InvalidEncoderException - if the encoder can't be created
See Also:
EncoderInterface.encodeData(DataObject)

encodeData

public java.lang.String encodeData(java.lang.String className,
                                   DataObject message)
                            throws EncodeException,
                                   InvalidEncoderException
This method tries to create a EncoderInterface object using the given class and encode the given message in the DataObject.
Parameters:
className - Class to use to instantiate a encoder
message - DataObject containing a message to be encoded
Returns:
encoded message as a String
Throws:
EncodeException - if the message can't be encoded
InvalidEncoderException - if the encoder can't be created
See Also:
EncoderInterface.encodeData(DataObject)