|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.config.AbstractBasicResourceManager org.deegree.commons.jdbc.ConnectionManager
public class ConnectionManager
Entry point for accessing JDBC connections in deegree that are defined in JDBC configuration files.
Configuration of JDBC connections used in deegree is based on simple string identifiers: each configured JDBC connection has a unique identifier. This class allows the retrieval of connections based on their identifier.
Nested Class Summary | |
---|---|
static class |
ConnectionManager.Type
|
Field Summary |
---|
Fields inherited from class org.deegree.commons.config.AbstractBasicResourceManager |
---|
dir, idToState, workspace |
Constructor Summary | |
---|---|
ConnectionManager()
|
Method Summary | |
---|---|
ResourceState |
activate(String id)
Activates the resource with the given identifier. |
static void |
addConnection(JDBCConnection jaxbConn,
String connId)
Adds a connection pool from the given pool definition. |
static void |
addConnection(String connId,
String url,
String user,
String password,
int poolMinSize,
int poolMaxSize)
Adds a connection pool as specified in the parameters. |
static void |
addConnection(URL jdbcConfigUrl,
String connId,
DeegreeWorkspace workspace)
Adds the connection pool defined in the given file. |
ResourceState |
deactivate(String id)
Deactivates the resource with the given identifier. |
ResourceState |
deleteResource(String id)
Removes the specified resource and deletes the corresponding configuration file. |
static void |
destroy(String connid)
|
Connection |
get(String id)
Returns a connection from the connection pool with the given id. |
String |
getConfigNamespace()
Returns the namespace for configuration documents that this provider handles. |
URL |
getConfigSchema()
Returns the URL for retrieving the configuration document schema. |
static Connection |
getConnection(String id)
Returns a connection from the connection pool with the given id. |
static Set<String> |
getConnectionIds()
|
Class<? extends ResourceManager>[] |
getDependencies()
|
ResourceManagerMetadata |
getMetadata()
|
protected ResourceProvider |
getProvider(File file)
|
ConnectionManager.Type |
getType(String id)
|
void |
init(File jdbcDir,
DeegreeWorkspace workspace)
Initializes the ConnectionManager by loading all JDBC pool configurations from the given directory. |
static void |
invalidate(String id,
Connection conn)
Invalidates a broken Connection to avoid its re-use. |
protected void |
remove(String id)
|
void |
shutdown()
Is called upon workspace shutdown. |
void |
startup(DeegreeWorkspace workspace)
Is called upon workspace startup. |
Methods inherited from class org.deegree.commons.config.AbstractBasicResourceManager |
---|
createResource, getState, getStates, init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionManager()
Method Detail |
---|
public void init(File jdbcDir, DeegreeWorkspace workspace)
ConnectionManager
by loading all JDBC pool configurations from the given directory.
jdbcDir
- public static void destroy(String connid)
public ConnectionManager.Type getType(String id)
id
-
public Connection get(String id)
id
- id of the connection pool
public static Connection getConnection(String id) throws SQLException
id
- id of the connection pool
SQLException
- if the connection pool is unknown or a SQLException occurs creating the connectionpublic static void invalidate(String id, Connection conn) throws Exception
Connection
to avoid its re-use.
id
- connection pool id, must not be null
conn
- connection, must not be null
Exception
public static void addConnection(URL jdbcConfigUrl, String connId, DeegreeWorkspace workspace) throws JAXBException
jdbcConfigUrl
- connId
- workspace
- can be null
JAXBException
public static void addConnection(JDBCConnection jaxbConn, String connId)
jaxbConn
- connId
- public static void addConnection(String connId, String url, String user, String password, int poolMinSize, int poolMaxSize)
connId
- url
- user
- password
- poolMinSize
- poolMaxSize
- public static Set<String> getConnectionIds()
public void shutdown()
ResourceManager
shutdown
in interface ResourceManager
public void startup(DeegreeWorkspace workspace)
ResourceManager
startup
in interface ResourceManager
public Class<? extends ResourceManager>[] getDependencies()
getDependencies
in interface ResourceManager
public ResourceManagerMetadata getMetadata()
getMetadata
in interface ResourceManager
public String getConfigNamespace()
ResourceProvider
getConfigNamespace
in interface ResourceProvider
null
public URL getConfigSchema()
ResourceProvider
getConfigSchema
in interface ResourceProvider
null
public ResourceState deleteResource(String id)
ResourceManager
deleteResource
in interface ResourceManager
deleteResource
in class AbstractBasicResourceManager
id
- resource identifier, must not be null
null
(if not, deletion failed)protected void remove(String id)
remove
in class AbstractBasicResourceManager
public ResourceState activate(String id)
ResourceManager
activate
in interface ResourceManager
id
- resource identifier, must not be null
null
public ResourceState deactivate(String id)
ResourceManager
deactivate
in interface ResourceManager
id
- resource identifier, must not be null
null
protected ResourceProvider getProvider(File file)
getProvider
in class AbstractBasicResourceManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |