Package org.jboss.as.cli.parsing

Examples of org.jboss.as.cli.parsing.CharacterHandler


        super(ID);
        //setDefaultHandler(new EnterStateCharacterHandler(nodeState));
        setDefaultHandler(new LineBreakHandler(false, false){
            @Override
            public void doHandle(ParsingContext ctx) throws CommandFormatException {
                final CharacterHandler handler = enterStateHandlers.getHandler(ctx.getCharacter());
                if(handler == null) {
                    ctx.enterState(nodeState);
                } else {
                    handler.handle(ctx);
                }
            }});
        enterState(':', addrOpSep);
        enterState('(', propList);
        enterState('{', headerList);
        enterState(OutputTargetState.OUTPUT_REDIRECT_CHAR, outRedirect);
        setReturnHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    return;
                }
                CharacterHandler handler = enterStateHandlers.getHandler(ctx.getCharacter());
                if(handler != null) {
                    handler.handle(ctx);
                }
            }});
        setIgnoreWhitespaces(true);
    }
View Full Code Here


    public static final NameValueSeparatorState INSTANCE = new NameValueSeparatorState();

    public NameValueSeparatorState() {
        super(ID);
        setEnterHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                try {
                    // check if it's native DMR '=>' instead of simple '='
                    if(ctx.getInput().charAt(ctx.getLocation() + 1) == '>') {
View Full Code Here

    public static ArgumentValueState INSTANCE = new ArgumentValueState();

    public ArgumentValueState() {
        super(ID);
        setEnterHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                final char ch = ctx.getCharacter();
                if(ch == '"') {
                    ctx.enterState(QuotesState.QUOTES_EXCLUDED);
View Full Code Here

                } else {
                    ctx.enterState(sgList);
                }
            }});
        setDefaultHandler(new EnterStateCharacterHandler(props));
        setReturnHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    return;
                }
View Full Code Here

                    ctx.enterState(propList);
                } else if(ch != ')') {
                    ctx.leaveState();
                }
            }});
        setReturnHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    return;
                }
View Full Code Here

            @Override
            protected void doHandle(ParsingContext ctx) throws CommandFormatException {
                ctx.enterState(argList);
            }
        });
        this.setReturnHandler(new CharacterHandler() {
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    ctx.leaveState();
                    return;
                }
                final CharacterHandler handler = getHandler(ctx.getCharacter());
                if(handler != null) {
                    handler.handle(ctx);
                }
            }});
        enterState(OutputTargetState.OUTPUT_REDIRECT_CHAR, outputRedirect);
    }
View Full Code Here

        this(ArgumentState.INSTANCE, ArgumentValueState.INSTANCE, OutputTargetState.INSTANCE);
    }

    ArgumentListState(ArgumentState argState, final ArgumentValueState valueState, OutputTargetState outputTarget) {
        super(ID);
        setEnterHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                final CharacterHandler handler = getHandler(ctx.getCharacter());
                if(handler != null) {
                    handler.handle(ctx);
                }
            }});
        enterState('-', argState);
        setDefaultHandler(new LineBreakHandler(false, false){
            @Override
            protected void doHandle(ParsingContext ctx) throws CommandFormatException {
                ctx.enterState(valueState);
            }
        });
        putHandler(OutputTargetState.OUTPUT_REDIRECT_CHAR, GlobalCharacterHandlers.LEAVE_STATE_HANDLER);
        setIgnoreWhitespaces(true);
        setReturnHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    ctx.leaveState();
                } else {
View Full Code Here

        final NameValueSeparatorState nvSep = new NameValueSeparatorState(valueState);
        enterState('=', nvSep);
        //setLeaveOnWhitespace(true);
        setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON);
        setWhitespaceHandler(new EnterStateCharacterHandler(new WhitespaceState()));
        setReturnHandler(new CharacterHandler(){
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    ctx.leaveState();
                } else if(ctx.getCharacter() == '=') {
View Full Code Here

    }

    private static class WhitespaceState extends DefaultParsingState {
        public WhitespaceState() {
            super("WS");
            setDefaultHandler(new CharacterHandler(){
                @Override
                public void handle(ParsingContext ctx) throws CommandFormatException {
                    if(!Character.isWhitespace(ctx.getCharacter())) {
                        ctx.leaveState();
                    }
View Full Code Here

    public static final ArgumentValueState INSTANCE = new ArgumentValueState();
    public static final String ID = "PROP_VALUE";

    ArgumentValueState() {
        super(ID);
        this.setEnterHandler(new CharacterHandler() {
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.getCharacter() != '=') {
                    getHandler(ctx.getCharacter()).handle(ctx);
                }
            }});
        enterState('[', new DefaultStateWithEndCharacter("BRACKETS", ']', false, true, enterStateHandlers));
        enterState('(', new DefaultStateWithEndCharacter("PARENTHESIS", ')', false, true, enterStateHandlers));
        enterState('{', new DefaultStateWithEndCharacter("BRACES", '}', false, true, enterStateHandlers));
        setLeaveOnWhitespace(true);
        if(!Util.isWindows()) {
            // on windows we don't escape, this would mess up file system paths for example.
            setDefaultHandler(WordCharacterHandler.LB_LEAVE_ESCAPE_ON);
            enterState('"', QuotesState.QUOTES_INCLUDED);
        } else {
            setDefaultHandler(new WordCharacterHandler(true, false));
            enterState('"', new QuotesState(true, false));
        }
        setReturnHandler(new CharacterHandler() {
            @Override
            public void handle(ParsingContext ctx) throws CommandFormatException {
                if(ctx.isEndOfContent()) {
                    ctx.leaveState();
                }
View Full Code Here

TOP

Related Classes of org.jboss.as.cli.parsing.CharacterHandler

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.