Package org.apache.karaf.shell.impl.console

Examples of org.apache.karaf.shell.impl.console.TerminalFactory


        run(sessionFactory, sb.toString(), in, out, err, cl);
    }

    private void run(final SessionFactory sessionFactory, String command, final InputStream in, final PrintStream out, final PrintStream err, ClassLoader cl) throws Exception {

        final TerminalFactory terminalFactory = new TerminalFactory();
        try {
            final Terminal terminal = new JLineTerminal(terminalFactory.getTerminal());
            Session session = createSession(sessionFactory, command.length() > 0 ? null : in, out, err, terminal);
            session.put("USER", user);
            session.put("APPLICATION", application);

            discoverCommands(session, cl, getDiscoveryResource());

            if (command.length() > 0) {
                // Shell is directly executing a sub/command, we don't setup a console
                // in this case, this avoids us reading from stdin un-necessarily.
                session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode()));
                session.put(Session.PRINT_STACK_TRACES, "execution");
                try {
                    session.execute(command);
                } catch (Throwable t) {
                    ShellUtil.logException(session, t);
                }

            } else {
                // We are going into full blown interactive shell mode.
                session.run();
            }
        } finally {
            terminalFactory.destroy();
        }
    }
View Full Code Here


        actionExtender = new CommandExtender(sessionFactory);
        actionExtender.start(context);

        if (Boolean.parseBoolean(context.getProperty(START_CONSOLE))) {
            terminalFactory = new TerminalFactory();
            localConsoleManager = new LocalConsoleManager(context, terminalFactory, sessionFactory);
            localConsoleManager.start();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.impl.console.TerminalFactory

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.