gov.sns.tools.logbook
Class ElogUtility

java.lang.Object
  |
  +--gov.sns.tools.logbook.ElogUtility

public class ElogUtility
extends java.lang.Object

ElogUtility provides convenience methods for interacting with the Elog database.


Field Summary
protected  java.sql.Connection _connection
          database connection
protected  ConnectionDictionary _connectionDictionary
          connection dictionary
protected  DatabaseAdaptor _databaseAdaptor
          database adaptor
protected  java.sql.CallableStatement _postEntry
          Stored procedure for posting an Elog entry
 
Constructor Summary
ElogUtility(ConnectionDictionary dictionary)
          ElogUtility constructor Uses the default database adaptor.
ElogUtility(DatabaseAdaptor adaptor, ConnectionDictionary dictionary)
          ElogUtility constructor
 
Method Summary
static ElogUtility defaultUtility()
          Get the default elog utility which uses the default connection dictionary and the default database adaptor.
 void postEntry(java.lang.String logbook, java.lang.String title, java.lang.String content)
          Post an entry to a logbook using the account of the user logged in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_connection

protected java.sql.Connection _connection
database connection


_connectionDictionary

protected ConnectionDictionary _connectionDictionary
connection dictionary


_databaseAdaptor

protected DatabaseAdaptor _databaseAdaptor
database adaptor


_postEntry

protected java.sql.CallableStatement _postEntry
Stored procedure for posting an Elog entry

Constructor Detail

ElogUtility

public ElogUtility(ConnectionDictionary dictionary)
            throws DatabaseException
ElogUtility constructor Uses the default database adaptor.

Parameters:
dictionary - The connection dictionary.
Throws:
DatabaseException - if an exception occurs while connecting to the database

ElogUtility

public ElogUtility(DatabaseAdaptor adaptor,
                   ConnectionDictionary dictionary)
            throws DatabaseException
ElogUtility constructor

Parameters:
adaptor - The database adaptor to use
dictionary - The connection dictionary.
Throws:
DatabaseException - if an exception occurs while connecting to the database
Method Detail

defaultUtility

public static ElogUtility defaultUtility()
                                  throws DatabaseException
Get the default elog utility which uses the default connection dictionary and the default database adaptor.

Returns:
The elog utility if the default connection dictionary exists and null if the connection dictionary cannot be found
Throws:
DatabaseException - if an exception occurs while connecting to the database
See Also:
ConnectionDictionary.defaultDictionary()

postEntry

public void postEntry(java.lang.String logbook,
                      java.lang.String title,
                      java.lang.String content)
               throws DatabaseException
Post an entry to a logbook using the account of the user logged in.

Parameters:
logbook - The name of the logbook to which we are posting the entry
title - The title of the entry to post
content - The content of the entry to post
Throws:
DatabaseException - if a database exception occurs while posting an entry