/* (non-Javadoc)
   * @see org.jboss.as.cli.CandidatesProvider#getNodeTypes(org.jboss.as.cli.Prefix)
   */
  @Override
  public List<String> getNodeTypes(OperationRequestAddress prefix) {

    ModelControllerClient client = ctx.getModelControllerClient();
    if (client == null) {
      return Collections.emptyList();
    }

    if (prefix.endsOnType()) {
      throw new IllegalArgumentException("The prefix isn't expected to end on a type.");
    }

    ModelNode request;
    DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(prefix);
    try {
      builder.operationName("read-children-types");
      request = builder.buildRequest();
    } catch (OperationFormatException e1) {
      throw new IllegalStateException("Failed to build operation", e1);
    }

    List<String> result;
    try {
      ModelNode outcome = client.execute(request);
      if (!Util.isSuccess(outcome)) {
        // TODO logging... exception?
        result = Collections.emptyList();
      } else {
        result = Util.getList(outcome);
      }
    } catch (Exception e) {
      result = Collections.emptyList();
    }
    return result;
  }
 protected void printCommands(CommandContext ctx) {
   ModelNode request = initRequest(ctx);
   if (request == null) {
     return;
   }
   request.get(Util.OPERATION).set(Util.READ_OPERATION_NAMES);
   try {
     ModelNode result = ctx.getModelControllerClient().execute(request);
     if (!result.hasDefined("result")) {
       ctx.printLine("Operation names aren't available.");
       return;
     }
     final List<String> list = Util.getList(result);
     list.removeAll(this.excludeOps);
     list.add(
         "To read the description of a specific command execute '"
             + this.commandName
             + " command_name --help'.");
     for (String name : list) {
       ctx.printLine(name);
     }
   } catch (Exception e) {
   }
 }