MemberMBeanBridge.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:gemfirexd-oss 作者:
/**
   * Processes the given command string using the given environment information
   * if it's non-empty. Result returned is in a JSON format.
   * 
   * @param commandString
   *          command string to be processed
   * @param env
   *          environment information to be used for processing the command
   * @return result of the processing the given command string.
   */
  public String processCommand(String commandString, Map<String, String> env) {
    if (commandService == null) {
      throw new JMRuntimeException(
          "Command can not be processed as Command Service did not get initialized. Reason: "+commandServiceInitError);
    }

    boolean isGfshRequest = isGfshRequest(env);
    if (isGfshRequest) {
      CommandExecutionContext.setShellRequest();
    }
//    System.out.println("isGfshRequest :: "+isGfshRequest);

    Result result = ((MemberCommandService)commandService).processCommand(commandString, env);
    if (!(result instanceof CommandResult)) {// TODO - Abhishek - Shouldn't be needed
      while (result.hasNextLine()) {
        result = ResultBuilder.createInfoResult(result.nextLine());
      }
    }
    if (isGfshRequest) {
      String responseJson = CommandResponseBuilder.createCommandResponseJson(getMember(), (CommandResult) result);
  //    System.out.println("responseJson :: "+responseJson);
      return responseJson;
    } else {
      return ResultBuilder.resultAsString(result);
    }
  }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号