Package org.apache.felix.shell

Examples of org.apache.felix.shell.Command


        public String getCommandUsage(String name)
        {
            Object[] commands = m_tracker.getServices();
            for (int i = 0; (commands != null) && (i < commands.length); i++)
            {
                Command command = (Command) commands[i];
                if (command.getName().equals(name))
                {
                    return command.getUsage();
                }
            }
            return null;
        }
View Full Code Here


        public String getCommandDescription(String name)
        {
            Object[] commands = m_tracker.getServices();
            for (int i = 0; (commands != null) && (i < commands.length); i++)
            {
                Command command = (Command) commands[i];
                if (command.getName().equals(name))
                {
                    return command.getShortDescription();
                }
            }
            return null;
        }
View Full Code Here

        public ServiceReference getCommandReference(String name)
        {
            ServiceReference[] refs = m_tracker.getServiceReferences();
            for (int i = 0; (refs != null) && (i < refs.length); i++)
            {
                Command command = (Command) m_tracker.getService(refs[i]);
                if ((command != null) && command.getName().equals(name))
                {
                    return refs[i];
                }
            }
            return null;
View Full Code Here

            String commandLine, PrintStream out, PrintStream err) throws Exception
        {
            commandLine = commandLine.trim();
            String commandName = (commandLine.indexOf(' ') >= 0)
                ? commandLine.substring(0, commandLine.indexOf(' ')) : commandLine;
            Command command = getCommand(commandName);
            if (command != null)
            {
                if (System.getSecurityManager() != null)
                {
                    try
                    {
                        AccessController.doPrivileged(
                            new ExecutePrivileged(command, commandLine, out, err));
                    }
                    catch (PrivilegedActionException ex)
                    {
                        throw ex.getException();
                    }
                }
                else
                {
                    try
                    {
                        command.execute(commandLine, out, err);
                    }
                    catch (Throwable ex)
                    {
                        err.println("Unable to execute command: " + ex);
                        ex.printStackTrace(err);
View Full Code Here

        Command getCommand(String name)
        {
            Object[] commands = m_tracker.getServices();
            for (int i = 0; (commands != null) && (i < commands.length); i++)
            {
                Command command = (Command) commands[i];
                if (command.getName().equals(name))
                {
                    return command;
                }
            }
            return null;
View Full Code Here

        Assert.assertNotNull(commandReferences);

        int foundCommands = 0;
        Set<String> names = defaultCommansList.keySet();
        for (ServiceReference commandReference : commandReferences) {
            Command command = (Command) bc.getService(commandReference);
            if (names.contains(command.getName())) {
                foundCommands++;
            }
        }
        Assert.assertEquals(defaultCommansList.size(), foundCommands);

        registration.unregister();

        foundCommands = 0;
        commandReferences = bc.getServiceReferences("org.apache.felix.shell.Command", null);
        if (commandReferences != null) {
            for (ServiceReference commandReference : commandReferences) {
                Command command = (Command) bc.getService(commandReference);
                if (names.contains(command.getName())) {
                    foundCommands++;
                }
            }
        }
        Assert.assertEquals(0, foundCommands);
View Full Code Here

TOP

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

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.