uk.ac.ebi.intact.persistence
Interface DAOSource

All Known Implementing Classes:
ObjectBridgeDAOSource

public interface DAOSource

This interface defines the functionality usually provided by a specific data source, eg Castor, oracle etc. In particular it allows clients to obtain a Data Access Object (a connection rather than object-specific DAOs). Note that only what might be termed "common" persistence layer methods are presently included.

Author:
Chris Lewington

Method Summary
 java.lang.ClassLoader getClassLoader()
           
 java.lang.String getConfig()
           
 DAO getDAO()
          This method returns a connection to the data source.
 DAO getDAO(java.lang.String user, java.lang.String password)
          Returns a connection made using the specified user details.
 java.lang.String getDataSourceName()
           
 org.apache.log4j.Logger getLogger()
          Returns the log destination being used for this data source
 java.lang.String getPassword()
           
 java.lang.String getUser()
           
 boolean isAutoSaveSet()
           
 void setAutoSave(boolean val)
          Defines whether or not data are saved automatically
 void setConfig(java.util.Map configFiles)
          sets the configuration data for the data source.
 void setLogger(org.apache.log4j.Logger logger)
          allows a logging destination to be specified
 void setPassword(java.lang.String password)
          Used to define a password which overrides any default supplied via config data.
 void setUser(java.lang.String user)
          Used to specify a user for connecting to the persistent store.
 

Method Detail

setConfig

public void setConfig(java.util.Map configFiles)
               throws DataSourceException

sets the configuration data for the data source. If configuration fails then an exception is thrown back to the caller.

Parameters:
configFiles - - the collection of configuration files to be used
Throws:
DataSourceException - - thrown if there are configuration problems

setUser

public void setUser(java.lang.String user)
Used to specify a user for connecting to the persistent store. If this method is not used, default user details will be obtained from details supplied in the setConfig method (eg from a supplied config file).

Parameters:
user - the username to use for connection (overrides any default)

getUser

public java.lang.String getUser()

setPassword

public void setPassword(java.lang.String password)
Used to define a password which overrides any default supplied via config data. Should typically be used in conjunction with the setUser method for consistency.

Parameters:
password - the password to be used for persistent store connection.

getPassword

public java.lang.String getPassword()

getDAO

public DAO getDAO()
           throws DataSourceException
This method returns a connection to the data source.

Returns:
a Data Access Object (ie a connection)
Throws:
DataSourceException - - thrown if a DAO cannot be obtained

getDAO

public DAO getDAO(java.lang.String user,
                  java.lang.String password)
           throws DataSourceException
Returns a connection made using the specified user details. Note that if either a null username is supplied, or a connection could not be made with the supplied details, then a default connection will be attempted.

Parameters:
user - username to make a connection with
password - the user's password (null values are allowed)
Returns:
a Data Access Object
Throws:
DataSourceException - - thrown if a DAO cannot be obtained

getDataSourceName

public java.lang.String getDataSourceName()
Returns:
the name of the data source (as per configuration)

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns:
The class loader used to load the data source

getConfig

public java.lang.String getConfig()
Returns:
the configuration information about the data source

setAutoSave

public void setAutoSave(boolean val)
Defines whether or not data are saved automatically


isAutoSaveSet

public boolean isAutoSaveSet()
Returns:
true if data are set to be saved automatically, false otherwise

setLogger

public void setLogger(org.apache.log4j.Logger logger)
allows a logging destination to be specified

Parameters:
logger - A log4j Logger for logging output

getLogger

public org.apache.log4j.Logger getLogger()
Returns the log destination being used for this data source

Returns:
PrintWriter a destination log interface


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk