|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.apache.openjpa.lib.meta.XMLMetaDataParser
org.apache.openjpa.lib.meta.CFMetaDataParser
org.apache.openjpa.persistence.XMLPersistenceMetaDataParser
public class XMLPersistenceMetaDataParser
Custom SAX parser used by the system to quickly parse persistence metadata files. This parser may invoke another parser to scan source code annotation.
Nested Class Summary | |
---|---|
protected static class |
XMLPersistenceMetaDataParser.localDBIdentifiers
|
Field Summary | |
---|---|
protected static java.lang.String |
ELEM_ACCESS
|
protected static java.lang.String |
ELEM_ATTRS
|
protected static java.lang.String |
ELEM_CASCADE
|
protected static java.lang.String |
ELEM_CASCADE_ALL
|
protected static java.lang.String |
ELEM_CASCADE_DET
|
protected static java.lang.String |
ELEM_CASCADE_MER
|
protected static java.lang.String |
ELEM_CASCADE_PER
|
protected static java.lang.String |
ELEM_CASCADE_REF
|
protected static java.lang.String |
ELEM_CASCADE_REM
|
protected static java.lang.String |
ELEM_DELIM_IDS
|
protected static java.lang.String |
ELEM_LISTENER
|
protected static java.lang.String |
ELEM_PKG
|
protected static java.lang.String |
ELEM_PU_DEF
|
protected static java.lang.String |
ELEM_PU_META
|
protected static java.lang.String |
ELEM_XML_MAP_META_COMPLETE
|
Constructor Summary | |
---|---|
XMLPersistenceMetaDataParser(OpenJPAConfiguration conf)
Constructor; supply configuration. |
Method Summary | |
---|---|
protected void |
addDeferredEmbeddableMetaData()
Process all deferred embeddables using an unknown access type. |
protected void |
addDeferredEmbeddableMetaData(java.lang.Class<?> embedType,
int access)
Process all deferred embeddables and embeddable mapping overrides for a given class. |
void |
addToParseList(java.util.ArrayList<java.lang.Class<?>> parseList)
|
void |
addToParseList(java.lang.Class<?> parentCls)
|
protected void |
applyDeferredEmbeddableOverrides(java.lang.Class<?> cls)
|
protected java.lang.Class<?> |
classForName(java.lang.String name)
Instantiate the given class, taking into account the default package. |
protected void |
clearDeferredMetaData()
|
protected java.lang.Object |
currentElement()
Return the current element being parsed. |
protected java.lang.Object |
currentParent()
Return the tag of the current parent element. |
protected PersistenceStrategy |
currentStrategy()
Return the current PersistenceStrategy if any. |
protected void |
deferEmbeddable(java.lang.Class<?> embedType,
MetaDataContext fmd)
|
protected void |
endClass(java.lang.String elem)
End a class. |
protected void |
endClassElement(java.lang.String name)
Override this method marking the end of an element within a declared class. |
protected void |
endClassMapping(ClassMetaData mapping)
Implement to finalize class mapping. |
protected void |
endClassMappingElement(java.lang.String name)
Implement to parse a mapping element within a class. |
protected void |
endEmbeddedId()
|
protected void |
endFieldMapping(FieldMetaData field)
Implement to finalize field mapping. |
protected void |
endGeneratedValue()
|
protected void |
endId()
|
protected void |
endIdClass()
|
protected void |
endLob()
|
protected void |
endNamedNativeQuery()
|
protected void |
endNamedQuery()
|
protected void |
endQueryHint()
|
protected void |
endQueryString()
|
protected void |
endSequenceGenerator()
|
protected void |
endSystemElement(java.lang.String name)
Override this method marking the end of an element outside of any package or class. |
protected void |
endSystemMappingElement(java.lang.String name)
Implement to parse a mapping element outside of any class. |
protected void |
endVersion()
|
AnnotationPersistenceMetaDataParser |
getAnnotationParser()
The annotation parser. |
protected java.lang.String |
getClassAttributeName()
The attribute of the class element that holds the name, or null to use the element text. |
protected int |
getClassElementDepth()
The depth of the class element. |
OpenJPAConfiguration |
getConfiguration()
Configuration supplied on construction. |
java.lang.ClassLoader |
getEnvClassLoader()
Return the environmental class loader to pass on to parsed metadata instances. |
boolean |
getMappingOverride()
Whether to allow later parses of mapping information to override earlier information for the same class. |
int |
getMode()
The parse mode according to the expected document type. |
protected java.lang.String |
getPackageAttributeName()
The attribute of the package element that holds the name, or null to use the element text. |
java.lang.Class<?> |
getParseClass()
|
java.util.ArrayList<java.lang.Class<?>> |
getParseList()
|
MetaDataRepository |
getRepository()
Returns the repository for this parser. |
protected java.lang.Object |
getSchemaSource()
Implement to return the XML schema source for the document. |
protected boolean |
isClassElementName(java.lang.String name)
The name of the class element. |
protected boolean |
isDeferredEmbeddable(java.lang.Class<?> embedType,
MetaDataContext fmd)
|
protected boolean |
isMappingMode()
Convenience method for interpreting getMode() . |
protected boolean |
isMappingOverrideMode()
Returns true if we're in mapping mode or in metadata mode with mapping override enabled. |
protected boolean |
isMetaDataMode()
Convenience method for interpreting getMode() . |
protected boolean |
isQueryMode()
Convenience method for interpreting getMode() . |
protected boolean |
isRuntime()
Return whether we're running the parser at runtime. |
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)
|
void |
parse(java.io.File file)
Parse the given file, which may be a directory, in which case it will be scanned recursively for metadata files. |
void |
parse(java.net.URL url)
Parse the given resource. |
protected void |
parseBasic(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse basic. |
protected void |
parseElementCollection(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
|
protected void |
parseEmbedded(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse embedded. |
boolean |
parseListContains(java.lang.Class<?> cls)
|
protected void |
parseManyToMany(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse many-to-many. |
protected void |
parseManyToOne(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse many-to-one. |
protected void |
parseOneToMany(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse one-to-many. |
protected void |
parseOneToOne(FieldMetaData fmd,
org.xml.sax.Attributes attrs)
Parse one-to-one. |
protected java.lang.Object |
peekElement()
Peek a parse element from the stack. |
protected java.lang.Object |
popElement()
Pop a parse element from the stack. |
protected void |
pushElement(java.lang.Object elem)
Push a parse element onto the stack. |
protected void |
reset()
Override this method to clear any state and ready the parser for a new document. |
void |
setAnnotationParser(AnnotationPersistenceMetaDataParser parser)
The annotation parser. |
protected void |
setCascades(FieldMetaData fmd)
Set the cached cascades into the field. |
protected void |
setDeferredEmbeddableAccessType(java.lang.Class<?> embedType,
int access)
|
void |
setEnvClassLoader(java.lang.ClassLoader loader)
Set the environmental class loader to pass on to parsed metadata instances. |
void |
setMappingOverride(boolean override)
Whether to allow later parses of mapping information to override earlier information for the same class. |
void |
setMode(int mode)
The parse mode according to the expected document type. |
void |
setMode(int mode,
boolean on)
The parse mode according to the expected document type. |
protected void |
setOrphanRemoval(ValueMetaData vmd,
boolean orphanRemoval)
|
void |
setRepository(MetaDataRepository repos)
Set the metadata repository for this parser. |
protected boolean |
startCascade(java.lang.Object tag,
org.xml.sax.Attributes attrs)
Lazily parse cascades. |
protected boolean |
startClass(java.lang.String elem,
org.xml.sax.Attributes attrs)
Start a class. |
protected boolean |
startClassElement(java.lang.String name,
org.xml.sax.Attributes attrs)
Override this method marking the start of an element within a declared class. |
protected void |
startClassMapping(ClassMetaData mapping,
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 |
startEmbeddedId(org.xml.sax.Attributes attrs)
Parse embedded-id. |
protected void |
startFieldMapping(FieldMetaData field,
org.xml.sax.Attributes attrs)
Implement to add field mapping data. |
protected boolean |
startGeneratedValue(org.xml.sax.Attributes attrs)
Parse generated-value. |
protected boolean |
startId(org.xml.sax.Attributes attrs)
Parse id. |
protected boolean |
startIdClass(org.xml.sax.Attributes attrs)
Parse id-class. |
protected boolean |
startLob(org.xml.sax.Attributes attrs)
Parse lob. |
protected boolean |
startNamedNativeQuery(org.xml.sax.Attributes attrs)
Parse native-named-query. |
protected boolean |
startNamedQuery(org.xml.sax.Attributes attrs)
Parse named-query. |
protected boolean |
startOrderColumn(org.xml.sax.Attributes attrs)
|
protected boolean |
startQueryHint(org.xml.sax.Attributes attrs)
Parse query-hint. |
protected boolean |
startQueryString(org.xml.sax.Attributes attrs)
|
protected boolean |
startSequenceGenerator(org.xml.sax.Attributes attrs)
Parse sequence-generator. |
protected boolean |
startSystemElement(java.lang.String name,
org.xml.sax.Attributes attrs)
Override this method marking the start of an element outside of any package or class. |
protected java.lang.Object |
startSystemMappingElement(java.lang.String name,
org.xml.sax.Attributes attrs)
Implement to parse a mapping element outside of any class. |
protected boolean |
startVersion(org.xml.sax.Attributes attrs)
Parse version. |
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, getParseComments, getParseText, getResults, getSourceFile, getSourceIsSystemId, getSourceName, getSuffix, ignoreContent, isCaching, isParsing, isValidating, parse, parse, parse, parse, parsed, parseNewResource, setCaching, setClassLoader, setDocumentLocator, setLexicalHandler, setLocation, setLog, 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 |
Field Detail |
---|
protected static final java.lang.String ELEM_PKG
protected static final java.lang.String ELEM_ACCESS
protected static final java.lang.String ELEM_ATTRS
protected static final java.lang.String ELEM_LISTENER
protected static final java.lang.String ELEM_CASCADE
protected static final java.lang.String ELEM_CASCADE_ALL
protected static final java.lang.String ELEM_CASCADE_PER
protected static final java.lang.String ELEM_CASCADE_MER
protected static final java.lang.String ELEM_CASCADE_REM
protected static final java.lang.String ELEM_CASCADE_REF
protected static final java.lang.String ELEM_CASCADE_DET
protected static final java.lang.String ELEM_PU_META
protected static final java.lang.String ELEM_PU_DEF
protected static final java.lang.String ELEM_XML_MAP_META_COMPLETE
protected static final java.lang.String ELEM_DELIM_IDS
Constructor Detail |
---|
public XMLPersistenceMetaDataParser(OpenJPAConfiguration conf)
Method Detail |
---|
public OpenJPAConfiguration getConfiguration()
public AnnotationPersistenceMetaDataParser getAnnotationParser()
public void setAnnotationParser(AnnotationPersistenceMetaDataParser parser)
public MetaDataRepository getRepository()
getRepository
in interface AbstractCFMetaDataFactory.Parser
public void setRepository(MetaDataRepository repos)
public java.lang.ClassLoader getEnvClassLoader()
public void setEnvClassLoader(java.lang.ClassLoader loader)
public boolean getMappingOverride()
public void setMappingOverride(boolean override)
public int getMode()
public void setMode(int mode, boolean on)
public void setMode(int mode)
setMode
in interface AbstractCFMetaDataFactory.Parser
public void parse(java.net.URL url) throws java.io.IOException
MetaDataParser
parse
in interface MetaDataParser
parse
in class XMLMetaDataParser
java.io.IOException
public void parse(java.io.File file) throws java.io.IOException
MetaDataParser
parse
in interface MetaDataParser
parse
in class XMLMetaDataParser
java.io.IOException
protected boolean isMetaDataMode()
getMode()
.
protected boolean isQueryMode()
getMode()
.
protected boolean isMappingMode()
getMode()
.
protected boolean isMappingOverrideMode()
protected void pushElement(java.lang.Object elem)
protected java.lang.Object popElement()
protected java.lang.Object peekElement()
protected java.lang.Object currentElement()
protected PersistenceStrategy currentStrategy()
PersistenceStrategy
if any.
protected java.lang.Object currentParent()
protected boolean isRuntime()
protected java.lang.Object getSchemaSource()
XMLMetaDataParser
String
pointing to schema URI.InputStream
containing schema contents.InputSource
containing schema contents.File
containing schema contents.
getSchemaSource
in class XMLMetaDataParser
protected java.lang.String getPackageAttributeName()
CFMetaDataParser
getPackageAttributeName
in class CFMetaDataParser
protected java.lang.String getClassAttributeName()
CFMetaDataParser
getClassAttributeName
in class CFMetaDataParser
protected int getClassElementDepth()
CFMetaDataParser
getClassElementDepth
in class CFMetaDataParser
protected boolean isClassElementName(java.lang.String name)
CFMetaDataParser
isClassElementName
in class CFMetaDataParser
protected void reset()
CFMetaDataParser
super.reset()
to clear superclass state.
reset
in class CFMetaDataParser
protected boolean startSystemElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
CFMetaDataParser
startSystemElement
in class CFMetaDataParser
org.xml.sax.SAXException
protected void endSystemElement(java.lang.String name) throws org.xml.sax.SAXException
CFMetaDataParser
endSystemElement
in class CFMetaDataParser
org.xml.sax.SAXException
protected java.lang.Object startSystemMappingElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endSystemMappingElement(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startClassElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
CFMetaDataParser
startClassElement
in class CFMetaDataParser
org.xml.sax.SAXException
protected void endClassElement(java.lang.String name) throws org.xml.sax.SAXException
CFMetaDataParser
endClassElement
in class CFMetaDataParser
org.xml.sax.SAXException
protected java.lang.Object startClassMappingElement(java.lang.String name, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endClassMappingElement(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startClass(java.lang.String elem, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
CFMetaDataParser
startClass
in class CFMetaDataParser
org.xml.sax.SAXException
protected void endClass(java.lang.String elem) throws org.xml.sax.SAXException
CFMetaDataParser
endClass
in class CFMetaDataParser
org.xml.sax.SAXException
protected void startClassMapping(ClassMetaData mapping, boolean mappedSuper, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endClassMapping(ClassMetaData mapping) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startSequenceGenerator(org.xml.sax.Attributes attrs)
protected void endSequenceGenerator()
protected boolean startId(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endId() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startEmbeddedId(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endEmbeddedId() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startIdClass(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endIdClass() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startLob(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endLob() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startGeneratedValue(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endGeneratedValue() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startCascade(java.lang.Object tag, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void setCascades(FieldMetaData fmd)
protected void startFieldMapping(FieldMetaData field, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endFieldMapping(FieldMetaData field) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startVersion(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endVersion() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseBasic(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseEmbedded(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseOneToOne(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseManyToOne(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseManyToMany(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void parseOneToMany(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void setOrphanRemoval(ValueMetaData vmd, boolean orphanRemoval)
protected void parseElementCollection(FieldMetaData fmd, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startNamedQuery(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endNamedQuery() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startQueryString(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endQueryString() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startQueryHint(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endQueryHint() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startNamedNativeQuery(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void endNamedNativeQuery() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected boolean startOrderColumn(org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected java.lang.Class<?> classForName(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void addDeferredEmbeddableMetaData()
protected void addDeferredEmbeddableMetaData(java.lang.Class<?> embedType, int access) throws org.xml.sax.SAXException
embedType
- embeddable classaccess
- class level access for embeddable
org.xml.sax.SAXException
protected void setDeferredEmbeddableAccessType(java.lang.Class<?> embedType, int access)
protected void clearDeferredMetaData()
clearDeferredMetaData
in class XMLMetaDataParser
protected boolean isDeferredEmbeddable(java.lang.Class<?> embedType, MetaDataContext fmd)
protected void deferEmbeddable(java.lang.Class<?> embedType, MetaDataContext fmd)
protected void applyDeferredEmbeddableOverrides(java.lang.Class<?> cls) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void addToParseList(java.util.ArrayList<java.lang.Class<?>> parseList)
public void addToParseList(java.lang.Class<?> parentCls)
public boolean parseListContains(java.lang.Class<?> cls)
public java.util.ArrayList<java.lang.Class<?>> getParseList()
public java.lang.Class<?> getParseClass()
protected boolean startDelimitedIdentifiers()
protected java.lang.String normalizeSequenceName(java.lang.String seqName)
protected java.lang.String normalizeSchemaName(java.lang.String schName)
protected java.lang.String normalizeCatalogName(java.lang.String catName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |