Spring Web Flow

org.springframework.webflow.execution.repository.snapshot
Class SerializedFlowExecutionSnapshot

java.lang.Object
  extended by org.springframework.webflow.execution.repository.snapshot.FlowExecutionSnapshot
      extended by org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class SerializedFlowExecutionSnapshot
extends FlowExecutionSnapshot
implements java.io.Externalizable

A snapshot implementation that is based on standard Java serialization, created by a SerializedFlowExecutionSnapshotFactory.

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

Constructor Summary
SerializedFlowExecutionSnapshot()
          Default constructor necessary for Externalizable custom serialization semantics.
SerializedFlowExecutionSnapshot(FlowExecution flowExecution, boolean compress)
          Creates a new serialized flow execution snapshot.
 
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, java.lang.ClassLoader classLoader)
          Internal helper method to deserialize given flow execution data.
 boolean equals(java.lang.Object o)
           
protected  byte[] getFlowExecutionData()
          Return the flow execution data in its raw byte[] form.
 int hashCode()
           
 boolean isCompressed()
          Returns whether or not the flow execution data in this snapshot is compressed.
 void readExternal(java.io.ObjectInput in)
           
protected  byte[] serialize(FlowExecution flowExecution)
          Internal helper method to serialize given flow execution.
 FlowExecution unmarshal(java.lang.ClassLoader classLoader)
          Unmarshal the flow execution from this snapshot's data.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializedFlowExecutionSnapshot

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


SerializedFlowExecutionSnapshot

public SerializedFlowExecutionSnapshot(FlowExecution flowExecution,
                                       boolean compress)
                                throws SnapshotCreationException
Creates a new serialized flow execution snapshot.

Parameters:
flowExecution - the flow execution
compress - whether or not to apply compression during snapshotting
Throws:
SnapshotCreationException
Method Detail

isCompressed

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


unmarshal

public FlowExecution unmarshal(java.lang.ClassLoader classLoader)
                        throws SnapshotUnmarshalException
Unmarshal the flow execution from this snapshot's data.

Parameters:
classLoader - the classloader to use to resolve types during execution deserialization
Returns:
the unmarashalled flow execution
Throws:
SnapshotUnmarshalException

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

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,
                                    java.lang.ClassLoader classLoader)
                             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
classLoader - the class loader to use to resolve classes during deserialization
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

Spring Web Flow