Class JDOXmlMetaDataHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
org.datanucleus.api.jdo.metadata.JDOXmlMetaDataHandler
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class JDOXmlMetaDataHandler
extends org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
Parser handler for JDO XML MetaData.
Caters for "JDO", "ORM" and "JDOQUERY" XML MetaData.
Implements DefaultHandler and handles the extracting of MetaData for JDO from the XML elements/attributes.
This class simply constructs the MetaData representation mirroring what is in the XML MetaData file.
It has no knowledge of the class(es) that it represents, simply the information in the XML MetaData file.
The knowledge of the classes is imposed on the representation at a later stage where necessary.
Operates the parse process using a Stack. XML MetaData components are added to the stack as they are encountered and created. They are then popped off the stack when the end element is encountered.
-
Field Summary
Fields inherited from class org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
charactersBuffer, clr, entityResolver, filename, metadata, mmgr, stack, validate -
Constructor Summary
ConstructorsConstructorDescriptionJDOXmlMetaDataHandler(org.datanucleus.metadata.MetaDataManager mgr, String filename, EntityResolver resolver) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidendElement(String uri, String localName, String qName) Handler method called at the end of an element.protected org.datanucleus.metadata.ClassMetaDatanewClassObject(org.datanucleus.metadata.PackageMetaData pmd, Attributes attrs) Utility to create a new class component.protected org.datanucleus.metadata.FieldMetaDatanewFieldObject(org.datanucleus.metadata.MetaData md, Attributes attrs) Utility to create a new field component.protected org.datanucleus.metadata.InterfaceMetaDatanewInterfaceObject(org.datanucleus.metadata.PackageMetaData pmd, Attributes attrs) Utility to create a new interface component.protected org.datanucleus.metadata.PropertyMetaDatanewPropertyObject(org.datanucleus.metadata.MetaData md, Attributes attrs) Utility to create a new property component.voidstartElement(String uri, String localName, String qName, Attributes attrs) Handler method called at the start of an element.Methods inherited from class org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
characters, error, getAttr, getAttr, getMetaData, getStack, getString, isPersistenceContext, popStack, pushStack, resolveEntity, setValidateMethods inherited from class DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Constructor Details
-
JDOXmlMetaDataHandler
public JDOXmlMetaDataHandler(org.datanucleus.metadata.MetaDataManager mgr, String filename, EntityResolver resolver) Constructor. Protected to prevent instantiation.- Parameters:
mgr- the metadata managerfilename- The name of the file to parseresolver- Entity Resolver to use (null if not available)
-
-
Method Details
-
newClassObject
protected org.datanucleus.metadata.ClassMetaData newClassObject(org.datanucleus.metadata.PackageMetaData pmd, Attributes attrs) Utility to create a new class component.- Parameters:
pmd- The parent PackageMetaDataattrs- The attributes- Returns:
- The ClassMetaData
-
newInterfaceObject
protected org.datanucleus.metadata.InterfaceMetaData newInterfaceObject(org.datanucleus.metadata.PackageMetaData pmd, Attributes attrs) Utility to create a new interface component.- Parameters:
pmd- The parent PackageMetaDataattrs- The attributes- Returns:
- The InterfaceMetaData
-
newFieldObject
protected org.datanucleus.metadata.FieldMetaData newFieldObject(org.datanucleus.metadata.MetaData md, Attributes attrs) Utility to create a new field component.- Parameters:
md- The parent MetaDataattrs- The attributes- Returns:
- The FieldMetaData
-
newPropertyObject
protected org.datanucleus.metadata.PropertyMetaData newPropertyObject(org.datanucleus.metadata.MetaData md, Attributes attrs) Utility to create a new property component.- Parameters:
md- The parent MetaDataattrs- The attributes- Returns:
- The PropertyMetaData
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException Handler method called at the start of an element.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri- URI of the taglocalName- Local nameqName- Element nameattrs- Attributes for this element- Throws:
SAXException- in parsing errors
-
endElement
Handler method called at the end of an element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri- URI of the taglocalName- local nameqName- Name of element just ending- Throws:
SAXException- in parsing errors
-