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);
}
Aggregations