Search in sources :

Example 41 with Resources

use of com.sun.enterprise.config.serverbeans.Resources 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)41 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)25 PropertyVetoException (java.beans.PropertyVetoException)18 Resource (com.sun.enterprise.config.serverbeans.Resource)14 ResourceStatus (org.glassfish.resourcebase.resources.api.ResourceStatus)14 Domain (com.sun.enterprise.config.serverbeans.Domain)7 ActionReport (org.glassfish.api.ActionReport)7 SingleConfigCode (org.jvnet.hk2.config.SingleConfigCode)7 JdbcResource (org.glassfish.jdbc.config.JdbcResource)6 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)5 ParameterMap (org.glassfish.api.admin.ParameterMap)4 AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)4 ResourceAdapterConfig (org.glassfish.connectors.config.ResourceAdapterConfig)4 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)4 MailResource (org.glassfish.resources.javamail.config.MailResource)4 BindableResource (com.sun.enterprise.config.serverbeans.BindableResource)3 PropsFileActionReporter (com.sun.enterprise.v3.common.PropsFileActionReporter)3 AdminCommandContextImpl (org.glassfish.api.admin.AdminCommandContextImpl)3 CommandRunner (org.glassfish.api.admin.CommandRunner)3 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)3