Java Fabric API: Serialization
Posted: Thu, 10/09/2008 - 11:41
Java Fabric API: Serialization
How does serialization work in Fabric API calls.
If I set put an Object (for example an instance of FooBar ) into the FabricRequest object how will the fabric handle this? If FooBar is defined in both locations? If FooBar is not defined in the destination?
Is there a way to plugin a custom serialization technique?
Thank you,
-Vito








Serialization is performed using java.io.ObjectOutputStream and java.io.ObjectInputStream. You should be able to customize the serialization for "interesting" classes by implementing:
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException; private void writeObject(java.io.ObjectOutputStream stream) throws IOExceptionThe class must be available on the ClassPath both on the client and any fabric-side Java that attempts to deserialize class "FooBar". If not, ClassNotFoundException is thrown, which can be catch in your fabric-side task code if you were accessing the FabricRequest. If, however, the fabric attempts to deserialize the object on your code's behalf (e.g., if you are using components or annotations to describe your fabric-side code), it will store the exception in the request, consider the current step in the process flow failed, and branch the flow. The exception will be available in the request for the next step in the flow and/or to the client.