org.gcube.vremanagement.resourcebroker.utils.serialization.parser.xstream
Class XStreamTransformer

java.lang.Object
  extended by org.gcube.vremanagement.resourcebroker.utils.serialization.parser.xstream.XStreamTransformer

public class XStreamTransformer
extends java.lang.Object

Provides the factory for transforming both PlanRequest and PlanResponse objects.

Usage:

        // Instantiates the PlanRequest.
        PlanRequest planReq = new PlanRequest ("/gcube/devsec");
        ...
        XStreamTransformer transformer = new XStreamTransformer();
        // from PlanRequest -> XML
        String xml = transformer.toXML(planReq);
        ...
        // from XML -> PlanRequest.
        PlanRequest tReq = transformer.getRequestfromXML(xml);

Author:
Daniele Strollo (ISTI-CNR)

Constructor Summary
XStreamTransformer()
           
 
Method Summary
 Feedback getFeedbackFromXML(java.lang.String xml, boolean validate)
          Given an XML representation of a Feedback instance it returns its object representation.
 PlanRequest getRequestFromXML(java.lang.String xml, boolean validate)
          Given an XML representation of a PlanRequest instance it returns its object representation.
 PlanResponse getResponseFromXML(java.lang.String xml, boolean validate)
          Given an XML representation of a PlanResponse instance it returns its object representation.
 java.lang.String toXML(Feedback feedback)
          Given a Feedback element it is serialized in its XML representation.
 java.lang.String toXML(PlanRequest request)
          Given a PlanRequest element it is serialized in its XML representation.
 java.lang.String toXML(PlanResponse response)
          Given a PlanResponse element it is serialized in its XML representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XStreamTransformer

public XStreamTransformer()
Method Detail

toXML

public final java.lang.String toXML(PlanRequest request)
                             throws GCUBEFault
Given a PlanRequest element it is serialized in its XML representation.

Parameters:
request - the object to serialize
Returns:
the XML representation of input PlanRequest
Throws:
GCUBEFault

toXML

public final java.lang.String toXML(PlanResponse response)
                             throws GCUBEFault
Given a PlanResponse element it is serialized in its XML representation.

Parameters:
response - the object to serialize
Returns:
the XML representation of input PlanResponse
Throws:
GCUBEFault

toXML

public final java.lang.String toXML(Feedback feedback)
                             throws GCUBEFault
Given a Feedback element it is serialized in its XML representation.

Parameters:
feedback - the object to serialize
Returns:
the XML representation of input Feedback
Throws:
GCUBEFault

getRequestFromXML

public final PlanRequest getRequestFromXML(java.lang.String xml,
                                           boolean validate)
                                    throws GCUBEFault
Given an XML representation of a PlanRequest instance it returns its object representation.

Parameters:
xml - the serialized PlanRequest element.
validate - if the xml input must be validated.
Returns:
the object representation of PlanRequest.
Throws:
GCUBEFault - if the parameter is null or if validation fails (when required).

getFeedbackFromXML

public final Feedback getFeedbackFromXML(java.lang.String xml,
                                         boolean validate)
                                  throws GCUBEFault
Given an XML representation of a Feedback instance it returns its object representation.

Parameters:
xml - the serialized Feedback element.
validate - if the xml input must be validated.
Returns:
the object representation of Feedback.
Throws:
GCUBEFault - if the parameter is null or if validation fails (when required).

getResponseFromXML

public final PlanResponse getResponseFromXML(java.lang.String xml,
                                             boolean validate)
                                      throws GCUBEFault
Given an XML representation of a PlanResponse instance it returns its object representation.

Parameters:
xml - the serialized PlanResponse element.
validate - if the xml input must be validated.
Returns:
the object representation of PlanResponse.
Throws:
GCUBEFault - if the parameter is null or if validation fails (when required).