Search in sources :

Example 21 with Configured

use of org.jvnet.hk2.config.Configured in project Payara by payara.

the class ConfigureJMSCluster method execute.

/**
 * Executes the command with the command parameters passed as Properties
 * where the keys are the paramter names and the values the parameter values
 *
 * @param context information
 */
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    // Server targetServer = domain.getServerNamed(target);
    // String configRef = targetServer.getConfigRef();
    Cluster cluster = domain.getClusterNamed(clusterName);
    if (cluster == null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.invalidClusterName", "No Cluster by this name has been configured"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    List instances = cluster.getInstances();
    String warning = null;
    if (instances.size() > 0) {
        ActionReport listReport = habitat.getService(ActionReport.class);
        ParameterMap parameters = new ParameterMap();
        parameters.set("DEFAULT", clusterName);
        commandRunner.getCommandInvocation("list-instances", listReport, context.getSubject()).parameters(parameters).execute();
        if (ActionReport.ExitCode.FAILURE.equals(listReport.getActionExitCode())) {
            warning = localStrings.getLocalString("configure.jms.cluster.clusterWithInstances", "Warning: Please make sure running this command with all cluster instances stopped, otherwise it may lead to inconsistent JMS behavior and corruption of configuration and message stores.");
        } else {
            String result = listReport.getMessage();
            String fixedResult = result.replaceAll("not running", "stopped");
            if (fixedResult.indexOf("running") > -1) {
                warning = localStrings.getLocalString("configure.jms.cluster.clusterWithInstances", "Warning: Please make sure running this command with all cluster instances stopped, otherwise it may lead to inconsistent JMS behavior and corruption of configuration and message stores.");
                warning = warning + "\r\n" + result + "\r\n";
            }
        }
    }
    Config config = domain.getConfigNamed(cluster.getConfigRef());
    JmsService jmsService = config.getExtensionByType(JmsService.class);
    if (jmsService == null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.nojmsservice", "No JMS Service element in config"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (!CONVENTIONAL.equalsIgnoreCase(clusterType) && !ENHANCED.equalsIgnoreCase(clusterType)) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongClusterType", "Invalid option sepecified for clustertype. Valid options are conventional and enhanced"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !SHARED_DB.equalsIgnoreCase(configStoreType)) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongConfigStoreType", "Invalid option sepecified for configstoretype. Valid options are masterbroker and shareddb"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (ENHANCED.equalsIgnoreCase(clusterType) && configStoreType != null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongStoreType", "configstoretype option is not configurable for Enhanced clusters."));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !FILE.equalsIgnoreCase(messageStoreType) && !JDBC.equalsIgnoreCase(messageStoreType)) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongMessageStoreType", "Invalid option sepecified for messagestoretype. Valid options are file and jdbc"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (ENHANCED.equalsIgnoreCase(clusterType) && messageStoreType != null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongmsgStoreType", "messagestoretype option is not configurable for Enhanced clusters."));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    String integrationMode = jmsService.getType();
    if (REMOTE.equalsIgnoreCase(integrationMode)) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.remoteMode", "JMS integration mode should be either EMBEDDED or LOCAL to run this command. Please use the asadmin.set command to change the integration mode"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    String changeIntegrationMode = null;
    if (EMBEDDED.equalsIgnoreCase(integrationMode) && ENHANCED.equalsIgnoreCase(clusterType)) {
        try {
            ConfigSupport.apply(new SingleConfigCode<JmsService>() {

                public Object run(JmsService param) throws PropertyVetoException, TransactionFailure {
                    param.setType(LOCAL);
                    return param;
                }
            }, jmsService);
            changeIntegrationMode = localStrings.getLocalString("configure.jms.cluster.integrationModeChanged", "WARNING: JMS integration mode has been changed from EMBEDDED to LOCAL automatically.");
        } catch (TransactionFailure tfe) {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.cannotChangeIntegrationMode", "Unable to change the JMS integration mode to LOCAL for Enhanced cluster {0}.", clusterName) + " " + tfe.getLocalizedMessage());
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setFailureCause(tfe);
            return;
        }
    }
    if (MASTER_BROKER.equalsIgnoreCase(configStoreType) && FILE.equals(messageStoreType)) {
        if (dbvendor != null || dburl != null || dbuser != null) {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.invalidDboptions", "Database options should not be specified for this configuration"));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
    }
    if (!MASTER_BROKER.equalsIgnoreCase(configStoreType) || ENHANCED.equalsIgnoreCase(clusterType) || JDBC.equalsIgnoreCase(messageStoreType)) {
        if (dbvendor == null) {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.nodbvendor", "No DataBase vendor specified"));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        } else if (dburl == null) {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.nojdbcurl", "No JDBC URL specified"));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        } else if (!isSupportedDbVendor()) {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.invaliddbvendor", "Invalid DB Vednor specified"));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
    }
    if (CONVENTIONAL.equalsIgnoreCase(clusterType) && configStoreType == null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.noConfigStoreType", "No configstoretype specified. Using the default value - masterbroker"));
        configStoreType = "masterbroker";
    }
    if (CONVENTIONAL.equalsIgnoreCase(clusterType) && messageStoreType == null) {
        report.setMessage(localStrings.getLocalString("configure.jms.cluster.noMessagetoreType", "No messagestoretype specified. Using the default value - file"));
        messageStoreType = "file";
    }
    config = domain.getConfigNamed(cluster.getConfigRef());
    JmsAvailability jmsAvailability = config.getAvailabilityService().getExtensionByType(JmsAvailability.class);
    final Boolean availabilityEnabled = Boolean.valueOf(ENHANCED.equalsIgnoreCase(clusterType));
    try {
        ConfigSupport.apply(new SingleConfigCode<JmsAvailability>() {

            public Object run(JmsAvailability param) throws PropertyVetoException, TransactionFailure {
                param.setAvailabilityEnabled(availabilityEnabled.toString());
                if (availabilityEnabled.booleanValue()) {
                    param.setMessageStoreType(JDBC);
                } else {
                    param.setConfigStoreType(configStoreType.toLowerCase(Locale.ENGLISH));
                    param.setMessageStoreType(messageStoreType.toLowerCase(Locale.ENGLISH));
                }
                param.setDbVendor(dbvendor);
                param.setDbUsername(dbuser);
                param.setDbPassword(jmsDbPassword);
                param.setDbUrl(dburl);
                if (props != null) {
                    for (Map.Entry e : props.entrySet()) {
                        Property prop = param.createChild(Property.class);
                        prop.setName((String) e.getKey());
                        prop.setValue((String) e.getValue());
                        param.getProperty().add(prop);
                    }
                }
                return param;
            }
        }, jmsAvailability);
    /* //update the useMasterBroker flag on the JmsService only if availabiltyEnabled is false
            if(!availabilityEnabled.booleanValue()){
              ConfigSupport.apply(new SingleConfigCode<JmsService>() {
                public Object run(JmsService param) throws PropertyVetoException, TransactionFailure {

                    param.setUseMasterBroker(useMasterBroker.toString());
                    return param;
                }
            }, jmsservice);
            }*/
    } catch (TransactionFailure tfe) {
        report.setMessage((changeIntegrationMode == null ? "" : changeIntegrationMode + "\n") + localStrings.getLocalString("configure.jms.cluster.fail", "Unable to Configure JMS Cluster for cluster {0}.", clusterName) + " " + tfe.getLocalizedMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(tfe);
    }
    report.setMessage((warning == null ? "" : warning + "\n") + (changeIntegrationMode == null ? "" : changeIntegrationMode + "\n") + localStrings.getLocalString("configure.jms.cluster.success", "JMS Cluster Configuration updated for Cluster {0}.", clusterName));
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : TransactionFailure(org.jvnet.hk2.config.TransactionFailure) JmsService(com.sun.enterprise.connectors.jms.config.JmsService) ActionReport(org.glassfish.api.ActionReport) PropertyVetoException(java.beans.PropertyVetoException) JmsAvailability(com.sun.enterprise.connectors.jms.config.JmsAvailability) List(java.util.List) Property(org.jvnet.hk2.config.types.Property)

Example 22 with Configured

use of org.jvnet.hk2.config.Configured in project Payara by payara.

the class ChangeMasterBrokerCommand method execute.

/**
 * Executes the command with the command parameters passed as Properties
 * where the keys are the paramter names and the values the parameter values
 *
 * @param context information
 */
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    final String newMB = newMasterBroker;
    Server newMBServer = domain.getServerNamed(newMasterBroker);
    if (newMBServer == null) {
        report.setMessage(localStrings.getLocalString("change.master.broker.invalidServerName", "Invalid server name specified. There is no server by this name"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    // domain.getClusterNamed(clusterName);
    Cluster cluster = newMBServer.getCluster();
    if (cluster == null) {
        report.setMessage(localStrings.getLocalString("change.master.broker.invalidClusterName", "The server specified is not associated with a cluster. The server assocaited with the master broker has to be a part of the cluster"));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    /*if(!cluster.getName().equals(newMBServer.getCluster().getName()))
        {
            report.setMessage(localStrings.getLocalString("configure.jms.cluster.invalidClusterName",
                            "{0} does not belong to the specified cluster", newMasterBroker));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        } */
    Nodes nodes = domain.getNodes();
    config = domain.getConfigNamed(cluster.getConfigRef());
    JmsService jmsservice = config.getExtensionByType(JmsService.class);
    Server oldMBServer = null;
    // Else use the first configured instance in the cluster list
    if (jmsservice.getMasterBroker() != null) {
        oldMBServer = domain.getServerNamed(jmsservice.getMasterBroker());
    } else {
        List<Server> serverList = cluster.getInstances();
        // if(serverList == null || serverList.size() == 0){
        // report.setMessage(localStrings.getLocalString("change.master.broker.invalidCluster",
        // "No servers configured in cluster {0}", clusterName));
        // report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        // return;
        // }
        oldMBServer = serverList.get(0);
    }
    String oldMasterBrokerPort = JmsRaUtil.getJMSPropertyValue(oldMBServer);
    if (oldMasterBrokerPort == null) {
        SystemProperty sp = config.getSystemProperty("JMS_PROVIDER_PORT");
        if (sp != null)
            oldMasterBrokerPort = sp.getValue();
    }
    if (oldMasterBrokerPort == null)
        oldMasterBrokerPort = getDefaultJmsHost(jmsservice).getPort();
    String oldMasterBrokerHost = nodes.getNode(oldMBServer.getNodeRef()).getNodeHost();
    String newMasterBrokerPort = JmsRaUtil.getJMSPropertyValue(newMBServer);
    if (newMasterBrokerPort == null)
        newMasterBrokerPort = getDefaultJmsHost(jmsservice).getPort();
    String newMasterBrokerHost = nodes.getNode(newMBServer.getNodeRef()).getNodeHost();
    String oldMasterBroker = oldMasterBrokerHost + ":" + oldMasterBrokerPort;
    String newMasterBroker = newMasterBrokerHost + ":" + newMasterBrokerPort;
    // System.out.println("1: IN deleteinstanceCheck supplimental oldMasterBroker = " + oldMasterBroker + " newmasterBroker " + newMasterBroker);
    try {
        CompositeData result = updateMasterBroker(oldMBServer.getName(), oldMasterBroker, newMasterBroker);
        boolean success = ((Boolean) result.get("Success")).booleanValue();
        if (!success) {
            int statusCode = ((Integer) result.get("StatusCode")).intValue();
            String detailMessage = (String) result.get("DetailMessage");
            String msg = " " + detailMessage;
            if (BrokerStatusCode.BAD_REQUEST.getCode() == statusCode || BrokerStatusCode.NOT_ALLOWED.getCode() == statusCode || BrokerStatusCode.UNAVAILABLE.getCode() == statusCode || BrokerStatusCode.PRECONDITION_FAILED.getCode() == statusCode) {
                msg = localStrings.getLocalString("change.master.broker.errorMsg", "{0}. But it didn't affect current master broker configuration.", msg);
            } else {
                msg = msg + ". " + localStrings.getLocalString("change.master.broker.otherErrorMsg", "The cluster should be shutdown and configured with the new master broker then restarts.");
            }
            report.setMessage(localStrings.getLocalString("change.master.broker.CannotChangeMB", "Unable to change master broker.{0}", msg));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
    } catch (Exception e) {
        report.setMessage(localStrings.getLocalString("change.master.broker.CannotChangeMB", "Unable to change master broker.{0}", ""));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        /*String setCommandStr = cluster.getConfigRef() + "." + "jms-service" + "." +"master-Broker";
            ParameterMap parameters = new ParameterMap();
            parameters.set(setCommandStr, newMB );

            ActionReport subReport = report.addSubActionsReport();
	        commandRunner.getCommandInvocation("set", subReport, context.getSubject()).parameters(parameters).execute();

              if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())){
                    report.setMessage(localStrings.getLocalString("create.jms.resource.cannotCreateConnectionPool",
                            "Unable to create connection pool."));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
              }*/
        ConfigSupport.apply(new SingleConfigCode<JmsService>() {

            public Object run(JmsService param) throws PropertyVetoException, TransactionFailure {
                param.setMasterBroker(newMB);
                return param;
            }
        }, jmsservice);
    } catch (Exception tfe) {
        report.setMessage(localStrings.getLocalString("change.master.broker.fail", "Unable to update the domain.xml with the new master broker") + " " + tfe.getLocalizedMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(tfe);
    }
    report.setMessage(localStrings.getLocalString("change.master.broker.success", "Master broker change has executed successfully for Cluster {0}.", cluster.getName()));
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : TransactionFailure(org.jvnet.hk2.config.TransactionFailure) JmsService(com.sun.enterprise.connectors.jms.config.JmsService) CompositeData(javax.management.openmbean.CompositeData) Cluster(com.sun.enterprise.config.serverbeans.Cluster) ActionReport(org.glassfish.api.ActionReport) PropertyVetoException(java.beans.PropertyVetoException) PropertyVetoException(java.beans.PropertyVetoException)

Example 23 with Configured

use of org.jvnet.hk2.config.Configured in project Payara by payara.

the class ManagedThreadFactoryManager method delete.

public ResourceStatus delete(final Resources resources, final String jndiName, final String target) throws Exception {
    if (jndiName == null) {
        String msg = localStrings.getLocalString("managed.thread.factory.noJndiName", "No JNDI name defined for managed thread factory.");
        return new ResourceStatus(ResourceStatus.FAILURE, msg);
    }
    Resource resource = ConnectorsUtil.getResourceByName(resources, ManagedThreadFactory.class, jndiName);
    // ensure we already have this resource
    if (resource == null) {
        String msg = localStrings.getLocalString("delete.managed.thread.factory.notfound", "A managed thread factory named {0} does not exist.", jndiName);
        return new ResourceStatus(ResourceStatus.FAILURE, msg);
    }
    if (SYSTEM_ALL_REQ.equals(resource.getObjectType())) {
        String msg = localStrings.getLocalString("delete.concurrent.resource.notAllowed", "The {0} resource cannot be deleted as it is required to be configured in the system.", jndiName);
        return new ResourceStatus(ResourceStatus.FAILURE, msg);
    }
    if (environment.isDas()) {
        if ("domain".equals(target)) {
            if (resourceUtil.getTargetsReferringResourceRef(jndiName).size() > 0) {
                String msg = localStrings.getLocalString("delete.managed.thread.factory.resource-ref.exist", "This managed thread factory [ {0} ] is referenced in an instance/cluster target, use delete-resource-ref on appropriate target", jndiName);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
        } else {
            if (!resourceUtil.isResourceRefInTarget(jndiName, target)) {
                String msg = localStrings.getLocalString("delete.managed.thread.factory.no.resource-ref", "This managed thread factory [ {0} ] is not referenced in target [ {1} ]", jndiName, target);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
            if (resourceUtil.getTargetsReferringResourceRef(jndiName).size() > 1) {
                String msg = localStrings.getLocalString("delete.managed.thread.factory.multiple.resource-refs", "This managed thread factory [ {0} ] is referenced in multiple instance/cluster targets, Use delete-resource-ref on appropriate target", jndiName);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
        }
    }
    try {
        // delete resource-ref
        resourceUtil.deleteResourceRef(jndiName, target);
        // delete managed-thread-factory
        if (ConfigSupport.apply(new SingleConfigCode<Resources>() {

            public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
                ManagedThreadFactory resource = (ManagedThreadFactory) ConnectorsUtil.getResourceByName(resources, ManagedThreadFactory.class, jndiName);
                return param.getResources().remove(resource);
            }
        }, resources) == null) {
            String msg = localStrings.getLocalString("delete.managed.thread.factory.failed", "Managed thread factory {0} deletion failed", jndiName);
            return new ResourceStatus(ResourceStatus.FAILURE, msg);
        }
    } catch (TransactionFailure tfe) {
        String msg = localStrings.getLocalString("delete.managed.thread.factory.failed", "Managed thread factory {0} deletion failed ", jndiName);
        ResourceStatus status = new ResourceStatus(ResourceStatus.FAILURE, msg);
        status.setException(tfe);
        return status;
    }
    String msg = localStrings.getLocalString("delete.managed.thread.factory.success", "Managed thread factory {0} deleted successfully", jndiName);
    return new ResourceStatus(ResourceStatus.SUCCESS, msg);
}
Also used : TransactionFailure(org.jvnet.hk2.config.TransactionFailure) SingleConfigCode(org.jvnet.hk2.config.SingleConfigCode) Resource(com.sun.enterprise.config.serverbeans.Resource) ResourceStatus(org.glassfish.resourcebase.resources.api.ResourceStatus) Resources(com.sun.enterprise.config.serverbeans.Resources) ManagedThreadFactory(org.glassfish.concurrent.config.ManagedThreadFactory)

Example 24 with Configured

use of org.jvnet.hk2.config.Configured in project Payara by payara.

the class JDBCResourceManager method delete.

public ResourceStatus delete(final Resources resources, final String jndiName, final String target) throws Exception {
    if (jndiName == null) {
        String msg = localStrings.getLocalString("jdbc.resource.noJndiName", "No JNDI name defined for JDBC resource.");
        return new ResourceStatus(ResourceStatus.FAILURE, msg);
    }
    // ensure we already have this resource
    if (ConnectorsUtil.getResourceByName(resources, JdbcResource.class, jndiName) == null) {
        String msg = localStrings.getLocalString("delete.jdbc.resource.notfound", "A JDBC resource named {0} does not exist.", jndiName);
        return new ResourceStatus(ResourceStatus.FAILURE, msg);
    }
    if (environment.isDas()) {
        if ("domain".equals(target)) {
            if (resourceUtil.getTargetsReferringResourceRef(jndiName).size() > 0) {
                String msg = localStrings.getLocalString("delete.jdbc.resource.resource-ref.exist", "jdbc-resource [ {0} ] is referenced in an" + "instance/cluster target, Use delete-resource-ref on appropriate target", jndiName);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
        } else {
            if (!resourceUtil.isResourceRefInTarget(jndiName, target)) {
                String msg = localStrings.getLocalString("delete.jdbc.resource.no.resource-ref", "jdbc-resource [ {0} ] is not referenced in target [ {1} ]", jndiName, target);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
            if (resourceUtil.getTargetsReferringResourceRef(jndiName).size() > 1) {
                String msg = localStrings.getLocalString("delete.jdbc.resource.multiple.resource-refs", "jdbc resource [ {0} ] is referenced in multiple " + "instance/cluster targets, Use delete-resource-ref on appropriate target", jndiName);
                return new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
        }
    }
    try {
        JdbcResource jdbcResource = (JdbcResource) ConnectorsUtil.getResourceByName(resources, JdbcResource.class, jndiName);
        if (ResourceConstants.SYSTEM_ALL_REQ.equals(jdbcResource.getObjectType())) {
            String msg = localStrings.getLocalString("delete.jdbc.resource.system-all-req.object-type", "The jdbc resource [ {0} ] cannot be deleted as it is required to be configured in the system.", jndiName);
            return new ResourceStatus(ResourceStatus.FAILURE, msg);
        }
        // delete resource-ref
        resourceUtil.deleteResourceRef(jndiName, target);
        // delete jdbc-resource
        if (ConfigSupport.apply(new SingleConfigCode<Resources>() {

            public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
                JdbcResource resource = (JdbcResource) ConnectorsUtil.getResourceByName(resources, JdbcResource.class, jndiName);
                return param.getResources().remove(resource);
            }
        }, resources) == null) {
            String msg = localStrings.getLocalString("jdbc.resource.deletionFailed", "JDBC resource {0} delete failed ", jndiName);
            return new ResourceStatus(ResourceStatus.FAILURE, msg);
        }
    } catch (TransactionFailure tfe) {
        String msg = localStrings.getLocalString("jdbc.resource.deletionFailed", "JDBC resource {0} delete failed ", jndiName);
        ResourceStatus status = new ResourceStatus(ResourceStatus.FAILURE, msg);
        status.setException(tfe);
        return status;
    }
    String msg = localStrings.getLocalString("jdbc.resource.deleteSuccess", "JDBC resource {0} deleted successfully", jndiName);
    return new ResourceStatus(ResourceStatus.SUCCESS, msg);
}
Also used : TransactionFailure(org.jvnet.hk2.config.TransactionFailure) JdbcResource(org.glassfish.jdbc.config.JdbcResource) SingleConfigCode(org.jvnet.hk2.config.SingleConfigCode) ResourceStatus(org.glassfish.resourcebase.resources.api.ResourceStatus) Resources(com.sun.enterprise.config.serverbeans.Resources)

Aggregations

Property (org.jvnet.hk2.config.types.Property)12 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)10 ActionReport (org.glassfish.api.ActionReport)8 PropertyVetoException (java.beans.PropertyVetoException)7 FileRealm (com.sun.enterprise.security.auth.realm.file.FileRealm)6 Resources (com.sun.enterprise.config.serverbeans.Resources)5 NoSuchRealmException (com.sun.enterprise.security.auth.realm.NoSuchRealmException)5 SingleConfigCode (org.jvnet.hk2.config.SingleConfigCode)5 Resource (com.sun.enterprise.config.serverbeans.Resource)4 File (java.io.File)4 ResourceStatus (org.glassfish.resourcebase.resources.api.ResourceStatus)4 BadRealmException (com.sun.enterprise.security.auth.realm.BadRealmException)3 List (java.util.List)3 Properties (java.util.Properties)3 SecurityService (com.sun.enterprise.config.serverbeans.SecurityService)2 JmsService (com.sun.enterprise.connectors.jms.config.JmsService)2 ArrayList (java.util.ArrayList)2 Enumeration (java.util.Enumeration)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2