本文整理了Java中org.apache.karaf.shell.commands.Option.<init>()
方法的一些代码示例,展示了Option.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.<init>()
方法的具体详情如下:
包路径:org.apache.karaf.shell.commands.Option
类名称:Option
方法名:<init>
暂无
代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command
/**
* For commands that need a connection factory and authentication information
*/
public abstract class JmsConnectionCommandSupport extends JmsCommandSupport {
@Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false)
String connectionFactory;
@Option(name = "-u", aliases = { "--username" }, description = "Username to connect to the JMS broker", required = false, multiValued = false)
String username = "karaf";
@Option(name = "-p", aliases = { "--password" }, description = "Password to connect to the JMS broker", required = false, multiValued = false)
String password = "karaf";
}
代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command
@Command(scope = "jms", name = "create", description = "Create a JMS connection factory.")
public class CreateCommand extends JmsCommandSupport {
@Argument(index = 0, name = "name", description = "The JMS connection factory name", required = true, multiValued = false)
String name;
@Option(name = "-t", aliases = { "--type" }, description = "The JMS connection factory type (ActiveMQ or WebsphereMQ)", required = false, multiValued = false)
String type = "ActiveMQ";
@Option(name = "--url", description = "URL of the JMS broker. For WebsphereMQ type, the URL is hostname/port/queuemanager/channel", required = false, multiValued = false)
String url = "tcp://localhost:61616";
@Option(name = "-u", aliases = { "--username" }, description = "Username to connect to the JMS broker", required = false, multiValued = false)
String username = "karaf";
@Option(name = "-p", aliases = { "--password" }, description = "Password to connect to the JMS broker", required = false, multiValued = false)
String password = "karaf";
public Object doExecute() throws Exception {
getJmsService().create(name, type, url, username, password);
return null;
}
}
代码示例来源:origin: org.apache.karaf.obr/org.apache.karaf.obr.command
@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 the 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: org.apache.karaf.package/org.apache.karaf.package.command
@Command(scope = "package", name = "imports", description = "Lists imported packages and the bundles that import them")
public class Imports extends OsgiCommandSupport {
@Option(name = "-p", description = "Only show package instead of full filter", required = false, multiValued = false)
boolean onlyPackage;
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
boolean noFormat;
代码示例来源:origin: org.onosproject/onos-app-vtn-mgr
/**
* Supports for updating the external gateway virtualPort.
*/
@Command(scope = "onos", name = "externalportname-set",
description = "Supports for setting the external port name.")
public class VtnCommand extends AbstractShellCommand {
@Option(name = "-n", aliases = "--name", description = "external port name.", required = true,
multiValued = false)
String exPortName = "";
@Override
protected void execute() {
VtnManager.setExPortName(exPortName);
}
}
代码示例来源:origin: org.apache.karaf.kar/org.apache.karaf.kar.command
@Command(scope = "kar", name = "list", description = "List the installed KAR files.")
public class ListKarCommand extends KarCommandSupport {
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
boolean noFormat;
public Object doExecute() throws Exception {
ShellTable table = new ShellTable();
table.column("KAR Name");
for (String karName : this.getKarService().list()) {
table.addRow().addContent(karName);
}
table.print(System.out, !noFormat);
return null;
}
}
代码示例来源:origin: org.apache.karaf.obr/org.apache.karaf.obr.command
@Command(scope = "obr", name = "url-list", description = "Displays the repository URLs currently associated with the OBR service.")
public class ListUrlCommand extends ObrCommandSupport {
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
boolean noFormat;
protected void doExecute(RepositoryAdmin admin) {
ShellTable table = new ShellTable();
table.column("Index");
table.column("OBR URL");
table.emptyTableText("No OBR repository URL");
Repository[] repos = admin.listRepositories();
if (repos != null) {
for (int i = 0; i < repos.length; i++) {
table.addRow().addContent(i, repos[i].getURI());
}
}
table.print(System.out, !noFormat);
}
}
代码示例来源:origin: org.opendaylight.vpnservice/neutronvpn-shell
@Command(scope = "vpnservice", name = "l3vpn-config-show", description = "Displays Neutron L3VPN configuration")
public class ShowVpnConfigCommand extends OsgiCommandSupport {
@Option(name = "-vid", aliases = {"--vpnid"}, description = "VPN ID", required = false, multiValued = false)
String vid;
private INeutronVpnManager neutronVpnManager;
public void setNeutronVpnManager(INeutronVpnManager neutronVpnManager) {
this.neutronVpnManager = neutronVpnManager;
}
@Override
protected Object doExecute() throws Exception {
Uuid vuuid = null;
if (vid != null) {
vuuid = new Uuid(vid);
}
for (String p : neutronVpnManager.showVpnConfigCLI(vuuid)) {
System.out.println(p);
}
return null;
}
}
代码示例来源:origin: org.onosproject/onos-apps-vtn-vtnrsc
/**
* Supports for remove a router interface.
*/
@Command(scope = "onos", name = "routerinterface-remove", description = "Supports for removing a router interface")
public class RouterInterfaceRemoveCommand extends AbstractShellCommand {
@Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface",
required = true, multiValued = false)
String subnetId = null;
@Override
protected void execute() {
RouterInterfaceService service = get(RouterInterfaceService.class);
try {
RouterInterface routerInterface = service
.getRouterInterface(SubnetId.subnetId(subnetId));
if (routerInterface == null) {
print(null, "subnet ID of interface doesn't exist");
return;
}
service.removeRouterInterface(routerInterface);
} catch (Exception e) {
print(null, e.getMessage());
}
}
}
代码示例来源:origin: org.onosproject/onos-app-vtn-rsc
/**
* Supports for remove a router interface.
*/
@Command(scope = "onos", name = "routerinterface-remove", description = "Supports for removing a router interface")
public class RouterInterfaceRemoveCommand extends AbstractShellCommand {
@Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface",
required = true, multiValued = false)
String subnetId = null;
@Override
protected void execute() {
RouterInterfaceService service = get(RouterInterfaceService.class);
try {
RouterInterface routerInterface = service
.getRouterInterface(SubnetId.subnetId(subnetId));
if (routerInterface == null) {
print(null, "subnet ID of interface doesn't exist");
return;
}
service.removeRouterInterface(routerInterface);
} catch (Exception e) {
print(null, e.getMessage());
}
}
}
代码示例来源:origin: org.apache.karaf.http/org.apache.karaf.http.command
@Command(scope = "http", name = "list", description = "Lists details for servlets.")
public class ServletListCommand extends OsgiCommandSupport {
@Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
boolean noFormat;
代码示例来源:origin: org.onosproject/onos-app-vtn-rsc
@Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface",
required = false, multiValued = false)
String subnetId = null;
代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command
@Command(scope = "jms", name = "consume", description = "Consume messages from a JMS queue.")
public class ConsumeCommand extends JmsConnectionCommandSupport {
@Argument(index = 1, name = "queue", description = "The JMS queue where to consume messages", required = true, multiValued = false)
String queue;
@Option(name = "-s", aliases = { "--selector" }, description = "The selector to use to select the messages to consume", required = false, multiValued = false)
String selector;
public Object doExecute() throws Exception {
System.out.println(getJmsService().consume(connectionFactory, queue, selector, username, password) + " message(s) consumed");
return null;
}
}
代码示例来源:origin: org.apache.karaf.obr/org.apache.karaf.obr.command
@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: jgoodyear/ApacheKarafCookbook
@Command(scope = "cookbook", name = "sample", description = "a sample custom command")
public class sample extends OsgiCommandSupport {
@Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
private String option;
@Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
private String argument;
protected Object doExecute() throws Exception {
System.out.println("Executing command sample");
System.out.println("Option: " + option);
System.out.println("Argument: " + argument);
return null;
}
}
代码示例来源:origin: org.opendaylight.controller/sal-karaf-xsql
@Command(scope = "odl", name = "xsql", description = "XSQL Karaf Command")
public class xsql extends OsgiCommandSupport {
@Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
private String option;
@Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
private String argument;
protected Object doExecute() throws Exception {
if(argument==null){
System.out.println("Nothing to do..., please specify a command.");
return null;
}
XSQLAdapter.getInstance().processCommand(new StringBuffer(argument),
System.out);
return null;
}
}
代码示例来源:origin: org.apache.karaf.config/org.apache.karaf.config.command
@Command(scope = "config", name = "delete", description = "Delete a configuration.")
public class DeleteCommand extends ConfigCommandSupport {
@Argument(index = 0, name = "pid", description = "PID of the configuration", required = true, multiValued = false)
String pid;
@Option(name = "--force", aliases = {}, description = "Force the edition of this config, even if another one was under edition", required = false, multiValued = false)
boolean force;
protected Object doExecute() throws Exception {
String oldPid = (String) this.session.get(PROPERTY_CONFIG_PID);
if (oldPid != null && oldPid.equals(pid) && !force) {
System.err.println("This config is being edited. Cancel / update first, or use the --force option");
return null;
}
this.configRepository.delete(pid);
if (oldPid != null && oldPid.equals(pid) && !force) {
this.session.put(PROPERTY_CONFIG_PID, null);
this.session.put(PROPERTY_CONFIG_PROPS, null);
}
return null;
}
}
代码示例来源:origin: org.apache.karaf.obr/org.apache.karaf.obr.command
@Command(scope = "obr", name = "url-remove", description = "Removes a list of repository URLs from the OBR service.")
public class RemoveUrlCommand extends ObrCommandSupport {
@Option(name = "-i", aliases = { "--index" }, description = "Use index to identify URL", required = false, multiValued = false)
boolean useIndex;
@Argument(index = 0, name = "ids", description = "Repository URLs (or indexes if you use -i) to remove from OBR service", required = true, multiValued = true)
List<String> ids;
protected void doExecute(RepositoryAdmin admin) throws Exception {
for (String id : ids) {
if (useIndex) {
Repository[] repos = admin.listRepositories();
int index = Integer.parseInt(id);
if (index >= 0 && index < repos.length) {
admin.removeRepository(repos[index].getURI());
} else {
System.err.println("Invalid index");
}
} else {
admin.removeRepository(id);
}
}
persistRepositoryList(admin);
}
}
代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command
@Command(scope = "jms", name = "move", description = "Move messages from one JMS queue to another one.")
public class MoveCommand extends JmsConnectionCommandSupport {
@Argument(index = 1, name = "source", description = "The source JMS queue", required = true, multiValued = false)
String source;
@Argument(index = 2, name = "destination", description = "The destination JMS queue", required = true, multiValued = false)
String destination;
@Option(name = "-s", aliases = { "--selector" }, description = "Selector to move only some messages", required = false, multiValued = false)
String selector;
public Object doExecute() throws Exception {
System.out.println(getJmsService().move(connectionFactory, source, destination, selector, username, password) + " message(s) moved");
return null;
}
}
代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command
@Command(scope = "jms", name = "send", description = "Send a message to ")
public class SendCommand extends JmsConnectionCommandSupport {
@Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
String queue;
@Argument(index = 2, name = "message", description = "The JMS message content", required = true, multiValued = false)
String message;
@Option(name = "-r", aliases = { "--replyTo" }, description = "Set the message ReplyTo", required = false, multiValued = false)
String replyTo;
public Object doExecute() throws Exception {
getJmsService().send(connectionFactory, queue, message, replyTo, username, password);
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!