Package org.apache.felix.shell

Examples of org.apache.felix.shell.ShellService


            pw.print(command == null ? "" : WebConsoleUtil.escapeHtml(command)); //$NON-NLS-1$
            pw.println("</span><br />"); //$NON-NLS-1$

            if (command != null && command.length() > 0)
            {
                ShellService shellService = getShellService();
                if (shellService != null)
                {
                    ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
                    ByteArrayOutputStream baosErr = new ByteArrayOutputStream();

                    shellService.executeCommand(command, new PrintStream(baosOut, true),
                        new PrintStream(baosErr, true));
                    if (baosOut.size() > 0)
                    {
                        pw.print(WebConsoleUtil.escapeHtml(new String(
                            baosOut.toByteArray())));
View Full Code Here


        {
            m_out.println("No shell service is available.");
            return;
        }

        ShellService shell = (ShellService) m_context.getService(ref);

        // Print the command line in the output window.
        m_out.println("-> " + line);

        try {
            shell.executeCommand(line, m_out, m_out);
        } catch (Exception ex) {
            m_out.println(ex.toString());
            ex.printStackTrace(m_out);
        }
View Full Code Here

            ServiceReference ref = m_context.getServiceReference(
                org.apache.felix.shell.ShellService.class.getName());

            if (ref != null)
            {
                ShellService ss = (ShellService) m_context.getService(ref);

                // Parse command line.
                StringTokenizer st = new StringTokenizer(s, " ");

                // Ignore the command name.
                st.nextToken();

                if (!st.hasMoreTokens())
                {
                    String[] cmds = ss.getCommands();
                    for (int i = 0; i < cmds.length; i++)
                    {
                        out.println(cmds[i]);
                    }
                    out.println("\nUse 'help <command-name>' for more information.");
                }
                else
                {
                    String[] cmds = ss.getCommands();
                    String[] targets = new String[st.countTokens()];
                    for (int i = 0; i < targets.length; i++)
                    {
                        targets[i] = st.nextToken().trim();
                    }
                    boolean found = false;
                    for (int cmdIdx = 0; (cmdIdx < cmds.length); cmdIdx++)
                    {
                        for (int targetIdx = 0; targetIdx < targets.length; targetIdx++)
                        {
                            if (cmds[cmdIdx].equals(targets[targetIdx]))
                            {
                                if (found)
                                {
                                    out.println("---");
                                }
                                found = true;
                                out.println("Command     : "
                                    + cmds[cmdIdx]);
                                out.println("Usage       : "
                                    + ss.getCommandUsage(cmds[cmdIdx]));
                                out.println("Description : "
                                    + ss.getCommandDescription(cmds[cmdIdx]));
                            }
                        }
                    }
                }
            }
View Full Code Here

                    report.setActionExitCode(ActionReport.ExitCode.WARNING);
                    return;
                } else if("asadmin-osgi-shell".equals(cmdName)) {
                    out.println("felix");
                } else {
                    ShellService s = (ShellService) shell;
                    s.executeCommand(cmd, out, err);
                }
            } else {
                // try with gogo...

                // GLASSFISH-19126 - prepare fake input stream...
View Full Code Here

                    report.setActionExitCode(ActionReport.ExitCode.WARNING);
                    return;
                } else if("asadmin-osgi-shell".equals(cmdName)) {
                    out.println("felix");
                } else {
                    ShellService s = (ShellService) shell;
                    s.executeCommand(cmd, out, err);
                }
            } else {
                // try with gogo...

                // GLASSFISH-19126 - prepare fake input stream...
View Full Code Here

    public String getOutput() {
        return output;
    }

    public void executeCommand(String commandLine, PrintStream out, PrintStream err) throws Exception {
        ShellService shellService = getShellService();
        if (shellService != null)
            shellService.executeCommand(commandLine, out, err);
        else
            err.println("Apache Felix Shell service is not installed");
    }
View Full Code Here

            if (line.equalsIgnoreCase("exit") || line.equalsIgnoreCase("disconnect"))
            {
                return;
            }

            ShellService shs = (ShellService)
                m_owner.getServices().getShellService(ServiceMediator.NO_WAIT);
            try
            {
                lock.acquire();
                shs.executeCommand(line, m_out, m_out);
            }
            catch (Exception ex)
            {
                m_owner.getServices().error("Shell::run()", ex);
            }
View Full Code Here

                    report.setActionExitCode(ActionReport.ExitCode.WARNING);
                    return;
                } else if("asadmin-osgi-shell".equals(cmdName)) {
                    out.println("felix");
                } else {
                    ShellService s = (ShellService) shell;
                    s.executeCommand(cmd, out, err);
                }
            } else {
                // try with gogo...

                // GLASSFISH-19126 - prepare fake input stream...
View Full Code Here

TOP

Related Classes of org.apache.felix.shell.ShellService

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.