Class PersistenceFileMetaDataHandler

  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.datanucleus.metadata.xml.AbstractMetaDataHandler
          extended by org.datanucleus.metadata.xml.PersistenceFileMetaDataHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.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, LOCALISER, metadata, mgr, stack, validate
Constructor Summary
PersistenceFileMetaDataHandler(MetaDataManager mgr, java.lang.String filename, org.xml.sax.EntityResolver resolver)
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Handler method called at the end of an element.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.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, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PersistenceFileMetaDataHandler(MetaDataManager mgr,
                                      java.lang.String filename,
                                      org.xml.sax.EntityResolver resolver)
Constructor. Protected to prevent instantiation.

mgr - the metadata manager
filename - The name of the file to parse
resolver - Entity Resolver to use (null if not available)
Method Detail


public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Handler method called at the start of an element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
startElement in class org.xml.sax.helpers.DefaultHandler
uri - URI of the tag
localName - Local name
qName - Element name
attrs - Attributes for this element
org.xml.sax.SAXException - in parsing errors


public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Handler method called at the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
endElement in class org.xml.sax.helpers.DefaultHandler
uri - URI of the tag
localName - local name
qName - Name of element just ending
org.xml.sax.SAXException - in parsing errors

Copyright © 2011. All Rights Reserved.