protected void printNodeDescription(CommandContext ctx) { ModelNode request = initRequest(ctx); if (request == null) { return; } request.get(Util.OPERATION).set(Util.READ_RESOURCE_DESCRIPTION); ModelNode result = null; try { result = ctx.getModelControllerClient().execute(request); if (!result.hasDefined(Util.RESULT)) { ctx.printLine("Node description is not available."); return; } result = result.get(Util.RESULT); if (!result.hasDefined(Util.DESCRIPTION)) { ctx.printLine("Node description is not available."); return; } } catch (Exception e) { } final StringBuilder buf = new StringBuilder(); buf.append("\nSYNOPSIS\n\n"); buf.append(commandName).append(" --help [--properties | --commands] |\n"); for (int i = 0; i <= commandName.length(); ++i) { buf.append(' '); } buf.append(name.getFullName()) .append("=<value> --<property>=<value> (--<property>=<value>)* |\n"); for (int i = 0; i <= commandName.length(); ++i) { buf.append(' '); } buf.append("<command> ").append(name.getFullName()).append("=<value> (--<parameter>=<value>)*"); buf.append("\n\nDESCRIPTION\n\n"); buf.append("The command is used to manage resources of type " + this.nodeType + "."); buf.append("\n\nRESOURCE DESCRIPTION\n\n"); if (result != null) { buf.append(result.get(Util.DESCRIPTION).asString()); } else { buf.append( "N/A. Please, open a jira issue at https://issues.jboss.org/browse/AS7 to get this fixed. Thanks!"); } buf.append("\n\nARGUMENTS\n"); buf.append("\n--help - prints this content."); buf.append( "\n--help --properties - prints the list of the resource properties including their access-type"); buf.append("\n (read/write/metric), value type, and the description."); buf.append( "\n--help --commands - prints the list of the commands available for the resource."); buf.append( "\n To get the complete description of a specific command (including its parameters,"); buf.append("\n their types and descriptions), execute ") .append(commandName) .append(" <command> --help."); buf.append("\n\n").append(name.getFullName()).append(" - "); if (idProperty == null) { buf.append("is the name of the resource that completes the path ") .append(nodeType) .append(" and \n"); } else { buf.append("corresponds to a property of the resourse which \n"); } for (int i = 0; i < name.getFullName().length() + 5; ++i) { buf.append(' '); } buf.append("is used to identify the resourse against which the command should be executed."); buf.append("\n\n<property> - property name of the resourse whose value should be updated."); buf.append( "\n For a complete list of available property names, their types and descriptions,"); buf.append("\n execute ").append(commandName).append(" --help --properties."); buf.append( "\n\n<command> - command name provided by the resourse. For a complete list of available commands,"); buf.append("\n execute ").append(commandName).append(" --help --commands."); buf.append("\n\n<parameter> - parameter name of the <command> provided by the resourse."); buf.append( "\n For a complete list of available parameter names of a specific <command>,"); buf.append("\n their types and descriptions, execute ") .append(commandName) .append(" <command> --help."); ctx.printLine(buf.toString()); }
@Override protected Map<String, CommandArgument> loadArguments(CommandContext ctx) { final Map<String, CommandArgument> args = super.loadArguments(ctx); args.put(conProps.getFullName(), conProps); return args; }