use of javax.resource.ResourceException in project Payara by payara.
the class ResourcesDeployer method createAppScopedResources.
private void createAppScopedResources(Application app, List<org.glassfish.resources.api.Resource> resources, DeploymentContext dc, boolean embedded) throws ResourceException {
try {
if (resources != null) {
Application application = dc.getTransientAppMetaData(ServerTags.APPLICATION, Application.class);
Resources asc = dc.getTransientAppMetaData(APP_META_DATA_RESOURCES, Resources.class);
if (asc == null) {
asc = application.createChild(Resources.class);
application.setResources(asc);
dc.addTransientAppMetaData(APP_META_DATA_RESOURCES, asc);
ApplicationInfo appInfo = appRegistry.get(app.getName());
if (appInfo != null) {
appInfo.addTransientAppMetaData(app.getName() + "-resources", asc);
}
}
createConfig(asc, resources, embedded);
String appName = app.getName();
preserveResources(asc, appName, appName);
}
} catch (Exception e) {
Object[] params = new Object[] { app.getName(), e };
_logger.log(Level.SEVERE, "gf.resources.app.scope.deployment.failure", params);
throw new ResourceException(e);
}
}
use of javax.resource.ResourceException in project Payara by payara.
the class CustomResourceManager method createConfigBean.
public Resource createConfigBean(Resources resources, HashMap attributes, Properties properties, boolean validate) throws Exception {
setAttributes(attributes, null);
ResourceStatus status = null;
if (!validate) {
status = new ResourceStatus(ResourceStatus.SUCCESS, "");
} else {
status = isValid(resources, false, null);
}
if (status.getStatus() == ResourceStatus.SUCCESS) {
return createConfigBean(resources, properties);
} else {
throw new ResourceException(status.getMessage());
}
}
use of javax.resource.ResourceException in project Payara by payara.
the class ResourcesDeployer method createConfig.
private Collection<Resource> createConfig(Resources resources, Collection<org.glassfish.resources.api.Resource> resourcesToRegister, boolean embedded) throws ResourceException {
List<Resource> resourceConfigs = new ArrayList<Resource>();
for (org.glassfish.resources.api.Resource resource : resourcesToRegister) {
final HashMap attrList = resource.getAttributes();
final Properties props = resource.getProperties();
String desc = resource.getDescription();
if (desc != null) {
attrList.put("description", desc);
}
try {
final ResourceManager rm = resourceFactory.getResourceManager(resource);
if (embedded && isEmbeddedResource(resource, resourcesToRegister)) {
Resource configBeanResource = rm.createConfigBean(resources, attrList, props, false);
resources.getResources().add(configBeanResource);
resourceConfigs.add(configBeanResource);
} else if (!embedded && !isEmbeddedResource(resource, resourcesToRegister)) {
com.sun.enterprise.config.serverbeans.Resource configBeanResource = rm.createConfigBean(resources, attrList, props, true);
resources.getResources().add(configBeanResource);
resourceConfigs.add(configBeanResource);
}
} catch (Exception e) {
throw new ResourceException(e);
}
}
return resourceConfigs;
}
use of javax.resource.ResourceException in project Payara by payara.
the class JavaMailResourceManager method createConfigBean.
public Resource createConfigBean(Resources resources, HashMap attributes, Properties properties, boolean validate) throws Exception {
setAttributes(attributes, null);
ResourceStatus status = null;
if (!validate) {
status = new ResourceStatus(ResourceStatus.SUCCESS, "");
} else {
status = isValid(resources, false, null);
}
if (status.getStatus() == ResourceStatus.SUCCESS) {
return createConfigBean(resources, properties);
} else {
throw new ResourceException(status.getMessage());
}
}
use of javax.resource.ResourceException in project Payara by payara.
the class JndiResourceManager method createConfigBean.
public Resource createConfigBean(Resources resources, HashMap attributes, Properties properties, boolean validate) throws Exception {
setAttributes(attributes, null);
ResourceStatus status = null;
if (!validate) {
status = new ResourceStatus(ResourceStatus.SUCCESS, "");
} else {
status = isValid(resources, false, null);
}
if (status.getStatus() == ResourceStatus.SUCCESS) {
return createConfigBean(resources, properties);
} else {
throw new ResourceException(status.getMessage());
}
}
Aggregations