use of org.glassfish.resources.admin.cli.ResourceManager 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;
}
Aggregations