org.jboss.portal.portlet.impl.state
Class StateConverterV0

java.lang.Object
  extended by org.jboss.portal.portlet.impl.state.StateConverterV0
All Implemented Interfaces:
StateConverter

public class StateConverterV0
extends java.lang.Object
implements StateConverter

An implementation that relies on the DataInputStream and DataOutputStream to marshall and unmarshall the producer state. The marshalled value starts with a magic value and a version id to ensure future backward compatibility.

It is an important matter because a migrated producer will probably have to take care of consumers that hold a previous version of the producer state.

Version:
$Revision: 1.1 $
Author:
Julien Viet

Constructor Summary
StateConverterV0()
           
 
Method Summary
 byte[] marshall(PortletState state)
          Marshall the producer state as a byte array.
 PortletState unmarshall(byte[] marshalledState)
          Unmarshall the producer state from a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateConverterV0

public StateConverterV0()
Method Detail

marshall

public byte[] marshall(PortletState state)
                throws StateConversionException
Description copied from interface: StateConverter
Marshall the producer state as a byte array.

Specified by:
marshall in interface StateConverter
Parameters:
state - the producer state
Returns:
the marshalled state
Throws:
StateConversionException - if marshalling cannot be performed

unmarshall

public PortletState unmarshall(byte[] marshalledState)
                        throws StateConversionException
Description copied from interface: StateConverter
Unmarshall the producer state from a byte array.

Specified by:
unmarshall in interface StateConverter
Parameters:
marshalledState - the marshalled state
Returns:
the producer state
Throws:
StateConversionException - if unmarshalling cannot be performed