Search in sources :

Example 11 with AdminObjectResource

use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.

the class ListAdminObjects 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();
    // TODO 3.1 - support for cluster-config ?
    try {
        ArrayList<String> list = new ArrayList<String>();
        Collection<AdminObjectResource> adminObjects = domain.getResources().getResources(AdminObjectResource.class);
        for (AdminObjectResource r : adminObjects) {
            if (bindableResourcesHelper.resourceExists(r.getJndiName(), target)) {
                list.add(r.getJndiName());
            }
        }
        for (String jndiName : list) {
            final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
            part.setMessage(jndiName);
        }
    } catch (Exception e) {
        report.setMessage(localStrings.getLocalString("list.admin.object.fail", "Unable to list administered objects") + " " + e.getLocalizedMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(e);
        return;
    }
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : ArrayList(java.util.ArrayList) ActionReport(org.glassfish.api.ActionReport) AdminObjectResource(org.glassfish.connectors.config.AdminObjectResource)

Aggregations

AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)11 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)2 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)2 URISyntaxException (java.net.URISyntaxException)2 PrivilegedActionException (java.security.PrivilegedActionException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ExecutionException (java.util.concurrent.ExecutionException)2 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)2 ActionReport (org.glassfish.api.ActionReport)2 ConnectorConnectionPool (org.glassfish.connectors.config.ConnectorConnectionPool)2 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)2 MultiException (org.glassfish.hk2.api.MultiException)2 Property (org.jvnet.hk2.config.types.Property)2 BindableResource (com.sun.enterprise.config.serverbeans.BindableResource)1 Resource (com.sun.enterprise.config.serverbeans.Resource)1 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)1 Application (com.sun.enterprise.deployment.Application)1