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.

  • Constructor Details

    • JDOXmlMetaDataHandler

      public JDOXmlMetaDataHandler(org.datanucleus.metadata.MetaDataManager mgr, String filename, EntityResolver resolver)
      Constructor. Protected to prevent instantiation.
      Parameters:
      mgr - the metadata manager
      filename - The name of the file to parse
      resolver - 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 PackageMetaData
      attrs - 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 PackageMetaData
      attrs - 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 MetaData
      attrs - 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 MetaData
      attrs - 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:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      Parameters:
      uri - URI of the tag
      localName - Local name
      qName - Element name
      attrs - 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 interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
      Parameters:
      uri - URI of the tag
      localName - local name
      qName - Name of element just ending
      Throws:
      SAXException - in parsing errors