SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.impl.jdbc.meta
Class XMLMappingInfoParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.solarmetric.rd.meta.XMLMetaDataParser
              |
              +--com.solarmetric.rd.meta.CFMetaDataParser
                    |
                    +--com.solarmetric.rd.kodo.impl.jdbc.meta.XMLMappingInfoParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, MappingInfoParser, MetaDataParser

public class XMLMappingInfoParser
extends CFMetaDataParser
implements MappingInfoParser

Custom SAX parser used to parse MappingInfo objects. The parser deserializes from the following general XML format (there is no validation due to the fact that custom mappings can be introduced, and attributes linking to application identity primary keys are prefixed with the primary key column name):
<!ELEMENT mapping (package)+>
<!ELEMENT package (class)+>
<!ATTLIST package name CDATA #REQUIRED>
<!ELEMENT class ((jdbc-class-map), (jdbc-version-ind)?, (jdbc-class-ind)?, (field)*)>
<!ATTLIST class name CDATA #REQUIRED>
<!ELEMENT jdbc-class-map EMPTY>
<!ATTLIST jdbc-class-map type (base|flat|vertical|..) #REQUIRED>
<!ATTLIST jdbc-class-map table CDATA #IMPLIED>
<!ATTLIST jdbc-class-map pk-column CDATA #IMPLIED>
<!ATTLIST jdbc-class-map [pkcol-]ref-column* CDATA #IMPLIED>
<!ATTLIST jdbc-class-map class CDATA #IMPLIED>
<!ATTLIST jdbc-class-map ANY>
<!ELEMENT field (jdbc-field-map)>
<!ATTLIST field name CDATA #REQUIRED>
<!ELEMENT jdbc-field-map (field)*>
<!ATTLIST jdbc-field-map type (value|blob|clob|one-one|collection |one-many|many-many|map|n-many-map|..) #REQUIRED>
<!ATTLIST jdbc-field-map table CDATA #IMPLIED>
<!ATTLIST jdbc-field-map [pkcol-]column* CDATA #IMPLIED>
<!ATTLIST jdbc-field-map [pkcol-]key-column* CDATA #IMPLIED>
<!ATTLIST jdbc-field-map [pkcol-]value-column* CDATA #REQUIRED>
<!ATTLIST jdbc-field-map [pkcol-]ref-column* CDATA #IMPLIED>
<!ATTLIST jdbc-field-map order-column CDATA #IMPLIED>
<!ATTLIST jdbc-field-map meta-column CDATA #IMPLIED>
<!ATTLIST jdbc-field-map class CDATA #IMPLIED>
<!ATTLIST jdbc-field-map ANY>
<!ELEMENT jdbc-version-ind EMPTY>
<!ATTLIST jdbc-version-ind type (version-num|..) #REQUIRED>
<!ATTLIST jdbc-version-ind column CDATA #IMPLIED>
<!ATTLIST jdbc-version-ind class CDATA #IMPLIED>
<!ATTLIST jdbc-version-ind ANY>
<!ELEMENT jdbc-class-ind EMPTY>
<!ATTLIST jdbc-class-ind type (in-class-name|not-in-class-name|..) #REQUIRED>
<!ATTLIST jdbc-class-ind column CDATA #IMPLIED>
<!ATTLIST jdbc-class-ind class CDATA #IMPLIED>
<!ATTLIST jdbc-class-ind ANY>

Mapping parsers are not threadsafe.


Field Summary
static java.lang.String CLASS_IND
          Element name of class indicator information.
static java.lang.String CLASS_MAPPING
          Element name of class mapping information.
static java.lang.String FIELD_MAPPING
          Element name of field mapping information.
static java.lang.String VERSION_IND
          Element name of version indicator information.
 
