Package org.apache.felix.service.command

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


                }

                program = readScript(script);
            }

            result = newSession.execute(program);
        }

        if (login && interactive && !opt.isSet("noshutdown"))
        {
            System.out.println("gosh: stopping framework");
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

        public void execute(String command, String expectedOutput, String expectedError) {
            try {
                ByteArrayOutputStream output = new ByteArrayOutputStream();
                ByteArrayOutputStream error = new ByteArrayOutputStream();
                CommandSession session = m_commandProcessor.createSession(System.in, new PrintStream(output), new PrintStream(error));
                session.execute(command);
               
                String out = output.toString();                               
                Pattern p = Pattern.compile(expectedOutput, Pattern.MULTILINE);               
                               
                Assert.assertTrue("\n\nexpected:\n\n" + expectedOutput + "\nbut got:\n\n" + out, p.matcher(out).matches());
View Full Code Here

        commandSession.put("APPLICATION", System.getProperty("karaf.name", "root"));
        commandSession.put("USER", "karaf");

        try {
            System.err.println(command);
            commandSession.execute(command);
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
        return byteArrayOutputStream.toString();
    }
View Full Code Here

        commandSession.put("USER", "karaf");

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

            session.put("USER", user);
            session.put("APPLICATION", application);
            session.put(NameScoping.MULTI_SCOPE_MODE_KEY, Boolean.toString(isMultiScopeMode()));

            try {
                session.execute(sb);
            } catch (Throwable t) {
                if (t instanceof CommandNotFoundException) {
                    String str = Ansi.ansi()
                        .fg(Ansi.Color.RED)
                        .a("Command not found: ")
View Full Code Here

                    Object result;
                    if (subject != null) {
                        try {
                            result = Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
                                public Object run() throws Exception {
                                    return session.execute(command);
                                }
                            });
                        } catch (PrivilegedActionException e) {
                            throw e.getException();
                        }
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.