use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class MailSessionDeployer method registerMSDReferredByApplication.
private void registerMSDReferredByApplication(String appName, MailSessionDescriptor msd) {
if (!msd.isDeployed()) {
CommonResourceProxy proxy = mailSessionProxyProvider.get();
org.glassfish.resourcebase.resources.naming.ResourceNamingService resourceNamingService = resourceNamingServiceProvider.get();
proxy.setDescriptor(msd);
if (msd.getName().startsWith(ConnectorConstants.JAVA_APP_SCOPE_PREFIX)) {
msd.setResourceId(appName);
}
if (msd.getName().startsWith(ConnectorConstants.JAVA_GLOBAL_SCOPE_PREFIX) || msd.getName().startsWith(ConnectorConstants.JAVA_APP_SCOPE_PREFIX)) {
ResourceInfo resourceInfo = new ResourceInfo(msd.getName(), appName);
try {
resourceNamingService.publishObject(resourceInfo, proxy, true);
msd.setDeployed(true);
} catch (NamingException e) {
Object[] params = new Object[] { appName, msd.getName(), e };
_logger.log(Level.WARNING, "exception while registering mail-session ", params);
}
}
}
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class JdbcResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
// deployResource is not synchronized as there is only one caller
// ResourceProxy which is synchronized
JdbcResource jdbcRes = (JdbcResource) resource;
String jndiName = jdbcRes.getJndiName();
String poolName = jdbcRes.getPoolName();
PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName);
ResourceInfo resourceInfo = new ResourceInfo(jndiName, applicationName, moduleName);
runtime.createConnectorResource(resourceInfo, poolInfo, null);
// In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to create one
if (ConnectorsUtil.getValidSuffix(jndiName) == null) {
ResourceInfo pmResourceInfo = new ResourceInfo(ConnectorsUtil.getPMJndiName(jndiName), resourceInfo.getApplicationName(), resourceInfo.getModuleName());
runtime.createConnectorResource(pmResourceInfo, poolInfo, null);
}
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("deployed resource " + jndiName);
}
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class JdbcResourceDeployer method deleteResource.
private void deleteResource(JdbcResource jdbcResource, ResourceInfo resourceInfo) throws Exception {
runtime.deleteConnectorResource(resourceInfo);
ConnectorRegistry.getInstance().removeResourceFactories(resourceInfo);
// In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to delete one
if (ConnectorsUtil.getValidSuffix(resourceInfo.getName()) == null) {
String pmJndiName = ConnectorsUtil.getPMJndiName(resourceInfo.getName());
ResourceInfo pmResourceInfo = new ResourceInfo(pmJndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
runtime.deleteConnectorResource(pmResourceInfo);
ConnectorRegistry.getInstance().removeResourceFactories(pmResourceInfo);
}
// Since 8.1 PE/SE/EE - if no more resource-ref to the pool
// of this resource in this server instance, remove pool from connector
// runtime
checkAndDeletePool(jdbcResource);
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class JdbcResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public void deployResource(Object resource) throws Exception {
JdbcResource jdbcRes = (JdbcResource) resource;
ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(jdbcRes);
deployResource(jdbcRes, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ConnectionPoolHealthCheck method doCheck.
@Override
public HealthCheckResult doCheck() {
HealthCheckResult result = new HealthCheckResult();
Collection<JdbcResource> allJdbcResources = getAllJdbcResources();
for (JdbcResource resource : allJdbcResources) {
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(resource);
JdbcConnectionPool pool = JdbcResourcesUtil.createInstance().getJdbcConnectionPoolOfResource(resourceInfo);
PoolInfo poolInfo = ResourceUtil.getPoolInfo(pool);
if (getOptions().getPoolName() != null) {
if (getOptions().getPoolName().equals(poolInfo.getName())) {
evaluatePoolUsage(result, poolInfo);
}
} else {
evaluatePoolUsage(result, poolInfo);
}
}
return result;
}
Aggregations