|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.base.resource.ResourceFactory
com.gargoylesoftware.base.resource.jdbc.JDBCResourceFactory
public class JDBCResourceFactory
A ResourceFactory for JDBC connections
Field Summary | |
---|---|
private java.lang.String |
databaseName_
|
private java.lang.String |
password_
|
private java.lang.String |
userName_
|
Constructor Summary | |
---|---|
JDBCResourceFactory(java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
Create the factory. |
|
JDBCResourceFactory(java.lang.String databaseName,
java.lang.String userName,
java.lang.String password,
boolean verifyThatConnectionCanBeOpened)
Create the factory. |
Method Summary | |
---|---|
protected java.sql.Connection |
allocateRealConnection(java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
Allocate a real database connection from the DriverManager |
private void |
ensureDatabaseCanBeOpened()
|
protected void |
freeRealConnection(java.sql.Connection connection)
Free a real database connection |
protected ManagedResource |
getResourceImpl(ResourceManager resourceManager)
Allocate a resource for the specified store |
boolean |
reinitializeResourceIfPossible(ManagedResource resource)
Reinitialize the resource to a known state. |
protected void |
releaseResourceImpl(ResourceManager resourceManager,
ManagedResource resource)
Release the specified resource. |
Methods inherited from class com.gargoylesoftware.base.resource.ResourceFactory |
---|
getResource, releaseAllResources, releaseResource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String databaseName_
private final java.lang.String userName_
private final java.lang.String password_
Constructor Detail |
---|
public JDBCResourceFactory(java.lang.String databaseName, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
databaseName
- The name of the databaseuserName
- The user id that we will use to connect to the databasepassword
- The password for the specified user
java.sql.SQLException
- If an error occurspublic JDBCResourceFactory(java.lang.String databaseName, java.lang.String userName, java.lang.String password, boolean verifyThatConnectionCanBeOpened) throws java.sql.SQLException
databaseName
- The name of the databaseuserName
- The user id that we will use to connect to the databasepassword
- The password for the specified userverifyThatConnectionCanBeOpened
- If true than one connection will
be immediately allocated and then freed from the specified database
java.sql.SQLException
- If an error occursMethod Detail |
---|
public boolean reinitializeResourceIfPossible(ManagedResource resource)
reinitializeResourceIfPossible
in class ResourceFactory
resource
- the resource to reinitialize
protected ManagedResource getResourceImpl(ResourceManager resourceManager) throws java.lang.Exception
getResourceImpl
in class ResourceFactory
resourceManager
- The resource manager that owns this factory
java.lang.Exception
- If an error occursprotected void releaseResourceImpl(ResourceManager resourceManager, ManagedResource resource) throws java.lang.Exception
releaseResourceImpl
in class ResourceFactory
resource
- The resource that we are releasingresourceManager
- The manager that is controlling this factory
java.lang.Exception
- If an error occursprotected final java.sql.Connection allocateRealConnection(java.lang.String databaseName, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
databaseName
- The name of the databaseuserName
- The user id that we will use to connect to the databasepassword
- The password for the specified user
java.sql.SQLException
- If an error occursprotected final void freeRealConnection(java.sql.Connection connection) throws java.sql.SQLException
connection
- The connection to release
java.sql.SQLException
- If an error occursprivate void ensureDatabaseCanBeOpened() throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |