org.apache.axis2.context
Interface SelfManagedDataManager


public interface SelfManagedDataManager

An interface for use by a message handler to allow it to save and restore any message-specific data.

A handler can have message-specific data that needs to be associated the message being processed. The handler can keep this message-specific data in the Messagecontext object by adding the data to the user data table via the MessageContext method. When the MessageContext object is saved (for example, to persistent storage), and restored, this interface SelfManagedDataManager provides a way for the handler to save and restore the handler's message-specific data.

See Also:
MessageContext

Method Summary
 void deserializeSelfManagedData(java.io.ByteArrayInputStream data, MessageContext mc)
          This method is invoked when the MessageContext object is being restored.
 void restoreTransientData(MessageContext mc)
          This method is invoked when the MessageContext object is being restored and after the deserializeSelfManagedData() method.
 java.io.ByteArrayOutputStream serializeSelfManagedData(MessageContext mc)
          This method is invoked when the MessageContext object is being saved.
 

Method Detail

serializeSelfManagedData

java.io.ByteArrayOutputStream serializeSelfManagedData(MessageContext mc)
                                                       throws java.io.IOException
This method is invoked when the MessageContext object is being saved.

Implementors are expected to iterate through the data objects they wish to save and return it in a ByteArrayOutputStream. This data will later be passed to the implementor's deserializeSelfManagedData method when the data object is to be restored.

The data being saved may be the data stored by the implementor in the MessageContext object's SelfManagedData list and may include additional information such as the implementor's fields. Note that data stored by the implementor in the MessageContext object's SelfManagedData list is retrievable by calling the MessageContext.getSelfManagedData() method for EACH key/value pair.

Parameters:
mc - the MessageContext that is being saved
Returns:
The saved data in the output stream. Note that the format of the data in the output stream is defined by the implementor.
Throws:
java.io.IOException

deserializeSelfManagedData

void deserializeSelfManagedData(java.io.ByteArrayInputStream data,
                                MessageContext mc)
                                throws java.io.IOException
This method is invoked when the MessageContext object is being restored.

Implementors will receive the data they had previously saved in the serializeSelfManagedData() method. Implementors are responsible for reconstituting their message-specific data.

Parameters:
data - ByteArrayInputStream consisting of the data that this handler had previously saved
mc - the MessageContext object being restored
Throws:
java.io.IOException

restoreTransientData

void restoreTransientData(MessageContext mc)
This method is invoked when the MessageContext object is being restored and after the deserializeSelfManagedData() method.

Implementors use this method to re-establish transient message-specific data, particularly if the implementor did not save any user data in the serializeSelfManagedData() method.

Parameters:
mc - the MessageContext object being restored


Copyright © 2007 Apache Web Services Project. All Rights Reserved.