Package org.apache.karaf.shell.console.jline

Examples of org.apache.karaf.shell.console.jline.Console$ConsoleInputStream


     * @param terminal
     * @return
     * @throws Exception
     */
    protected Console createConsole(CommandShellImpl commandProcessor, InputStream in, PrintStream out, PrintStream err, Terminal terminal) throws Exception {
        return new Console(commandProcessor, in, out, err, terminal, null);
    }
View Full Code Here


        setUser("unknown");
    }

    @Override
    protected Console createConsole(CommandShellImpl commandProcessor, InputStream in, PrintStream out, PrintStream err, Terminal terminal) throws Exception {
        return new Console(commandProcessor, in, out, err, terminal, null) {

            /**
             * If you don't overwrite, then karaf will use the welcome message found in the
             * following resource files:
             * <ul>
 
View Full Code Here

        } else {

            // We are going into full blown interactive shell mode.
            TerminalFactory terminalFactory = new TerminalFactory();
            Terminal terminal = terminalFactory.getTerminal();
            Console console = createConsole(commandProcessor, in, out, err, terminal);
            CommandSession session = console.getSession();
            session.put("LINES", Integer.toString(terminal.getTerminalHeight()));
            session.put("COLUMNS", Integer.toString(terminal.getTerminalWidth()));
            session.put(".jline.terminal", terminal);
            session.put("USER", user);
            session.put("APPLICATION", application);
            session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode()));

            console.run();
            terminalFactory.destroy();
        }
    }
View Full Code Here

     * @param terminal
     * @return
     * @throws Exception
     */
    protected Console createConsole(CommandShellImpl commandProcessor, InputStream in, PrintStream out, PrintStream err, Terminal terminal) throws Exception {
        return new Console(commandProcessor, in, out, err, terminal, null);
    }
View Full Code Here

                in = new PipedOutputStream();
                out = new PipedInputStream();
                PrintStream pipedOut = new PrintStream(new PipedOutputStream(out), true);

                console = new Console(commandProcessor,
                                      new PipedInputStream(in),
                                      pipedOut,
                                      pipedOut,
                                      new WebTerminal(TERM_WIDTH, TERM_HEIGHT),
                                      null);
View Full Code Here

        }

        public void start(final Environment env) throws IOException {
            try {
                final Terminal terminal = new SshTerminal(env);
                Console console = new Console(commandProcessor,
                                              in,
                                              new PrintStream(new LfToCrLfFilterOutputStream(out), true),
                                              new PrintStream(new LfToCrLfFilterOutputStream(err), true),
                                              terminal,
                                              new Runnable() {
                                                  public void run() {
                                                      destroy();
                                                  }
                                              });
                final CommandSession session = console.getSession();
                session.put("APPLICATION", System.getProperty("karaf.name", "root"));
                for (Map.Entry<String,String> e : env.getEnv().entrySet()) {
                    session.put(e.getKey(), e.getValue());
                }
                session.put("LINES", Integer.toString(terminal.getTerminalHeight()));
View Full Code Here

        }

        public void start(final Environment env) throws IOException {
            try {
                final Terminal terminal = new SshTerminal(env);
                Console console = new Console(commandProcessor,
                                              in,
                                              new PrintStream(new LfToCrLfFilterOutputStream(out), true),
                                              new PrintStream(new LfToCrLfFilterOutputStream(err), true),
                                              terminal,
                                              new Runnable() {
                                                  public void run() {
                                                      destroy();
                                                  }
                                              });
                final CommandSession session = console.getSession();
                session.put("APPLICATION", System.getProperty("karaf.name", "root"));
                for (Map.Entry<String,String> e : env.getEnv().entrySet()) {
                    session.put(e.getKey(), e.getValue());
                }
                session.put("LINES", Integer.toString(terminal.getTerminalHeight()));
View Full Code Here

        }

        public void start(final Environment env) throws IOException {
            try {
                final Terminal terminal = new SshTerminal(env);
                Console console = consoleFactory.createConsole(in,
                        new PrintStream(new LfToCrLfFilterOutputStream(out), true),
                        new PrintStream(new LfToCrLfFilterOutputStream(err), true),
                        terminal,
                        new Runnable() {
                            public void run() {
                                destroy();
                            }
                        });
                // The consoleFactory already sets a lot of things in this console's session.
                // All we need to do here is set up some SSH-specific things.
                final CommandSession session = console.getSession();
                for (Map.Entry<String, String> e : env.getEnv().entrySet()) {
                    session.put(e.getKey(), e.getValue());
                }

                new Thread(console) {
View Full Code Here

        } else {
            // We are going into full blown interactive shell mode.

            final TerminalFactory terminalFactory = new TerminalFactory();
            final Terminal terminal = terminalFactory.getTerminal();
            Console console = createConsole(commandProcessor, in, out, err, terminal);
            CommandSession session = console.getSession();
            session.put("USER", user);
            session.put("APPLICATION", application);
            session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode()));
            session.put("#LINES", new Function() {
                public Object execute(CommandSession session, List<Object> arguments) throws Exception {
                    return Integer.toString(terminal.getHeight());
                }
            });
            session.put("#COLUMNS", new Function() {
                public Object execute(CommandSession session, List<Object> arguments) throws Exception {
                    return Integer.toString(terminal.getWidth());
                }
            });
            session.put(".jline.terminal", terminal);

            console.run();

            terminalFactory.destroy();
        }

    }
View Full Code Here

     * @param terminal
     * @return
     * @throws Exception
     */
    protected Console createConsole(CommandProcessorImpl commandProcessor, InputStream in, PrintStream out, PrintStream err, Terminal terminal) throws Exception {
        return new Console(commandProcessor, in, out, err, terminal, null);
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.console.jline.Console$ConsoleInputStream

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.