use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ResourcesDeployer method deployResources.
public void deployResources(String applicationName, String moduleName, Collection<com.sun.enterprise.config.serverbeans.Resource> resources, boolean postDeployPhase) throws Exception {
for (Resource resource : resources) {
if (resource instanceof BindableResource) {
BindableResource bindableResource = (BindableResource) resource;
ResourceInfo resourceInfo = new ResourceInfo(bindableResource.getJndiName(), applicationName, moduleName);
if (getResourceDeployer(bindableResource).canDeploy(postDeployPhase, resources, bindableResource)) {
resourcesBinder.deployResource(resourceInfo, bindableResource);
}
} else {
if (getResourceDeployer(resource).canDeploy(postDeployPhase, resources, resource)) {
getResourceDeployer(resource).deployResource(resource, applicationName, moduleName);
}
}
}
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class CustomResourceDeployer method undeployResource.
/**
* {@inheritDoc}
*/
@Override
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
CustomResource customResource = (CustomResource) resource;
ResourceInfo resourceInfo = new ResourceInfo(customResource.getJndiName(), applicationName, moduleName);
deleteResource(customResource, resourceInfo);
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class MailResourceDeployer method undeployResource.
/**
* {@inheritDoc}
*/
@Override
public synchronized void undeployResource(Object resource) throws Exception {
MailResource mailRes = (MailResource) resource;
// converts the config data to j2ee resource
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(mailRes);
deleteResource(mailRes, resourceInfo);
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class MailResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
MailResource mailRes = (MailResource) resource;
if (mailRes == null) {
_logger.log(Level.INFO, "Error in resource deploy.");
} else {
ResourceInfo resourceInfo = new ResourceInfo(mailRes.getJndiName(), applicationName, moduleName);
// registers the jsr77 object for the mail resource deployed
/* TODO Not needed any more ?
/*ManagementObjectManager mgr =
getAppServerSwitchObject().getManagementObjectManager();
mgr.registerJavaMailResource(mailRes.getJndiName());*/
installResource(mailRes, resourceInfo);
}
}
use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.
the class ApplicationScopedResourcesManager method deployResources.
/**
* deploy resources
* @param resources list
*/
public void deployResources(Collection<Resource> resources) {
if (resources != null) {
String applicationName = null;
String moduleName = null;
for (Resource resource : resources) {
Object parentObject = resource.getParent().getParent();
if (parentObject instanceof Application) {
applicationName = ((Application) parentObject).getName();
} else if (parentObject instanceof Module) {
moduleName = ((Module) parentObject).getName();
applicationName = ((Application) ((Module) parentObject).getParent()).getName();
}
if (resource instanceof BindableResource) {
BindableResource bindableResource = (BindableResource) resource;
ResourceInfo resourceInfo = new ResourceInfo(bindableResource.getJndiName(), applicationName, moduleName);
resourcesBinder.deployResource(resourceInfo, resource);
} else if (resource instanceof ResourcePool) {
// ignore, as they are loaded lazily
} else {
// only other resources left are RAC, CWSM
try {
getResourceDeployer(resource).deployResource(resource, applicationName, moduleName);
} catch (Exception e) {
Object[] params = { ResourceUtil.getGenericResourceInfo(resource), e };
_logger.log(Level.WARNING, "resources.resource-manager.deploy-resource-failed", params);
}
}
}
addListenerToResources(resources);
}
}
Aggregations