|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.meta.XMLMetaDataSerializer org.apache.openjpa.lib.meta.CFMetaDataSerializer org.apache.openjpa.persistence.XMLPersistenceMetaDataSerializer
public class XMLPersistenceMetaDataSerializer
Serializes persistence metadata back to XML. This class processes all object level tags that are store-agnostic. However, it provides hooks for the subclasses to include store-specific tags to be serialized both at <entity-mappings> and <entity> level.
Nested Class Summary | |
---|---|
protected class |
XMLPersistenceMetaDataSerializer.SerializationComparator
Compares clases, sequences, and queries to order them for serialization. |
Field Summary | |
---|---|
protected static int |
TYPE_CLASS_QUERIES
|
protected static int |
TYPE_CLASS_SEQS
|
protected static int |
TYPE_META
|
protected static int |
TYPE_QUERY
|
protected static int |
TYPE_SEQ
|
Fields inherited from interface org.apache.openjpa.lib.meta.MetaDataSerializer |
---|
APPEND, COMPACT, PRETTY, VERBOSE |
Constructor Summary | |
---|---|
XMLPersistenceMetaDataSerializer(OpenJPAConfiguration conf)
Constructor. |
Method Summary | |
---|---|
void |
addAll(MetaDataRepository repos)
Add all components in the given repository to the set to be serialized. |
protected void |
addClassMappingAttributes(ClassMetaData mapping)
Add mapping attributes for the given class. |
protected void |
addFieldMappingAttributes(FieldMetaData fmd,
FieldMetaData orig)
Add mapping attributes for the given field. |
void |
addMetaData(ClassMetaData meta)
Add a class meta data to the set to be serialized. |
void |
addQueryMetaData(QueryMetaData meta)
Add a query meta data to the set to be serialized. |
void |
addSequenceMetaData(SequenceMetaData meta)
Add a sequence meta data to the set to be serialized. |
protected void |
addStrategyMappingAttributes(FieldMetaData fmd)
Set mapping attributes for strategy. |
protected void |
addSystemMappingElements(Collection toSerialize)
Add system-level mapping elements to be serialized. |
void |
clear()
Clear the set of metadatas to be serialized. |
OpenJPAConfiguration |
getConfiguration()
Configuration. |
int |
getMode()
The serialization mode according to the expected document type. |
protected Collection |
getObjects()
Return the current set of objects for serialization. |
protected String |
getPackage(Object obj)
Return the package name of the given object, or null if not in a package. |
boolean |
getSerializeAnnotations()
Whether to serialize content originally specified in annotations. |
protected File |
getSourceFile(Object obj)
Override to not overwrite annotations. |
protected PersistenceStrategy |
getStrategy(FieldMetaData fmd)
Return the serialized strategy name. |
protected boolean |
isMappingMode()
Convenience method for interpreting getMode() . |
protected boolean |
isMappingMode(ClassMetaData meta)
Convenience method for interpreting getMode() . |
protected boolean |
isMappingMode(ValueMetaData vmd)
Convenience method for interpreting getMode() . |
protected boolean |
isMetaDataMode()
Convenience method for interpreting getMode() . |
protected boolean |
isQueryMode()
Convenience method for interpreting getMode() . |
protected XMLPersistenceMetaDataSerializer.SerializationComparator |
newSerializationComparator()
Create a new comparator for ordering objects that are to be serialized. |
boolean |
removeAll(MetaDataRepository repos)
Remove all the components in the given repository from the set to be serialized. |
boolean |
removeMetaData(ClassMetaData meta)
Remove a metadata from the set to be serialized. |
boolean |
removeQueryMetaData(QueryMetaData meta)
Remove a query metadata from the set to be serialized. |
boolean |
removeSequenceMetaData(SequenceMetaData meta)
Remove a sequence metadata from the set to be serialized. |
protected void |
serialize(Collection objects)
Serialize the given set of objects. |
protected boolean |
serializeAttributeOverride(FieldMetaData fmd,
FieldMetaData orig)
Always returns false by default. |
protected void |
serializeAttributeOverrideMappingContent(FieldMetaData fmd,
FieldMetaData orig)
Serialize attribute override mapping content. |
protected void |
serializeClass(ClassMetaData meta,
boolean access)
Serialize class metadata. |
protected void |
serializeClassMappingContent(ClassMetaData mapping)
Serialize class mapping content. |
protected void |
serializeFieldMappingContent(FieldMetaData fmd,
PersistenceStrategy strategy)
Serialize field mapping content; this will be called before #serializeValueMappingContent . |
protected void |
serializeInheritanceContent(ClassMetaData mapping)
Serialize inheritance content. |
protected void |
serializeQueryMappings(ClassMetaData meta)
Serialize query mappings. |
protected void |
serializeSequence(SequenceMetaData meta)
Serialize sequence metadata. |
protected void |
serializeSystemMappingElement(Object obj)
Serialize unknown mapping element at system level. |
void |
setMode(int mode)
The serialization mode according to the expected document type. |
void |
setMode(int mode,
boolean on)
The serialization mode according to the expected document type. |
void |
setSerializeAnnotations(boolean annos)
Whether to serialize content originally specified in annotations. |
protected int |
type(Object o)
Return the type constant for the given object based on its runtime class. |
Methods inherited from class org.apache.openjpa.lib.meta.CFMetaDataSerializer |
---|
getClassName, getPackage, groupByPackage, setPackage |
Methods inherited from class org.apache.openjpa.lib.meta.XMLMetaDataSerializer |
---|
addAttribute, addComments, addComments, addText, currentBackupFile, endElement, getAttributes, getFileMap, getLog, isVerbose, prepareWrite, reset, serialize, serialize, serialize, serialize, serialize, serialize, setLog, startElement |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.openjpa.lib.meta.MetaDataSerializer |
---|
serialize, serialize, serialize, serialize |
Field Detail |
---|
protected static final int TYPE_SEQ
protected static final int TYPE_QUERY
protected static final int TYPE_META
protected static final int TYPE_CLASS_SEQS
protected static final int TYPE_CLASS_QUERIES
Constructor Detail |
---|
public XMLPersistenceMetaDataSerializer(OpenJPAConfiguration conf)
Method Detail |
---|
public OpenJPAConfiguration getConfiguration()
public boolean getSerializeAnnotations()
public void setSerializeAnnotations(boolean annos)
public int getMode()
public void setMode(int mode)
setMode
in interface AbstractCFMetaDataFactory.Serializer
public void setMode(int mode, boolean on)
protected File getSourceFile(Object obj)
getSourceFile
in class XMLMetaDataSerializer
protected boolean isMetaDataMode()
getMode()
.
protected boolean isQueryMode()
getMode()
.
protected boolean isMappingMode()
getMode()
.
protected boolean isMappingMode(ClassMetaData meta)
getMode()
. Takes into
account whether mapping information is loaded for the given instance.
protected boolean isMappingMode(ValueMetaData vmd)
getMode()
. Takes into
account whether mapping information is loaded for the given instance.
public void addMetaData(ClassMetaData meta)
addMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addSequenceMetaData(SequenceMetaData meta)
addSequenceMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addQueryMetaData(QueryMetaData meta)
addQueryMetaData
in interface AbstractCFMetaDataFactory.Serializer
public void addAll(MetaDataRepository repos)
addAll
in interface AbstractCFMetaDataFactory.Serializer
public boolean removeMetaData(ClassMetaData meta)
removeMetaData
in interface AbstractCFMetaDataFactory.Serializer
public boolean removeSequenceMetaData(SequenceMetaData meta)
public boolean removeQueryMetaData(QueryMetaData meta)
public boolean removeAll(MetaDataRepository repos)
public void clear()
protected Collection getObjects()
XMLMetaDataSerializer
getObjects
in class XMLMetaDataSerializer
protected void addSystemMappingElements(Collection toSerialize)
protected XMLPersistenceMetaDataSerializer.SerializationComparator newSerializationComparator()
protected void serialize(Collection objects) throws SAXException
XMLMetaDataSerializer
serialize
in class XMLMetaDataSerializer
SAXException
protected String getPackage(Object obj)
CFMetaDataSerializer
CFMetaDataSerializer.groupByPackage(java.util.Collection)
. Returns null by default.
getPackage
in class CFMetaDataSerializer
protected int type(Object o)
protected void serializeSystemMappingElement(Object obj) throws SAXException
SAXException
protected void serializeSequence(SequenceMetaData meta) throws SAXException
SAXException
protected void serializeClass(ClassMetaData meta, boolean access) throws SAXException
SAXException
protected void addClassMappingAttributes(ClassMetaData mapping) throws SAXException
SAXException
protected void serializeClassMappingContent(ClassMetaData mapping) throws SAXException
SAXException
protected void serializeInheritanceContent(ClassMetaData mapping) throws SAXException
SAXException
protected void serializeQueryMappings(ClassMetaData meta) throws SAXException
SAXException
protected void addFieldMappingAttributes(FieldMetaData fmd, FieldMetaData orig) throws SAXException
SAXException
protected boolean serializeAttributeOverride(FieldMetaData fmd, FieldMetaData orig)
protected void serializeAttributeOverrideMappingContent(FieldMetaData fmd, FieldMetaData orig) throws SAXException
SAXException
protected PersistenceStrategy getStrategy(FieldMetaData fmd)
protected void serializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy) throws SAXException
#serializeValueMappingContent
. Does nothing by default.
SAXException
protected void addStrategyMappingAttributes(FieldMetaData fmd) throws SAXException
SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |