org.xquark.mediator
Class Mediator

java.lang.Object
  extended byorg.xquark.mediator.Mediator
All Implemented Interfaces:
XMLDataSource

public class Mediator
extends java.lang.Object
implements XMLDataSource

This class represent the mediator as a source that can be accessed by xdbc.


Constructor Summary
Mediator()
           
Mediator(java.lang.String configURI)
          Initialize the mediator with a configuration file URI where wrappers location are defined.
 
Method Summary
 void addXDBCWrapper(java.lang.String name, java.lang.String driver, java.lang.String uri)
           
 void addXDBCWrapper(java.lang.String name, java.lang.String driver, java.lang.String uri, java.lang.String login, java.lang.String password)
           
 void addXDBCWrapper(java.lang.String name, XMLDataSource ds)
           
 void addXDBCWrapper(XDBCWrapper wrapper)
          Add a new Subaccessor in the mediator hashmap.
 XMLConnection getConnection()
          Attempts to establish a connection with the data source.
 XMLConnection getConnection(java.lang.String user, java.lang.String password)
          Attempts to establish a connection with the data source.
protected  org.xquark.xquery.metadata.MetaDataImpl getDataSourceMetaData(boolean refresh)
           
 int getLoginTimeout()
          Gets the maximum time in seconds that the object can wait when attempting to log in to a data source
 java.io.PrintWriter getLogWriter()
          Retrieves the log writer currently used by the XDataSource object to print messages.
 java.lang.String getName()
           
 java.lang.String getURL()
           
 XDBCWrapper getWrapper(java.lang.String name)
           
 java.util.Map getWrappers()
           
 void setLoginTimeout(int seconds)
          Sets the maximum time in seconds that the object will wait when attempting to log in to a data source.
 void setLogWriter(java.io.PrintWriter writer)
          Sets the logging/tracing java.io.PrintWriter object that is used by the XDataSource object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mediator

public Mediator()

Mediator

public Mediator(java.lang.String configURI)
         throws XMLDBCException
Initialize the mediator with a configuration file URI where wrappers location are defined.

Method Detail

getName

public java.lang.String getName()

getURL

public java.lang.String getURL()

addXDBCWrapper

public void addXDBCWrapper(XDBCWrapper wrapper)
                    throws XMLDBCException
Add a new Subaccessor in the mediator hashmap.

Throws:
XMLDBCException

addXDBCWrapper

public void addXDBCWrapper(java.lang.String name,
                           XMLDataSource ds)
                    throws XMLDBCException
Throws:
XMLDBCException

addXDBCWrapper

public void addXDBCWrapper(java.lang.String name,
                           java.lang.String driver,
                           java.lang.String uri)
                    throws XMLDBCException
Throws:
XMLDBCException

addXDBCWrapper

public void addXDBCWrapper(java.lang.String name,
                           java.lang.String driver,
                           java.lang.String uri,
                           java.lang.String login,
                           java.lang.String password)
                    throws XMLDBCException
Throws:
XMLDBCException

getWrappers

public java.util.Map getWrappers()

getWrapper

public XDBCWrapper getWrapper(java.lang.String name)

getDataSourceMetaData

protected org.xquark.xquery.metadata.MetaDataImpl getDataSourceMetaData(boolean refresh)
                                                                 throws XMLDBCException
Throws:
XMLDBCException

getConnection

public XMLConnection getConnection()
                            throws XMLDBCException
Attempts to establish a connection with the data source.

Specified by:
getConnection in interface XMLDataSource
Returns:
an XMLConnection object that represents a connection to the data source
Throws:
XMLDBCException - If a data source access error occurs

getConnection

public XMLConnection getConnection(java.lang.String user,
                                   java.lang.String password)
                            throws XMLDBCException
Attempts to establish a connection with the data source.

Specified by:
getConnection in interface XMLDataSource
Parameters:
user - the data source registered user
password - the user's password
Returns:
an XMLConnection object that represents a connection to the data source
Throws:
XMLDBCException - If a data source access error occurs

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
Sets the logging/tracing java.io.PrintWriter object that is used by the XDataSource object.

Specified by:
setLogWriter in interface XMLDataSource
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 log writer currently used by the XDataSource object to print messages.

Specified by:
getLogWriter in interface XMLDataSource
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 the object will wait when attempting to log in to a data source. Setting the timeout to 0 will disable it.

Specified by:
setLoginTimeout in interface XMLDataSource
Parameters:
seconds - the login time limit in seconds

getLoginTimeout

public int getLoginTimeout()
Gets the maximum time in seconds that the object can wait when attempting to log in to a data source

Specified by:
getLoginTimeout in interface XMLDataSource
Returns:
the data source login timeout in seconds, 0 if no timeout is defined


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