Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.osgi.framework.internal.core
Class FrameworkCommandProvider  view FrameworkCommandProvider download FrameworkCommandProvider.java

java.lang.Object
  extended byorg.eclipse.osgi.framework.internal.core.FrameworkCommandProvider
All Implemented Interfaces:
org.eclipse.osgi.framework.console.CommandProvider

public class FrameworkCommandProvider
extends java.lang.Object
implements org.eclipse.osgi.framework.console.CommandProvider

This class provides methods to execute commands from the command line. It registers itself as a CommandProvider so it can be invoked by a CommandInterpreter. The FrameworkCommandProvider registers itself with the highest ranking (Integer.MAXVALUE) so it will always be called first. Other CommandProviders should register with lower rankings. The commands provided by this class are: ---Controlling the OSGi framework--- close - shutdown and exit exit - exit immediately (System.exit) gc - perform a garbage collection init - uninstall all bundles launch - start the Service Management Framework setprop = - set the OSGI property shutdown - shutdown the Service Management Framework ---Controlliing Bundles--- install {s[tart]} - install and optionally start bundle from the given URL refresh (|) - refresh the packages of the specified bundles start (|) - start the specified bundle(s) stop (|) - stop the specified bundle(s) uninstall (|) - uninstall the specified bundle(s) update (||<*>) - update the specified bundle(s) ---Displaying Status--- bundle (|) - display details for the specified bundle(s) bundles - display details for all installed bundles headers (|) - print bundle headers packages {||} - display imported/exported package details props - display System properties services {filter} - display registered service details ss - display installed bundles (short status) status - display installed bundles and registered services threads - display threads and thread groups ---Log Commands--- log {(|)} - display log entries ---Extras--- exec - execute a command in a separate process and wait fork - execute a command in a separate process ---Controlling StartLevel--- sl {(|)} - display the start level for the specified bundle, or for the framework if no bundle specified setfwsl - set the framework start level setbsl (|) - set the start level for the bundle(s) setibsl - set the initial bundle start level There is a method for each command which is named '_'+method. The methods are invoked by a CommandInterpreter's execute method.


Field Summary
private  org.osgi.framework.BundleContext context
          The system bundle context
private  java.lang.String newline
           
private  OSGi osgi
          An instance of the OSGi framework
private  StartLevelManager slImpl
          The start level implementation
private  java.lang.String tab
          Strings used to format other strings
 
Constructor Summary
FrameworkCommandProvider(OSGi osgi)
          Constructor.
 
