org.objectweb.dream.message.codec
Class MessageCodecHelperCompositeMessageDataStreamImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.message.codec.AbstractDelegatingMessageCodecImpl
          extended by org.objectweb.dream.message.codec.MessageCodecHelperCompositeMessageDataStreamImpl
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, MessageCodec, BindingController, LifeCycleController

public class MessageCodecHelperCompositeMessageDataStreamImpl
extends AbstractDelegatingMessageCodecImpl
implements MessageCodec

Codec helper implementation for composite messages. It scans the message structure and recursively delegates to the client codec the encoding/decoding of the message's chunks. This codec implementation requires a DataInputas input and a DataOutputas output.


Field Summary
 
Fields inherited from class org.objectweb.dream.message.codec.AbstractDelegatingMessageCodecImpl
DELEATE_MESSAGE_CODEC_ITF_NAME, delegateMessageCodecItf, messageManagerItf
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.message.codec.MessageCodec
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
MessageCodecHelperCompositeMessageDataStreamImpl()
           
 
Method Summary
 Message decode(CodecInputOutput cio)
          De-serializes a message from the given stream.
protected  Message doDecode(DataInput input, CodecInputOutput cio)
          Decode recursively a message and its sub messages (if any).
protected  void doEncode(Message message, DataOutput output, CodecInputOutput cio)
          Encode recursively a message and its sub messages (if any).
 void encode(CodecInputOutput cio, Message message)
          Encodes the given message on the given stream.
 
Methods inherited from class org.objectweb.dream.message.codec.AbstractDelegatingMessageCodecImpl
bindFc, listFc
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageCodecHelperCompositeMessageDataStreamImpl

public MessageCodecHelperCompositeMessageDataStreamImpl()
Method Detail

encode

public void encode(CodecInputOutput cio,
                   Message message)
            throws IOException
Description copied from interface: MessageCodec
Encodes the given message on the given stream. This method is responsible to encode the given message and its sub messages recursively.

Specified by:
encode in interface MessageCodec
Parameters:
cio - contains the input on which the message is encoded.
message - a message to serialize.
Throws:
IOException - if an error occurs during the serialization.
See Also:
MessageCodec.encode(CodecInputOutput, Message)

decode

public Message decode(CodecInputOutput cio)
               throws IOException
Description copied from interface: MessageCodec
De-serializes a message from the given stream. This method is responsible to decode the given message and its sub messages recursively.

Specified by:
decode in interface MessageCodec
Parameters:
cio - contains the output on which the message is decoded.
Returns:
a message
Throws:
IOException - if an error occurs during the de-serialization.
See Also:
MessageCodec.decode(CodecInputOutput)

doDecode

protected Message doDecode(DataInput input,
                           CodecInputOutput cio)
                    throws IOException
Decode recursively a message and its sub messages (if any). It delegates to the client message codec to decode a single message.

Throws:
IOException

doEncode

protected void doEncode(Message message,
                        DataOutput output,
                        CodecInputOutput cio)
                 throws IOException
Encode recursively a message and its sub messages (if any). It delegates to the client message codec to encode a single message.

Throws:
IOException


Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.