Package org.datanucleus.metadata.xml
Class PersistenceFileMetaDataHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.datanucleus.metadata.xml.AbstractMetaDataHandler
-
- org.datanucleus.metadata.xml.PersistenceFileMetaDataHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class PersistenceFileMetaDataHandler extends AbstractMetaDataHandler
Parser handler for "persistence.xml" files to convert them into a PersistenceFileMetaData. Implements DefaultHandler and handles the extracting of MetaData from the XML elements/attributes. This class simply constructs the MetaData representation mirroring what is in the MetaData file.Operates the parse process using a Stack. 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.AbstractMetaDataHandler
charactersBuffer, entityResolver, filename, metadata, mmgr, stack, validate
-
-
Constructor Summary
Constructors Constructor Description PersistenceFileMetaDataHandler(MetaDataManager mgr, String filename, EntityResolver resolver)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endElement(String uri, String localName, String qName)
Handler method called at the end of an element.void
startElement(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.AbstractMetaDataHandler
characters, error, getAttr, getAttr, getMetaData, getStack, getString, isPersistenceContext, popStack, pushStack, resolveEntity, setValidate
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
PersistenceFileMetaDataHandler
public PersistenceFileMetaDataHandler(MetaDataManager mgr, String filename, EntityResolver resolver)
Constructor. Protected to prevent instantiation.- Parameters:
mgr
- the metadata manager (not used)filename
- The name of the file to parseresolver
- Entity Resolver to use (null if not available)
-
-
Method Detail
-
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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
uri
- URI of the taglocalName
- Local nameqName
- Element nameattrs
- Attributes for this element- Throws:
SAXException
- in parsing errors
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
Handler method called at the end of an element.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Parameters:
uri
- URI of the taglocalName
- local nameqName
- Name of element just ending- Throws:
SAXException
- in parsing errors
-
-