Search in sources :

Example 1 with CustomResource

use of org.glassfish.resources.config.CustomResource in project Payara by payara.

the class CustomResourceDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    CustomResource customResource = (CustomResource) resource;
    ResourceInfo resourceInfo = new ResourceInfo(customResource.getJndiName(), applicationName, moduleName);
    deployResource(resource, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) CustomResource(org.glassfish.resources.config.CustomResource)

Example 2 with CustomResource

use of org.glassfish.resources.config.CustomResource in project Payara by payara.

the class CustomResourceDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void deployResource(Object resource) throws Exception {
    CustomResource customResource = (CustomResource) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(customResource);
    deployResource(customResource, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) CustomResource(org.glassfish.resources.config.CustomResource)

Example 3 with CustomResource

use of org.glassfish.resources.config.CustomResource in project Payara by payara.

the class CustomResourceDeployer method undeployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void undeployResource(Object resource) throws Exception {
    CustomResource customResource = (CustomResource) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(customResource);
    deleteResource(customResource, resourceInfo);
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) CustomResource(org.glassfish.resources.config.CustomResource)

Example 4 with CustomResource

use of org.glassfish.resources.config.CustomResource in project Payara by payara.

the class CustomResourceDeployer method deployResource.

private void deployResource(Object resource, ResourceInfo resourceInfo) {
    CustomResource customRes = (CustomResource) resource;
    // converts the config data to j2ee resource
    JavaEEResource j2eeResource = toCustomJavaEEResource(customRes, resourceInfo);
    // installs the resource
    installCustomResource((org.glassfish.resources.beans.CustomResource) j2eeResource, resourceInfo);
}
Also used : CustomResource(org.glassfish.resources.config.CustomResource)

Example 5 with CustomResource

use of org.glassfish.resources.config.CustomResource in project Payara by payara.

the class CustomResourceManager method createConfigBean.

private CustomResource createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    CustomResource newResource = param.createChild(CustomResource.class);
    newResource.setJndiName(jndiName);
    newResource.setFactoryClass(factoryClass);
    newResource.setResType(resType);
    newResource.setEnabled(enabled);
    if (description != null) {
        newResource.setDescription(description);
    }
    if (properties != null) {
        for (Map.Entry e : properties.entrySet()) {
            Property prop = newResource.createChild(Property.class);
            prop.setName((String) e.getKey());
            prop.setValue((String) e.getValue());
            newResource.getProperty().add(prop);
        }
    }
    return newResource;
}
Also used : CustomResource(org.glassfish.resources.config.CustomResource) HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

Aggregations

CustomResource (org.glassfish.resources.config.CustomResource)16 Resource (com.sun.enterprise.config.serverbeans.Resource)5 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 ConfigApiTest (org.glassfish.tests.utils.ConfigApiTest)4 Test (org.junit.Test)4 PropertyVetoException (java.beans.PropertyVetoException)3 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)3 ResourceRef (com.sun.enterprise.config.serverbeans.ResourceRef)2 Resources (com.sun.enterprise.config.serverbeans.Resources)2 ActionReport (org.glassfish.api.ActionReport)2 ParameterMap (org.glassfish.api.admin.ParameterMap)2 Property (org.jvnet.hk2.config.types.Property)2 ResourceProperty (com.sun.enterprise.repository.ResourceProperty)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ResourceUtil (org.glassfish.resourcebase.resources.admin.cli.ResourceUtil)1 After (org.junit.After)1