本文整理了Java中org.apache.karaf.shell.api.action.Argument.<init>()
方法的一些代码示例,展示了Argument.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument.<init>()
方法的具体详情如下:
包路径:org.apache.karaf.shell.api.action.Argument
类名称:Argument
方法名:<init>
暂无
代码示例来源:origin: apache/karaf
@Command(scope = "shell", name = "printf", description = "Formats and prints arguments.")
@Service
public class PrintfAction implements Action {
@Argument(index = 0, name = "format", description = "The format pattern to use", required = true, multiValued = false)
private String format;
@Argument(index = 1, name = "arguments", description = "The arguments for the given format pattern", required = true, multiValued = true)
private Collection<Object> arguments = null;
@Override
public Object execute() throws Exception {
System.out.printf(format, arguments.toArray());
return null;
}
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.commands
@Command(scope = "shell", name = "printf", description = "Formats and prints arguments.")
@Service
public class PrintfAction implements Action {
@Argument(index = 0, name = "format", description = "The format pattern to use", required = true, multiValued = false)
private String format;
@Argument(index = 1, name = "arguments", description = "The arguments for the given format pattern", required = true, multiValued = true)
private Collection<Object> arguments = null;
@Override
public Object execute() throws Exception {
System.out.printf(format, arguments.toArray());
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "obr", name = "url-add", description = "Adds a list of repository URLs to the OBR service.")
@Service
public class AddUrlCommand extends ObrCommandSupport {
@Argument(index = 0, name = "urls", description = "Repository URLs to add to the OBR service separated by whitespaces", required = true, multiValued = true)
List<String> urls;
protected void doExecute(RepositoryAdmin admin) throws Exception {
for (String url : urls) {
admin.addRepository(url);
}
persistRepositoryList(admin);
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "config", name = "property-delete", description = "Deletes a property from the configuration being edited.")
@Service
public class PropDelCommand extends ConfigPropertyCommandSupport {
@Argument(index = 0, name = "property", description = "The name of the property to delete", required = true, multiValued = false)
String prop;
@Override
public void propertyAction(TypedProperties props) {
props.remove(prop);
}
}
代码示例来源:origin: org.apache.karaf.config/org.apache.karaf.config.core
@Command(scope = "config", name = "property-delete", description = "Deletes a property from the configuration being edited.")
@Service
public class PropDelCommand extends ConfigPropertyCommandSupport {
@Argument(index = 0, name = "property", description = "The name of the property to delete", required = true, multiValued = false)
String prop;
@Override
public void propertyAction(TypedProperties props) {
props.remove(prop);
}
}
代码示例来源:origin: org.apache.karaf.obr/org.apache.karaf.obr.core
@Command(scope = "obr", name = "url-add", description = "Adds a list of repository URLs to the OBR service.")
@Service
public class AddUrlCommand extends ObrCommandSupport {
@Argument(index = 0, name = "urls", description = "Repository URLs to add to the OBR service separated by whitespaces", required = true, multiValued = true)
List<String> urls;
protected void doExecute(RepositoryAdmin admin) throws Exception {
for (String url : urls) {
admin.addRepository(url);
}
persistRepositoryList(admin);
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "jms", name = "count", description = "Count the number of messages on a JMS queue.")
@Service
public class CountCommand extends JmsConnectionCommandSupport {
@Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
String queue;
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Messages Count");
table.addRow().addContent(getJmsService().count(connectionFactory, queue, username, password));
table.print(System.out);
return null;
}
}
代码示例来源:origin: org.xipki.shell/shell-base
@Command(scope = "xi", name = "confirm", description = "confirm an action")
@Service
public static class Confirm extends XiAction {
@Argument(index = 0, name = "message", required = true, description = "prompt message")
private String prompt;
@Override
protected Object execute0() throws Exception {
boolean toContinue = confirm(prompt + "\nDo you want to continue", 3);
if (!toContinue) {
throw new CmdFailure("User cancelled");
}
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "feature", name = "provided", description = "List the features provided by a features repository")
@Service
public class ListProvidedFeaturesCommand extends FeaturesCommandSupport {
@Argument(index = 0, name = "repo", description = "The features repository URI", required = true, multiValued = false)
URI featuresRepositoryUri;
@Override
protected void doExecute(FeaturesService service) throws Exception {
ShellTable table = new ShellTable();
table.column("Name");
table.column("Version");
for (Feature feature : service.repositoryProvidedFeatures(featuresRepositoryUri)) {
table.addRow().addContent(feature.getName(), feature.getVersion());
}
table.print(System.out);
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "docker", name = "tag", description = "Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE")
@Service
public class TagCommand extends DockerCommandSupport {
@Argument(index = 0, name = "image", description = "ID or name of the image to tag", required = true, multiValued = false)
@Completion(ImagesRepoTagsCompleter.class)
String image;
@Argument(index = 1, name = "tag", description = "Tag", required = true, multiValued = false)
String tag;
@Argument(index = 2, name = "repo", description = "Repository where to tag", required = false, multiValued = false)
String repo;
@Override
public Object execute() throws Exception {
getDockerService().tag(image, repo, tag, url);
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "instance", name = "opts-change", description = "Changes the Java options of an existing container instance.")
@Service
public class ChangeOptsCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "javaOpts", description = "The new Java options to set", required = true, multiValued = false)
private String javaOpts;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeJavaOpts(javaOpts);
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "config", name = "property-set", description = "Sets a property in the currently edited configuration.")
@Service
public class PropSetCommand extends ConfigPropertyCommandSupport {
@Argument(index = 0, name = "property", description = "The name of the property to set", required = true, multiValued = false)
@Completion(ConfigurationPropertyCompleter.class)
String prop;
@Argument(index = 1, name = "value", description = "The value of the property", required = true, multiValued = false)
Object value;
@Override
public void propertyAction(TypedProperties props) {
props.put(prop, value);
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "instance", name = "rmi-registry-port-change", description = "Changes the RMI registry port (used by management layer) of an existing container instance.")
@Service
public class ChangeRmiRegistryPortCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "port", description = "The new RMI registry port to set", required = true, multiValued = false)
private int port = 0;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeRmiRegistryPort(port);
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "instance", name = "rmi-server-port-change", description = "Changes the RMI server port (used by management layer) of an existing instance.")
@Service
public class ChangeRmiServerPortCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "port", description = "The new RMI server port to set", required = true, multiValued = false)
private int port = 0;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeRmiServerPort(port);
return null;
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "instance", name = "ssh-port-change", description = "Changes the secure shell port of an existing container instance.")
@Service
public class ChangeSshPortCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "port", description = "The new secure shell port to set", required = true, multiValued = false)
private int port = 0;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeSshPort(port);
return null;
}
}
代码示例来源:origin: org.onosproject/onos-cli
/**
* Removes a controller cluster node.
*/
@Service
@Command(scope = "onos", name = "remove-node",
description = "Removes a new controller cluster node")
public class NodeRemoveCommand extends AbstractShellCommand {
@Argument(index = 0, name = "nodeId", description = "Node ID",
required = true, multiValued = false)
String nodeId = null;
@Override
protected void doExecute() {
ClusterAdminService service = get(ClusterAdminService.class);
service.removeNode(new NodeId(nodeId));
}
}
代码示例来源:origin: apache/karaf
@Command(scope = "instance", name = "ssh-host-change", description = "Changes the secure shell host of an existing container instance.")
@Service
public class ChangeSshHostCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
@Completion(StoppedInstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "host", description = "The new secure shell host to set", required = true, multiValued = false)
private String host = "0.0.0.0";
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeSshHost(host);
return null;
}
}
代码示例来源:origin: org.apache.karaf.instance/org.apache.karaf.instance.core
@Command(scope = "instance", name = "opts-change", description = "Changes the Java options of an existing container instance.")
@Service
public class ChangeOptsCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "javaOpts", description = "The new Java options to set", required = true, multiValued = false)
private String javaOpts;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeJavaOpts(javaOpts);
return null;
}
}
代码示例来源:origin: org.apache.karaf.instance/org.apache.karaf.instance.core
@Command(scope = "instance", name = "rmi-registry-port-change", description = "Changes the RMI registry port (used by management layer) of an existing container instance.")
@Service
public class ChangeRmiRegistryPortCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "port", description = "The new RMI registry port to set", required = true, multiValued = false)
private int port = 0;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeRmiRegistryPort(port);
return null;
}
}
代码示例来源:origin: org.apache.karaf.instance/org.apache.karaf.instance.core
@Command(scope = "instance", name = "rmi-server-port-change", description = "Changes the RMI server port (used by management layer) of an existing instance.")
@Service
public class ChangeRmiServerPortCommand extends InstanceCommandSupport {
@Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
@Completion(InstanceCompleter.class)
private String instance = null;
@Argument(index = 1, name = "port", description = "The new RMI server port to set", required = true, multiValued = false)
private int port = 0;
protected Object doExecute() throws Exception {
getExistingInstance(instance).changeRmiServerPort(port);
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!