org.xquark.xml.xdbc
Class XMLDriverManager

java.lang.Object
  |
  +--org.xquark.xml.xdbc.XMLDriverManager

public class XMLDriverManager
extends java.lang.Object

This class is used for managing a set of drivers and/or connections.


Method Summary
static void deregisterDriver(XMLDriver driver)
          Removes the specified driver from the driver manager list.
static XMLConnection getConnection(java.lang.String uri)
          Attempts to establish a connection to the given data source URI.
static XMLConnection getConnection(java.lang.String uri, java.lang.String user, java.lang.String password)
          Attempts to establish a connection to the given data source URI with a login/password.
static XMLDataSource getDataSource(java.lang.String uri)
          Returns a handle to a data source with the specified URI.
static XMLDataSource getDataSource(java.lang.String uri, java.lang.String user, java.lang.String password)
          Returns a handle to a data source with the specified URI.
static XMLDriver getDriver(java.lang.String uri)
          Attempts to locate a driver that understands the given URI.
static java.util.Iterator getDrivers()
          Returns an iterator on registered XMLDBC drivers.
 int getLoginTimeout()
          Gets the maximum time in seconds that all data source objects obtained from the manager can wait when attempting to log in to a data source
 java.io.PrintWriter getLogWriter()
          Retrieves the default log writer currently used by all data source objects obtained from the manager.
static void registerDriver(XMLDriver driver)
          Adds the given driver in the driver manager list.
 void setLoginTimeout(int seconds)
          Sets the maximum time in seconds that all data source objects obtained from the manager will wait when attempting to log in to a data source.
static void setLogWriter(java.io.PrintWriter writer)
          Sets the default logging/tracing java.io.PrintWriter object that is used by all data source objects obtained from the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDriver

public static XMLDriver getDriver(java.lang.String uri)
                           throws XMLDBCException
Attempts to locate a driver that understands the given URI.

Parameters:
uri - an URI corresponding to an existing driver.
Returns:
a driver that understands the given URI.
Throws:
XMLDBCException - if a data source access error occurs.

getConnection

public static XMLConnection getConnection(java.lang.String uri)
                                   throws XMLDBCException
Attempts to establish a connection to the given data source URI.

Parameters:
uri - an URI corresponding to an existing driver.
Returns:
a connection to the data source.
Throws:
XMLDBCException - if a data source access error occurs.

getConnection

public static XMLConnection getConnection(java.lang.String uri,
                                          java.lang.String user,
                                          java.lang.String password)
                                   throws XMLDBCException
Attempts to establish a connection to the given data source URI with a login/password.

Parameters:
uri - an URI corresponding to an existing driver.
user - a login to access data source account.
password - a password to access data source account.
Returns:
a connection to the data source.
Throws:
XMLDBCException - if a data source access error occurs.

getDataSource

public static XMLDataSource getDataSource(java.lang.String uri)
                                   throws XMLDBCException
Returns a handle to a data source with the specified URI.

Parameters:
uri - an URI corresponding to a data source.
Returns:
an instance of the specified data source, or null if the driver does not know this type of data source
Throws:
XMLDBCException - if a data source access error occurs.

getDataSource

public static XMLDataSource getDataSource(java.lang.String uri,
                                          java.lang.String user,
                                          java.lang.String password)
                                   throws XMLDBCException
Returns a handle to a data source with the specified URI.

Parameters:
uri - a URI corresponding to a data source.
user - a user name
password - a user password
Returns:
an instance of the specified data source, or null if the driver does not know this type of data source
Throws:
XMLDBCException - if a data source access error occurs.

setLogWriter

public static void setLogWriter(java.io.PrintWriter writer)
Sets the default logging/tracing java.io.PrintWriter object that is used by all data source objects obtained from the manager.

Parameters:
writer - the new logging/tracing java.io.PrintWriter object, or null to disable logging and tracing

getLogWriter

public java.io.PrintWriter getLogWriter()
Retrieves the default log writer currently used by all data source objects obtained from the manager.

Returns:
the java.io.PrintWriter object used to log data source messages, or null if none is defined

setLoginTimeout

public void setLoginTimeout(int seconds)
Sets the maximum time in seconds that all data source objects obtained from the manager will wait when attempting to log in to a data source. Setting the timeout to 0 will disable it.

Parameters:
seconds - The login time limit in seconds

getLoginTimeout

public int getLoginTimeout()
Gets the maximum time in seconds that all data source objects obtained from the manager can wait when attempting to log in to a data source

Returns:
the data source login timeout in seconds, 0 if no timeout is defined

registerDriver

public static void registerDriver(XMLDriver driver)
Adds the given driver in the driver manager list.

Parameters:
driver - the new XMLDBC driver that must be registered with the driver manager.

deregisterDriver

public static void deregisterDriver(XMLDriver driver)
Removes the specified driver from the driver manager list.

Parameters:
driver - the XMLDBC driver that must be dropped from the driver manager.

getDrivers

public static java.util.Iterator getDrivers()
Returns an iterator on registered XMLDBC drivers.

Returns:
an enumeration of XMLDBC drivers.


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