org.eclipse.osgi.framework.internal.core
Class FrameworkConsole

java.lang.Object
  extended by org.eclipse.osgi.framework.internal.core.FrameworkConsole
All Implemented Interfaces:
Runnable

public class FrameworkConsole
extends Object
implements Runnable

This class starts OSGi with a console for development use. FrameworkConsole provides a printStackTrace method to print Exceptions and their nested Exceptions.


Constructor Summary
FrameworkConsole(BundleContext context, ConsoleSession consoleSession, boolean isSystemInOut, ServiceTracker<CommandProvider,CommandProvider> cptracker)
           
 
Method Summary
protected  void docommand(String cmdline)
          Process the args on the command line.
 String getInput()
          Reads a string from standard input until user hits the Enter key.
 CommandProvider[] getServices()
          Return an array of service objects for all services being tracked by this ServiceTracker object.
 PrintWriter getWriter()
          Return the current output PrintWriter
 void run()
          Command Line Interface for OSGi.
 void shutdown()
          Stops the console so the thread can be GC'ed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameworkConsole

public FrameworkConsole(BundleContext context,
                        ConsoleSession consoleSession,
                        boolean isSystemInOut,
                        ServiceTracker<CommandProvider,CommandProvider> cptracker)
Method Detail

getWriter

public PrintWriter getWriter()
Return the current output PrintWriter

Returns:
The currently active PrintWriter

run

public void run()
Command Line Interface for OSGi. The method processes the initial commands and then reads and processes commands from the console InputStream. Command output is written to the console PrintStream. The method will loop reading commands from the console InputStream until end-of-file is reached. This method will then return.

Specified by:
run in interface Runnable

docommand

protected void docommand(String cmdline)
Process the args on the command line. This method invokes a CommandInterpreter to do the actual work.

Parameters:
cmdline - a string containing the command line arguments

getInput

public String getInput()
Reads a string from standard input until user hits the Enter key.

Returns:
The string read from the standard input without the newline character.

getServices

public CommandProvider[] getServices()
Return an array of service objects for all services being tracked by this ServiceTracker object. The array is sorted primarily by descending Service Ranking and secondarily by ascending Service ID.

Returns:
Array of service objects; if no service are being tracked then an empty array is returned

shutdown

public void shutdown()
Stops the console so the thread can be GC'ed



Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.