Search in sources :

Example 36 with Node

use of org.jboss.as.cli.operation.OperationRequestAddress.Node in project wildfly-core by wildfly.

the class CLIAccessControl method setAddress.

private static void setAddress(ModelNode request, String[] parent, OperationRequestAddress address) {
    final ModelNode addressNode = request.get(Util.ADDRESS);
    addressNode.setEmptyList();
    if (parent != null) {
        int i = 0;
        while (i < parent.length) {
            addressNode.add(parent[i++], parent[i++]);
        }
    }
    if (!address.isEmpty()) {
        final Iterator<Node> iterator = address.iterator();
        while (iterator.hasNext()) {
            final OperationRequestAddress.Node node = iterator.next();
            if (node.getName() != null) {
                addressNode.add(node.getType(), node.getName());
            } else if (iterator.hasNext()) {
                throw new IllegalArgumentException("The node name is not specified for type '" + node.getType() + "'");
            }
        }
    }
}
Also used : Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) Node(org.jboss.as.cli.operation.OperationRequestAddress.Node) ModelNode(org.jboss.dmr.ModelNode) ModelNode(org.jboss.dmr.ModelNode) OperationRequestAddress(org.jboss.as.cli.operation.OperationRequestAddress)

Aggregations

Node (org.jboss.as.cli.operation.OperationRequestAddress.Node)36 OperationRequestAddress (org.jboss.as.cli.operation.OperationRequestAddress)35 DefaultOperationRequestAddress (org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress)32 DefaultCallbackHandler (org.jboss.as.cli.operation.impl.DefaultCallbackHandler)29 Test (org.junit.Test)28 ModelNode (org.jboss.dmr.ModelNode)14 OperationFormatException (org.jboss.as.cli.operation.OperationFormatException)4 IOException (java.io.IOException)3 TerminalString (org.aesh.readline.terminal.formatting.TerminalString)1 CommandArgument (org.jboss.as.cli.CommandArgument)1 CommandContext (org.jboss.as.cli.CommandContext)1 CommandFormatException (org.jboss.as.cli.CommandFormatException)1 CommandLineException (org.jboss.as.cli.CommandLineException)1 ArgumentWithoutValue (org.jboss.as.cli.impl.ArgumentWithoutValue)1 ParsedOperationRequestHeader (org.jboss.as.cli.operation.ParsedOperationRequestHeader)1 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)1