use of com.sun.enterprise.admin.util.CommandModelData.ParamModelData in project Payara by payara.
the class RemoteCLICommand method prepare.
@Override
protected void prepare() throws CommandException, CommandValidationException {
try {
processProgramOptions();
initializeAuth();
/*
* Now we have all the information we need to create
* the remote admin command object.
*/
initializeRemoteAdminCommand();
if (responseFormatType != null) {
rac.setResponseFormatType(responseFormatType);
}
if (userOut != null) {
rac.setUserOut(userOut);
}
/*
* Initialize a CookieManager so that we can retreive
* any cookies included in the reply. These cookies
* (e.g. JSESSIONID, JROUTE) are used for CLI session
* based routing.
*/
initializeCookieManager();
/*
* If this is a help request, we don't need the command
* metadata and we throw away all the other options and
* fake everything else.
*/
if (programOpts.isHelp()) {
CommandModelData cm = new CommandModelData(name);
cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
this.commandModel = cm;
rac.setCommandModel(cm);
return;
}
/*
* Find the metadata for the command.
*/
commandModel = rac.getCommandModel();
} catch (CommandException cex) {
if (logger.isLoggable(Level.FINER))
logger.finer("RemoteCommand.prepare throws " + cex);
throw cex;
} catch (Exception e) {
if (logger.isLoggable(Level.FINER))
logger.finer("RemoteCommand.prepare throws " + e);
throw new CommandException(e.getMessage());
}
}
use of com.sun.enterprise.admin.util.CommandModelData.ParamModelData in project Payara by payara.
the class CreateDomainCommand method usageOptions.
/**
* Add --adminport and --instanceport options with proper default values.
* (Can't set default values above because it conflicts with --portbase
* option processing.)
*/
@Override
protected Collection<ParamModel> usageOptions() {
Collection<ParamModel> opts = commandModel.getParameters();
Set<ParamModel> uopts = new LinkedHashSet<ParamModel>();
ParamModel aPort = new ParamModelData(ADMIN_PORT, String.class, true, Integer.toString(CLIConstants.DEFAULT_ADMIN_PORT));
ParamModel iPort = new ParamModelData(INSTANCE_PORT, String.class, true, Integer.toString(DEFAULT_INSTANCE_PORT));
for (ParamModel pm : opts) {
if (pm.getName().equals(ADMIN_PORT)) {
uopts.add(aPort);
} else if (pm.getName().equals(INSTANCE_PORT)) {
uopts.add(iPort);
} else {
uopts.add(pm);
}
}
return uopts;
}
use of com.sun.enterprise.admin.util.CommandModelData.ParamModelData in project Payara by payara.
the class ProgramOptions method addMetaOption.
/**
* Helper method to define a meta-option.
*
* @param name long option name
* @param sname short option name
* @param type option type (String.class, Boolean.class, etc.)
* @param req is option required?
* @param def default value for option
*/
private static void addMetaOption(Set<ParamModel> opts, String name, char sname, Class type, boolean req, String def) {
ParamModel opt = new ParamModelData(name, type, !req, def, Character.toString(sname));
opts.add(opt);
}
use of com.sun.enterprise.admin.util.CommandModelData.ParamModelData in project Payara by payara.
the class RemoteCommand method prepare.
@Override
protected void prepare() throws CommandException, CommandValidationException {
try {
processProgramOptions();
initializeAuth();
/*
* Now we have all the information we need to create
* the remote admin command object.
*/
initializeRemoteAdminCommand();
if (responseFormatType != null) {
rac.setResponseFormatType(responseFormatType);
}
if (userOut != null) {
rac.setUserOut(userOut);
}
/*
* Initialize a CookieManager so that we can retreive
* any cookies included in the reply. These cookies
* (e.g. JSESSIONID, JROUTE) are used for CLI session
* based routing.
*/
initializeCookieManager();
/*
* If this is a help request, we don't need the command
* metadata and we throw away all the other options and
* fake everything else.
*/
if (programOpts.isHelp()) {
commandModel = helpModel();
rac.setCommandModel(commandModel);
return;
}
/*
* Find the metadata for the command.
*/
commandModel = rac.getCommandModel();
if (programOpts.isNotifyCommand()) {
commandModel.add(new ParamModelData("notify", boolean.class, true, "false"));
}
} catch (CommandException cex) {
if (logger.isLoggable(Level.FINER))
logger.finer("RemoteCommand.prepare throws " + cex);
throw cex;
} catch (Exception e) {
if (logger.isLoggable(Level.FINER))
logger.finer("RemoteCommand.prepare throws " + e);
throw new CommandException(e.getMessage());
}
}
use of com.sun.enterprise.admin.util.CommandModelData.ParamModelData in project Payara by payara.
the class RemoteCommand method helpModel.
/**
* Return a CommandModel that only includes the --help option.
*/
private CommandModel helpModel() {
CommandModelData cm = new CommandModelData(name);
cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
return cm;
}
Aggregations