Class XMLPersistenceMappingParser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.openjpa.lib.meta.XMLMetaDataParser
-
- org.apache.openjpa.lib.meta.CFMetaDataParser
-
- org.apache.openjpa.persistence.XMLPersistenceMetaDataParser
-
- org.apache.openjpa.persistence.jdbc.XMLPersistenceMappingParser
-
- All Implemented Interfaces:
MetaDataParser
,AbstractCFMetaDataFactory.Parser
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.ext.LexicalHandler
public class XMLPersistenceMappingParser extends XMLPersistenceMetaDataParser
Custom SAX parser used by the system to parse persistence mapping files.- Author:
- Steve Kim
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.openjpa.persistence.XMLPersistenceMetaDataParser
XMLPersistenceMetaDataParser.localDBIdentifiers
-
-
Field Summary
-
Fields inherited from class org.apache.openjpa.persistence.XMLPersistenceMetaDataParser
_cls, ELEM_ACCESS, ELEM_ATTRS, ELEM_CASCADE, ELEM_CASCADE_ALL, ELEM_CASCADE_DET, ELEM_CASCADE_MER, ELEM_CASCADE_PER, ELEM_CASCADE_REF, ELEM_CASCADE_REM, ELEM_DELIM_IDS, ELEM_LISTENER, ELEM_PKG, ELEM_PU_DEF, ELEM_PU_META, ELEM_XML_MAP_META_COMPLETE
-
Fields inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
_extendedNamespace, _openjpaNamespace
-
-
Constructor Summary
Constructors Constructor Description XMLPersistenceMappingParser(JDBCConfiguration conf)
Constructor; supply configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDeferredEmbeddableMetaData()
Process all deferred embeddables using an unknown access type.protected void
applyDeferredEmbeddableOverrides(java.lang.Class<?> cls)
Process all deferred embeddable overrides for a given class.protected void
clearDeferredMetaData()
protected void
endClassMapping(ClassMetaData meta)
Implement to finalize class mapping.protected void
endClassMappingElement(java.lang.String name)
Implement to parse a mapping element within a class.protected void
endFieldMapping(FieldMetaData field)
Extend to set the columns.protected void
endSystemMappingElement(java.lang.String name)
Implement to parse a mapping element outside of any class.protected java.lang.String
normalizeCatalogName(java.lang.String catName)
protected java.lang.String
normalizeSchemaName(java.lang.String schName)
protected java.lang.String
normalizeSequenceName(java.lang.String seqName)
protected void
parseEagerFetchModeAttr(FieldMetaData fmd, org.xml.sax.Attributes attrs)
protected void
parseElementClassCriteriaAttr(FieldMetaData fmd, org.xml.sax.Attributes attrs)
protected void
parseStrategy(FieldMetaData fmd, org.xml.sax.Attributes attrs)
protected void
reset()
Override this method to clear any state and ready the parser for a new document.protected void
setTargetIdentifier(Column col, java.lang.String refColumnName)
protected void
startClassMapping(ClassMetaData meta, boolean mappedSuper, org.xml.sax.Attributes attrs)
Implement to add mapping attributes to class.protected java.lang.Object
startClassMappingElement(java.lang.String name, org.xml.sax.Attributes attrs)
Implement to parse a mapping element within a class.protected boolean
startDelimitedIdentifiers()
protected boolean
startExtendedClass(java.lang.String elem, org.xml.sax.Attributes attrs)
protected void
startFieldMapping(FieldMetaData field, org.xml.sax.Attributes attrs)
Extend to clear annotation mapping info.protected boolean
startLob(org.xml.sax.Attributes attrs)
Parse lob.protected boolean
startOrderColumn(org.xml.sax.Attributes attrs)
Process OrderColumn.protected java.lang.Object
startSystemMappingElement(java.lang.String name, org.xml.sax.Attributes attrs)
Implement to parse a mapping element outside of any class.-
Methods inherited from class org.apache.openjpa.persistence.XMLPersistenceMetaDataParser
addDeferredEmbeddableMetaData, addToParseList, addToParseList, classForName, currentElement, currentParent, currentStrategy, deferEmbeddable, endClass, endClassElement, endEmbeddedId, endExtendedClass, endGeneratedValue, endId, endIdClass, endLob, endNamedNativeQuery, endNamedQuery, endQueryHint, endQueryString, endSequenceGenerator, endSystemElement, endVersion, getAnnotationParser, getClassAttributeName, getClassElementDepth, getConfiguration, getEnvClassLoader, getMappingOverride, getMode, getPackageAttributeName, getParseClass, getParseList, getRepository, getSchemaSource, isClassElementName, isDeferredEmbeddable, isDuplicateClass, isDuplicateQuery, isMappingMode, isMappingOverrideMode, isMetaDataMode, isQueryMode, isRuntime, parse, parse, parseBasic, parseElementCollection, parseEmbedded, parseListContains, parseManyToMany, parseManyToOne, parseOneToMany, parseOneToOne, peekElement, popElement, pushElement, setAnnotationParser, setCascades, setDeferredEmbeddableAccessType, setEnvClassLoader, setMappingOverride, setMode, setMode, setOrphanRemoval, setRepository, startCascade, startClass, startClassElement, startEmbeddedId, startGeneratedValue, startId, startIdClass, startNamedNativeQuery, startNamedQuery, startQueryHint, startQueryString, startSequenceGenerator, startSystemElement, startVersion
-
Methods inherited from class org.apache.openjpa.lib.meta.CFMetaDataParser
classForName, classForName, currentClassName, currentPackage, endElement, endPackage, endPackageElement, getPackageElementDepth, isPackageElementName, startElement, startPackage, startPackageElement
-
Methods inherited from class org.apache.openjpa.lib.meta.XMLMetaDataParser
addComments, addResult, characters, clear, comment, currentClassLoader, currentComments, currentDepth, currentLocation, currentText, endCDATA, endDTD, endElement, endEntity, error, fatalError, finish, getClassLoader, getDocType, getException, getException, getException, getLexicalHandler, getLocation, getLog, getOverrideContextClassloader, getParseComments, getParseText, getResults, getSourceFile, getSourceIsSystemId, getSourceName, getSuffix, ignoreContent, isCaching, isParsing, isValidating, parse, parse, parse, parse, parsed, parseNewResource, setCaching, setClassLoader, setDocumentLocator, setLexicalHandler, setLocation, setLog, setOverrideContextClassloader, setParseComments, setParseText, setParsing, setSourceIsSystemId, setSuffix, setValidating, startCDATA, startDTD, startElement, startEntity
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
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.MetaDataParser
clear, getResults, parse, parse, parse, parse, setClassLoader
-
-
-
-
Constructor Detail
-
XMLPersistenceMappingParser
public XMLPersistenceMappingParser(JDBCConfiguration conf)
Constructor; supply configuration.
-
-
Method Detail
-
reset
protected void reset()
Description copied from class:CFMetaDataParser
Override this method to clear any state and ready the parser for a new document. Subclasses should callsuper.reset()
to clear superclass state.- Overrides:
reset
in classXMLPersistenceMetaDataParser
-
startSystemMappingElement
protected java.lang.Object startSystemMappingElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to parse a mapping element outside of any class.- Overrides:
startSystemMappingElement
in classXMLPersistenceMetaDataParser
- Returns:
- the tag for the given element, or null to skip the element
- Throws:
org.xml.sax.SAXException
-
endSystemMappingElement
protected void endSystemMappingElement(java.lang.String name) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to parse a mapping element outside of any class.- Overrides:
endSystemMappingElement
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
startClassMappingElement
protected java.lang.Object startClassMappingElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to parse a mapping element within a class.- Overrides:
startClassMappingElement
in classXMLPersistenceMetaDataParser
- Returns:
- the tag for the given element, or null to skip element
- Throws:
org.xml.sax.SAXException
-
endClassMappingElement
protected void endClassMappingElement(java.lang.String name) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to parse a mapping element within a class.- Overrides:
endClassMappingElement
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
startClassMapping
protected void startClassMapping(ClassMetaData meta, boolean mappedSuper, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to add mapping attributes to class.- Overrides:
startClassMapping
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
endClassMapping
protected void endClassMapping(ClassMetaData meta) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Implement to finalize class mapping.- Overrides:
endClassMapping
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
startLob
protected boolean startLob(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Description copied from class:XMLPersistenceMetaDataParser
Parse lob.- Overrides:
startLob
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
startFieldMapping
protected void startFieldMapping(FieldMetaData field, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Extend to clear annotation mapping info.- Overrides:
startFieldMapping
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
endFieldMapping
protected void endFieldMapping(FieldMetaData field) throws org.xml.sax.SAXException
Extend to set the columns.- Overrides:
endFieldMapping
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
setTargetIdentifier
protected void setTargetIdentifier(Column col, java.lang.String refColumnName)
-
startOrderColumn
protected boolean startOrderColumn(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
Process OrderColumn.- Overrides:
startOrderColumn
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
applyDeferredEmbeddableOverrides
protected void applyDeferredEmbeddableOverrides(java.lang.Class<?> cls) throws org.xml.sax.SAXException
Process all deferred embeddable overrides for a given class. This should only occur after the embeddable is mapped.- Overrides:
applyDeferredEmbeddableOverrides
in classXMLPersistenceMetaDataParser
- Parameters:
embedType
- embeddable classaccess
- class level access for embeddable- Throws:
org.xml.sax.SAXException
-
clearDeferredMetaData
protected void clearDeferredMetaData()
- Overrides:
clearDeferredMetaData
in classXMLPersistenceMetaDataParser
-
addDeferredEmbeddableMetaData
protected void addDeferredEmbeddableMetaData()
Process all deferred embeddables using an unknown access type.- Overrides:
addDeferredEmbeddableMetaData
in classXMLPersistenceMetaDataParser
-
startDelimitedIdentifiers
protected boolean startDelimitedIdentifiers()
- Overrides:
startDelimitedIdentifiers
in classXMLPersistenceMetaDataParser
-
normalizeSequenceName
protected java.lang.String normalizeSequenceName(java.lang.String seqName)
- Overrides:
normalizeSequenceName
in classXMLPersistenceMetaDataParser
-
normalizeSchemaName
protected java.lang.String normalizeSchemaName(java.lang.String schName)
- Overrides:
normalizeSchemaName
in classXMLPersistenceMetaDataParser
-
normalizeCatalogName
protected java.lang.String normalizeCatalogName(java.lang.String catName)
- Overrides:
normalizeCatalogName
in classXMLPersistenceMetaDataParser
-
parseEagerFetchModeAttr
protected void parseEagerFetchModeAttr(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
- Overrides:
parseEagerFetchModeAttr
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
parseElementClassCriteriaAttr
protected void parseElementClassCriteriaAttr(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
- Overrides:
parseElementClassCriteriaAttr
in classXMLPersistenceMetaDataParser
- Throws:
org.xml.sax.SAXException
-
parseStrategy
protected void parseStrategy(FieldMetaData fmd, org.xml.sax.Attributes attrs)
- Overrides:
parseStrategy
in classXMLPersistenceMetaDataParser
-
startExtendedClass
protected boolean startExtendedClass(java.lang.String elem, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
- Overrides:
startExtendedClass
in classCFMetaDataParser
- Throws:
org.xml.sax.SAXException
-
-