Class SDOXMLHelperDelegator

java.lang.Object
org.eclipse.persistence.sdo.helper.delegates.AbstractHelperDelegator
org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegator
All Implemented Interfaces:
XMLHelper, SDOXMLHelper

public class SDOXMLHelperDelegator extends AbstractHelperDelegator implements SDOXMLHelper

Purpose: Helper to XML documents into DataObects and DataObjects into XML documents.

Responsibilities:

  • Finds the appropriate SDOXMLHelperDelegate for the classLoader/application name and delegates work to that
  • Load methods create commonj.sdo.XMLDocument objects from XML (unmarshal)
  • Save methods create XML from commonj.sdo.XMLDocument and commonj.sdo.DataObject objects (marshal)
  • Constructor Details

    • SDOXMLHelperDelegator

      public SDOXMLHelperDelegator()
    • SDOXMLHelperDelegator

      public SDOXMLHelperDelegator(HelperContext aContext)
  • Method Details

    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
      The specified TimeZone will be used for all String to date object conversions. By default the TimeZone from the JVM is used.
      Specified by:
      setTimeZone in interface SDOXMLHelper
    • setTimeZoneQualified

      public void setTimeZoneQualified(boolean timeZoneQualified)
      By setting this flag to true the marshalled date objects marshalled to the XML schema types time and dateTime will be qualified by a time zone. By default time information is not time zone qualified.
      Specified by:
      setTimeZoneQualified in interface SDOXMLHelper
    • load

      public XMLDocument load(String inputString)
      Description copied from interface: XMLHelper
      Creates and returns an XMLDocument from the input String. By default does not perform XSD validation. Same as load(new StringReader(inputString), null, null);
      Specified by:
      load in interface XMLHelper
      Parameters:
      inputString - specifies the String to read from
      Returns:
      the new XMLDocument loaded
    • load

      public XMLDocument load(InputStream inputStream) throws IOException
      Description copied from interface: XMLHelper
      Creates and returns an XMLDocument from the inputStream. The InputStream will be closed after reading. By default does not perform XSD validation. Same as load(inputStream, null, null);
      Specified by:
      load in interface XMLHelper
      Parameters:
      inputStream - specifies the InputStream to read from
      Returns:
      the new XMLDocument loaded
      Throws:
      IOException - for stream exceptions.
    • load

      public XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException
      Description copied from interface: XMLHelper
      Creates and returns an XMLDocument from the inputStream. The InputStream will be closed after reading. By default does not perform XSD validation.
      Specified by:
      load in interface XMLHelper
      Parameters:
      inputStream - specifies the InputStream to read from
      locationURI - specifies the URI of the document for relative schema locations
      options - implementation-specific options.
      Returns:
      the new XMLDocument loaded
      Throws:
      IOException - for stream exceptions.
    • load

      public XMLDocument load(InputSource inputSource, String locationURI, Object options) throws IOException
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      load in interface SDOXMLHelper
      Parameters:
      inputSource -
      locationURI -
      options -
      Returns:
      Throws:
      IOException
    • load

      public XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException
      Description copied from interface: XMLHelper
      Creates and returns an XMLDocument from the inputReader. The InputStream will be closed after reading. By default does not perform XSD validation.
      Specified by:
      load in interface XMLHelper
      Parameters:
      inputReader - specifies the Reader to read from
      locationURI - specifies the URI of the document for relative schema locations
      options - implementation-specific options.
      Returns:
      the new XMLDocument loaded
      Throws:
      IOException - for stream exceptions.
    • load

      public XMLDocument load(Source source, String locationURI, Object options) throws IOException
      Description copied from interface: XMLHelper
      Creates and returns an XMLDocument from the inputSource. The InputSource will be closed after reading. By default does not perform XSD validation.
      Specified by:
      load in interface XMLHelper
      Parameters:
      source - specifies the Source to read from
      locationURI - specifies the URI of the document for relative schema locations
      options - implementation-specific options.
      Returns:
      the new XMLDocument loaded
      Throws:
      IOException - for stream exceptions.
    • save

      public String save(DataObject dataObject, String rootElementURI, String rootElementName)
      Description copied from interface: XMLHelper
      Returns the DataObject saved as an XML document with the specified root element. Same as StringWriter stringWriter = new StringWriter(); save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, null); stringWriter.toString();
      Specified by:
      save in interface XMLHelper
      Parameters:
      dataObject - specifies DataObject to be saved
      rootElementURI - the Target Namespace URI of the root XML element
      rootElementName - the Name of the root XML element
      Returns:
      the saved XML document as a string
    • save

      public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws IOException
      Description copied from interface: XMLHelper
      Saves the DataObject as an XML document with the specified root element. Same as save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null);
      Specified by:
      save in interface XMLHelper
      Parameters:
      dataObject - specifies DataObject to be saved
      rootElementURI - the Target Namespace URI of the root XML element
      rootElementName - the Name of the root XML element
      outputStream - specifies the OutputStream to write to.
      Throws:
      IOException - for stream exceptions.
    • save

      public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException
      Description copied from interface: XMLHelper
      Serializes an XMLDocument as an XML document into the outputStream. If the DataObject's Type was defined by an XSD, the serialization will follow the XSD. Otherwise the serialization will follow the format as if an XSD were generated as defined by the SDO specification. The OutputStream will be flushed after writing. Does not perform validation to ensure compliance with an XSD.
      Specified by:
      save in interface XMLHelper
      Parameters:
      xmlDocument - specifies XMLDocument to be saved
      outputStream - specifies the OutputStream to write to.
      options - implementation-specific options.
      Throws:
      IOException - for stream exceptions.
    • save

      public void save(XMLDocument xmlDocument, Writer outputWriter, Object options) throws IOException
      Description copied from interface: XMLHelper
      Serializes an XMLDocument as an XML document into the outputWriter. If the DataObject's Type was defined by an XSD, the serialization will follow the XSD. Otherwise the serialization will follow the format as if an XSD were generated as defined by the SDO specification. The OutputStream will be flushed after writing. Does not perform validation to ensure compliance with an XSD.
      Specified by:
      save in interface XMLHelper
      Parameters:
      xmlDocument - specifies XMLDocument to be saved
      outputWriter - specifies the Writer to write to.
      options - implementation-specific options.
      Throws:
      IOException - for stream exceptions.
    • save

      public void save(XMLDocument xmlDocument, Result result, Object options) throws IOException
      Description copied from interface: XMLHelper
      Serializes an XMLDocument as an XML document into the outputResult in a serialization technology independent format (as specified in javax.xml.transform). The OutputResult will be flushed after writing. Does not perform validation to ensure compliance with an XSD.
      Specified by:
      save in interface XMLHelper
      Parameters:
      xmlDocument - specifies XMLDocument to be saved
      result - specifies Result to be saved
      options - implementation-specific options.
      Throws:
      IOException - for stream exceptions.
    • serialize

      public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException
      Specified by:
      serialize in interface SDOXMLHelper
      Throws:
      IOException
    • createDocument

      public XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName)
      Description copied from interface: XMLHelper
      Creates an XMLDocument with the specified XML rootElement for the DataObject.
      Specified by:
      createDocument in interface XMLHelper
      Parameters:
      dataObject - specifies DataObject to be saved
      rootElementURI - the Target Namespace URI of the root XML element
      rootElementName - the Name of the root XML element
      Returns:
      XMLDocument a new XMLDocument set with the specified parameters.
    • setLoader

      public void setLoader(SDOClassLoader loader)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      setLoader in interface SDOXMLHelper
      Parameters:
      loader -
    • getLoader

      public SDOClassLoader getLoader()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getLoader in interface SDOXMLHelper
      Returns:
    • setXmlContext

      public void setXmlContext(XMLContext xmlContext)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      setXmlContext in interface SDOXMLHelper
      Parameters:
      xmlContext -
    • getXmlContext

      public XMLContext getXmlContext()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getXmlContext in interface SDOXMLHelper
      Returns:
    • addDescriptors

      public void addDescriptors(List descriptors)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      addDescriptors in interface SDOXMLHelper
      Parameters:
      descriptors -
    • setTopLinkProject

      public void setTopLinkProject(Project toplinkProject)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      setTopLinkProject in interface SDOXMLHelper
      Parameters:
      toplinkProject -
    • initializeDescriptor

      public void initializeDescriptor(XMLDescriptor descriptor)
      Specified by:
      initializeDescriptor in interface SDOXMLHelper
    • getTopLinkProject

      public Project getTopLinkProject()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getTopLinkProject in interface SDOXMLHelper
      Returns:
    • setXmlMarshaller

      public void setXmlMarshaller(XMLMarshaller xmlMarshaller)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      setXmlMarshaller in interface SDOXMLHelper
      Parameters:
      xmlMarshaller -
    • getXmlMarshaller

      public XMLMarshaller getXmlMarshaller()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getXmlMarshaller in interface SDOXMLHelper
      Returns:
    • setXmlUnmarshaller

      public void setXmlUnmarshaller(XMLUnmarshaller xmlUnmarshaller)
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      setXmlUnmarshaller in interface SDOXMLHelper
      Parameters:
      xmlUnmarshaller -
    • getXmlUnmarshaller

      public XMLUnmarshaller getXmlUnmarshaller()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getXmlUnmarshaller in interface SDOXMLHelper
      Returns:
    • getXMLHelperDelegate

      public SDOXMLHelperDelegate getXMLHelperDelegate()
    • reset

      public void reset()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      reset in interface SDOXMLHelper
    • getXmlConversionManager

      public XMLConversionManager getXmlConversionManager()
      Description copied from interface: SDOXMLHelper
      INTERNAL:
      Specified by:
      getXmlConversionManager in interface SDOXMLHelper