Methods Summary |
---|
private void | checkAndDeletePool(com.sun.enterprise.config.serverbeans.JdbcResource cr)Checks if no more resource-refs to resources exists for the
JDBC connection pool and then deletes the pool
String poolName = cr.getPoolName();
Resources res = (Resources) cr.parent();
try {
boolean poolReferred =
ResourcesUtil.createInstance().isJdbcPoolReferredInServerInstance(poolName);
if (!poolReferred) {
_logger.fine("Deleting JDBC pool " + poolName + "as there is no more " +
"resource-refs to the pool in this server instance");
com.sun.enterprise.config.serverbeans.JdbcConnectionPool jcp
= res.getJdbcConnectionPoolByName(poolName);
//Delete/Undeploy Pool
JdbcConnectionPoolDeployer deployer =
new JdbcConnectionPoolDeployer();
deployer.actualUndeployResource(jcp);
}
} catch (ConfigException ce) {
_logger.warning(ce.getMessage());
_logger.fine("Exception while deleting pool : " + ce );
throw ce;
}
|
public synchronized void | deployResource(java.lang.Object resource)Deploy the resource into the server's runtime naming context
com.sun.enterprise.config.serverbeans.JdbcResource jdbcRes =
(com.sun.enterprise.config.serverbeans.JdbcResource) resource;
if (jdbcRes.isEnabled()) {
String jndiName = jdbcRes.getJndiName();
String poolName = jdbcRes.getPoolName();
// loads dependent jdbc connection pool if not loaded
loadPool(jdbcRes);
ManagementObjectManager mgr = Switch.getSwitch().getManagementObjectManager();
mgr.registerJDBCResource( jndiName );
ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
runtime.createConnectorResource( jndiName, poolName, null);
runtime.createConnectorResource( getPMJndiName( jndiName),
poolName, null);
_logger.finest("deployed resource " + jndiName );
} else {
_logger.log(Level.INFO, "core.resource_disabled",
new Object[] {jdbcRes.getJndiName(),
IASJ2EEResourceFactoryImpl.JDBC_RES_TYPE});
}
|
public synchronized void | disableResource(java.lang.Object resource)Disable the resource in the server's runtime naming context
undeployResource(resource);
|
public synchronized void | enableResource(java.lang.Object resource)Enable the resource in the server's runtime naming context
deployResource(resource);
|
private java.lang.String | getPMJndiName(java.lang.String jndiName)
return jndiName + PM_JNDI_EXTENSION;
|
public java.lang.Object | getResource(java.lang.String name, com.sun.enterprise.config.serverbeans.Resources rbeans)Utility method to find a resource from Resources beans and converte
it to a resource object to be used by the implemented ResourceDeployer
Object res = rbeans.getJdbcResourceByJndiName(name);
if (res == null) {
String msg = localStrings.getString("resource.no_resource",name);
throw new Exception(msg);
}
return res;
|
private void | loadPool(com.sun.enterprise.config.serverbeans.JdbcResource jr)
String poolName = jr.getPoolName();
Resources resources = (Resources) jr.parent();
ConfigBean cb = resources.getJdbcConnectionPoolByName(poolName);
if (cb != null) {
try {
InitialContext ic = new InitialContext();
ic.lookup(ConnectorAdminServiceUtils.
getReservePrefixedJNDINameForPool(poolName));
} catch (Exception e) {
// pool is not loaded
JdbcConnectionPoolDeployer deployer =
new JdbcConnectionPoolDeployer();
deployer.actualDeployResource(cb);
}
}
|
public synchronized void | redeployResource(java.lang.Object resource)Redeploy the resource into the server's runtime naming context
undeployResource(resource);
deployResource(resource);
|
public synchronized void | undeployResource(java.lang.Object resource)Undeploy the resource from the server's runtime naming context
com.sun.enterprise.config.serverbeans.JdbcResource jdbcRes =
(com.sun.enterprise.config.serverbeans.JdbcResource) resource;
String jndiName = jdbcRes.getJndiName();
String pmJndiName = getPMJndiName( jdbcRes.getJndiName() );
ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
runtime.deleteConnectorResource( jndiName );
runtime.deleteConnectorResource( pmJndiName );
ManagementObjectManager mgr =
Switch.getSwitch().getManagementObjectManager();
mgr.unregisterJDBCResource( jndiName );
//Since 8.1 PE/SE/EE - if no more resource-ref to the pool
//of this resource exists in this server instance, remove
//pool from connector runtime
checkAndDeletePool(jdbcRes);
|