Package org.jboss.as.cli.operation

Examples of org.jboss.as.cli.operation.OperationRequestAddress


            ParserUtil.parseOperationRequest(type, callback);
        } catch (CommandFormatException e) {
            throw new IllegalArgumentException("Failed to parse nodeType: " + e.getMessage());
        }

        OperationRequestAddress typeAddress = callback.getAddress();
        if(!typeAddress.endsOnType()) {
            return null;
        }

        final String typeName = typeAddress.toParentNode().getType();
        for(OperationRequestAddress.Node node : typeAddress) {
            address.add(node.getType(), node.getName());
        }
        address.add(typeName, "?");
        return request;
View Full Code Here


        } catch (CommandFormatException e) {
            ctx.printLine("Failed to validate input: " + e.getLocalizedMessage());
            return false;
        }

        OperationRequestAddress typeAddress = callback.getAddress();
        if(!typeAddress.endsOnType()) {
            ctx.printLine("Node path '" + typePath + "' doesn't appear to end on a type.");
            return false;
        }

        final String typeName = typeAddress.toParentNode().getType();
        for(OperationRequestAddress.Node node : typeAddress) {
            address.add(node.getType(), node.getName());
        }

        request.get("operation").set("read-children-types");
View Full Code Here

    protected void doHandle(CommandContext ctx) throws CommandFormatException {

        final ParsedCommandLine parsedCmd = ctx.getParsedCommandLine();
        String nodePath = this.nodePath.getValue(parsedCmd);

        final OperationRequestAddress address;
        if (nodePath != null) {
            address = new DefaultOperationRequestAddress(ctx.getPrefix());
            CommandLineParser.CallbackHandler handler = new DefaultCallbackHandler(address);
            nodePath = ctx.getArgumentsString();
            if(l.isPresent(parsedCmd)) {
                nodePath = nodePath.trim();
                if(nodePath.startsWith("-l ")) {
                    nodePath = nodePath.substring(3);
                } else {
                    nodePath = nodePath.substring(0, nodePath.length() - 3);
                }
            }

            try {
                ctx.getCommandLineParser().parse(nodePath, handler);
            } catch (CommandFormatException e) {
                ctx.printLine(e.getLocalizedMessage());
            }
        } else {
            address = new DefaultOperationRequestAddress(ctx.getPrefix());
        }

        final List<String> names;
        if(address.endsOnType()) {
            final String type = address.getNodeType();
            address.toParentNode();
            names = Util.getNodeNames(ctx.getModelControllerClient(), address, type);
        } else {
            names = Util.getNodeTypes(ctx.getModelControllerClient(), address);
        }
View Full Code Here

    }

    @Override
    protected void handle(CommandContext ctx, String args) {

        final OperationRequestAddress address;

        boolean lSwitch = false;
        String nodePath = null;
        if (args != null) {
            String[] arr = args.split("\\s+");
            for (int i = 0; i < arr.length; ++i) {
                String arg = arr[i];
                if ("-l".equals(arg)) {
                    lSwitch = true;
                } else {
                    nodePath = arg;
                }
            }
        }

        if (nodePath != null) {
            address = new DefaultOperationRequestAddress(ctx.getPrefix());
            OperationRequestParser.CallbackHandler handler = new DefaultOperationCallbackHandler(address);
            try {
                ctx.getOperationRequestParser().parse(nodePath, handler);
            } catch (CommandFormatException e) {
                ctx.printLine(e.getLocalizedMessage());
            }
        } else {
            address = ctx.getPrefix();
        }

        final List<String> names;
        if(address.endsOnType()) {
            names = ctx.getOperationCandidatesProvider().getNodeNames(address);
        } else {
            names = ctx.getOperationCandidatesProvider().getNodeTypes(address);
        }
View Full Code Here

    /* (non-Javadoc)
     * @see org.jboss.as.cli.handlers.CommandHandlerWithHelp#handle(org.jboss.as.cli.CommandContext, java.lang.String)
     */
    @Override
    protected void handle(CommandContext ctx, String args) {
        OperationRequestAddress prefix = ctx.getPrefix();
        ctx.printLine(ctx.getPrefixFormatter().format(prefix));
    }
View Full Code Here

    }

    @Override
    protected void handle(CommandContext ctx, String args) {

        OperationRequestAddress prefix = ctx.getPrefix();

        if(args == null) {
            ctx.printLine(ctx.getPrefixFormatter().format(prefix));
            return;
        }
View Full Code Here

                            }
                        } else {
                            profileName = null;
                        }

                        OperationRequestAddress datasources = new DefaultOperationRequestAddress();
                        if (profileName != null) {
                            datasources.toNode("profile", profileName);
                        }
                        datasources.toNode("subsystem", "datasources");
                        return Util.getNodeNames(
                                ctx.getModelControllerClient(), datasources,
                                "jdbc-driver");
                    }
                }));
View Full Code Here

    @Override
    protected void doHandle(CommandContext ctx) throws CommandFormatException {

        final String nodePath = this.nodePath.getValue(ctx.getParsedArguments());

        final OperationRequestAddress address;
        if (nodePath != null) {
            address = new DefaultOperationRequestAddress(ctx.getPrefix());
            OperationRequestParser.CallbackHandler handler = new DefaultOperationCallbackHandler(address);
            try {
                ctx.getOperationRequestParser().parse(nodePath, handler);
            } catch (CommandFormatException e) {
                ctx.printLine(e.getLocalizedMessage());
            }
        } else {
            address = new DefaultOperationRequestAddress(ctx.getPrefix());
        }

        final List<String> names;
        if(address.endsOnType()) {
            final String type = address.getNodeType();
            address.toParentNode();
            names = Util.getNodeNames(ctx.getModelControllerClient(), address, type);
        } else {
            names = Util.getNodeTypes(ctx.getModelControllerClient(), address);
        }
View Full Code Here

    @Override
    protected void doHandle(CommandContext ctx) {

        final String nodePath = this.nodePath.getValue(ctx.getParsedArguments());

        OperationRequestAddress prefix = ctx.getPrefix();

        if(nodePath == null) {
            ctx.printLine(ctx.getPrefixFormatter().format(prefix));
            return;
        }
View Full Code Here

                       DefaultOperationRequestParser.INSTANCE.parse(thePath, handler);
                   } catch (CommandFormatException e) {
                       return Collections.emptyList();
                   }

                   OperationRequestAddress typeAddress = handler.getAddress();
                   if (!typeAddress.endsOnType()) {
                       return Collections.emptyList();
                   }
                   return Collections.singletonList(typeAddress.getNodeType());
               }

                if (actionName.equals("remove")) {
                    return getExistingCommands();
                }
View Full Code Here

TOP

Related Classes of org.jboss.as.cli.operation.OperationRequestAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.