当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中com.neverwinterdp.server.gateway.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于com.neverwinterdp.server.gateway包,在下文中一共展示了Command类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) throws Exception {
  if("help".equalsIgnoreCase(command.getSubCommand())) {
    help() ;
    return ;
  }
  Class<ShellSubCommand> clazz = (Class<ShellSubCommand>) subCommands.get(command.getSubCommand()) ;
  if(clazz != null) {
    ShellSubCommand subCommand = clazz.newInstance() ;
    ctx.onStartCommand(this, subCommand);
    try {
      subCommand.execute(shell, ctx, command);
    } catch(Throwable t) {
      ctx.getExecuteContext().setError(t);
      StringWriter writer = new StringWriter() ;
      writer.append(command.getCommandLine()).append("\n") ;
      t.printStackTrace(new PrintWriter(writer));
      ctx.console().println(writer.getBuffer().toString());
    }
    ctx.onFinishCommand(this, subCommand);
  }
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:22,代码来源:ShellCommand.java

示例2: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) {
  try {
    command.mapAll(options);
    new HelloQueuengin().run(options);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:DemandCube,项目名称:Queuengin,代码行数:9,代码来源:KafkaCommandGroup.java

示例3: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) throws Exception {
  ServiceCommandResult<ClusterMetricRegistrySnapshot>[] results = ctx.getClusterGateway().execute(command) ;
  ctx.console().header("Cluster Metric Snapshot");
  ClusterMetricPrinter printer = new ClusterMetricPrinter(ctx.console().getConsoleAppendable()) ;
  for(int i = 0; i < results.length; i++) {
    ServiceCommandResult<ClusterMetricRegistrySnapshot> sel = results[i] ;
    if(sel.hasError()) {
      ctx.console().println(sel.getError());
    } else {
      printer.print(sel.getResult());
    }
  }
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:14,代码来源:YaraCommand.java

示例4: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) throws Exception {
  ServiceCommandResult<Boolean>[] results = ctx.getClusterGateway().execute(command) ;
  String[] explaination = {
    "The result is true when the service implement the cleanup method. "
  };
  CommandResultPrinterUtil.printPrimitiveServiceResults(ctx, command, results, explaination);
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:8,代码来源:ShellServiceCommand.java

示例5: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext context, Command command) throws Exception {
  command.mapAll(this);
  if (times.size() > 0) {
    long time = times.get(0);
    if (time > 0)
      Thread.sleep(time);
  }
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:9,代码来源:ShellBuiltinCommand.java

示例6: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) throws Exception {
  ServerCommandResult<ServerState>[] results = ctx.getClusterGateway().execute(command) ;
  String[] explaination = {
    "The result is the running state of the server."
  };
  CommandResultPrinterUtil.printPrimitiveServerResults(ctx, command, results, explaination);
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:8,代码来源:ShellServerCommand.java

示例7: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) {
  try {
    command.mapAll(options);
    new HelloSparkngin().run(options);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:DemandCube,项目名称:Sparkngin,代码行数:9,代码来源:SparknginShellCommand.java

示例8: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
public void execute(Shell shell, ShellContext ctx, Command command) throws Exception {
  ServerCommandResult<ModuleRegistration[]>[] results =  ctx.getClusterGateway().execute(command) ;
  list(ctx, results, "List Available Modules") ;
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:5,代码来源:ShellModuleCommand.java

示例9: execute

import com.neverwinterdp.server.gateway.Command; //导入依赖的package包/类
abstract public void execute(Shell shell, ShellContext context, Command command) throws Exception ; 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:2,代码来源:ShellSubCommand.java


注:本文中的com.neverwinterdp.server.gateway.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。