Class Activator.ShellServiceImpl

java.lang.Object
org.apache.felix.shell.impl.Activator.ShellServiceImpl
All Implemented Interfaces:
ShellService, ShellService
Enclosing class:
Activator

private class Activator.ShellServiceImpl extends Object implements ShellService, ShellService
  • Field Details

    • m_commandRefMap

      private HashMap m_commandRefMap
    • m_commandNameMap

      private TreeMap m_commandNameMap
  • Constructor Details

    • ShellServiceImpl

      private ShellServiceImpl()
  • Method Details

    • getCommands

      public String[] getCommands()
      Description copied from interface: ShellService
      Returns an array of command names available in the impl service.
      Specified by:
      getCommands in interface ShellService
      Specified by:
      getCommands in interface ShellService
      Returns:
      an array of available command names or an empty array.
    • getCommandUsage

      public String getCommandUsage(String name)
      Description copied from interface: ShellService
      Returns the usage string associated with the specified command name.
      Specified by:
      getCommandUsage in interface ShellService
      Specified by:
      getCommandUsage in interface ShellService
      Parameters:
      name - the name of the target command.
      Returns:
      the usage string of the specified command or null.
    • getCommandDescription

      public String getCommandDescription(String name)
      Description copied from interface: ShellService
      Returns the description associated with the specified command name.
      Specified by:
      getCommandDescription in interface ShellService
      Specified by:
      getCommandDescription in interface ShellService
      Parameters:
      name - the name of the target command.
      Returns:
      the description of the specified command or null.
    • getCommandReference

      public org.osgi.framework.ServiceReference getCommandReference(String name)
      Description copied from interface: ShellService
      Returns the service reference associated with the specified command name.
      Specified by:
      getCommandReference in interface ShellService
      Specified by:
      getCommandReference in interface ShellService
      Parameters:
      name - the name of the target command.
      Returns:
      the description of the specified command or null.
    • removeCommand

      public void removeCommand(org.osgi.framework.ServiceReference ref)
    • executeCommand

      public void executeCommand(String commandLine, PrintStream out, PrintStream err) throws Exception
      Description copied from interface: ShellService
      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.

      Specified by:
      executeCommand in interface ShellService
      Specified by:
      executeCommand in interface ShellService
      Parameters:
      commandLine - the command line to execute.
      out - the standard output print stream.
      err - the standard error print stream.
      Throws:
      Exception
    • getCommand

      protected Command getCommand(String name)
    • addCommand

      protected void addCommand(org.osgi.framework.ServiceReference ref)
    • clearCommands

      protected void clearCommands()