@Override
    public List<String> getNodeNames(CommandContext ctx, OperationRequestAddress prefix) {

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

        if(prefix.isEmpty()) {
            throw new IllegalArgumentException("The prefix must end on a type but it's empty.");
        }

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

        final ModelNode request;
        DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(prefix);
        try {
            builder.setOperationName(Util.READ_CHILDREN_NAMES);
            builder.addProperty(Util.CHILD_TYPE, prefix.getNodeType());
            builder.addProperty(Util.INCLUDE_SINGLETONS, "true");
            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;
    }
@ Override public List < String > getNodeNames ( CommandContext ctx , OperationRequestAddress prefix ) { ModelControllerClient client = ctx . getModelControllerClient ( ) ; if ( client == null ) { return Collections . emptyList ( ) ; } if ( prefix . isEmpty ( ) ) { throw new IllegalArgumentException ( "The prefix must end on a type but it's empty." ) ; } if ( ! prefix . endsOnType ( ) ) { throw new IllegalArgumentException ( "The prefix doesn't end on a type." ) ; } final ModelNode request ; DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder ( prefix ) ; try { builder . setOperationName ( Util . READ_CHILDREN_NAMES ) ; builder . addProperty ( Util . CHILD_TYPE , prefix . getNodeType ( ) ) ; builder . addProperty ( Util . INCLUDE_SINGLETONS , "true" ) ; 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 ) ) { result = Collections . emptyList ( ) ; } else { result = Util . getList ( outcome ) ; } } catch ( Exception e ) { result = Collections . emptyList ( ) ; } return result ; }
/* (non-Javadoc)
@see org.jboss.as.cli.CandidatesProvider#getNodeNames(org.jboss.as.cli.Prefix)