Interface ShellService


public interface ShellService
This interface defines the Felix impl service. The impl service is an extensible, user interface neutral impl for controlling and interacting with the framework. In general, the impl service assumes that it is operating in a command line fashion, i.e., it receives a complete command line, parses it, and executes the corresponding command, but graphical interfaces are also possible.

All commands in the impl service are actually implemented as OSGi services; these services implement the Command service interface. Any bundle can implement custom commands by creating command services and registering them with the OSGi framework.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    executeCommand(String commandLine, PrintStream out, PrintStream err)
    This method executes the supplied command line using the supplied output and error print stream.
    Returns the description associated with the specified command name.
    org.osgi.framework.ServiceReference
    Returns the service reference associated with the specified command name.
    Returns an array of command names available in the impl service.
    Returns the usage string associated with the specified command name.
  • Method Details

    • getCommands

      String[] getCommands()
      Returns an array of command names available in the impl service.
      Returns:
      an array of available command names or an empty array.
    • getCommandUsage

      String getCommandUsage(String name)
      Returns the usage string associated with the specified command name.
      Parameters:
      name - the name of the target command.
      Returns:
      the usage string of the specified command or null.
    • getCommandDescription

      String getCommandDescription(String name)
      Returns the description associated with the specified command name.
      Parameters:
      name - the name of the target command.
      Returns:
      the description of the specified command or null.
    • getCommandReference

      org.osgi.framework.ServiceReference getCommandReference(String name)
      Returns the service reference associated with the specified command name.
      Parameters:
      name - the name of the target command.
      Returns:
      the description of the specified command or null.
    • executeCommand

      void executeCommand(String commandLine, PrintStream out, PrintStream err) throws Exception
      This method executes the supplied command line using the supplied output and error print stream. The assumption of this method is that a command line will be typed by the user (or perhaps constructed by a GUI) and passed into it for execution. The command line is interpretted in a very simplistic fashion; it takes the leading string of characters terminated by a space character (not including it) and assumes that this leading token is the command name. For an example, consider the following command line:

           update 3 http://www.foo.com/bar.jar
       

      This is interpretted as an update command; as a result, the entire command line (include command name) is passed into the execute() method of the command service with the name update if one exists. If the corresponding command service is not found, then an error message is printed to the error print stream.

      Parameters:
      commandLine - the command line to execute.
      out - the standard output print stream.
      err - the standard error print stream.
      Throws:
      Exception