org.xquark.bridge
Class Mapping

java.lang.Object
  extended byorg.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.
However, as they encapsulate a JDBC connection, it is better to use different objects for different threads.
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(java.sql.Connection conn, org.xml.sax.InputSource source, boolean reload)
          Constructor.
Mapping(java.sql.Connection conn, org.xml.sax.InputSource source, boolean reload, java.lang.ClassLoader loader)
          Constructor.
Mapping(java.sql.Connection conn, java.lang.String fileURI, boolean reload)
          Constructor.
Mapping(java.sql.Connection conn, java.lang.String fileURI, boolean reload, java.lang.ClassLoader loader)
          Constructor.
 
Method Summary
 void close()
          Frees all resources associated to the object, and removes it from the cache
 java.sql.Connection getConnection()
          Returns the JDBC2 connection used by this object to access the database.
 Mapper getMapper()
          Creates a new Mapper object for storing a set of XML documents in the database
 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(java.sql.Connection conn,
               org.xml.sax.InputSource source,
               boolean reload,
               java.lang.ClassLoader loader)
        throws java.io.IOException,
               org.xml.sax.SAXException,
               java.sql.SQLException
Constructor.

Parameters:
conn - a JDBC connection
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
loader - ClassLoader used for loading user generators
Throws:
java.io.IOException - if an IO error occured while accessing the mapping file
org.xml.sax.SAXException - if a SAX error occured while parsing the mapping file
java.sql.SQLException - if an SQL error occured while accessing the database

Mapping

public Mapping(java.sql.Connection conn,
               org.xml.sax.InputSource source,
               boolean reload)
        throws java.io.IOException,
               org.xml.sax.SAXException,
               java.sql.SQLException
Constructor.

Parameters:
conn - a JDBC connection
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
Throws:
java.io.IOException - if an IO error occured while accessing the mapping file
org.xml.sax.SAXException - if a SAX error occured while parsing the mapping file
java.sql.SQLException - if an SQL error occured while accessing the database

Mapping

public Mapping(java.sql.Connection conn,
               java.lang.String fileURI,
               boolean reload,
               java.lang.ClassLoader loader)
        throws java.io.IOException,
               org.xml.sax.SAXException,
               java.sql.SQLException
Constructor.

Parameters:
conn - a JDBC connection
fileURI - the URI of the mapping file.
reload - true means that the mapping file should be reloaded, even if it is present in the cache
loader - ClassLoader used for loading user generators
Throws:
java.io.IOException - if an IO error occured while accessing the mapping file
org.xml.sax.SAXException - if a SAX error occured while parsing the mapping file
java.sql.SQLException - if an SQL error occured while accessing the database

Mapping

public Mapping(java.sql.Connection conn,
               java.lang.String fileURI,
               boolean reload)
        throws java.io.IOException,
               org.xml.sax.SAXException,
               java.sql.SQLException
Constructor.

Parameters:
conn - a JDBC connection
fileURI - the URI of the mapping file.
reload - true means that the mapping file should be reloaded, even if it is present in the cache
Throws:
java.io.IOException - if an IO error occured while accessing the mapping file
org.xml.sax.SAXException - if a SAX error occured while parsing the mapping file
java.sql.SQLException - if an SQL error occured while accessing the database
Method Detail

close

public void close()
           throws XMLDBCException,
                  java.sql.SQLException
Frees all resources associated to the object, and removes it from the cache

Throws:
XMLDBCException - if a database connection error occured.
java.sql.SQLException

getMapper

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

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

getConnection

public java.sql.Connection getConnection()
Returns the JDBC2 connection used by this object to access the database.

Returns:
a JDBC2 connection

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.


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