org.xquark.bridge
Class Mapping

java.lang.Object
  extended by org.xquark.bridge.Mapping

public class Mapping
extends java.lang.Object

An object implementing this class represents a processed mapping file. Objects of this class are thread-safe and can be reused multiple times.
This class uses a cache for loaded mapping files, so that the loading overhead is reduced. The cache mechanism can be overriden to reload a modified file.


Constructor Summary
Mapping(javax.sql.DataSource dataSource, org.xml.sax.InputSource source, boolean reload, java.lang.ClassLoader classLoader, org.xquark.schema.SchemaManager schemaManager, java.util.HashMap mappingMetadata)
          Constructor.
Mapping(javax.sql.DataSource dataSource, org.xml.sax.InputSource source, boolean reload, java.lang.ClassLoader classLoader, org.xquark.schema.SchemaManager schemaManager, java.util.HashMap mappingMetadata, javax.xml.transform.stream.StreamSource xslSource)
          Constructor.
 
Method Summary
 void close()
          Frees all resources associated to the object
 javax.sql.DataSource getDataSource()
          Returns the JDBC data source used by this mapping.
 Mapper getMapper()
          Creates a new Mapper object for storing a set of XML documents in the database using the default "insert" mode
 Mapper getMapper(java.lang.String mode)
          Creates a new Mapper object for storing a set of XML documents in the database
 java.util.List getMappingModes()
          Returns available mapping modes, as a list of strings
 java.lang.String getNamespace()
          Returns the namespace of the mapping.
 java.lang.String getSystemId()
          Returns the system id (the URL) of the mapping file, if known.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapping

public Mapping(javax.sql.DataSource dataSource,
               org.xml.sax.InputSource source,
               boolean reload,
               java.lang.ClassLoader classLoader,
               org.xquark.schema.SchemaManager schemaManager,
               java.util.HashMap mappingMetadata,
               javax.xml.transform.stream.StreamSource xslSource)
        throws XMLDBCException
Constructor.

Parameters:
dataSource - a JDBC data source
source - the SAX InputSource encapsulating the mapping file
reload - true means that the mapping file should be reloaded, even if it is present in the cache
classLoader - ClassLoader used for loading user generators
schemaManager - SchemaManager for schemas
mappingMetadata - if not null, a HashMap holding previously loaded mapping metadata
xslSource - if not null, the source containing the xsl style sheet
Throws:
XMLDBCException - if an error occured while loading the mapping file. The underlying exception provides the root cause for the exception

Mapping

public Mapping(javax.sql.DataSource dataSource,
               org.xml.sax.InputSource source,
               boolean reload,
               java.lang.ClassLoader classLoader,
               org.xquark.schema.SchemaManager schemaManager,
               java.util.HashMap mappingMetadata)
        throws XMLDBCException
Constructor.

Parameters:
dataSource - a JDBC data source
source - the SAX InputSource encapsulating the mapping file
reload - true means that the mapping file should be reloaded, even if it is present in the cache
classLoader - ClassLoader used for loading user generators
schemaManager - SchemaManager for schemas
mappingMetadata - if not null, a HashMap holding previously loaded mapping metadata
Throws:
XMLDBCException - if an error occured while loading the mapping file. The underlying exception provides the root cause for the exception
Method Detail

close

public void close()
           throws XMLDBCException
Frees all resources associated to the object

Throws:
XMLDBCException - if a database connection error occured.

getMapper

public Mapper getMapper()
                 throws XMLDBCException
Creates a new Mapper object for storing a set of XML documents in the database using the default "insert" mode

Returns:
a Mapper object
Throws:
XMLDBCException - if a database connection error occured.
See Also:
Mapper

getMapper

public Mapper getMapper(java.lang.String mode)
                 throws XMLDBCException
Creates a new Mapper object for storing a set of XML documents in the database

Parameters:
mode - the mapping mode used for storing the documents
Returns:
a Mapper object
Throws:
XMLDBCException - if a database connection error occured.
See Also:
Mapper

getSystemId

public java.lang.String getSystemId()
Returns the system id (the URL) of the mapping file, if known.

Returns:
the system id of the mapping file, or null if unknown.

getNamespace

public java.lang.String getNamespace()
Returns the namespace of the mapping.

Returns:
the namespace of the mapping (which is the empty string by default).

getMappingModes

public java.util.List getMappingModes()
Returns available mapping modes, as a list of strings

Returns:
List of available mapping modes

getDataSource

public javax.sql.DataSource getDataSource()
Returns the JDBC data source used by this mapping.

Returns:
a JDBC datasource.


Copyright © 2009 Université de Versailles Saint-Quentin, XQuark Group. All rights reserved.