dk.netarkivet.archive.arcrepositoryadmin
Class ArchiveDBConnection

java.lang.Object
  extended by dk.netarkivet.archive.arcrepositoryadmin.ArchiveDBConnection

public final class ArchiveDBConnection
extends java.lang.Object

This class handles connections to the Archive database The statements to create the tables are in scripts/sql/createBitpreservationDB.sql The implementation relies on a connection pool. Once acquired through the get() method, a connection must be explicitly returned to the pool by calling the release(Connection) method. THis class is intended to be used statically, and hence cannot be instantiated and is final.


Method Summary
static void cleanup()
          Closes the underlying data source.
static java.sql.Connection get()
          Get a connection to the harvest definition database from the pool.
static java.lang.String getArchiveUrl()
          Method for retrieving the url for the archive database.
static void release(java.sql.Connection connection)
          Helper method to return a connection to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static java.sql.Connection get()
Get a connection to the harvest definition database from the pool. The pool is configured via the following configuration properties: Note that the connection obtained must be returned to the pool by calling release(Connection).

Returns:
a connection to the harvest definition database
Throws:
IOFailure - if we cannot connect to the database (or find the driver).

cleanup

public static void cleanup()
Closes the underlying data source.


release

public static void release(java.sql.Connection connection)
Helper method to return a connection to the pool.

Parameters:
connection - a connection

getArchiveUrl

public static java.lang.String getArchiveUrl()
Method for retrieving the url for the archive database. This url will be constructed from the base-url, the machine, the port and the directory.

Returns:
The url for the archive database.