Package org.jboss.as.cli.operation.impl

Examples of org.jboss.as.cli.operation.impl.DefaultCallbackHandler


            if (line.isEmpty()) {
                throw new IllegalArgumentException("Null command line.");
            }

            final DefaultCallbackHandler originalParsedArguments = this.parsedCmd;
            try {
                this.parsedCmd = tmpBatched;
                resetArgs(line);
            } catch(CommandFormatException e) {
                this.parsedCmd = originalParsedArguments;
View Full Code Here


            if (line.isEmpty()) {
                throw new IllegalArgumentException("Null command line.");
            }

            final DefaultCallbackHandler originalParsedArguments = this.parsedCmd;
            try {
                this.parsedCmd = tmpBatched;
                resetArgs(line);
            } catch(CommandFormatException e) {
                this.parsedCmd = originalParsedArguments;
View Full Code Here

            }}), "--property-id");
        idProperty.addRequiredPreceding(nodePath);

        commandName = new ArgumentWithValue(this, new DefaultCompleter(new CandidatesProvider(){

            private final DefaultCallbackHandler callback = new DefaultCallbackHandler();

            @Override
            public List<String> getAllCandidates(CommandContext ctx) {

                final String actionName = action.getValue(ctx.getParsedCommandLine());
                if(actionName == null) {
                    return Collections.emptyList();
                }

                if (actionName.equals("add")) {
                   final String thePath = nodePath.getValue(ctx.getParsedCommandLine());
                   if (thePath == null) {
                      return Collections.emptyList();
                   }

                   callback.reset();
                   try {
                       ParserUtil.parseOperationRequest(thePath, callback);
                   } catch (CommandFormatException e) {
                       return Collections.emptyList();
                   }

                   OperationRequestAddress typeAddress = callback.getAddress();
                   if (!typeAddress.endsOnType()) {
                       return Collections.emptyList();
                   }
                   return Collections.singletonList(typeAddress.getNodeType());
               }
View Full Code Here

            address.add("profile", profileName);
        }

        final String type = nodePath.getValue(ctx.getParsedCommandLine());
        if(callback == null) {
            callback = new DefaultCallbackHandler();
        } else {
            callback.reset();
        }
        try {
            ParserUtil.parseOperationRequest(type, callback);
View Full Code Here

        if(profileName != null) {
            address.add("profile", profileName);
        }

        if(callback == null) {
            callback = new DefaultCallbackHandler();
        } else {
            callback.reset();
        }

        try {
View Full Code Here

            }
            Collections.sort(candidates);
            return 0;
        }

        final DefaultCallbackHandler parsedCmd = (DefaultCallbackHandler) ctx.getParsedCommandLine();
        try {
            parsedCmd.parse(ctx.getPrefix(), buffer);
        } catch(CommandFormatException e) {
            if(!parsedCmd.endsOnAddressOperationNameSeparator() || !parsedCmd.endsOnSeparator()) {
                return -1;
            }
        }

        final OperationCandidatesProvider candidatesProvider;
View Full Code Here

        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);
View Full Code Here

        // there perhaps could be more but for now only one is allowed
        if(requiredAddress != null) {
            throw new IllegalStateException("Only one required address is allowed, atm.");
        }
        requiredAddress = new DefaultOperationRequestAddress();
        CommandLineParser.CallbackHandler handler = new DefaultCallbackHandler(requiredAddress);
        try {
            ParserUtil.parseOperationRequest(requiredPath, handler);
        } catch (CommandFormatException e) {
            throw new IllegalArgumentException("Failed to parse nodeType: " + e.getMessage());
        }
View Full Code Here

                return super.canAppearNext(ctx);
            }
        };

        nodePath = new DefaultOperationRequestAddress();
        CommandLineParser.CallbackHandler handler = new DefaultCallbackHandler(nodePath);
        try {
            ParserUtil.parseOperationRequest(nodeType, handler);
        } catch (CommandFormatException e) {
            throw new IllegalArgumentException("Failed to parse nodeType: " + e.getMessage());
        }
View Full Code Here

            Collections.sort(candidates);
            candidates.add(OperationFormat.INSTANCE.getAddressOperationSeparator());
            return 0;
        }

        final DefaultCallbackHandler parsedCmd = (DefaultCallbackHandler) ctx.getParsedCommandLine();
        try {
            parsedCmd.parse(ctx.getCurrentNodePath(), buffer, false);
        } catch(CommandFormatException e) {
            if(!parsedCmd.endsOnAddressOperationNameSeparator() || !parsedCmd.endsOnSeparator()) {
                return -1;
            }
        }

        final OperationCandidatesProvider candidatesProvider;
        if(buffer.isEmpty() || parsedCmd.getFormat() == CommandFormat.INSTANCE) {
            candidatesProvider = cmdProvider;
        } else  {
            candidatesProvider = ctx.getOperationCandidatesProvider();
        }
View Full Code Here

TOP

Related Classes of org.jboss.as.cli.operation.impl.DefaultCallbackHandler

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.