org.apache.karaf.shell.commands.Command.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.apache.karaf.shell.commands.Command.<init>()方法的一些代码示例,展示了Command.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command.<init>()方法的具体详情如下:
包路径:org.apache.karaf.shell.commands.Command
类名称:Command
方法名:<init>

Command.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.unomi/unomi-metrics

@Command(scope = "metrics", name = "activate", description = "This will activate the metrics system.")
public class ActivateCommand extends MetricsCommandSupport {

  @Override
  protected Object doExecute() throws Exception {
    metricsService.setActivated(true);
    System.out.println("Metrics activated successfully.");
    return null;
  }

}

代码示例来源:origin: org.opendaylight.bgpcep/bgp-cli

@Command(scope = "bgp", name = "reset-stats", description = "Reset BGP stats.")
public class ResetBGPStatsCommandProvider extends AbstractStatsCommandProvider {

  @Override
  protected void onExecution(@Nonnull PrintStream out, @Nonnull BGPPeerRuntimeMXBean peerRuntimeMXBean,
                @Nonnull ObjectName objectName) {
    peerRuntimeMXBean.resetSession();
    out.println(String.format("BGP Statistics reset for [%s]!", objectName));
  }
}

代码示例来源:origin: org.opendaylight.snmp4sdn/plugin-shell

@Command(scope = "snmp4sdn", name = "TopoDiscover", description="Topology Discovery for Inventory and Edge, i.e. execute the two commands 'TopoDiscoverSwitches' and 'TopoDiscoverEdges' (collect switches, ports, and edges among switches)")
public class TopoDiscover extends OsgiCommandSupport{
  private ICore controller;

  @Override
  protected Object doExecute() throws Exception {
    controller.topoDiscover();
    return null;
  }

  public void setController(ICore controller){
    this.controller = controller;
  }
}

代码示例来源:origin: org.apache.karaf.config/org.apache.karaf.config.command

@Command(scope = "config", name = "cancel", description = "Cancels the changes to the configuration being edited.")
public class CancelCommand extends ConfigCommandSupport {

  protected Object doExecute() throws Exception {
    session.put(PROPERTY_CONFIG_PID, null);
    session.put(PROPERTY_CONFIG_PROPS, null);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command

@Command(scope = "jms", name = "queues", description = "List the JMS queues.")
public class QueuesCommand extends JmsConnectionCommandSupport {

  public Object doExecute() throws Exception {
    ShellTable table = new ShellTable();

    table.column("JMS Queues");

    for (String queue : getJmsService().queues(connectionFactory, username, password)) {
      table.addRow().addContent(queue);
    }

    table.print(System.out);

    return null;
  }

}

代码示例来源:origin: org.opendaylight.snmp4sdn/plugin-shell

@Command(scope = "snmp4sdn", name = "TopoDiscoverEdges", description="Topology Discovery for Edges (collect edges among switches)")
public class TopoDiscoverEdge extends OsgiCommandSupport{
  private ICore controller;

  @Override
  protected Object doExecute() throws Exception {
    controller.topoDiscoverEdge();
    return null;
  }

  public void setController(ICore controller){
    this.controller = controller;
  }
}

代码示例来源:origin: org.apache.unomi/unomi-metrics

@Command(scope = "metrics", name = "deactivate", description = "This will de-activate the metrics system.")
public class DeactivateCommand extends MetricsCommandSupport {

  @Override
  protected Object doExecute() throws Exception {
    metricsService.setActivated(false);
    System.out.println("Metrics de-activated successfully.");
    return null;
  }

}

代码示例来源:origin: org.opendaylight.snmp4sdn/plugin-shell

@Command(scope = "snmp4sdn", name = "PrintDB", description="Read the switch list file")
public class PrintDB extends OsgiCommandSupport{
  private ICore controller;

  @Override
  protected Object doExecute() throws Exception {
    controller.printDB();
    return null;
  }

  public void setController(ICore controller){
    this.controller = controller;
  }
}

代码示例来源:origin: org.apache.karaf.jndi/org.apache.karaf.jndi.command

@Command(scope = "jndi", name = "delete", description = "Delete a JNDI sub-context.")
public class DeleteCommand extends JndiCommandSupport {

  @Argument(index = 0, name = "context", description = "The JNDI sub-context name", required = true, multiValued = false)
  String context;

  public Object doExecute() throws Exception {
    this.getJndiService().delete(context);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.config/org.apache.karaf.config.command

@Command(scope = "config", name = "property-delete", description = "Deletes a property from the configuration being edited.")
public class PropDelCommand extends ConfigPropertyCommandSupport {

  @Argument(index = 0, name = "property", description = "The name of the property to delete", required = true, multiValued = false)
  String prop;

  @SuppressWarnings("rawtypes")
  @Override
  public void propertyAction(Dictionary props) {
    props.remove(prop);
  }
}

代码示例来源:origin: org.apache.karaf.region/org.apache.karaf.region.command

@Command(scope = "region", name = "region-add", description = "Adds a list of regions to the region digraph service.")
public class AddRegionCommand extends RegionCommandSupport {

  @Argument(index = 0, name = "name", description = "Regions to add to the region digraph service separated by whitespaces.", required = true, multiValued = true)
  List<String> regions;

  protected void doExecute(RegionDigraph regionDigraph, RegionsPersistence persist) throws Exception {
    for (String region : regions) {
      regionDigraph.createRegion(region);
    }
    persist.save();
  }
}

代码示例来源:origin: org.apache.karaf.jdbc/org.apache.karaf.jdbc.command

@Command(scope = "jdbc", name = "delete", description = "Delete a JDBC datasource")
public class DeleteCommand extends JdbcCommandSupport {

  @Argument(index = 0, name = "name", description = "The JDBC datasource name (the one used at creation time)", required = true, multiValued = false)
  String name;

  public Object doExecute() throws Exception {
    this.getJdbcService().delete(name);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.jndi/org.apache.karaf.jndi.command

@Command(scope = "jndi", name = "unbind", description = "Unbind a JNDI name.")
public class UnbindCommand extends JndiCommandSupport {

  @Argument(index = 0, name = "name", description = "The JNDI name to unbind", required = true, multiValued = false)
  String name;

  public Object doExecute() throws Exception {
    getJndiService().unbind(name);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command

@Command(scope = "jms", name = "delete", description = "Delete a JMS connection factory")
public class DeleteCommand extends JmsCommandSupport {

  @Argument(index = 0, name = "name", description = "The JMS connection factory name", required = true, multiValued = false)
  String name;

  public Object doExecute() throws Exception {
    getJmsService().delete(name);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.config/org.apache.karaf.config.command

@Command(scope = "config", name = "property-get", description = "Gets a property value in the currently edited configuration.")
public class PropGetCommand extends ConfigPropertyCommandSupport {

  @Argument(index = 0, name = "property", description = "The name of the property to get the value for", required = true, multiValued = false)
  String prop;

  @Override
  public void propertyAction(Dictionary props) {
    System.out.println(props.get(prop));
  }

}

代码示例来源:origin: org.apache.karaf.jms/org.apache.karaf.jms.command

@Command(scope = "jms", name = "count", description = "Count the number of messages on a JMS queue.")
public class CountCommand extends JmsConnectionCommandSupport {

  @Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
  String queue;

  public Object doExecute() 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.apache.karaf.config/org.apache.karaf.config.command

@Command(scope = "config", name = "property-set", description = "Sets a property in the currently edited configuration.")
public class PropSetCommand extends ConfigPropertyCommandSupport {

  @Argument(index = 0, name = "property", description = "The name of the property to set", required = true, multiValued = false)
  String prop;

  @Argument(index = 1, name = "value", description = "The value of the property", required = true, multiValued = false)
  String value;

  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  public void propertyAction(Dictionary props) {
    props.put(prop, value);
  }
}

代码示例来源:origin: org.apache.karaf.jdbc/org.apache.karaf.jdbc.command

@Command(scope = "jdbc", name = "execute", description = "Execute a SQL command on a given JDBC datasource")
public class ExecuteCommand extends JdbcCommandSupport {

  @Argument(index = 0, name = "datasource", description = "The JDBC datasource", required = true, multiValued = false)
  String datasource;

  @Argument(index = 1, name = "command", description = "The SQL command to execute", required = true, multiValued = false)
  String command;

  public Object doExecute() throws Exception {
    this.getJdbcService().execute(datasource, command);
    return null;
  }

}

代码示例来源:origin: org.apache.karaf.jndi/org.apache.karaf.jndi.command

@Command(scope = "jndi", name = "bind", description = "Bind an OSGi service in the JNDI context")
public class BindCommand extends JndiCommandSupport {

  @Argument(index = 0, name = "service", description = "The ID of the OSGi service to bind", required = true, multiValued = false)
  Long serviceId;

  @Argument(index = 1, name = "name", description = "The JNDI name to bind the OSGi service", required = true, multiValued = false)
  String name;

  public Object doExecute() throws Exception {
    this.getJndiService().bind(serviceId, name);
    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);
  }

}

相关文章