org.apache.karaf.shell.commands.Command类的使用及代码示例

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

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

Command介绍

暂无

代码示例

代码示例来源: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: apache/karaf

@Override
public String getDescription() {
  final Command cmd = oldCommand.getActionClass().getAnnotation(Command.class);
  if (cmd != null) {
    return cmd.description();
  }
  try {
    Method method = oldCommand.getActionClass().getMethod("description");
    method.setAccessible(true);
    return (String) method.invoke(oldCommand.createNewAction());
  } catch (Throwable ignore) {
  }
  return getName();
}

代码示例来源:origin: apache/karaf

public String getDetailedDescription() {
  String desc = command.detailedDescription();
  return loadDescription(actionClass, desc);
}

代码示例来源: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.opendaylight.snmp4sdn/plugin-shell

@Command(scope = "snmp4sdn", name = "TopoDiscoverSwitches", description="Inventory discovery (collect switches and ports)")
public class TopoDiscoverSwitch extends OsgiCommandSupport{
  private ICore controller;

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

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

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

@Command(scope = "system", name = "version", description = "Display the instance version")
public class Version extends AbstractSystemAction {

  protected Object doExecute() throws Exception {
    System.out.println(systemService.getVersion());
    return null;
  }

}

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

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

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

    table.column("JMS Topics");

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

    table.print(System.out);

    return null;
  }

}

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

@Command(scope = "metrics", name = "reset", description = "This will reset all the metrics to zero.")
public class ResetCommand extends MetricsCommandSupport {

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

代码示例来源:origin: org.opendaylight.openflowplugin/drop-test-karaf

@Command(scope = "drop-test", name = "showDropStats", description = "Show drop statistics.")
public class ShowDropStatsCommandProvider extends OsgiCommandSupport {

  @Override
  protected Object doExecute() throws Exception {
    PrintStream out = session.getConsole();
    final DropTestRpcProvider rpcProvider = DropTestProviderImpl.getDropRpcProvider();
    final DropTestDsProvider provider = DropTestProviderImpl.getDropDsProvider();

    out.format("RPC Test Statistics: %s%n", rpcProvider.getStats().toString());
    out.format("FRM Test Statistics: %s%n", provider.getStats().toString());

    return null;
  }

}

代码示例来源:origin: org.opendaylight.vpnservice/bgpmanager-impl

@Command(scope = "odl", name = "display-bgp-config", description="")
public class DisplayBgpConfigCli extends OsgiCommandSupport {

  protected Object doExecute() throws Exception {
    Cache cache = new Cache();
    return cache.show();
  } 
}

代码示例来源:origin: org.opendaylight.genius/itm-impl

@Command(scope = "tep", name = "state-show", description="Monitors tunnel state")

  public class TepStateShow extends OsgiCommandSupport {

    @Override

    protected Object doExecute() throws Exception {

       System.out.println("Executing show TEP states command");

    return null;

    }
  }

代码示例来源:origin: apache/incubator-unomi

@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: apache/incubator-unomi

@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.apache.karaf.jms/org.apache.karaf.jms.command

@Command(scope = "jms", name = "connectionfactories", description = "List the JMS connection factories")
public class ConnectionFactoriesCommand extends JmsCommandSupport {

  public Object doExecute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("JMS Connection Factory");

    List<String> connectionFactories = getJmsService().connectionFactories();
    for (String connectionFactory : connectionFactories) {
      table.addRow().addContent(connectionFactory);
    }

    table.print(System.out);

    return null;
  }

}

相关文章