本文整理了Java中org.apache.felix.gogo.commands.Option.<init>()
方法的一些代码示例,展示了Option.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.<init>()
方法的具体详情如下:
包路径:org.apache.felix.gogo.commands.Option
类名称:Option
方法名:<init>
暂无
代码示例来源:origin: com.redhat.rhevm.api/rhevm-api-cli-templates
/**
* Displays the Templates
*/
@Command(scope = "templates", name = "list", description = "Lists Templates.")
public class TemplatesListCommand extends AbstractListCommand<Template> {
@Option(name = "-b", aliases = {"--bound"}, description="Upper bound on number of Templates to display", required = false, multiValued = false)
protected int limit = Integer.MAX_VALUE;
@Option(name = "-s", aliases = {"--search"}, description="Query constraint on Templates", required = false, multiValued = false)
protected String constraint;
protected Object doExecute() throws Exception {
doList(client.getCollection("templates", Templates.class, constraint).getTemplates(), limit);
return null;
}
}
代码示例来源:origin: com.redhat.rhevm.api/rhevm-api-cli-vms
/**
* Displays the VMs
*/
@Command(scope = "vms", name = "list", description = "Lists Virtual Machines.")
public class VmsListCommand extends AbstractListCommand<VM> {
@Option(name = "-b", aliases = {"--bound"}, description="Upper bound on number of VMs to display", required = false, multiValued = false)
protected int limit = Integer.MAX_VALUE;
@Option(name = "-s", aliases = {"--search"}, description="Query constraint on VMs", required = false, multiValued = false)
protected String constraint;
protected Object doExecute() throws Exception {
doList(client.getCollection("vms", VMs.class, constraint).getVMs(), limit);
return null;
}
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.obr
@Command(scope = "obr", name = "deploy", description = "Deploys a list of bundles using OBR service.")
public class DeployCommand extends ObrCommandSupport {
@Argument(index = 0, name = "bundles", description = "List of bundle names to deploy (separated by whitespaces). The bundles are identified using the following syntax: symbolic_name,version where version is optional.", required = true, multiValued = true)
protected List<String> bundles;
@Option(name = "-s", aliases = { "--start" }, description = "Start all deployed bundles", required = false, multiValued = false)
protected boolean start = false;
@Option(name = "-d", aliases = { "--deployOptional" }, description = "Deploy optional bundles", required = false, multiValued = false)
protected boolean deployOptional = false;
protected void doExecute(RepositoryAdmin admin) throws Exception {
doDeploy(admin, bundles, start, deployOptional);
}
}
代码示例来源:origin: io.fabric8.patch/patch-commands
@Command(scope = "patch", name = "list", description = "Display known patches")
public class ListAction extends PatchActionSupport {
@Option(name = "--bundles", description = "Display the list of bundles for each patch")
boolean bundles;
ListAction(Service service) {
super(service);
}
@Override
protected void doExecute(Service service) throws Exception {
display(service.getPatches(), bundles);
}
}
代码示例来源:origin: org.fusesource.patch/patch-commands
@Command(scope = "patch", name = "list", description = "Display known patches")
public class List extends PatchCommandSupport {
@Option(name = "--bundles", description = "Display the list of bundles for each patch")
boolean bundles;
@Override
protected void doExecute(Service service) throws Exception {
display(service.getPatches(), bundles);
}
}
代码示例来源:origin: org.apache.provisionr/activiti-karaf-commands
@Command(scope = "activiti", name = "delete-group", description = "Delete Group")
public class DeleteGroupCommand extends ActivitiCommand {
@Option(name = "-i", aliases = "--id", description = "Group ID", required = true)
private String id;
@Override
protected Object doExecute() throws Exception {
getProcessEngine().getIdentityService().deleteGroup(id);
return null;
}
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.osgi
public abstract class BundlesCommand extends OsgiCommandSupport {
@Argument(index = 0, name = "ids", description = "The list of bundle (identified by IDs or name or name/version) separated by whitespaces", required = true, multiValued = true)
List<String> ids;
@Option(name = "--force", aliases = {}, description = "Forces the command to execute", required = false, multiValued = false)
boolean force;
protected Object doExecute() throws Exception {
BundleSelector selector = new BundleSelector(getBundleContext(), session);
List<Bundle> bundles = selector.selectBundles(ids, force);
doExecute(bundles);
return null;
}
protected abstract void doExecute(List<Bundle> bundles) throws Exception;
}
代码示例来源:origin: axemblr/axemblr-provisionr
@Command(scope = "activiti", name = "delete-group", description = "Delete Group")
public class DeleteGroupCommand extends ActivitiCommand {
@Option(name = "-i", aliases = "--id", description = "Group ID", required = true)
private String id;
@Override
protected Object doExecute() throws Exception {
getProcessEngine().getIdentityService().deleteGroup(id);
return null;
}
}
代码示例来源:origin: org.apache.provisionr/activiti-karaf-commands
@Command(scope = "activiti", name = "delete-user", description = "Delete existing Activiti user")
public class DeleteUserCommand extends ActivitiCommand {
@Option(name = "--id", description = "User ID")
private String id;
@Override
protected Object doExecute() throws Exception {
if (getProcessEngine() == null) {
throw new NullPointerException("Please configure a processEngine instance for this command");
}
IdentityService identityService = getProcessEngine().getIdentityService();
identityService.deleteUser(id);
return null;
}
}
代码示例来源:origin: org.apache.felix.karaf.shell/org.apache.felix.karaf.shell.admin
@Command(scope = "admin", name = "connect", description = "Connect to an existing instance.")
public class ConnectCommand extends AdminCommandSupport {
@Argument(index=0, name="INSTANCE", required=true, description="The instance name")
private String instance = null;
@Option(name="-u", aliases={"--username"}, description="Remote user name")
private String username = "karaf";
@Option(name="-p", aliases={"--password"}, description="Remote user password")
private String password = "karaf";
protected Object doExecute() throws Exception {
int port = getExistingInstance(instance).getPort();
session.execute("ssh -l " + username + " -P " + password + " -p " + port + " localhost");
return null;
}
}
代码示例来源:origin: axemblr/axemblr-provisionr
@Command(scope = "activiti", name = "delete-user", description = "Delete existing Activiti user")
public class DeleteUserCommand extends ActivitiCommand {
@Option(name = "--id", description = "User ID")
private String id;
@Override
protected Object doExecute() throws Exception {
if (getProcessEngine() == null) {
throw new NullPointerException("Please configure a processEngine instance for this command");
}
IdentityService identityService = getProcessEngine().getIdentityService();
identityService.deleteUser(id);
return null;
}
}
代码示例来源:origin: org.apache.felix.karaf.admin/org.apache.felix.karaf.admin.command
@Command(scope = "admin", name = "connect", description = "Connects to an existing container instance.")
public class ConnectCommand extends AdminCommandSupport {
@Argument(index = 0, name="name", description="The name of the container instance", required = true, multiValued = false)
private String instance = null;
@Option(name="-u", aliases={"--username"}, description="Remote user name (Default: karaf)", required = false, multiValued = false)
private String username = "karaf";
@Option(name="-p", aliases={"--password"}, description="Remote user password (Default: karaf)", required = false, multiValued = false)
private String password = "karaf";
protected Object doExecute() throws Exception {
int port = getExistingInstance(instance).getPort();
session.execute("ssh -l " + username + " -P " + password + " -p " + port + " localhost");
return null;
}
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.config
@Command(scope = "config", name = "update", description = "Saves and propagates changes from the configuration being edited.")
public class UpdateCommand extends ConfigCommandSupport {
@Option(name = "-b", aliases = {"--bypass-storage"}, multiValued = false, required = false, description = "Do not store the configuration in a properties file, but feed it directly to ConfigAdmin")
protected boolean bypassStorage;
protected void doExecute(ConfigurationAdmin admin) throws Exception {
Dictionary<String, Object> props = getEditedProps();
if (props == null) {
System.err.println("No configuration is being edited--run the edit command first");
return;
}
String pid = (String) this.session.get(PROPERTY_CONFIG_PID);
update(admin, pid, props, bypassStorage);
this.session.put(PROPERTY_CONFIG_PID, null);
this.session.put(PROPERTY_CONFIG_PROPS, null);
}
}
代码示例来源:origin: com.redhat.rhevm.api/rhevm-api-cli-vms
/**
* Migrate a VM
*/
@Command(scope = "vms", name = "migrate", description = "Migrate a Virtual Machine.")
public class VmsMigrateCommand extends AbstractVmsActionCommand {
@Option(name = "-h", aliases = { "--host" }, description = "Host name", required = true, multiValued = false)
private String host;
protected Object doExecute() throws Exception {
Action action = new Action();
action.setHost(new Host());
action.getHost().setName(host);
doAction("migrate", action);
return null;
}
}
代码示例来源:origin: com.redhat.rhevm.api/rhevm-api-cli-actions
public abstract class AbstractActionsCommand extends AbstractCommand {
@Argument(index = 0, name = "url", description = "URL of the action of interest", required = true, multiValued = false)
protected String url;
@Option(name = "-d", aliases = { "--detail" }, description = "Display Fault detail", required = false, multiValued = false)
protected boolean detail;
protected void display(Action action) throws Exception {
System.out.print("[" + getLink(action.getLink(), "replay"));
System.out.println("] " + action.getStatus());
if (Status.FAILED.equals(action.getStatus()) && action.isSetFault()) {
System.out.println("[" + action.getFault().getReason() + "]");
if (detail) {
System.out.println("[" + action.getFault().getDetail() + "]");
}
}
}
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.obr
@Command(scope = "obr", name = "start", description = "Deploys and starts a list of bundles using OBR.")
public class StartCommand extends ObrCommandSupport {
@Argument(index = 0, name = "bundles", description = "List of bundles to deploy (separated by whitespaces). The bundles are identified using the following syntax: symbolic_name,version where version is optional.", required = true, multiValued = true)
protected List<String> bundles;
@Option(name = "-d", aliases = { "--deployOptional" }, description = "Deploy optional bundles", required = false, multiValued = false)
protected boolean deployOptional = false;
protected void doExecute(RepositoryAdmin admin) throws Exception {
doDeploy(admin, bundles, true, deployOptional);
}
}
代码示例来源:origin: org.apache.felix.karaf.admin/org.apache.felix.karaf.admin.command
@Command(scope = "admin", name = "start", description = "Starts an existing container instance.")
public class StartCommand extends AdminCommandSupport {
@Option(name = "-o", aliases = { "--java-opts"}, description = "Java options when launching the instance", required = false, multiValued = false)
private String javaOpts;
@Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
private String instance = null;
protected Object doExecute() throws Exception {
getExistingInstance(instance).start(javaOpts);
return null;
}
}
代码示例来源:origin: org.fusesource.patch/patch-commands
@Command(scope = "patch", name = "add", description = "Download a patch")
public class Add extends PatchCommandSupport {
@Option(name = "--bundles", description = "Show bundles contained in patches")
boolean bundles;
@Argument(required = true, multiValued = false)
String url;
@Override
protected void doExecute(Service service) throws Exception {
Iterable<Patch> patches = service.download(new URL(url));
display(patches, bundles);
}
}
代码示例来源:origin: org.apache.felix.karaf.shell/org.apache.felix.karaf.shell.admin
@Command(scope = "admin", name = "start", description = "Start an existing instance.")
public class StartCommand extends AdminCommandSupport {
@Option(name = "-o", aliases = { "--java-opts"}, description = "Java options when launching the instance")
private String javaOpts;
@Argument(index=0, required=true, description="The instance name")
private String instance = null;
protected Object doExecute() throws Exception {
getExistingInstance(instance).start(javaOpts);
return null;
}
}
代码示例来源:origin: io.fabric8.patch/patch-commands
@Command(scope = "patch", name = "add", description = "Download a patch")
public class AddAction extends PatchActionSupport {
@Option(name = "--bundles", description = "Show bundles contained in patches")
boolean bundles;
@Argument(required = true, multiValued = false)
String url;
AddAction(Service service) {
super(service);
}
@Override
protected void doExecute(Service service) throws Exception {
Iterable<Patch> patches = service.download(new URL(url));
display(patches, bundles);
}
}
内容来源于网络,如有侵权,请联系作者删除!