|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.lib.meta.XMLMetaDataSerializer
public abstract class XMLMetaDataSerializer
Abstract base type for serlializers that transfer groups of objects to XML. Includes a way of serializing objects back to the XML files they were parsed from. Serializers are not thread safe.
Field Summary |
---|
Fields inherited from interface org.apache.openjpa.lib.meta.MetaDataSerializer |
---|
APPEND, COMPACT, PRETTY, VERBOSE |
Constructor Summary | |
---|---|
XMLMetaDataSerializer()
|
Method Summary | |
---|---|
protected void |
addAttribute(java.lang.String name,
java.lang.String value)
Add an attribute to the current group. |
protected void |
addComments(java.lang.Object obj)
Write the given entity's comments. |
protected void |
addComments(java.lang.String[] comments)
Add a comment to the stream. |
protected void |
addText(java.lang.String text)
Add text to the current element. |
protected java.io.File |
currentBackupFile()
The backup file made for the current file being parsed. |
protected void |
endElement(java.lang.String name)
End the current element. |
protected org.xml.sax.Attributes |
getAttributes()
The current attributes. |
protected java.util.Map<java.io.File,java.util.Collection<java.lang.Object>> |
getFileMap()
Returns a Map with keys of the File to be
written to, and values of a Collection of
SourceTracker instances. |
Log |
getLog()
The log to write to. |
protected abstract java.util.Collection<java.lang.Object> |
getObjects()
Return the current set of objects for serialization. |
protected java.io.File |
getSourceFile(java.lang.Object obj)
Return the source file for the given instance. |
protected boolean |
isVerbose()
Whether this serialization is in verbose mode. |
protected java.io.File |
prepareWrite(java.io.File file)
Prepare to write to the given file. |
protected void |
reset()
Reset serialization state for the next document. |
protected abstract void |
serialize(java.util.Collection<java.lang.Object> objs)
Serialize the given set of objects. |
void |
serialize(org.xml.sax.ContentHandler handler,
int flags)
Serilize the current set of objects to a series of SAX events on the given handler. |
void |
serialize(java.io.File file,
int flags)
Serialize the current set of objects to the given file. |
void |
serialize(int flags)
Serialize the current set of objects to the files from which they were parsed. |
void |
serialize(java.util.Map output,
int flags)
Serialize the current set of objects to the files from which they were parsed. |
void |
serialize(javax.xml.transform.Result result,
int flags)
Serialize the current set of objects to the given result. |
void |
serialize(java.io.Writer out,
int flags)
Serialize the current set of objects to the given stream. |
void |
setLog(Log log)
The log to write to. |
protected void |
startElement(java.lang.String name)
Start an element with the current attribute settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLMetaDataSerializer()
Method Detail |
---|
public Log getLog()
public void setLog(Log log)
public void serialize(int flags) throws java.io.IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
java.io.IOException
public void serialize(java.util.Map output, int flags) throws java.io.IOException
MetaDataSerializer
SourceTracker
interface.
serialize
in interface MetaDataSerializer
output
- if null, then serialize directly to the file system;
otherwise, populate the specified Map
with
keys that are the File
instances, and
values that are the String
contents of the MetaDataflags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
java.io.IOException
protected java.io.File prepareWrite(java.io.File file) throws java.io.IOException
java.io.IOException
protected java.util.Map<java.io.File,java.util.Collection<java.lang.Object>> getFileMap()
Map
with keys of the File
to be
written to, and values of a Collection
of
SourceTracker
instances.
protected java.io.File getSourceFile(java.lang.Object obj)
SourceTracker
.
public void serialize(java.io.File file, int flags) throws java.io.IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g.
MetaDataSerializer.PRETTY
| MetaDataSerializer.APPEND
java.io.IOException
public void serialize(java.io.Writer out, int flags) throws java.io.IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
java.io.IOException
public void serialize(javax.xml.transform.Result result, int flags) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void serialize(org.xml.sax.ContentHandler handler, int flags) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean isVerbose()
protected java.io.File currentBackupFile()
protected void startElement(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endElement(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void addText(java.lang.String text) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void addAttribute(java.lang.String name, java.lang.String value)
protected org.xml.sax.Attributes getAttributes()
protected void addComments(java.lang.String[] comments) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void addComments(java.lang.Object obj) throws org.xml.sax.SAXException
Commentable
.
org.xml.sax.SAXException
protected void reset()
protected abstract void serialize(java.util.Collection<java.lang.Object> objs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract java.util.Collection<java.lang.Object> getObjects()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |