/** * Copy constructor. Create a new ProgramOptions with the same * options as the specified ProgramOptions. */ public ProgramOptions(ProgramOptions other) { this.options = new ParameterMap(other.options); this.env = other.env; this.password = other.password; this.classPath = other.classPath; this.className = other.className; }
/** * Initialize program options based only on environment defaults, * with no options from the command line. */ public ProgramOptions(Environment env) throws CommandException { this(new ParameterMap(), env); optionsSet = false; }
/** * Copy constructor. Create a new ProgramOptions with the same * options as the specified ProgramOptions. */ public ProgramOptions(ProgramOptions other) { this.options = new ParameterMap(other.options); this.env = other.env; this.password = other.password; this.classPath = other.classPath; this.className = other.className; }
/** * Initialize program options based only on environment defaults, * with no options from the command line. */ public ProgramOptions(Environment env) throws CommandException { this(new ParameterMap(), env); optionsSet = false; }
public ParameterMap getOptions() { return new ParameterMap(params); } }
public ParameterMap getOptions() { return new ParameterMap(params); } }
/** * Creates a ParameterMap from the @Param fields defined on the * injected objects provided in the constructor call, excluding selected parameters. * @param parameterNamesToExclude parameter names to exclude from the parameter map * @return ParameterMap for the parameters injected into the targets passed to the constructor * @throws IllegalArgumentException * @throws IllegalAccessException */ public ParameterMap extract(final Collection<String> parameterNamesToExclude) throws IllegalArgumentException, IllegalAccessException { final ParameterMap paramMap = new ParameterMap(); for (Object target : injectionTargets) { if (target != null) { extract(target, parameterNamesToExclude, paramMap); } } return paramMap; }
private String getPid() throws CommandException { String cmdName = "_get-runtime-info"; RemoteAdminCommand rac = createRac(cmdName); rac.executeCommand(new ParameterMap()); Map<String, String> map = rac.getAttributes(); return map.get("pid_value"); }
private String getPid() throws CommandException { String cmdName = "_get-runtime-info"; RemoteRestAdminCommand rac = createRac(cmdName); rac.executeCommand(new ParameterMap()); return rac.findPropertyInReport("pid"); }
void deleteJMSResource(ActionReport subReport, String tmpJMSResource, final Subject subject) { ParameterMap aoAttrList = new ParameterMap(); aoAttrList.set("DEFAULT", tmpJMSResource); //aoAttrList.set("target", target); commandRunner.getCommandInvocation("delete-jms-resource", subReport, subject).parameters(aoAttrList).execute(); } }
private void downloadPayloadFromManaged(String jobId) { if (jobId == null) { return; } try { RemoteRestAdminCommand command = new RemoteRestAdminCommand("_get-payload", this.host, this.port, this.secure, this.user, this.password, this.logger, this.scope, this.authToken, this.prohibitDirectoryUploads,notify); ParameterMap params = new ParameterMap(); params.add("DEFAULT", jobId); command.executeCommand(params); } catch (CommandException ex) { logger.log(Level.WARNING, strings.getString("remote.sse.canNotGetPayload", "Cannot retrieve payload. {0}"), ex.getMessage()); } }
private ParameterMap populateConnectionResourceParameters() { ParameterMap parameters = new ParameterMap(); parameters.set("jndi_name", jndiName); parameters.set(DEFAULT_OPERAND, jndiName); parameters.set("enabled", Boolean.toString(enabled)); parameters.set("poolname", jndiNameForConnectionPool); parameters.set("target", target); if(description != null) parameters.set("description", description); return parameters; }
/** * return null if all went OK... * */ private void callInstance() throws CommandException { if (isError()) return; String cmdName = "_restart-instance"; RemoteAdminCommand rac = createRac(cmdName); // notice how we do NOT send in the instance's name as an operand!! ParameterMap map = new ParameterMap(); if (debug != null) map.add("debug", debug); rac.executeCommand(map); }
/** * return null if all went OK... * */ private void callInstance() throws CommandException { if (isError()) return; String cmdName = "_restart-instance"; RemoteRestAdminCommand rac = createRac(cmdName); // notice how we do NOT send in the instance's name as an operand!! ParameterMap map = new ParameterMap(); if (debug != null) map.add("debug", debug); rac.executeCommand(map); }
public void callInstance(ActionReport report, AdminCommandContext context, String targetName) { try { ParameterMap paramMap = new ParameterMap(); paramMap.set("MoniTor", "true"); paramMap.set("DEFAULT", pattern); List<Server> targetList = targetService.getInstances(targetName); ClusterOperationUtil.replicateCommand("list", FailurePolicy.Error, FailurePolicy.Warn, FailurePolicy.Ignore, targetList, context, paramMap, habitat); } catch(Exception ex) { report.setActionExitCode(ExitCode.FAILURE); report.setMessage("Failure while trying get details from instance " + targetName); } } }
logger.debug("Configure port for SSL"); String command = "create-http-listener"; ParameterMap params = new ParameterMap(); params.add("listeneraddress", "0.0.0.0"); params.add("listenerport", "443"); params.add("defaultvs", "server"); params.add("securityenabled", "true"); params.add("enabled", "true"); params.add("DEFAULT", "http-listener2"); CommandRunner runner = server.getHabitat().getComponent(CommandRunner.class); ActionReport report = server.getHabitat().getComponent(ActionReport.class); runner.getCommandInvocation(command, report).parameters(params).execute();
public boolean executeAdminCommand(ActionReport report, String commandName, String operand, String... parameters) { ParameterMap params = new ParameterMap(); if (operand!=null) { params.add("DEFAULT", operand); } for (int i=0;i<parameters.length;) { String key = parameters[i++]; String value=null; if (i<parameters.length) { value = parameters[i++]; } params.add(key, value); } CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation(commandName, report); inv.parameters(params); inv.execute(); return (report.getActionExitCode()==ActionReport.ExitCode.SUCCESS); }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); if (name == null) name = nodehost.toString(); if (nodes.getNode(name) != null) { //already created nothing to do here return; } CommandInvocation ci = cr.getCommandInvocation("_create-node", report); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); map.add(NodeUtils.PARAM_NODEDIR, nodedir); map.add(NodeUtils.PARAM_INSTALLDIR, installdir); map.add(NodeUtils.PARAM_NODEHOST, nodehost); map.add(NodeUtils.PARAM_TYPE,"CONFIG"); ci.parameters(map); ci.execute(); }
private ActionReport executeInternalCommand(AdminCommandContext context, String targetInstanceName) { String commandName = getCommandName(); ParameterMap params = new ParameterMap(); params.add("target", targetInstanceName); fillParameterMap(params); CommandRunner runner = serviceLocator.getService(CommandRunner.class); ActionReport subReport = context.getActionReport().addSubActionsReport(); CommandRunner.CommandInvocation inv = runner.getCommandInvocation(commandName, subReport, context.getSubject()); inv.parameters(params); inv.execute(); return subReport; }
private void displaySubComponents(String appName, ActionReport report, ActionReport.MessagePart part) { ActionReport subReport = report.addSubActionsReport(); CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation("list-sub-components", subReport); final ParameterMap parameters = new ParameterMap(); parameters.add("DEFAULT", appName); parameters.add("terse", "true"); parameters.add("resources", resources.toString()); inv.parameters(parameters).execute(); ActionReport.MessagePart subPart = subReport.getTopMessagePart(); for (ActionReport.MessagePart childPart: subPart.getChildren()) { ActionReport.MessagePart actualChildPart = part.addChild(); actualChildPart.setMessage(" " + childPart.getMessage()); for(ActionReport.MessagePart grandChildPart : childPart.getChildren()){ actualChildPart.addChild().setMessage(grandChildPart.getMessage()); } } }