com.ibm.portal.app.component
Interface Serializable


public interface Serializable

Serializable is one of the Application Component Interfaces, implemented by a composite application component. It is used to save the state of your component into an application XML.

Note: The component instance identifier input parameter used in the #serializeInstance(String, Map) method is the identifer returned by the Templateable#createFromTemplate(Reader, ListModel) method if it was created from a template, otherwise it is the id from the Lifecycle.createInstance(ListModel) method.

Since:
6.0.1

Field Summary
static java.lang.String NAMESPACE_60
           
static java.lang.String NAMESPACE_601
           
static java.lang.String NAMESPACE_61
           
 
Method Summary
 void cancelDeserializeInstance(javax.xml.transform.Result result)
          Called if an exception occured during the processing of the data for this component.
 void finishDeserializeInstance(javax.xml.transform.Result result)
          Called after all data was send to the Result object returned from initDeserializeInstance(String, Map).
 javax.xml.transform.Result initDeserializeInstance(java.lang.String id, java.util.Map parameters)
          This method is called to deserialize the business component instance.
 javax.xml.transform.Source serializeInstance(java.lang.String id, java.lang.String targetAction, java.lang.String targetNamespace, java.util.Map parameter)
          This method is called to serialize the business component instance.
 boolean supportsSerialization(java.lang.String targetAction, java.lang.String targetNamespace, java.util.Map parameters)
          This method is used to ask the component if it support the specified type of serialization.
 void undoDeserializeInstance(javax.xml.transform.Result result)
          Called if deserialization fails after this component was deserialized.
 

Field Detail

NAMESPACE_60

static final java.lang.String NAMESPACE_60
See Also:
Constant Field Values

NAMESPACE_601

static final java.lang.String NAMESPACE_601
See Also:
Constant Field Values

NAMESPACE_61

static final java.lang.String NAMESPACE_61
See Also:
Constant Field Values
Method Detail

supportsSerialization

boolean supportsSerialization(java.lang.String targetAction,
                              java.lang.String targetNamespace,
                              java.util.Map parameters)
                              throws TemporaryNotSupportedException
This method is used to ask the component if it support the specified type of serialization.

Parameters:
targetAction - identical to #serializeInstance(String, String, Stirng, Map)
targetNamespace - identical to #serializeInstance(String, String, Stirng, Map)
parameters - the map is identical to #serializeInstance(String, String, Stirng, Map)
Returns:
true if this type of serialization is supported
Throws:
TemporaryNotSupportedException - If the component is currently not able to support serialization. For example if the backend system is not available.

serializeInstance

javax.xml.transform.Source serializeInstance(java.lang.String id,
                                             java.lang.String targetAction,
                                             java.lang.String targetNamespace,
                                             java.util.Map parameter)
                                             throws ComponentException
This method is called to serialize the business component instance. That is marshaling all information needed to recreate the same instance back again. The data written does usually not contain the business data itself as this might be a complete business system. For best performance a SAXSource object should be returned. This allows for streaming the business component data into the aggregated XML document. It is however also valid to return any other Source object as long as it results in a well-formed XML document. If your component can only generate the content as a String or DOM the following can be used:
 java.io.Reader reader = new StringReader("<data>my data</data>"); 
 javax.xml.transform.Source source = new javax.xml.transform.stream.StreamSource(reader);
 
 javax.xml.transform.Source source = new javax.xml.transform.dom.DOMSource(document);
 
The parametres argument contains a set of additional key/value-pairs. Currently the following pairs are defined:
key value description
backupContext a java.lang.Object This value needs to be passed back to a backup service if one is used.

Parameters:
id - component instance identifier, must not be null.
id - targetAction component serialization can be invoked for different use cases. currently those are:
name description
backupInstance the full instance data needs to be stored for a later restore
serializeInstanceToClient The instance is going to be send to the client. Backend data should not be send over here as backend data could possible be huge. Such data should be send over using synchronization. Any information the component might need on the client to access the server instance could be transfered using the Serialization framework.
id - targetNamespace This is the namespace used by the aggregated document, which contains the components data. It can be used by the component to ensure the target can understand the format send. For example a client might connect to a later server version but would require to get the same format an older release sent. Currently supported values are:
  • http://www.ibm.com/xmlns/prod/websphere/portal/v6.0/ibm-portal-composite
  • http://www.ibm.com/xmlns/prod/websphere/portal/v6.0.1/ibm-portal-composite/application-instance
This is not the namespace the component has to use for its data! The component can use its own namespace.
parameter - a set of extra parameters, see above
Returns:
The Source object delivering the XML document for this business component instance or null if the business component does not support this type of serialization.
Throws:
ComponentException - if you throw this exception the serialization process of the application instance will fail

initDeserializeInstance

javax.xml.transform.Result initDeserializeInstance(java.lang.String id,
                                                   java.util.Map parameters)
                                                   throws ComponentException
This method is called to deserialize the business component instance. That is unmarshaling recreateing the same instance back from an earlier serialization. The data delivered is the same that was send out during serialization and usually does not contain the business data itself as this might be a complete business system. For best performance a SAXResult object should be returned. This allows for streaming the business component data into the component from the aggregated XML document. It is however also valid to return any other Result. The parametres argument contains a set of additional key/value-pairs. Currently the following pairs are defined:
key value description
backupServiceHandle a java.lang.Object This value needs to be passed back to a backup service if one is used.
application.id a java.lang.String ID of the composite application.

Parameters:
id - component instance identifier, must not be null.
parameters - a set of extra parameters, see above
Returns:
The Result object is the target the deserialization framework will use to send the component's data to. This is the data the component stored during serialization.
Throws:
ComponentException - if you throw this exception the serialization process of the application instance will fail

finishDeserializeInstance

void finishDeserializeInstance(javax.xml.transform.Result result)
                               throws ComponentException
Called after all data was send to the Result object returned from initDeserializeInstance(String, Map).

Parameters:
result - the same object that was returned in initDeserializeInstance(String, Map)
Throws:
ComponentException

cancelDeserializeInstance

void cancelDeserializeInstance(javax.xml.transform.Result result)
                               throws ComponentException
Called if an exception occured during the processing of the data for this component. If this method is called finishDeserializeInstance(Result) will not be called.

Parameters:
result - the same object that was returned in initDeserializeInstance(String, Map)
Throws:
ComponentException

undoDeserializeInstance

void undoDeserializeInstance(javax.xml.transform.Result result)
                             throws ComponentException
Called if deserialization fails after this component was deserialized.

Parameters:
result - the same object that was returned in initDeserializeInstance(String, Map)
Throws:
ComponentException