Arch4J 1.1

org.arch4j.dataaccess
Class DataAccessProvider

java.lang.Object
  |
  +--org.arch4j.dataaccess.DataAccessProvider

public class DataAccessProvider
extends Object

This class is the main service provider for data access services. The services are accessed via the static getProvider() method.

Version:
1.1
Author:
Arch4J Team

Constructor Summary
protected DataAccessProvider()
           
 
Method Summary
 DatabaseManager getDefaultManager()
          Create a DatabaseManager for data access.
 TransactionalDatabaseManager getDefaultTransactionalManager()
          Create a TransactionalDatabaseManager for data access.
 DatabaseManager getManagerFor(String logicalName)
          Create a DatabaseManager for data access.
 DatabaseManager getManagerFor(String logicalName, String dataSourceLookupName)
           
 DatabaseManager getManagerFor(String logicalName, String username, String password)
          Deprecated. Use other getDefaultManager constructor.
static DataAccessProvider getProvider()
           
 TransactionalDatabaseManager getTransactionalManagerFor(String logicalName)
          Create a TransactionalDatabaseManager for data access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataAccessProvider

protected DataAccessProvider()
Method Detail

getProvider

public static DataAccessProvider getProvider()
Returns:
The single instance of the DataAccessProvider.

getDefaultManager

public DatabaseManager getDefaultManager()
                                  throws DataAccessException
Create a DatabaseManager for data access. The logical database name to use is specified as the default connection property in the dataaccess.properties file.

Note: The property keys for the default connection is:

 defaultConnection
 

Returns:
A DatabaseManager instance to use for data access.
Throws:
DataAccessException - Thrown when there is a problem accessing the database.

getManagerFor

public DatabaseManager getManagerFor(String logicalName)
                              throws DataAccessException
Create a DatabaseManager for data access. The connection can be retreived from the Driver Manager and from a datasource. Map the given logical name for the database to the physical connection specification by looking in the dataaccess.properties file.

Note: The property keys used for the connection specification are summarized below. For example, if the logical name is myDatabase, the property keys used are:

These are the properties required for getting a connection from a Driver
 myDatabase.driver
 myDatabase.url
 myDatabase.username
 myDatabase.password
 myDatabase.useArch4JPool
 
The useArch4JPool is required to be set to true only if you want to use the connection pooling implementation of Arch4J. Is you are using a connection pool in a appserver world and the pooling is implemented by the driver then useArch4JPool is not required
These are the properties required for getting a connection from a Datasource
 myDatabase.dataSourceLookupName
 myDatabase.useArch4JPool
 
useArch4JPool is not required if you are not requiring the connection pooling implementation of Arch4J.

Parameters:
logicalName - The name to use for the connection mapping.
Returns:
A DatabaseManager instance to use for data access.
DataAccessException

getManagerFor

public DatabaseManager getManagerFor(String logicalName,
                                     String username,
                                     String password)
                              throws DataAccessException
Deprecated. Use other getDefaultManager constructor.

Create a DatabaseManager for data access. Map the given logical name for the database to the physical connection specification by looking in the dataaccess.properties file.

Note: The property keys used for the connection specification are summarized below. For example, if the logical name is myDatabase, the property keys used are:

 myDatabase.driver
 myDatabase.url
 myDatabase.useArch4JPool
 
The useArch4JPool is required to be set to true only if you want to use the connection pooling implementation of Arch4J. Is you are using a connection pool in a appserver world and the pooling is implemented by the driver then useArch4JPool is not required

Parameters:
logicalName - The name to use for the connection mapping.
username - The database user on whose behalf the connection is being made.
password - The user's password.
Returns:
A DatabaseManager instance to use for data access.
Throws:
DataAccessException - Thrown when there is a problem accessing the database.

getManagerFor

public DatabaseManager getManagerFor(String logicalName,
                                     String dataSourceLookupName)
                              throws DataAccessException
DataAccessException

getDefaultTransactionalManager

public TransactionalDatabaseManager getDefaultTransactionalManager()
                                                            throws DataAccessException
Create a TransactionalDatabaseManager for data access. Each instance is a singleton within the thread it is requested by. The logical database name to use is specified as the default connection property in the dataaccess.properties file.

Note: The property keys for the default connection is:

 defaultConnection
 

Returns:
A DatabaseManager instance to use for data access.
Throws:
DataAccessException - Thrown when there is a problem accessing the database.

getTransactionalManagerFor

public TransactionalDatabaseManager getTransactionalManagerFor(String logicalName)
                                                        throws DataAccessException
Create a TransactionalDatabaseManager for data access. Each calling into instances of this class can orchestrate a transaction. This allows for seperate transactions within a multi-threaded environment such as a Servlet engine. The connection can be retreived from the Driver Manager and from a datasource. Map the given logical name for the database to the physical connection specification by looking in the dataaccess.properties file.

Note: The property keys used for the connection specification are summarized below. For example, if the logical name is myDatabase, the property keys used are:

These are the properties required for getting a connection from a Driver
 myDatabase.driver
 myDatabase.url
 myDatabase.username
 myDatabase.password
 myDatabase.useArch4JPool
 
The useArch4JPool is required to be set to true only if you want to use the connection pooling implementation of Arch4J. Is you are using a connection pool in a appserver world and the pooling is implemented by the driver then useArch4JPool is not required
These are the properties required for getting a connection from a Datasource
 myDatabase.dataSourceLookupName
 myDatabase.useArch4JPool
 
useArch4JPool is not required if you are not requiring the connection pooling implementation of Arch4J.

Parameters:
logicalName - The name to use for the connection mapping.
Returns:
A DatabaseManager instance to use for data access.
DataAccessException

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.