Module org.eclipse.persistence.sdo
Class SDOXMLHelperDelegate
java.lang.Object
org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegate
- All Implemented Interfaces:
XMLHelper,SDOXMLHelper
- Direct Known Subclasses:
JAXBXMLHelper
Purpose: Helper to XML documents into DataObects and DataObjects into XML documents.
Responsibilities:
- Load methods create commonj.sdo.XMLDocument objects from XML (unmarshal)
- Save methods create XML from commonj.sdo.XMLDocument and commonj.sdo.DataObject objects (marshal)
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSDOXMLHelperDelegate(HelperContext aContext) SDOXMLHelperDelegate(HelperContext aContext, ClassLoader aClassLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDescriptors(List types) INTERNAL:createDocument(DataObject dataObject, String rootElementURI, String rootElementName) Creates an XMLDocument with the specified XML rootElement for the DataObject.INTERNAL: Return the helperContext that this instance is associated with.INTERNAL:org.eclipse.persistence.sessions.ProjectINTERNAL:org.eclipse.persistence.oxm.XMLContextINTERNAL:org.eclipse.persistence.internal.oxm.XMLConversionManagerINTERNAL:org.eclipse.persistence.oxm.XMLMarshallerINTERNAL:org.eclipse.persistence.oxm.XMLUnmarshallerINTERNAL:voidinitializeDescriptor(org.eclipse.persistence.oxm.XMLDescriptor descriptor) load(InputStream inputStream) Creates and returns an XMLDocument from the inputStream.load(InputStream inputStream, String locationURI, Object options) Creates and returns an XMLDocument from the inputStream.Creates and returns an XMLDocument from the inputReader.Creates and returns an XMLDocument from the input String.Creates and returns an XMLDocument from the inputSource.load(InputSource inputSource, String locationURI, Object options) Creates and returns an XMLDocument from the inputSource.voidreset()INTERNAL:save(DataObject dataObject, String rootElementURI, String rootElementName) Returns the DataObject saved as an XML document with the specified root element.voidsave(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) Saves the DataObject as an XML document with the specified root element.voidsave(XMLDocument xmlDocument, OutputStream outputStream, Object options) Serializes an XMLDocument as an XML document into the outputStream.voidsave(XMLDocument xmlDocument, Writer outputWriter, Object options) Serializes an XMLDocument as an XML document into the outputWriter.voidsave(XMLDocument xmlDocument, Result result, Object options) Serializes an XMLDocument as an XML document into the outputResult in a serialization technology independent format (as specified in javax.xml.transform).voidserialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) voidsetHelperContext(HelperContext helperContext) INTERNAL: Set the helperContext that this instance is associated with.voidsetLoader(SDOClassLoader loader) INTERNAL:voidsetTimeZone(TimeZone timeZone) The specified TimeZone will be used for all String to date object conversions.voidsetTimeZoneQualified(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.voidsetTopLinkProject(org.eclipse.persistence.sessions.Project toplinkProject) INTERNAL:voidsetXmlContext(org.eclipse.persistence.oxm.XMLContext xmlContext) INTERNAL:voidsetXmlMarshaller(org.eclipse.persistence.oxm.XMLMarshaller xmlMarshaller) INTERNAL:voidsetXmlUnmarshaller(org.eclipse.persistence.oxm.XMLUnmarshaller xmlUnmarshaller) INTERNAL:
-
Constructor Details
-
SDOXMLHelperDelegate
-
SDOXMLHelperDelegate
-
-
Method Details
-
setTimeZone
The specified TimeZone will be used for all String to date object conversions. By default the TimeZone from the JVM is used.- Specified by:
setTimeZonein interfaceSDOXMLHelper
-
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:
setTimeZoneQualifiedin interfaceSDOXMLHelper
-
load
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:
loadin interfaceXMLHelper- Parameters:
inputString- specifies the String to read from- Returns:
- the new XMLDocument loaded
- Throws:
RuntimeException- for errors in XML parsing or implementation-specific validation.
-
load
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:
loadin interfaceXMLHelper- Parameters:
inputStream- specifies the InputStream to read from- Returns:
- the new XMLDocument loaded
- Throws:
IOException- for stream exceptions.RuntimeException- for errors in XML parsing or implementation-specific validation.
-
load
public XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException Creates and returns an XMLDocument from the inputStream. The InputStream will be closed after reading. By default does not perform XSD validation.- Specified by:
loadin interfaceXMLHelper- Parameters:
inputStream- specifies the InputStream to read fromlocationURI- specifies the URI of the document for relative schema locationsoptions- implementation-specific options.- Returns:
- the new XMLDocument loaded
- Throws:
IOException- for stream exceptions.RuntimeException- for errors in XML parsing or implementation-specific validation.
-
load
public XMLDocument load(InputSource inputSource, String locationURI, Object options) throws IOException Creates and returns an XMLDocument from the inputSource. The InputSource will be closed after reading. By default does not perform XSD validation.- Specified by:
loadin interfaceSDOXMLHelper- Parameters:
inputSource- specifies the InputSource to read fromlocationURI- specifies the URI of the document for relative schema locationsoptions- implementation-specific options.- Returns:
- the new XMLDocument loaded
- Throws:
IOException- for stream exceptions.RuntimeException- for errors in XML parsing or implementation-specific validation.
-
load
Creates and returns an XMLDocument from the inputReader. The InputStream will be closed after reading. By default does not perform XSD validation.- Specified by:
loadin interfaceXMLHelper- Parameters:
inputReader- specifies the Reader to read fromlocationURI- specifies the URI of the document for relative schema locationsoptions- implementation-specific options.- Returns:
- the new XMLDocument loaded
- Throws:
IOException- for stream exceptions.RuntimeException- for errors in XML parsing or implementation-specific validation.
-
load
Description copied from interface:XMLHelperCreates and returns an XMLDocument from the inputSource. The InputSource will be closed after reading. By default does not perform XSD validation.- Specified by:
loadin interfaceXMLHelper- Parameters:
source- specifies the Source to read fromlocationURI- specifies the URI of the document for relative schema locationsoptions- implementation-specific options.- Returns:
- the new XMLDocument loaded
- Throws:
IOException- for stream exceptions.
-
save
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:
savein interfaceXMLHelper- Parameters:
dataObject- specifies DataObject to be savedrootElementURI- the Target Namespace URI of the root XML elementrootElementName- the Name of the root XML element- Returns:
- the saved XML document as a string
- Throws:
IllegalArgumentException- if the dataObject tree is not closed or has no container.
-
save
public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws org.eclipse.persistence.exceptions.XMLMarshalException, IOException Saves the DataObject as an XML document with the specified root element. Same as save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null);- Specified by:
savein interfaceXMLHelper- Parameters:
dataObject- specifies DataObject to be savedrootElementURI- the Target Namespace URI of the root XML elementrootElementName- the Name of the root XML elementoutputStream- specifies the OutputStream to write to.- Throws:
IOException- for stream exceptions.IllegalArgumentException- if the dataObject tree is not closed or has no container.org.eclipse.persistence.exceptions.XMLMarshalException
-
serialize
public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException - Specified by:
serializein interfaceSDOXMLHelper- Throws:
IOException
-
save
public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException 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:
savein interfaceXMLHelper- Parameters:
xmlDocument- specifies XMLDocument to be savedoutputStream- specifies the OutputStream to write to.options- implementation-specific options.- Throws:
IOException- for stream exceptions.IllegalArgumentException- if the dataObject tree is not closed or has no container.
-
save
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:
savein interfaceXMLHelper- Parameters:
xmlDocument- specifies XMLDocument to be savedoutputWriter- specifies the Writer to write to.options- implementation-specific options.- Throws:
IOException- for stream exceptions.IllegalArgumentException- if the dataObject tree is not closed or has no container.
-
save
Description copied from interface:XMLHelperSerializes 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:
savein interfaceXMLHelper- Parameters:
xmlDocument- specifies XMLDocument to be savedresult- specifies Result to be savedoptions- implementation-specific options.- Throws:
IOException- for stream exceptions.
-
createDocument
public XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName) Creates an XMLDocument with the specified XML rootElement for the DataObject.- Specified by:
createDocumentin interfaceXMLHelper- Parameters:
dataObject- specifies DataObject to be savedrootElementURI- the Target Namespace URI of the root XML elementrootElementName- the Name of the root XML element- Returns:
- XMLDocument a new XMLDocument set with the specified parameters.
-
setLoader
Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
setLoaderin interfaceSDOXMLHelper
-
getLoader
Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getLoaderin interfaceSDOXMLHelper- Returns:
-
setXmlContext
public void setXmlContext(org.eclipse.persistence.oxm.XMLContext xmlContext) Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
setXmlContextin interfaceSDOXMLHelper
-
getXmlContext
public org.eclipse.persistence.oxm.XMLContext getXmlContext()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getXmlContextin interfaceSDOXMLHelper- Returns:
-
initializeDescriptor
public void initializeDescriptor(org.eclipse.persistence.oxm.XMLDescriptor descriptor) - Specified by:
initializeDescriptorin interfaceSDOXMLHelper
-
addDescriptors
Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
addDescriptorsin interfaceSDOXMLHelper
-
setTopLinkProject
public void setTopLinkProject(org.eclipse.persistence.sessions.Project toplinkProject) Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
setTopLinkProjectin interfaceSDOXMLHelper
-
getTopLinkProject
public org.eclipse.persistence.sessions.Project getTopLinkProject()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getTopLinkProjectin interfaceSDOXMLHelper- Returns:
-
setXmlMarshaller
public void setXmlMarshaller(org.eclipse.persistence.oxm.XMLMarshaller xmlMarshaller) Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
setXmlMarshallerin interfaceSDOXMLHelper
-
getXmlMarshaller
public org.eclipse.persistence.oxm.XMLMarshaller getXmlMarshaller()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getXmlMarshallerin interfaceSDOXMLHelper- Returns:
-
setXmlUnmarshaller
public void setXmlUnmarshaller(org.eclipse.persistence.oxm.XMLUnmarshaller xmlUnmarshaller) Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
setXmlUnmarshallerin interfaceSDOXMLHelper
-
getXmlUnmarshaller
public org.eclipse.persistence.oxm.XMLUnmarshaller getXmlUnmarshaller()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getXmlUnmarshallerin interfaceSDOXMLHelper- Returns:
-
reset
public void reset()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
resetin interfaceSDOXMLHelper
-
getHelperContext
Description copied from interface:SDOXMLHelperINTERNAL: Return the helperContext that this instance is associated with.- Specified by:
getHelperContextin interfaceSDOXMLHelper- Returns:
-
setHelperContext
Description copied from interface:SDOXMLHelperINTERNAL: Set the helperContext that this instance is associated with.- Specified by:
setHelperContextin interfaceSDOXMLHelper
-
getXmlConversionManager
public org.eclipse.persistence.internal.oxm.XMLConversionManager getXmlConversionManager()Description copied from interface:SDOXMLHelperINTERNAL:- Specified by:
getXmlConversionManagerin interfaceSDOXMLHelper
-