org.springframework.webflow.execution.repository.continuation
Class SerializedFlowExecutionContinuation

java.lang.Object
  extended by org.springframework.webflow.execution.repository.continuation.FlowExecutionContinuation
      extended by org.springframework.webflow.execution.repository.continuation.SerializedFlowExecutionContinuation
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class SerializedFlowExecutionContinuation
extends FlowExecutionContinuation
implements java.io.Externalizable

A continuation implementation that is based on standard Java serialization, created by a SerializedFlowExecutionContinuationFactory.

Author:
Keith Donald, Erwin Vervaet
See Also:
SerializedFlowExecutionContinuationFactory, Serialized Form

Constructor Summary
SerializedFlowExecutionContinuation()
          Default constructor necessary for Externalizable custom serialization semantics.
SerializedFlowExecutionContinuation(FlowExecution flowExecution, boolean compress)
          Creates a new serialized flow execution continuation.
 
Method Summary
protected  byte[] compress(byte[] dataToCompress)
          Internal helper method to compress given flow execution data using GZIP compression.
protected  byte[] decompress(byte[] dataToDecompress)
          Internal helper method to decompress given flow execution data using GZIP decompression.
protected  FlowExecution deserialize(byte[] data)
          Internal helper method to deserialize given flow execution data.
protected  byte[] getFlowExecutionData()
          Return the flow execution data in its raw byte[] form.
 boolean isCompressed()
          Returns whether or not the flow execution data in this continuation is compressed.
 void readExternal(java.io.ObjectInput in)
           
protected  byte[] serialize(FlowExecution flowExecution)
          Internal helper method to serialize given flow execution.
 byte[] toByteArray()
          Converts this continuation to a byte array for convenient serialization.
 FlowExecution unmarshal()
          Restores the flow execution wrapped in this continuation.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializedFlowExecutionContinuation

public SerializedFlowExecutionContinuation()
Default constructor necessary for Externalizable custom serialization semantics. Should not be called by application code.


SerializedFlowExecutionContinuation

public SerializedFlowExecutionContinuation(FlowExecution flowExecution,
                                           boolean compress)
                                    throws ContinuationCreationException
Creates a new serialized flow execution continuation. This will marshall given flow execution into a serialized continuation form.

Parameters:
flowExecution - the flow execution
compress - whether or not the flow execution should be compressed
Throws:
ContinuationCreationException
Method Detail

isCompressed

public boolean isCompressed()
Returns whether or not the flow execution data in this continuation is compressed.


unmarshal

public FlowExecution unmarshal()
                        throws ContinuationUnmarshalException
Description copied from class: FlowExecutionContinuation
Restores the flow execution wrapped in this continuation.

Specified by:
unmarshal in class FlowExecutionContinuation
Returns:
the unmarshalled flow execution
Throws:
ContinuationUnmarshalException - when there is a problem unmarshalling this continuation

toByteArray

public byte[] toByteArray()
Description copied from class: FlowExecutionContinuation
Converts this continuation to a byte array for convenient serialization.

Specified by:
toByteArray in class FlowExecutionContinuation
Returns:
this as a byte array

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getFlowExecutionData

protected byte[] getFlowExecutionData()
                               throws java.io.IOException
Return the flow execution data in its raw byte[] form. Will decompress if necessary.

Returns:
the byte array
Throws:
java.io.IOException - a problem occured with decompression

serialize

protected byte[] serialize(FlowExecution flowExecution)
                    throws java.io.IOException
Internal helper method to serialize given flow execution. Override if a custom serialization method is used.

Parameters:
flowExecution - flow execution to serialize
Returns:
serialized flow flow execution data
Throws:
java.io.IOException - when something goes wrong during during serialization

deserialize

protected FlowExecution deserialize(byte[] data)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException
Internal helper method to deserialize given flow execution data. Override if a custom serialization method is used.

Parameters:
data - serialized flow flow execution data
Returns:
deserialized flow execution
Throws:
java.io.IOException - when something goes wrong during deserialization
java.lang.ClassNotFoundException - when required classes cannot be loaded

compress

protected byte[] compress(byte[] dataToCompress)
                   throws java.io.IOException
Internal helper method to compress given flow execution data using GZIP compression. Override if custom compression is desired.

Throws:
java.io.IOException

decompress

protected byte[] decompress(byte[] dataToDecompress)
                     throws java.io.IOException
Internal helper method to decompress given flow execution data using GZIP decompression. Override if custom decompression is desired.

Throws:
java.io.IOException


Copyright © 2004-2007. All Rights Reserved.