Constructor Summary
XMLMappingInfoParser(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
          Constructor.
 
Method Summary
protected  void endClass(java.lang.String name)
          Override this method marking the end of a declared <class>.
protected  void endClassElement(java.lang.String name)
          Override this method marking the end of an element within a declared <class>.
protected  void finish()
          Override this method to finish up after a parse; this is only called if no errors are encountered during parsing.
protected  java.io.Reader getDocType()
          Override this method to return any DOCTYPE declaration that should be dynamically included in xml documents that will be validated.
protected  java.lang.String getExtension()
          Override this method to return the extension used for metadata resources.
 com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository getRepository()
          Return the repository of mapping info.
protected  void reset()
          Override this method to clear any state and ready the parser for a new document.
 void setRepository(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository repos)
          Set the repository to add parsed mappings to.
protected  void startClass(java.lang.String name, org.xml.sax.Attributes attrs)
          Override this method marking the start of a declared <class>.
protected  void startClassElement(java.lang.String name, org.xml.sax.Attributes attrs)
          Override this method marking the start of an element within a declared <class>.
 
Methods inherited from class com.solarmetric.rd.meta.CFMetaDataParser
classForName, endElement, getDeclaredClass, getDeclaredPackage, startElement
 
Methods inherited from class com.solarmetric.rd.meta.XMLMetaDataParser
addResult, characters, clear, currentClassLoader, endElement, error, fatalError, findMetaData, getClassLoader, getCurrentLocation, getLocation, getLog, getResults, getSourceFile, getSourceName, getText, isValidating, parse, parse, parse, parse, setClassLoader, setDocumentLocator, setLocation, setLog, setValidating, startElement, throwException, throwException
 
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 com.solarmetric.rd.meta.MetaDataParser
clear, findMetaData, getLog, getResults, isValidating, parse, parse, parse, parse, setLog, setValidating
 

Field Detail

CLASS_MAPPING

public static final java.lang.String CLASS_MAPPING
Element name of class mapping information.

See Also:
Constant Field Values

FIELD_MAPPING

public static final java.lang.String FIELD_MAPPING
Element name of field mapping information.

See Also:
Constant Field Values

VERSION_IND

public static final java.lang.String VERSION_IND
Element name of version indicator information.

See Also:
Constant Field Values

CLASS_IND

public static final java.lang.String CLASS_IND
Element name of class indicator information.

See Also:
Constant Field Values
Constructor Detail

XMLMappingInfoParser

public XMLMappingInfoParser(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
Constructor. Supply configuration.

Method Detail

getRepository

public com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository getRepository()
Description copied from interface: MappingInfoParser
Return the repository of mapping info.

Specified by:
getRepository in interface MappingInfoParser

setRepository

public void setRepository(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository repos)
Description copied from interface: MappingInfoParser
Set the repository to add parsed mappings to.

Specified by:
setRepository in interface MappingInfoParser

finish

protected void finish()
Description copied from class: XMLMetaDataParser
Override this method to finish up after a parse; this is only called if no errors are encountered during parsing. Subclasses should call super.finish () to resolve superclass state.

Overrides:
finish in class XMLMetaDataParser

getExtension

protected java.lang.String getExtension()
Description copied from class: XMLMetaDataParser
Override this method to return the extension used for metadata resources.

Specified by:
getExtension in class XMLMetaDataParser

reset

protected void reset()
Description copied from class: CFMetaDataParser
Override this method to clear any state and ready the parser for a new document. Subclasses should call super.reset () to clear superclass state.

Overrides:
reset in class CFMetaDataParser

getDocType

protected java.io.Reader getDocType()
                             throws java.io.IOException
Description copied from class: XMLMetaDataParser
Override this method to return any DOCTYPE declaration that should be dynamically included in xml documents that will be validated. Returns null by default.

Overrides:
getDocType in class XMLMetaDataParser
java.io.IOException

startClass

protected void startClass(java.lang.String name,
                          org.xml.sax.Attributes attrs)
                   throws org.xml.sax.SAXException
Description copied from class: CFMetaDataParser
Override this method marking the start of a declared <class>. The given class name will not include the package.

Specified by:
startClass in class CFMetaDataParser
org.xml.sax.SAXException

endClass

protected void endClass(java.lang.String name)
                 throws org.xml.sax.SAXException
Description copied from class: CFMetaDataParser
Override this method marking the end of a declared <class>. The given class name will not include the package.

Specified by:
endClass in class CFMetaDataParser
org.xml.sax.SAXException

startClassElement

protected void startClassElement(java.lang.String name,
                                 org.xml.sax.Attributes attrs)
                          throws org.xml.sax.SAXException
Description copied from class: CFMetaDataParser
Override this method marking the start of an element within a declared <class>.

Specified by:
startClassElement in class CFMetaDataParser
org.xml.sax.SAXException

endClassElement

protected void endClassElement(java.lang.String name)
                        throws org.xml.sax.SAXException
Description copied from class: CFMetaDataParser
Override this method marking the end of an element within a declared <class>.

Specified by:
endClassElement in class CFMetaDataParser
org.xml.sax.SAXException

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.