Package org.gatein.pc.portlet.impl.state
Class StateConverterV0
- java.lang.Object
-
- org.gatein.pc.portlet.impl.state.StateConverterV0
-
- All Implemented Interfaces:
StateConverter
public class StateConverterV0 extends Object implements StateConverter
An implementation that relies on the
DataInputStreamandDataOutputStreamto 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
Constructors Constructor Description StateConverterV0()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S extends Serializable>
Smarshall(org.gatein.pc.api.PortletStateType<S> stateType, PortletState state)Marshall the producer state as a byte array.byte[]marshall(PortletState state)PortletStateunmarshall(byte[] marshalledState)<S extends Serializable>
PortletStateunmarshall(org.gatein.pc.api.PortletStateType<S> stateType, S marshalledState)Unmarshall the producer state from a byte array.
-
-
-
Method Detail
-
marshall
public <S extends Serializable> S marshall(org.gatein.pc.api.PortletStateType<S> stateType, PortletState state) throws StateConversionException, IllegalArgumentException
Description copied from interface:StateConverterMarshall the producer state as a byte array.- Specified by:
marshallin interfaceStateConverter- Parameters:
stateType- the state typestate- the producer state- Returns:
- the marshalled state
- Throws:
StateConversionException- if marshalling cannot be performedIllegalArgumentException- if the state is null
-
marshall
public byte[] marshall(PortletState state) throws StateConversionException
- Throws:
StateConversionException
-
unmarshall
public <S extends Serializable> PortletState unmarshall(org.gatein.pc.api.PortletStateType<S> stateType, S marshalledState) throws StateConversionException, IllegalArgumentException
Description copied from interface:StateConverterUnmarshall the producer state from a byte array.- Specified by:
unmarshallin interfaceStateConverter- Parameters:
stateType- the state typemarshalledState- the marshalled state- Returns:
- the producer state
- Throws:
StateConversionException- if unmarshalling cannot be performedIllegalArgumentException- if the argument is null
-
unmarshall
public PortletState unmarshall(byte[] marshalledState) throws StateConversionException
- Throws:
StateConversionException
-
-