Connection Managers

Data resources are exposed by OGSA-DAI via the use of connection managers. A connection manager is a Java object which manages a connection to, and interactions with, a data resource.

Connection managers are configured via information within the dataResource element of a data resource configuration document (which we described here).

This configuration information includes the database driver classname, the location of the data resource and also specification of the connection manager class.

The primary task of a connection manager is to manage the connection to its underlying data resource. However, advanced implementations may also offer additional facilities such as connection pooling and metadata queries.

The sole contract of a connection manager class is that it must sub-class the abstract class uk.org.ogsadai.dataresource.ConnectionManager. This class has no abstract methods, so the methods provided by the implementation may be chosen arbitrarily. These methods may be invoked by any compatible activity implementation class. The handle on the connection manager object can be obtained by activities by calling the getDataResource() method on a ActivityContext object.

Example Connection Managers

OGSA-DAI provides the following connection managers which you can use as-is or customise:

Name File System Connection Manager
Implementation Class uk.org.ogsadai.dataresource.conx.FileSystemConnectionManager
Source File OGSA-DAI/src/java/core/uk/org/ogsadai/dataresource/conx/FileSystemConnectionManager.java
Description Manages access to files in a file system.

This connection manager exposes two methods, getPath() and getDirectory(), which enable activities to access the top-level directory in the file system within which files may be accessed.

The method getFile(String) can be used to obtain a handle on a file with a given path relative to the top-level directory. This method also verifies that the path does not attempt to go outside the top-level directory's directory hierarchy, for example by referring to the .. directory. Several additional utility methods are also provided for use by activities wishing to access files in a file system.


Name Simple JDBC Connection Manager
Implementation Class uk.org.ogsadai.dataresource.conx.SimpleJDBCConnectionManager
Source File OGSA-DAI/src/java/core/uk/org/ogsadai/dataresource/conx/SimpleJDBCConnectionManager.java
Description This connection manager provides methods to obtain and relinquish connections to a relational database. This implementation does not implement advanced functions such as connection pooling.

Name Simple JDBC Connection Manager for Apache Derby
Implementation Class uk.org.ogsadai.dataresource.conx.SimpleJDBCConnectionManagerDerby
Source File OGSA-DAI/src/java/core/uk/org/ogsadai/dataresource/conx/SimpleJDBCConnectionManagerDerby.java
Description This connection manager is an extension of the Simple JDBC Connection Manager and returns connections in a "Derby-specific" manner, making databases available to other threads/jvms. NOTE: OGSA-DAI does not provide support for Apache Derby, although it is a tested platform. Support is planned when Derby emerges from the incubator phase of the Apache process.

Name XML:DB Connection Manager
Implementation Class uk.org.ogsadai.dataresource.conx.XMLDBConnectionManager
Source File OGSA-DAI/src/java/core/uk/org/ogsadai/dataresource/conx/XMLDBConnectionManager.java
Description This connection managerprovides methods to obtain and relinquish collections.