Package org.apache.karaf.shell.api.console

Examples of org.apache.karaf.shell.api.console.Session.execute()


                // 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 {
View Full Code Here


        PrintStream ps = new PrintStream(baos, true);
        Session s = session.getFactory().create(null, ps, ps);
        s.put(Session.SCOPE, session.get(Session.SCOPE));
        s.put(Session.SUBSHELL, session.get(Session.SUBSHELL));
        try {
            s.execute(path + " --help");
        } catch (Throwable t) {
            return null;
        } finally {
            s.close();
        }
View Full Code Here

            public String call() throws Exception {
                try {
                    if (!silent) {
                        System.err.println(command);
                    }
                    session.execute(command);
                } catch (Exception e) {
                    throw new RuntimeException(e.getMessage(), e);
                }
                printStream.flush();
                return byteArrayOutputStream.toString();
View Full Code Here

                    try {
                        String scriptFileName = System.getProperty(SHELL_INIT_SCRIPT);
                        executeScript(scriptFileName, session);
                        result = JaasHelper.doAs(subject, new PrivilegedExceptionAction<Object>() {
                            public Object run() throws Exception {
                                return session.execute(command);
                            }
                        });
                    } catch (PrivilegedActionException e) {
                        throw e.getException();
                    }
View Full Code Here

                        throw e.getException();
                    }
                } else {
                    String scriptFileName = System.getProperty(SHELL_INIT_SCRIPT);
                    executeScript(scriptFileName, session);
                    result = session.execute(command);
                }
                if (result != null)
                {
                    // TODO: print the result of the command ?
//                    session.getConsole().println(session.format(result, Converter.INSPECT));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.