Search in sources :

Example 1 with ResourceManager

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;
}
Also used : Resource(com.sun.enterprise.config.serverbeans.Resource) Resource(org.glassfish.resources.api.Resource) ResourceManager(org.glassfish.resources.admin.cli.ResourceManager) DeploymentProperties(org.glassfish.deployment.common.DeploymentProperties) ResourceException(javax.resource.ResourceException) IOException(java.io.IOException) DeploymentException(org.glassfish.deployment.common.DeploymentException) ResourceConflictException(org.glassfish.resourcebase.resources.api.ResourceConflictException) Resource(org.glassfish.resources.api.Resource) ResourceException(javax.resource.ResourceException) org.glassfish.resources.api(org.glassfish.resources.api) org.jvnet.hk2.config(org.jvnet.hk2.config)

Aggregations

Resource (com.sun.enterprise.config.serverbeans.Resource)1 IOException (java.io.IOException)1 ResourceException (javax.resource.ResourceException)1 DeploymentException (org.glassfish.deployment.common.DeploymentException)1 DeploymentProperties (org.glassfish.deployment.common.DeploymentProperties)1 ResourceConflictException (org.glassfish.resourcebase.resources.api.ResourceConflictException)1 ResourceManager (org.glassfish.resources.admin.cli.ResourceManager)1 org.glassfish.resources.api (org.glassfish.resources.api)1 Resource (org.glassfish.resources.api.Resource)1 org.jvnet.hk2.config (org.jvnet.hk2.config)1