當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。