org.apache.cayenne.map

## Class MapLoader

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - org.apache.cayenne.map.MapLoader

- All Implemented Interfaces:
    ContentHandler, DTDHandler, EntityResolver, 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.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DATA_MAP_ROOT`
    `static String` | `DATA_MAP_TAG`
    `static String` | `DB_ATTRIBUTE_PAIR_TAG`
    `static String` | `DB_ATTRIBUTE_TAG`
    `static String` | `DB_ENTITY_ROOT`
    `static String` | `DB_ENTITY_TAG`
    `static String` | `DB_GENERATOR_NAME_TAG`
    `static String` | `DB_GENERATOR_TYPE_TAG`
    `static String` | `DB_KEY_CACHE_SIZE_TAG`
    `static String` | `DB_KEY_GENERATOR_TAG`
    `static String` | `DB_RELATIONSHIP_REF_TAG`
    `static String` | `DB_RELATIONSHIP_TAG`
    `static String` | `EMBEDDABLE_ATTRIBUTE_OVERRIDE_TAG`
    `static String` | `EMBEDDABLE_ATTRIBUTE_TAG`
    `static String` | `EMBEDDABLE_TAG`
    `static String` | `EMBEDDED_ATTRIBUTE_TAG`
    `static String` | `ENTITY_LISTENER_TAG`
    `static String` | `FALSE`
    `static String` | `JAVA_CLASS_ROOT`
    `static String` | `OBJ_ATTRIBUTE_OVERRIDE_TAG`
    `static String` | `OBJ_ATTRIBUTE_TAG`
    `static String` | `OBJ_ENTITY_ROOT`
    `static String` | `OBJ_ENTITY_TAG`
    `static String` | `OBJ_RELATIONSHIP_TAG`
    `static String` | `POST_ADD_TAG`
    `static String` | `POST_LOAD_TAG`
    `static String` | `POST_PERSIST_TAG`
    `static String` | `POST_REMOVE_TAG`
    `static String` | `POST_UPDATE_TAG`
    `static String` | `PRE_PERSIST_TAG`
    `static String` | `PRE_REMOVE_TAG`
    `static String` | `PRE_UPDATE_TAG`
    `static String` | `PROCEDURE_PARAMETER_TAG`
    `static String` | `PROCEDURE_ROOT`
    `static String` | `PROCEDURE_TAG`
    `static String` | `PROPERTY_TAG`
    `static String` | `QUERY_EJBQL_TAG`
    `static String` | `QUERY_ORDERING_TAG`
    `static String` | `QUERY_PREFETCH_TAG`
    `static String` | `QUERY_QUALIFIER_TAG`
    `static String` | `QUERY_SQL_TAG`
    `static String` | `QUERY_TAG`
    `static String` | `TRUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapLoader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] text, int start, int length)`
    `protected ResourceFinder` | `createResourceFinder()` Deprecated. since 3.1 as MapLoader should not bother itself with looking up resources.
    `void` | `endElement(String namespaceURI, String localName, String qName)`
    `DataMap` | `loadDataMap(InputSource src)` Loads a DataMap from XML input source.
    `DataMap` | `loadDataMap(String uri)` Deprecated. since 3.1 `loadDataMap(InputSource)` should be used.
    `protected String` | `mapNameFromLocation(String location)` Helper method to guess the map name from its location.
    `void` | `startElement(String namespaceUri, String localName, String qName, 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 String DATA_MAP_TAG

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG

          public static final String PROPERTY_TAG

      See Also:
        Constant Field Values

    - #### EMBEDDABLE_TAG

          public static final String EMBEDDABLE_TAG

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### EMBEDDABLE_ATTRIBUTE_TAG

          public static final String EMBEDDABLE_ATTRIBUTE_TAG

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### EMBEDDED_ATTRIBUTE_TAG

          public static final String EMBEDDED_ATTRIBUTE_TAG

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### EMBEDDABLE_ATTRIBUTE_OVERRIDE_TAG

          public static final String EMBEDDABLE_ATTRIBUTE_OVERRIDE_TAG

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### DB_ENTITY_TAG

          public static final String DB_ENTITY_TAG

      See Also:
        Constant Field Values

    - #### OBJ_ENTITY_TAG

          public static final String OBJ_ENTITY_TAG

      See Also:
        Constant Field Values

    - #### DB_ATTRIBUTE_TAG

          public static final String DB_ATTRIBUTE_TAG

      See Also:
        Constant Field Values

    - #### OBJ_ATTRIBUTE_TAG

          public static final String OBJ_ATTRIBUTE_TAG

      See Also:
        Constant Field Values

    - #### OBJ_ATTRIBUTE_OVERRIDE_TAG

          public static final String OBJ_ATTRIBUTE_OVERRIDE_TAG

      See Also:
        Constant Field Values

    - #### OBJ_RELATIONSHIP_TAG

          public static final String OBJ_RELATIONSHIP_TAG

      See Also:
        Constant Field Values

    - #### DB_RELATIONSHIP_TAG

          public static final String DB_RELATIONSHIP_TAG

      See Also:
        Constant Field Values

    - #### DB_RELATIONSHIP_REF_TAG

          public static final String DB_RELATIONSHIP_REF_TAG

      See Also:
        Constant Field Values

    - #### DB_ATTRIBUTE_PAIR_TAG

          public static final String DB_ATTRIBUTE_PAIR_TAG

      See Also:
        Constant Field Values

    - #### PROCEDURE_TAG

          public static final String PROCEDURE_TAG

      See Also:
        Constant Field Values

    - #### PROCEDURE_PARAMETER_TAG

          public static final String PROCEDURE_PARAMETER_TAG

      See Also:
        Constant Field Values

    - #### ENTITY_LISTENER_TAG

          public static final String ENTITY_LISTENER_TAG

      See Also:
        Constant Field Values

    - #### POST_ADD_TAG

          public static final String POST_ADD_TAG

      See Also:
        Constant Field Values

    - #### PRE_PERSIST_TAG

          public static final String PRE_PERSIST_TAG

      See Also:
        Constant Field Values

    - #### POST_PERSIST_TAG

          public static final String POST_PERSIST_TAG

      See Also:
        Constant Field Values

    - #### PRE_UPDATE_TAG

          public static final String PRE_UPDATE_TAG

      See Also:
        Constant Field Values

    - #### POST_UPDATE_TAG

          public static final String POST_UPDATE_TAG

      See Also:
        Constant Field Values

    - #### PRE_REMOVE_TAG

          public static final String PRE_REMOVE_TAG

      See Also:
        Constant Field Values

    - #### POST_REMOVE_TAG

          public static final String POST_REMOVE_TAG

      See Also:
        Constant Field Values

    - #### POST_LOAD_TAG

          public static final String POST_LOAD_TAG

      See Also:
        Constant Field Values

    - #### QUERY_TAG

          public static final String QUERY_TAG

      See Also:
        Constant Field Values

    - #### QUERY_SQL_TAG

          public static final String QUERY_SQL_TAG

      See Also:
        Constant Field Values

    - #### QUERY_EJBQL_TAG

          public static final String QUERY_EJBQL_TAG

      See Also:
        Constant Field Values

    - #### QUERY_QUALIFIER_TAG

          public static final String QUERY_QUALIFIER_TAG

      See Also:
        Constant Field Values

    - #### QUERY_ORDERING_TAG

          public static final String QUERY_ORDERING_TAG

      See Also:
        Constant Field Values

    - #### QUERY_PREFETCH_TAG

          public static final String QUERY_PREFETCH_TAG

      See Also:
        Constant Field Values

    - #### TRUE

          public static final String TRUE

      See Also:
        Constant Field Values

    - #### FALSE

          public static final String FALSE

      See Also:
        Constant Field Values

    - #### DB_KEY_GENERATOR_TAG

          public static final String DB_KEY_GENERATOR_TAG

      See Also:
        Constant Field Values

    - #### DB_GENERATOR_TYPE_TAG

          public static final String DB_GENERATOR_TYPE_TAG

      See Also:
        Constant Field Values

    - #### DB_GENERATOR_NAME_TAG

          public static final String DB_GENERATOR_NAME_TAG

      See Also:
        Constant Field Values

    - #### DB_KEY_CACHE_SIZE_TAG

          public static final String DB_KEY_CACHE_SIZE_TAG

      See Also:
        Constant Field Values

    - #### OBJ_ENTITY_ROOT

          public static final String OBJ_ENTITY_ROOT

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### DB_ENTITY_ROOT

          public static final String DB_ENTITY_ROOT

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### PROCEDURE_ROOT

          public static final String PROCEDURE_ROOT

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### DATA_MAP_ROOT

          public static final String DATA_MAP_ROOT

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### JAVA_CLASS_ROOT

          public static final String JAVA_CLASS_ROOT

      Since:
        3.0
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MapLoader

          public MapLoader()

  - ### Method Detail

    - #### loadDataMap

          public DataMap loadDataMap(InputSource src)
                              throws CayenneRuntimeException

      Loads a DataMap from XML input source.
      Throws:
        `CayenneRuntimeException`

    - #### loadDataMap

          @Deprecated
          public DataMap loadDataMap(String uri)
                                           throws CayenneRuntimeException

      Deprecated. since 3.1 `loadDataMap(InputSource)` should be used.
      Loads DataMap from file specified by `uri` parameter.
      Throws:
        `CayenneRuntimeException` - if source URI does not resolve to a valid map files

    - #### mapNameFromLocation

          protected String mapNameFromLocation(String location)

      Helper method to guess the map name from its location.

    - #### createResourceFinder

          @Deprecated
          protected ResourceFinder createResourceFinder()

      Deprecated. since 3.1 as MapLoader should not bother itself with looking up resources.
      Creates, configures and returns a default ResourceFinder.
      Since:
        3.0

    - #### startElement

          public void startElement(String namespaceUri,
                                   String localName,
                                   String qName,
                                   Attributes attributes)
                            throws SAXException

      Specified by:
        `startElement` in interface `ContentHandler`
      Overrides:
        `startElement` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `SAXException`

    - #### endElement

          public void endElement(String namespaceURI,
                                 String localName,
                                 String qName)
                          throws SAXException

      Specified by:
        `endElement` in interface `ContentHandler`
      Overrides:
        `endElement` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `SAXException`

    - #### characters

          public void characters(char[] text,
                                 int start,
                                 int length)
                          throws SAXException

      Specified by:
        `characters` in interface `ContentHandler`
      Overrides:
        `characters` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `SAXException`

Copyright © 2001–2017 Apache Cayenne. All rights reserved.