org.xquark.mediator
Class MediatorConnection

java.lang.Object
  extended byorg.xquark.xml.xdbc.DefaultReadOnlyXMLConnection
      extended byorg.xquark.mediator.MediatorConnection
All Implemented Interfaces:
XMLConnection

public class MediatorConnection
extends DefaultReadOnlyXMLConnection
implements XMLConnection

This class implements the interface that represents a connection with a specific XML data source. Within the context of an XMLConnection, XQuery or XPath statements are executed and XML results are returned.
This interface is used by both read-only connections and storage connections, which require access to a larger set of interfaces, such as interfaces representing XML collections and documents. Classes providing read-only access to XML data sources can avoid implementing the optional interfaces for XML storage management, by deriving from the abstract class DefautReadOnlyXMLConnection.


Field Summary
 
Fields inherited from interface org.xquark.xml.xdbc.XMLConnection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE, XPATH_STRING_TYPE, XQUERY_STRING_TYPE
 
Method Summary
 void close()
          To close the current data source connection.
 XMLStatement createStatement()
          Creates a statement object for sending XQuery (query type by default) statements to the data source.
 XMLStatement createStatement(short queryType)
          Creates a statement object for sending XQuery or XPath (according to the specified type) statements to the data source.
 Mediator getMediator()
           
 XMLDataSourceMetaData getMetaData()
          Gets the metadata regarding this connection's data source.
 XMLDataSourceMetaData getMetaData(boolean refresh)
          Gets the metadata regarding this connection's data source.
 java.lang.String getURL()
          To get the current URL of this connection.
 java.lang.String getUserName()
          To get the current user name.
 boolean isClosed()
          To know the connection state (opened or closed).
 void loadModule(java.lang.String moduleURL)
           
 void loadSchema(org.xml.sax.InputSource source)
           
 PreparedXMLStatement prepareStatement(java.lang.String query)
          Creates a prepared statement object for sending parameterized XQuery (query type by default) statements to the data source.
 void setBaseURI(java.lang.String baseURI)
          Sets the base URI for documents.
 
Methods inherited from class org.xquark.xml.xdbc.DefaultReadOnlyXMLConnection
commit, createCollection, createCollectionConfig, deleteAllCollections, deleteCollection, getAutoCommit, getCollection, getTransactionIsolation, isReadOnly, renameCollection, rollback, setAutoCommit, setReadOnly, setTransactionIsolation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xquark.xml.xdbc.XMLConnection
commit, createCollection, createCollectionConfig, deleteAllCollections, deleteCollection, getAutoCommit, getCollection, getTransactionIsolation, isReadOnly, renameCollection, rollback, setAutoCommit, setReadOnly, setTransactionIsolation
 

Method Detail

getMediator

public Mediator getMediator()

close

public void close()
           throws XMLDBCException
To close the current data source connection.

Specified by:
close in interface XMLConnection
Throws:
XMLDBCException - if a data source access error occurs.

isClosed

public boolean isClosed()
                 throws XMLDBCException
To know the connection state (opened or closed).

Specified by:
isClosed in interface XMLConnection
Returns:
true if the current connection is closed, else false.
Throws:
XMLDBCException - if a data source access error occurs.

getMetaData

public XMLDataSourceMetaData getMetaData()
                                  throws XMLDBCException
Gets the metadata regarding this connection's data source. A connection's data source is able to provide information describing itself.

Specified by:
getMetaData in interface XMLConnection
Returns:
an XMLDataSourceMetaData object for this connection.
Throws:
XMLDBCException - if a data source access error occurs.

getMetaData

public XMLDataSourceMetaData getMetaData(boolean refresh)
                                  throws XMLDBCException
Gets the metadata regarding this connection's data source. A connection's data source is able to provide information describing itself.

Specified by:
getMetaData in interface XMLConnection
Parameters:
refresh - when it is true, reload metadata.
Returns:
an XMLDataSourceMetaData object for this connection.
Throws:
XMLDBCException - if a data source access error occurs.

getUserName

public java.lang.String getUserName()
                             throws XMLDBCException
To get the current user name.

Specified by:
getUserName in interface XMLConnection
Returns:
the current user name.
Throws:
XMLDBCException - if a data source access error occurs.

getURL

public java.lang.String getURL()
                        throws XMLDBCException
To get the current URL of this connection.

Specified by:
getURL in interface XMLConnection
Returns:
the current URL of this connection.
Throws:
XMLDBCException - if a data source access error occurs.

createStatement

public XMLStatement createStatement()
                             throws XMLDBCException
Creates a statement object for sending XQuery (query type by default) statements to the data source.

Specified by:
createStatement in interface XMLConnection
Returns:
a new statement.
Throws:
XMLDBCException - if a data source access error occurs.

createStatement

public XMLStatement createStatement(short queryType)
                             throws XMLDBCException
Creates a statement object for sending XQuery or XPath (according to the specified type) statements to the data source.

Specified by:
createStatement in interface XMLConnection
Parameters:
queryType - the type of query for this statement (see constants in this interface).
Returns:
a new statement.
Throws:
XMLDBCException - if a data source access error occurs.

prepareStatement

public PreparedXMLStatement prepareStatement(java.lang.String query)
                                      throws XMLDBCException,
                                             XMLDBCNotSupportedException
Creates a prepared statement object for sending parameterized XQuery (query type by default) statements to the data source. The advantage of prepared statements over statements is that the request may be precompiled once and executed several times. Note: this interface is optional.

Specified by:
prepareStatement in interface XMLConnection
Parameters:
query - a parameterized XQuery.
Returns:
a new prepared statement containing the pre-compiled statement.
Throws:
XMLDBCException - if a data source access error occurs.
XMLDBCNotSupportedException - if the method is not supported.

loadModule

public void loadModule(java.lang.String moduleURL)
                throws XMLDBCException
Throws:
XMLDBCException

loadSchema

public void loadSchema(org.xml.sax.InputSource source)
                throws org.xml.sax.SAXException,
                       XMLDBCException
Throws:
org.xml.sax.SAXException
XMLDBCException

setBaseURI

public void setBaseURI(java.lang.String baseURI)
Description copied from interface: XMLConnection
Sets the base URI for documents.

Specified by:
setBaseURI in interface XMLConnection
Returns:
nothing


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