Exemplo n.º 1
0
 @CliCommand(value = UPLOAD_MODULE, help = "Upload a new module")
 public String uploadModule(
     @CliOption(
             mandatory = true,
             key = {"type"},
             help = "the type for the uploaded module")
         RESTModuleType type,
     @CliOption(
             mandatory = true,
             key = {"name"},
             help = "the name for the uploaded module")
         String name,
     @CliOption(
             mandatory = true,
             key = {"", "file"},
             help = "path to the module archive")
         File file)
     throws IOException {
   Resource resource = new FileSystemResource(file);
   ModuleDefinitionResource composedModule = moduleOperations().uploadModule(name, type, resource);
   return String.format(
       ("Successfully uploaded module '%s:%s'"),
       composedModule.getType(),
       composedModule.getName());
 }
Exemplo n.º 2
0
 @CliCommand(value = COMPOSE_MODULE, help = "Create a virtual module")
 public String composeModule(
     @CliOption(
             mandatory = true,
             key = {"name", ""},
             help = "the name to give to the module")
         String name,
     @CliOption(
             mandatory = true,
             key = "definition",
             optionContext = "completion-module disable-string-converter",
             help = "module definition using xd dsl")
         String dsl) {
   ModuleDefinitionResource composedModule = moduleOperations().composeModule(name, dsl);
   return String.format(
       ("Successfully created module '%s' with type %s"),
       composedModule.getName(),
       composedModule.getType());
 }