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


Java CliCommand类代码示例

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


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

示例1: debug

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {CliStrings.DEBUG}, help = CliStrings.DEBUG__HELP)
@CliMetaData(shellOnly = true,
    relatedTopic = {CliStrings.TOPIC_GFSH, CliStrings.TOPIC_GEODE_DEBUG_UTIL})
public Result debug(
    @CliOption(key = CliStrings.DEBUG__STATE, unspecifiedDefaultValue = "OFF", mandatory = true,
        optionContext = "debug", help = CliStrings.DEBUG__STATE__HELP) String state) {
  Gfsh gfshInstance = Gfsh.getCurrentInstance();
  if (gfshInstance != null) {
    // Handle state
    if (state.equalsIgnoreCase("ON")) {
      gfshInstance.setDebug(true);
    } else if (state.equalsIgnoreCase("OFF")) {
      gfshInstance.setDebug(false);
    } else {
      return ResultBuilder.createUserErrorResult(
          CliStrings.format(CliStrings.DEBUG__MSG_0_INVALID_STATE_VALUE, state));
    }

  } else {
    ErrorResultData errorResultData =
        ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
            .addLine(CliStrings.ECHO__MSG__NO_GFSH_INSTANCE);
    return ResultBuilder.buildResult(errorResultData);
  }
  return ResultBuilder.createInfoResult(CliStrings.DEBUG__MSG_DEBUG_STATE_IS + state);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:ShellCommands.java

示例2: listIndex

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = CliStrings.LIST_INDEX, help = CliStrings.LIST_INDEX__HELP)
@CliMetaData(shellOnly = false,
    relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result listIndex(@CliOption(key = CliStrings.LIST_INDEX__STATS, mandatory = false,
    specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
    help = CliStrings.LIST_INDEX__STATS__HELP) final boolean showStats) {
  try {
    return toTabularResult(getIndexListing(), showStats);
  } catch (FunctionInvocationTargetException ignore) {
    return ResultBuilder.createGemFireErrorResult(
        CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_INDEX));
  } catch (VirtualMachineError e) {
    SystemFailure.initiateFailure(e);
    throw e;
  } catch (Throwable t) {
    SystemFailure.checkFailure();
    getCache().getLogger().error(t);
    return ResultBuilder.createGemFireErrorResult(
        String.format(CliStrings.LIST_INDEX__ERROR_MESSAGE, toString(t, isDebugging())));
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:IndexCommands.java

示例3: describeConnection

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {CliStrings.DESCRIBE_CONNECTION}, help = CliStrings.DESCRIBE_CONNECTION__HELP)
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH, CliStrings.TOPIC_GEODE_JMX})
public Result describeConnection() {
  Result result = null;
  try {
    TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
    Gfsh gfshInstance = getGfsh();
    if (gfshInstance.isConnectedAndReady()) {
      OperationInvoker operationInvoker = gfshInstance.getOperationInvoker();
      // tabularResultData.accumulate("Monitored GemFire DS", operationInvoker.toString());
      tabularResultData.accumulate("Connection Endpoints", operationInvoker.toString());
    } else {
      tabularResultData.accumulate("Connection Endpoints", "Not connected");
    }
    result = ResultBuilder.buildResult(tabularResultData);
  } catch (Exception e) {
    ErrorResultData errorResultData = ResultBuilder.createErrorResultData()
        .setErrorCode(ResultBuilder.ERRORCODE_DEFAULT).addLine(e.getMessage());
    result = ResultBuilder.buildResult(errorResultData);
  }

  return result;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:ShellCommands.java

示例4: cd

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = "cd", help = "Changes current dir")
public String cd(@CliOption(key = {""}, help = "cd [<path>]") String newDir) {
    if (StringUtils.isEmpty(newDir)) {
        newDir = getHomeDir();
    }

    final Path path = (newDir.startsWith("/")) ? new Path(newDir) : new Path(getCurrentDir(), newDir);
    try {
        final FileSystem fs = getFileSystem();
        if (fs.exists(path) && fs.isDirectory(path)) {
            currentDir = path.toUri().getPath();
        } else {
            return "-shell: cd: " + newDir + " No such file or directory";
        }
    } catch (Exception e) {
        return "Change directory failed! " + e.getMessage();
    }
    return "";
}
 
开发者ID:avast,项目名称:hdfs-shell,代码行数:20,代码来源:ContextCommands.java

