org.xquark.bridge
Class XQBridge

java.lang.Object
  extended byorg.xquark.bridge.XQBridge

public class XQBridge
extends java.lang.Object

Objects of this class encapsulate a JDBC connection and provide access to both the XQuery and insertion capabilities of the XQBridge.
Objects of this class are thread-safe and can be reused multiple times. However, as they encapsulate a JDBC connection, it is recommended to use different objects with different JDBC connections for different threads.


Constructor Summary
XQBridge(java.sql.Connection jdbcConn)
           
XQBridge(java.sql.Connection jdbcConn, java.lang.String confFile)
           
XQBridge(java.lang.String confFile)
           
 
Method Summary
 void close()
           
 java.sql.Connection getConnection()
          Returns the JDBC connection used to access the underlying database.
 Mapping getMapping(org.xml.sax.InputSource source)
          Deprecated. Prefer the string methods because they do not pose a problem for resolving relative URIs in mapping file schemaLocation attribute.
 Mapping getMapping(org.xml.sax.InputSource source, boolean reload)
          Deprecated. Prefer the string methods because they do not pose a problem for resolving relative URIs in mapping file schemaLocation attribute.
 Mapping getMapping(java.lang.String fileURI)
          Creates a mapping object containing the processed version of the specified mapping file.
 Mapping getMapping(java.lang.String fileURI, boolean reload)
          Creates a mapping object containing the processed version of the specified mapping file.
 java.lang.ClassLoader getMappingClassLoader()
          Returns the class loader used for loading mappings and user generators.
 XMLConnection getXMLConnection()
          Returns the XMLDBC connection used to execute XQuery statements over the database.
static void main(java.lang.String[] args)
          The method called from the command line to run the XQBridge as a standalone program.
 void setMappingClassLoader(java.lang.ClassLoader loader)
          Set the class loader used for loading mappings and user generators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XQBridge

public XQBridge(java.sql.Connection jdbcConn)

XQBridge

public XQBridge(java.lang.String confFile)

XQBridge

public XQBridge(java.sql.Connection jdbcConn,
                java.lang.String confFile)
Method Detail

getConnection

public java.sql.Connection getConnection()
Returns the JDBC connection used to access the underlying database. Returns null when no connection to the database is available.

Returns:
a JDBC connection

getXMLConnection

public XMLConnection getXMLConnection()
                               throws XMLDBCException
Returns the XMLDBC connection used to execute XQuery statements over the database.

Returns:
an XMLConnection object
Throws:
XMLDBCException

close

public void close()
           throws XMLDBCException
Throws:
XMLDBCException

setMappingClassLoader

public void setMappingClassLoader(java.lang.ClassLoader loader)
Set the class loader used for loading mappings and user generators.

Parameters:
loader - ClassLoader

getMappingClassLoader

public java.lang.ClassLoader getMappingClassLoader()
Returns the class loader used for loading mappings and user generators.


getMapping

public Mapping getMapping(org.xml.sax.InputSource source)
                   throws org.xml.sax.SAXException,
                          java.sql.SQLException,
                          java.io.IOException
Deprecated. Prefer the string methods because they do not pose a problem for resolving relative URIs in mapping file schemaLocation attribute.

Creates a mapping object containing the processed version of the specified mapping file. This object can subsequently be used to store XML documents in the database, according to the specified mapping.
The mapping file is specified as a SAX input source. If the systemId property of the input source is set, the object will first be looked up, based on this property, in the mapping cache, and only be created if not found.

Parameters:
source - a SAX input source encapsulating the mapping file.
Returns:
a Mapping object
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

getMapping

public Mapping getMapping(org.xml.sax.InputSource source,
                          boolean reload)
                   throws org.xml.sax.SAXException,
                          java.sql.SQLException,
                          java.io.IOException
Deprecated. Prefer the string methods because they do not pose a problem for resolving relative URIs in mapping file schemaLocation attribute.

Creates a mapping object containing the processed version of the specified mapping file. This object can subsequently be used to store XML documents in the database, according to the specified mapping.
The mapping file is specified as a SAX input source. If the systemId property of the input source is set, and the reload flag is false, the object will first be looked up, based on this property, in the mapping cache, and only be created if not found.

Parameters:
source - a SAX input source encapsulating the mapping file.
reload - true if the mapping file must be reloaded even if found in the cache.
Returns:
a Mapping object
Throws:
org.xml.sax.SAXException
java.sql.SQLException
java.io.IOException

getMapping

public Mapping getMapping(java.lang.String fileURI)
                   throws org.xml.sax.SAXException,
                          java.sql.SQLException,
                          java.io.IOException
Creates a mapping object containing the processed version of the specified mapping file. This object can subsequently be used to store XML documents in the database, according to the specified mapping.
the object will first be looked up, based on the file URI, in the mapping cache, and only be created if not found.

Parameters:
fileURI - the URI of the mapping file.
Returns:
a Mapping object
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

getMapping

public Mapping getMapping(java.lang.String fileURI,
                          boolean reload)
                   throws org.xml.sax.SAXException,
                          java.sql.SQLException,
                          java.io.IOException
Creates a mapping object containing the processed version of the specified mapping file. This object can subsequently be used to store XML documents in the database, according to the specified mapping.
If the reload flag is false, the object will first be looked up, based on the file URI, in the mapping cache, and only be created if not found.

Parameters:
fileURI - the URI of the mapping file.
reload - true if the mapping file must be reloaded even if found in the cache.
Returns:
a Mapping object
Throws:
org.xml.sax.SAXException
java.sql.SQLException
java.io.IOException

main

public static void main(java.lang.String[] args)
The method called from the command line to run the XQBridge as a standalone program. Use the -help option to display a list of available options.

Parameters:
args - the command line parameters


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