use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedScheduledExecutorServiceDeployer method deployResource.
@Override
public void deployResource(Object resource) throws Exception {
ManagedScheduledExecutorService ManagedScheduledExecutorServiceResource = (ManagedScheduledExecutorService) resource;
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedScheduledExecutorServiceResource);
deployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedScheduledExecutorServiceDeployer method deployResource.
@Override
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
ManagedScheduledExecutorService managedScheduledExecutorServiceRes = (ManagedScheduledExecutorService) resource;
if (managedScheduledExecutorServiceRes == null) {
_logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedScheduledExecutorService");
return;
}
String jndiName = managedScheduledExecutorServiceRes.getJndiName();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "ManagedScheduledExecutorServiceDeployer.deployResource() : jndi-name [" + jndiName + "]");
}
ResourceInfo resourceInfo = new ResourceInfo(managedScheduledExecutorServiceRes.getJndiName(), applicationName, moduleName);
ManagedScheduledExecutorServiceConfig config = new ManagedScheduledExecutorServiceConfig(managedScheduledExecutorServiceRes);
javax.naming.Reference ref = new javax.naming.Reference(javax.enterprise.concurrent.ManagedScheduledExecutorService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null);
RefAddr addr = new SerializableObjectRefAddr(ManagedScheduledExecutorServiceConfig.class.getName(), config);
ref.add(addr);
RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo);
ref.add(resAddr);
try {
// Publish the object ref
namingService.publishObject(resourceInfo, ref, true);
} catch (NamingException ex) {
LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedScheduledExecutorService", jndiName);
}
registerMonitorableComponent(managedScheduledExecutorServiceRes);
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedThreadFactoryDeployer method deployResource.
@Override
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
ManagedThreadFactory ManagedThreadFactoryRes = (ManagedThreadFactory) resource;
if (ManagedThreadFactoryRes == null) {
_logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedThreadFactory");
return;
}
String jndiName = ManagedThreadFactoryRes.getJndiName();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "ManagedThreadFactoryDeployer.deployResource() : jndi-name [" + jndiName + "]");
}
ResourceInfo resourceInfo = new ResourceInfo(ManagedThreadFactoryRes.getJndiName(), applicationName, moduleName);
ManagedThreadFactoryConfig config = new ManagedThreadFactoryConfig(ManagedThreadFactoryRes);
javax.naming.Reference ref = new javax.naming.Reference(javax.enterprise.concurrent.ManagedThreadFactory.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null);
RefAddr addr = new SerializableObjectRefAddr(ManagedThreadFactoryConfig.class.getName(), config);
ref.add(addr);
RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo);
ref.add(resAddr);
try {
// Publish the object ref
namingService.publishObject(resourceInfo, ref, true);
} catch (NamingException ex) {
LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedThreadFactory", jndiName);
}
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ManagedThreadFactoryDeployer method undeployResource.
@Override
public void undeployResource(Object resource) throws Exception {
ManagedThreadFactory ManagedThreadFactoryResource = (ManagedThreadFactory) resource;
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(ManagedThreadFactoryResource);
undeployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class DataSourceDefinitionDeployer method unregisterDSDReferredByApplication.
private void unregisterDSDReferredByApplication(String appName, DataSourceDefinitionDescriptor dsd) {
try {
if (dsd.isDeployed()) {
undeployResource(dsd);
// unbind from JNDI
ResourceNamingService resourceNamingService = resourceNamingServiceProvider.get();
String dsdName = dsd.getName();
if (dsdName.startsWith(JAVA_GLOBAL_SCOPE_PREFIX) || dsdName.startsWith(JAVA_APP_SCOPE_PREFIX)) {
ResourceInfo resourceInfo = new ResourceInfo(dsdName, appName, null);
try {
resourceNamingService.unpublishObject(resourceInfo, dsdName);
dsd.setDeployed(false);
} catch (NamingException e) {
_logger.log(WARNING, "dsd.unregistration.failed", new Object[] { appName, dsdName, e });
}
}
}
} catch (Exception e) {
_logger.log(WARNING, "exception while unregistering DSD [ " + dsd.getName() + " ]", e);
}
}
Aggregations