示例5: listDiskStore

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = CliStrings.LIST_DISK_STORE, help = CliStrings.LIST_DISK_STORE__HELP)
@CliMetaData(shellOnly = false, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result listDiskStore() {
  try {
    Set<DistributedMember> dataMembers = getNormalMembers(getCache());

    if (dataMembers.isEmpty()) {
      return ResultBuilder.createInfoResult(CliStrings.NO_CACHING_MEMBERS_FOUND_MESSAGE);
    }

    return toTabularResult(getDiskStoreListing(dataMembers));
  } catch (FunctionInvocationTargetException ignore) {
    return ResultBuilder.createGemFireErrorResult(CliStrings
        .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_DISK_STORE));
  } catch (VirtualMachineError e) {
    SystemFailure.initiateFailure(e);
    throw e;
  } catch (Throwable t) {
    SystemFailure.checkFailure();
    return ResultBuilder.createGemFireErrorResult(
        String.format(CliStrings.LIST_DISK_STORE__ERROR_MESSAGE, toString(t, isDebugging())));
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:DiskStoreCommands.java

示例6: command1

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {COMMAND1_NAME, COMMAND1_NAME_ALIAS}, help = COMMAND1_HELP)
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public static String command1(
    @CliArgument(name = ARGUMENT1_NAME, argumentContext = ARGUMENT1_CONTEXT,
        help = ARGUMENT1_HELP, mandatory = true) String argument1,
    @CliArgument(name = ARGUMENT2_NAME, argumentContext = ARGUMENT2_CONTEXT,
        help = ARGUMENT2_HELP, mandatory = false,
        unspecifiedDefaultValue = ARGUMENT2_UNSPECIFIED_DEFAULT_VALUE,
        systemProvided = false) String argument2,
    @CliOption(key = {OPTION1_NAME, OPTION1_SYNONYM}, help = OPTION1_HELP, mandatory = true,
        optionContext = OPTION1_CONTEXT) String option1,
    @CliOption(key = {OPTION2_NAME}, help = OPTION2_HELP, mandatory = false,
        optionContext = OPTION2_CONTEXT,
        specifiedDefaultValue = OPTION2_SPECIFIED_DEFAULT_VALUE) String option2,
    @CliOption(key = {OPTION3_NAME, OPTION3_SYNONYM}, help = OPTION3_HELP, mandatory = false,
        optionContext = OPTION3_CONTEXT,
        unspecifiedDefaultValue = OPTION3_UNSPECIFIED_DEFAULT_VALUE) String option3) {
  return null;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:GfshParserJUnitTest.java

示例7: executeScript

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {CliStrings.RUN}, help = CliStrings.RUN__HELP)
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH})
public Result executeScript(
    @CliOption(key = CliStrings.RUN__FILE, optionContext = ConverterHint.FILE, mandatory = true,
        help = CliStrings.RUN__FILE__HELP) File file,
    @CliOption(key = {CliStrings.RUN__QUIET}, specifiedDefaultValue = "true",
        unspecifiedDefaultValue = "false", help = CliStrings.RUN__QUIET__HELP) boolean quiet,
    @CliOption(key = {CliStrings.RUN__CONTINUEONERROR}, specifiedDefaultValue = "true",
        unspecifiedDefaultValue = "false",
        help = CliStrings.RUN__CONTINUEONERROR__HELP) boolean continueOnError) {
  Result result = null;

  Gfsh gfsh = Gfsh.getCurrentInstance();
  try {
    result = gfsh.executeScript(file, quiet, continueOnError);
  } catch (IllegalArgumentException e) {
    result = ResultBuilder.createShellClientErrorResult(e.getMessage());
  } // let CommandProcessingException go to the caller

  return result;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:22,代码来源:ShellCommands.java

示例8: register

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = REGISTER_APPLICATION, help = "Register a new application")
public String register(
		@CliOption(mandatory = true,
				key = {"", "name"},
				help = "the name for the registered application")
		String name,
		@CliOption(mandatory = true,
				key = {"type"},
				help = "the type for the registered application")
				String type,
		@CliOption(mandatory = true,
				key = {"uri"},
				help = "URI for the application artifact")
		String uri,
		@CliOption(key = "force",
				help = "force update if application is already registered (only if not in use)",
				specifiedDefaultValue = "true",
				unspecifiedDefaultValue = "false")
		boolean force) {
	appRegistryOperations().register(name, type, uri, force);
	return String.format(("Successfully registered application '%s:%s'"), type, name);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:23,代码来源:AppRegistryCommands.java

示例9: command1

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {COMMAND1_NAME, COMMAND1_NAME_ALIAS}, help = COMMAND1_HELP)
@CliMetaData(shellOnly = true, relatedTopic = {"relatedTopicOfCommand1"})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public static String command1(
    @CliArgument(name = ARGUMENT1_NAME, argumentContext = ARGUMENT1_CONTEXT,
        help = ARGUMENT1_HELP, mandatory = true) String argument1,
    @CliArgument(name = ARGUMENT2_NAME, argumentContext = ARGUMENT2_CONTEXT,
        help = ARGUMENT2_HELP, mandatory = false,
        unspecifiedDefaultValue = ARGUMENT2_UNSPECIFIED_DEFAULT_VALUE,
        systemProvided = false) String argument2,
    @CliOption(key = {OPTION1_NAME, OPTION1_SYNONYM}, help = OPTION1_HELP, mandatory = true,
        optionContext = OPTION1_CONTEXT,
        specifiedDefaultValue = OPTION1_SPECIFIED_DEFAULT_VALUE) String option1,
    @CliOption(key = {OPTION2_NAME}, help = OPTION2_HELP, mandatory = false,
        optionContext = OPTION2_CONTEXT,
        specifiedDefaultValue = OPTION2_SPECIFIED_DEFAULT_VALUE) String option2,
    @CliOption(key = {OPTION3_NAME, OPTION3_SYNONYM}, help = OPTION3_HELP, mandatory = false,
        optionContext = OPTION3_CONTEXT,
        unspecifiedDefaultValue = OPTION3_UNSPECIFIED_DEFAULT_VALUE,
        specifiedDefaultValue = OPTION3_SPECIFIED_DEFAULT_VALUE) String option3) {
  return null;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:CommandManagerJUnitTest.java

示例10: testParamConcat

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {"testParamConcat"})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public static Result testParamConcat(@CliOption(key = {"string"}) String string,
    @CliOption(key = {"stringArray"}) @CliMetaData(valueSeparator = ",") String[] stringArray,
    @CliOption(key = {"stringList"}, optionContext = ConverterHint.STRING_LIST) @CliMetaData(
        valueSeparator = ",") List<String> stringList,
    @CliOption(key = {"integer"}) Integer integer,
    @CliOption(key = {"colonArray"}) @CliMetaData(valueSeparator = ":") String[] colonArray) {
  return null;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:CommandManagerJUnitTest.java

示例11: rmApp

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = "rm-app", help = "Remove an application")
public String rmApp(
		@CliOption(key = "name", mandatory = false, help = HELP_APPLICATION_NAME) String applicationName,
		@CliOption(key = "errorIfNotExists", mandatory = false, help = "Throw an error if not exists",
		    specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") Boolean errorIfNotExists,
		@CliOption(key = "scriptUsage", mandatory = false, help = "Non-interactive mode",
		    specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") Boolean scriptUsage) {
	return applicationUtils.rmApp(applicationName, errorIfNotExists, scriptUsage ? null : new CliPrompter());
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:10,代码来源:ApplicationCommands.java

示例12: obtainHelp

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = CliStrings.HELP, help = CliStrings.HELP__HELP)
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_HELP})
public Result obtainHelp(
    @CliArgument(name = CliStrings.HELP__COMMAND, argumentContext = CliStrings.PARAM_CONTEXT_HELP,
        help = CliStrings.HELP__COMMAND__HELP) String commandString) {
  return ResultBuilder.createInfoResult(getGfsh().obtainHelp(commandString, null));
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:GfshHelpCommands.java

示例13: createSnapshot

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = "create-snapshot", help = "Create a new snapshot for the current application")
public String createSnapshot(
		@CliOption(key = { "tag" }, mandatory = true, help = "You must name your snapshot") String tag,
		@CliOption(key = {
				"applicationName" }, mandatory = false, help = "You must name your snapshot") String applicationName) {
	return snapshotUtils.createSnapshot(tag, applicationName);
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:8,代码来源:SnapshotCommands.java

示例14: clone

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = "clone", help = "Create a new app from a previous image")
public String clone(
		@CliOption(key = { "tag" }, mandatory = true, help = "You must put the snapshot name") String tag,
		@CliOption(key = {
				"applicationName" }, mandatory = false, help = "You must name your new application") String applicationName) {
	return snapshotUtils.clone(applicationName, tag);

}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:9,代码来源:SnapshotCommands.java

示例15: enterDirectory

import org.springframework.shell.core.annotation.CliCommand; //导入依赖的package包/类
@CliCommand(value = {"change-directory", "cd"}, help = "Enter into a directory")
public String enterDirectory(@CliOption(key = { "", "directoryName" }) String directoryName,
		@CliOption(key = {
				"parent" }, mandatory = false, help = "Return at the parent directory", specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") Boolean parent)
		throws ManagerResponseException {

       if (directoryName == null || directoryName.trim().length() == 0) { return "Need an directory as argument."; }
	return fileUtils.changeDirectory(directoryName);
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:10,代码来源:FileCommands.java


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