Method Summary
 void _b(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the bundle command's abbreviation.
 void _bundle(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the bundle command.
 void _bundles(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the bundles command.
 void _classSpaces(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           
 void _close(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the close command.
 void _exec(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Executes the given system command in a separate system process and waits for it to finish.
 void _exit(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the exit command.
 void _fork(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Executes the given system command in a separate system process.
 void _gc(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the gc command.
 void _h(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the headers command's abbreviation.
 void _headers(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the headers command.
 void _i(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the install command's abbreviation.
 void _init(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the init command.
 void _install(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the install command.
 void _l(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the log command's abbreviation.
 void _launch(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the launch command.
 void _log(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the log command.
 void _p(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the packages command's abbreviation.
 void _packages(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the packages command.
 void _pr(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the props command's abbreviation.
 void _props(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the _props command.
 void _r(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the refresh command's abbreviation.
 void _refresh(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the refresh command.
 void _s(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the status command's abbreviation.
 void _se(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the services command's abbreviation.
 void _services(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the services command.
 void _setbsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the setbsl (set bundle startlevel) command.
 void _setfwsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the setfwsl (set framework startlevel) command.
 void _setibsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the setibsl (set initial bundle startlevel) command.
 void _setp(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the setprop command's abbreviation.
 void _setprop(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the setprop command.
 void _shutdown(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the shutdown command.
 void _sl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the sl (startlevel) command.
 void _ss(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Prints the short version of the status.
 void _sta(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the start command's abbreviation.
 void _start(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the start command.
 void _status(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the status command.
 void _sto(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the stop command's abbreviation.
 void _stop(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the stop command.
 void _t(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handles the threads command abbreviation.
 void _threads(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Prints the information about the currently running threads in the embedded system.
 void _un(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the uninstall command's abbreviation.
 void _uninstall(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the uninstall command.
 void _up(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the update command's abbreviation.
 void _update(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Handle the update command.
private  void addCommand(java.lang.String command, java.lang.String description, java.lang.StringBuffer help)
          Private helper method for getHelp.
private  void addCommand(java.lang.String command, java.lang.String parameters, java.lang.String description, java.lang.StringBuffer help)
          Private helper method for getHelp.
private  void addHeader(java.lang.String header, java.lang.StringBuffer help)
          Private helper method for getHelp.
protected  AbstractBundle getBundleFromToken(org.eclipse.osgi.framework.console.CommandInterpreter intp, java.lang.String token, boolean error)
          Given a number, retrieve the Bundle object with that id.
 java.lang.String getHelp()
          Answer a string (may be as many lines as you like) with help texts that explain the command.
protected  int getStartLevelFromToken(org.eclipse.osgi.framework.console.CommandInterpreter intp, java.lang.String value)
          Given a string containing a startlevel value, validate it and convert it to an int
protected  java.lang.String getStateName(int state)
          Given a state value, return the string describing that state.
protected  java.lang.ThreadGroup[] getThreadGroups()
          Answers all thread groups in the system.
protected  java.lang.ThreadGroup getTopThreadGroup()
          Answers the top level group of the current thread.
protected  boolean isStartLevelSvcPresent(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          Checks for the presence of the StartLevel Service.
 java.lang.String simpleClassName(java.lang.Object o)
          Returns the simple class name of an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

osgi

private OSGi osgi
An instance of the OSGi framework


context

private org.osgi.framework.BundleContext context
The system bundle context


slImpl

private StartLevelManager slImpl
The start level implementation


tab

private java.lang.String tab
Strings used to format other strings


newline

private java.lang.String newline
Constructor Detail

FrameworkCommandProvider

public FrameworkCommandProvider(OSGi osgi)
Constructor. It registers itself as a CommandProvider with the highest ranking possible.

Method Detail

getHelp

public java.lang.String getHelp()
Answer a string (may be as many lines as you like) with help texts that explain the command. This getHelp() method uses the ConsoleMsg class to obtain the correct NLS data to display to the user.

Specified by:
getHelp in interface org.eclipse.osgi.framework.console.CommandProvider

addHeader

private void addHeader(java.lang.String header,
                       java.lang.StringBuffer help)
Private helper method for getHelp. Formats the help headers.


addCommand

private void addCommand(java.lang.String command,
                        java.lang.String description,
                        java.lang.StringBuffer help)
Private helper method for getHelp. Formats the command descriptions.


addCommand

private void addCommand(java.lang.String command,
                        java.lang.String parameters,
                        java.lang.String description,
                        java.lang.StringBuffer help)
Private helper method for getHelp. Formats the command descriptions with command arguements.


_exit

public void _exit(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Handle the exit command. Exit immediately (System.exit)


_launch

public void _launch(org.eclipse.osgi.framework.console.CommandInterpreter intp)
             throws java.lang.Exception
Handle the launch command. Start the OSGi framework.


_shutdown

public void _shutdown(org.eclipse.osgi.framework.console.CommandInterpreter intp)
               throws java.lang.Exception
Handle the shutdown command. Shutdown the OSGi framework.


_sta

public void _sta(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          throws java.lang.Exception
Handle the start command's abbreviation. Invoke _start()


_start

public void _start(org.eclipse.osgi.framework.console.CommandInterpreter intp)
            throws java.lang.Exception
Handle the start command. Start the specified bundle(s).


_sto

public void _sto(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          throws java.lang.Exception
Handle the stop command's abbreviation. Invoke _stop()


_stop

public void _stop(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Handle the stop command. Stop the specified bundle(s).


_i

public void _i(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the install command's abbreviation. Invoke _install()


_install

public void _install(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handle the install command. Install and optionally start bundle from the given URL\r\n"


_up

public void _up(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handle the update command's abbreviation. Invoke _update()


_update

public void _update(org.eclipse.osgi.framework.console.CommandInterpreter intp)
             throws java.lang.Exception
Handle the update command. Update the specified bundle(s).


_un

public void _un(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handle the uninstall command's abbreviation. Invoke _uninstall()


_uninstall

public void _uninstall(org.eclipse.osgi.framework.console.CommandInterpreter intp)
                throws java.lang.Exception
Handle the uninstall command. Uninstall the specified bundle(s).


_s

public void _s(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the status command's abbreviation. Invoke _status()


_status

public void _status(org.eclipse.osgi.framework.console.CommandInterpreter intp)
             throws java.lang.Exception
Handle the status command. Display installed bundles and registered services.


_se

public void _se(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handle the services command's abbreviation. Invoke _services()


_services

public void _services(org.eclipse.osgi.framework.console.CommandInterpreter intp)
               throws java.lang.Exception
Handle the services command. Display registered service details.


_p

public void _p(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the packages command's abbreviation. Invoke _packages()


_packages

public void _packages(org.eclipse.osgi.framework.console.CommandInterpreter intp)
               throws java.lang.Exception
Handle the packages command. Display imported/exported package details.


_bundles

public void _bundles(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handle the bundles command. Display details for all installed bundles.


_b

public void _b(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the bundle command's abbreviation. Invoke _bundle()


_bundle

public void _bundle(org.eclipse.osgi.framework.console.CommandInterpreter intp)
             throws java.lang.Exception
Handle the bundle command. Display details for the specified bundle(s).


_l

public void _l(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the log command's abbreviation. Invoke _log()


_log

public void _log(org.eclipse.osgi.framework.console.CommandInterpreter intp)
          throws java.lang.Exception
Handle the log command. Display log entries.


_gc

public void _gc(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handle the gc command. Perform a garbage collection.


_init

public void _init(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Handle the init command. Uninstall all bundles.


_close

public void _close(org.eclipse.osgi.framework.console.CommandInterpreter intp)
            throws java.lang.Exception
Handle the close command. Shutdown and exit.


_r

public void _r(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the refresh command's abbreviation. Invoke _refresh()


_refresh

public void _refresh(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handle the refresh command. Refresh the packages of the specified bundles.


_exec

public void _exec(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Executes the given system command in a separate system process and waits for it to finish.


_fork

public void _fork(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Executes the given system command in a separate system process. It does not wait for a result.


_h

public void _h(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handle the headers command's abbreviation. Invoke _headers()


_headers

public void _headers(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handle the headers command. Display headers for the specified bundle(s).


_pr

public void _pr(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handles the props command's abbreviation. Invokes _props()


_props

public void _props(org.eclipse.osgi.framework.console.CommandInterpreter intp)
            throws java.lang.Exception
Handles the _props command. Prints the system properties sorted.


_setp

public void _setp(org.eclipse.osgi.framework.console.CommandInterpreter intp)
           throws java.lang.Exception
Handles the setprop command's abbreviation. Invokes _setprop()


_setprop

public void _setprop(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handles the setprop command. Sets the CDS property in the given argument.


_ss

public void _ss(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Prints the short version of the status. For the long version use "status".


_t

public void _t(org.eclipse.osgi.framework.console.CommandInterpreter intp)
        throws java.lang.Exception
Handles the threads command abbreviation. Invokes _threads().


_threads

public void _threads(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Prints the information about the currently running threads in the embedded system.


_sl

public void _sl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
         throws java.lang.Exception
Handles the sl (startlevel) command.


_setfwsl

public void _setfwsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handles the setfwsl (set framework startlevel) command.


_setbsl

public void _setbsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
             throws java.lang.Exception
Handles the setbsl (set bundle startlevel) command.


_setibsl

public void _setibsl(org.eclipse.osgi.framework.console.CommandInterpreter intp)
              throws java.lang.Exception
Handles the setibsl (set initial bundle startlevel) command.


_classSpaces

public void _classSpaces(org.eclipse.osgi.framework.console.CommandInterpreter intp)

isStartLevelSvcPresent

protected boolean isStartLevelSvcPresent(org.eclipse.osgi.framework.console.CommandInterpreter intp)
Checks for the presence of the StartLevel Service. Outputs a message if it is not present.


getBundleFromToken

protected AbstractBundle getBundleFromToken(org.eclipse.osgi.framework.console.CommandInterpreter intp,
                                            java.lang.String token,
                                            boolean error)
Given a number, retrieve the Bundle object with that id.


getStartLevelFromToken

protected int getStartLevelFromToken(org.eclipse.osgi.framework.console.CommandInterpreter intp,
                                     java.lang.String value)
Given a string containing a startlevel value, validate it and convert it to an int


getStateName

protected java.lang.String getStateName(int state)
Given a state value, return the string describing that state.


getThreadGroups

protected java.lang.ThreadGroup[] getThreadGroups()
Answers all thread groups in the system.


getTopThreadGroup

protected java.lang.ThreadGroup getTopThreadGroup()
Answers the top level group of the current thread.

It is the 'system' or 'main' thread group under which all 'user' thread groups are allocated.


simpleClassName

public java.lang.String simpleClassName(java.lang.Object o)
Returns the simple class name of an object.