Package org.apache.felix.service.command

Examples of org.apache.felix.service.command.CommandSession.execute()


                        out.println(id);
                    }
                } else if("execute".equals(sessionOp)) {
                    RemoteCommandSession remote = sessions.get(sessionId);
                    CommandSession session = remote.attach(in, out, err);
                    session.execute(cmd);
                    remote.detach();
                } else if("stop".equals(sessionOp)) {
                    RemoteCommandSession remote = sessions.remove(sessionId);
                    CommandSession session = remote.attach(in, out, err);
                    session.close();
View Full Code Here


            throw new IllegalArgumentException("Script definition *must* define at least a 'script' property!");
        }

        CommandSession session = m_processor.createSession(System.in, System.out, System.err);
        try {
            Object scriptResult = session.execute(script);
            m_logger.log(LogService.LOG_DEBUG, "Script output:\n" + scriptResult);
        }
        finally {
            session.close();
        }
View Full Code Here

    @Descriptor("executes a script definition")
    public void execute(CommandSession session, @Descriptor("the script to execute, multiple commands should be separated by semicolons") String script) throws Exception {
        CommandSession newSession = m_processor.createSession(session.getKeyboard(), session.getConsole(), System.err);
        try {
            newSession.execute(script);
        }
        finally {
            newSession.close();
        }
    }
View Full Code Here

                StringBuilder builder = new StringBuilder();
                while ((line = reader.readLine()) != null)
                    builder.append(line).append("\n");

                session = m_processor.createSession(System.in, System.out, System.err);
                session.execute(builder.toString());
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            finally {
View Full Code Here

                    public String call() {
                        try {
                            if (!silent) {
                                System.err.println(command);
                            }
                            commandSession.execute(command);
                        } catch (Exception e) {
                            e.printStackTrace(System.err);
                        }
                        printStream.flush();
                        return byteArrayOutputStream.toString();
View Full Code Here

                    public String call() {
                        try {
                            if (!silent) {
                                System.err.println(command);
                            }
                            commandSession.execute(command);
                        } catch (Exception e) {
                            e.printStackTrace(System.err);
                        }
                        printStream.flush();
                        return byteArrayOutputStream.toString();
View Full Code Here

                }

                program = readScript(script);
            }

            result = newSession.execute(program);
        }

        if (login && interactive && !opt.isSet("noshutdown"))
        {
            System.out.println("gosh: stopping framework");
View Full Code Here

                {
                    public void run()
                    {
                        try
                        {
                            session.execute("gosh --login --noshutdown");
                        }
                        catch (Exception e)
                        {
                            e.printStackTrace();
                        }
View Full Code Here

                    public String call() {
                        try {
                            if (!silent) {
                                System.err.println(command);
                            }
                            commandSession.execute(command);
                        } catch (Exception e) {
                            e.printStackTrace(System.err);
                        }
                        printStream.flush();
                        return byteArrayOutputStream.toString();
View Full Code Here

                new Callable<String>() {
                    public String call() {
                        try {
                            for (String command : commands) {
                                System.err.println(command);
                                commandSession.execute(command);
                            }
                        } catch (Exception e) {
                            e.printStackTrace(System.err);
                        }
                        return byteArrayOutputStream.toString();
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.