Search in sources :

Example 1 with ResourceUtil

use of org.glassfish.resourcebase.resources.admin.cli.ResourceUtil in project Payara by payara.

the class JNDIConfigSource method deleteValue.

public void deleteValue(final String propertyName, String target) throws TransactionFailure {
    // remove the resource reference
    ResourceUtil resourceUtil = Globals.getDefaultHabitat().getService(ResourceUtil.class);
    resourceUtil.deleteResourceRef(propertyName, target);
    ConfigSupport.apply(new SingleConfigCode<Resources>() {

        public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
            CustomResource resource = (CustomResource) domainConfiguration.getResources().getResourceByName(CustomResource.class, propertyName);
            if (resource != null && resource.getJndiName().equals(propertyName)) {
                return param.getResources().remove(resource);
            }
            return null;
        }
    }, domainConfiguration.getResources());
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) ResourceUtil(org.glassfish.resourcebase.resources.admin.cli.ResourceUtil) CustomResource(org.glassfish.resources.config.CustomResource) Resources(com.sun.enterprise.config.serverbeans.Resources)

Aggregations

Resources (com.sun.enterprise.config.serverbeans.Resources)1 PropertyVetoException (java.beans.PropertyVetoException)1 ResourceUtil (org.glassfish.resourcebase.resources.admin.cli.ResourceUtil)1 CustomResource (org.glassfish.resources.config.CustomResource)1 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)1