Class XMLFormatter
- java.lang.Object
 - 
- org.apache.openjpa.persistence.jest.XMLFormatter
 
 
- 
- All Implemented Interfaces:
 ObjectFormatter<Document>
public class XMLFormatter extends Object implements ObjectFormatter<Document>
Marshals a root instance and its persistent closure as an XML element. The closure is resolved against the persistence context that contains the root instance. The XML document adheres to thejest-instance.xsdschema.- Author:
 - Pinaki Poddar
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static Localizer_locstatic Schema_xsd- 
Fields inherited from interface org.apache.openjpa.persistence.jest.ObjectFormatter
dateFormat 
 - 
 
- 
Constructor Summary
Constructors Constructor Description XMLFormatter() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Documentencode(jakarta.persistence.metamodel.Metamodel model)Encodes the given meta-model into a new XML document according to JEST Domain XML Schema.Documentencode(Collection<OpenJPAStateManager> sms, jakarta.persistence.metamodel.Metamodel model)Encodes the closure of given collection of managed instance into a new XML document according to JEST Instance XML Schema.StringgetMimeType()Gets the mime type produced by this formatter.ElementnewDocument(String rootTag)Create a new document with the given tag as the root element.voidwrite(Document doc, OutputStream out)voidwrite(Document doc, Writer writer)DocumentwriteOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out)Encodes the given domain model, then write it into the given output stream.DocumentwriteOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out)Encodes thepersistent closureof the given collection of objects, then write it into the given output stream. 
 - 
 
- 
- 
Method Detail
- 
getMimeType
public String getMimeType()
Description copied from interface:ObjectFormatterGets the mime type produced by this formatter.- Specified by:
 getMimeTypein interfaceObjectFormatter<Document>
 
- 
encode
public Document encode(Collection<OpenJPAStateManager> sms, jakarta.persistence.metamodel.Metamodel model)
Encodes the closure of given collection of managed instance into a new XML document according to JEST Instance XML Schema.- Specified by:
 encodein interfaceObjectFormatter<Document>- Parameters:
 sm- a collection of managed instances.parent- the parent node to which the new node be attached.- Returns:
 - an encoded object e.g. a XML or HTML Document or a JSON object.
 
 
- 
encode
public Document encode(jakarta.persistence.metamodel.Metamodel model)
Encodes the given meta-model into a new XML document according to JEST Domain XML Schema.- Specified by:
 encodein interfaceObjectFormatter<Document>- Parameters:
 model- a persistent domain model. Must not be null.- Returns:
 - an encoded object e.g. a XML or HTML Document or a JSON object.
 
 
- 
newDocument
public Element newDocument(String rootTag)
Create a new document with the given tag as the root element.- Parameters:
 rootTag- the tag of the root element- Returns:
 - the document element of a new document
 
 
- 
writeOut
public Document writeOut(Collection<OpenJPAStateManager> objs, jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
Description copied from interface:ObjectFormatterEncodes thepersistent closureof the given collection of objects, then write it into the given output stream.- Specified by:
 writeOutin interfaceObjectFormatter<Document>- Parameters:
 objs- the collection of objects to be formatted.model- a meta-model of managed types, provided for easier introspection if necessarytitle- TODOdesc- TODOuri- TODO- Throws:
 IOException
 
- 
writeOut
public Document writeOut(jakarta.persistence.metamodel.Metamodel model, String title, String desc, String uri, OutputStream out) throws IOException
Description copied from interface:ObjectFormatterEncodes the given domain model, then write it into the given output stream.- Specified by:
 writeOutin interfaceObjectFormatter<Document>- Parameters:
 model- a meta-model of managed types- Throws:
 IOException
 
- 
write
public void write(Document doc, OutputStream out) throws IOException
- Throws:
 IOException
 
- 
write
public void write(Document doc, Writer writer) throws IOException
- Throws:
 IOException
 
 - 
 
 -