org.apache.cayenne.map
Class MapLoader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.cayenne.map.MapLoader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class MapLoader
extends org.xml.sax.helpers.DefaultHandler

Default MapLoader. Its responsibilities include reading DataMaps from XML files and saving DataMap objects back to XML.

Author:
Misha Shengaout, Andrus Adamchik, Andriy Shapochka

Field Summary
static java.lang.String DATA_MAP_TAG
           
static java.lang.String DB_ATTRIBUTE_DERIVED_TAG
           
static java.lang.String DB_ATTRIBUTE_PAIR_TAG
           
static java.lang.String DB_ATTRIBUTE_REF_TAG
           
static java.lang.String DB_ATTRIBUTE_TAG
           
static java.lang.String DB_ENTITY_TAG
           
static java.lang.String DB_GENERATOR_NAME_TAG
           
static java.lang.String DB_GENERATOR_TYPE_TAG
           
static java.lang.String DB_KEY_CACHE_SIZE_TAG
           
static java.lang.String DB_KEY_GENERATOR_TAG
           
static java.lang.String DB_RELATIONSHIP_REF_TAG
           
static java.lang.String DB_RELATIONSHIP_TAG
           
static java.lang.String FALSE
           
static java.lang.String OBJ_ATTRIBUTE_TAG
           
static java.lang.String OBJ_ENTITY_TAG
           
static java.lang.String OBJ_RELATIONSHIP_TAG
           
static java.lang.String PROCEDURE_PARAMETER_TAG
           
static java.lang.String PROCEDURE_TAG
           
static java.lang.String PROPERTY_TAG
           
static java.lang.String QUERY_ORDERING_TAG
           
static java.lang.String QUERY_PREFETCH_TAG
           
static java.lang.String QUERY_QUALIFIER_TAG
           
static java.lang.String QUERY_RESULT_COLUMN_TAG
          Deprecated. since 1.2 unused
static java.lang.String QUERY_SQL_TAG
           
static java.lang.String QUERY_TAG
           
static java.lang.String TRUE
           
 
Constructor Summary
MapLoader()
           
 
Method Summary
 void characters(char[] text, int start, int length)
           
protected  ResourceLocator configLocator()
          Creates, configures and returns ResourceLocator object used to lookup DataMap files.
 void endElement(java.lang.String namespaceURI, java.lang.String local_name, java.lang.String qName)
           
 DataMap loadDataMap(org.xml.sax.InputSource src)
          Loads a DataMap from XML input source.
 DataMap loadDataMap(java.lang.String uri)
          Loads DataMap from file specified by uri parameter.
protected  java.lang.String mapNameFromLocation(java.lang.String location)
          Helper method to guess the map name from its location.
 void startElement(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_MAP_TAG

public static final java.lang.String DATA_MAP_TAG
See Also:
Constant Field Values

PROPERTY_TAG

public static final java.lang.String PROPERTY_TAG
See Also:
Constant Field Values

DB_ENTITY_TAG

public static final java.lang.String DB_ENTITY_TAG
See Also:
Constant Field Values

OBJ_ENTITY_TAG

public static final java.lang.String OBJ_ENTITY_TAG
See Also:
Constant Field Values

DB_ATTRIBUTE_TAG

public static final java.lang.String DB_ATTRIBUTE_TAG
See Also:
Constant Field Values

DB_ATTRIBUTE_DERIVED_TAG

public static final java.lang.String DB_ATTRIBUTE_DERIVED_TAG
See Also:
Constant Field Values

DB_ATTRIBUTE_REF_TAG

public static final java.lang.String DB_ATTRIBUTE_REF_TAG
See Also:
Constant Field Values

OBJ_ATTRIBUTE_TAG

public static final java.lang.String OBJ_ATTRIBUTE_TAG
See Also:
Constant Field Values

OBJ_RELATIONSHIP_TAG

public static final java.lang.String OBJ_RELATIONSHIP_TAG
See Also:
Constant Field Values

DB_RELATIONSHIP_TAG

public static final java.lang.String DB_RELATIONSHIP_TAG
See Also:
Constant Field Values

DB_RELATIONSHIP_REF_TAG

public static final java.lang.String DB_RELATIONSHIP_REF_TAG
See Also:
Constant Field Values

DB_ATTRIBUTE_PAIR_TAG

public static final java.lang.String DB_ATTRIBUTE_PAIR_TAG
See Also:
Constant Field Values

PROCEDURE_TAG

public static final java.lang.String PROCEDURE_TAG
See Also:
Constant Field Values

PROCEDURE_PARAMETER_TAG

public static final java.lang.String PROCEDURE_PARAMETER_TAG
See Also:
Constant Field Values

QUERY_TAG

public static final java.lang.String QUERY_TAG
See Also:
Constant Field Values

QUERY_RESULT_COLUMN_TAG

public static final java.lang.String QUERY_RESULT_COLUMN_TAG
Deprecated. since 1.2 unused
See Also:
Constant Field Values

QUERY_SQL_TAG

public static final java.lang.String QUERY_SQL_TAG
See Also:
Constant Field Values

QUERY_QUALIFIER_TAG

public static final java.lang.String QUERY_QUALIFIER_TAG
See Also:
Constant Field Values

QUERY_ORDERING_TAG

public static final java.lang.String QUERY_ORDERING_TAG
See Also:
Constant Field Values

QUERY_PREFETCH_TAG

public static final java.lang.String QUERY_PREFETCH_TAG
See Also:
Constant Field Values

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

public static final java.lang.String FALSE
See Also:
Constant Field Values

DB_KEY_GENERATOR_TAG

public static final java.lang.String DB_KEY_GENERATOR_TAG
See Also:
Constant Field Values

DB_GENERATOR_TYPE_TAG

public static final java.lang.String DB_GENERATOR_TYPE_TAG
See Also:
Constant Field Values

DB_GENERATOR_NAME_TAG

public static final java.lang.String DB_GENERATOR_NAME_TAG
See Also:
Constant Field Values

DB_KEY_CACHE_SIZE_TAG

public static final java.lang.String DB_KEY_CACHE_SIZE_TAG
See Also:
Constant Field Values
Constructor Detail

MapLoader

public MapLoader()
Method Detail

loadDataMap

public DataMap loadDataMap(org.xml.sax.InputSource src)
                    throws CayenneRuntimeException
Loads a DataMap from XML input source.

Throws:
CayenneRuntimeException

loadDataMap

public DataMap loadDataMap(java.lang.String uri)
                    throws CayenneRuntimeException
Loads DataMap from file specified by uri parameter.

Throws:
CayenneRuntimeException - if source URI does not resolve to a valid map files

mapNameFromLocation

protected java.lang.String mapNameFromLocation(java.lang.String location)
Helper method to guess the map name from its location.


configLocator

protected ResourceLocator configLocator()
Creates, configures and returns ResourceLocator object used to lookup DataMap files.


startElement

public void startElement(java.lang.String namespaceUri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String local_name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] text,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException


Copyright © 2001-2006 Apache.org All Rights Reserved.