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

Quick Search    Search Deep

org.eclipse.core.runtime.adaptor
Class EclipseStarter  view EclipseStarter download EclipseStarter.java

java.lang.Object
  extended byorg.eclipse.core.runtime.adaptor.EclipseStarter

public class EclipseStarter
extends java.lang.Object

Special startup class for the Eclipse Platform. This class cannot be instantiated; all functionality is provided by static methods.

The Eclipse Platform makes heavy use of Java class loaders for loading plug-ins. Even the Eclispe Runtime itself and the OSGi framework need to be loaded by special class loaders. The upshot is that a client program (such as a Java main program, a servlet) cannot reference any part of Eclipse directly. Instead, a client must use this loader class to start the platform, invoking functionality defined in plug-ins, and shutting down the platform when done.

Note that the fields on this class are not API.

Since:
3.0

Nested Class Summary
private static class EclipseStarter.InitialBundle
           
 
Field Summary
private static org.eclipse.osgi.framework.adaptor.FrameworkAdaptor adaptor
           
private static org.osgi.util.tracker.ServiceTracker applicationTracker
           
private static java.lang.String ARCH
           
private static java.lang.String CLEAN
           
private static java.lang.String CONFIGURATION
           
private static java.lang.String CONSOLE
           
private static java.lang.String CONSOLE_LOG
           
private static java.lang.String CONSOLE_NAME
           
private static org.osgi.framework.BundleContext context
           
private static java.lang.String DATA
           
static boolean debug
           
private static java.lang.String DEBUG
           
protected static java.lang.String DEFAULT_ADAPTOR_CLASS
          string containing the classname of the adaptor to be used in this framework instance
protected static java.lang.String DEFAULT_CONSOLE_CLASS
           
private static java.lang.String DEV
           
private static java.lang.String FILE_PROTOCOL
           
private static java.lang.String FILE_SCHEME
           
private static java.lang.String INITIAL_LOCATION
           
private static boolean initialize
           
private static java.lang.String INITIALIZE
           
private static org.eclipse.osgi.framework.log.FrameworkLog log
           
private static java.lang.String NL
           
private static java.lang.String OS
           
static java.lang.String PROP_ADAPTOR
           
static java.lang.String PROP_ARCH
           
static java.lang.String PROP_BUNDLES
           
static java.lang.String PROP_BUNDLES_STARTLEVEL
           
static java.lang.String PROP_CHECK_CONFIG
           
static java.lang.String PROP_CLEAN
           
private static java.lang.String PROP_COMMANDS
           
static java.lang.String PROP_CONSOLE
           
static java.lang.String PROP_CONSOLE_CLASS
           
static java.lang.String PROP_CONSOLE_LOG
           
static java.lang.String PROP_DEBUG
           
static java.lang.String PROP_DEV
           
static java.lang.String PROP_EXITCODE
           
static java.lang.String PROP_EXITDATA
           
static java.lang.String PROP_INITIAL_STARTLEVEL
           
static java.lang.String PROP_LOGFILE
           
static java.lang.String PROP_NL
           
static java.lang.String PROP_OS
           
static java.lang.String PROP_SYSPATH
           
private static java.lang.String PROP_VM
           
private static java.lang.String PROP_VMARGS
           
static java.lang.String PROP_WS
           
private static java.lang.String REFERENCE_PROTOCOL
           
private static java.lang.String REFERENCE_SCHEME
           
private static boolean running
           
private static java.lang.String USER
           
private static java.lang.String WS
           
 
Constructor Summary
EclipseStarter()
           
 
Method Summary
private static java.lang.String buildCommandLine(java.lang.String arg, java.lang.String value)
           
private static int compareVersion(java.lang.Object[] left, java.lang.Object[] right)
          Compares version strings.
private static org.eclipse.osgi.framework.adaptor.FrameworkAdaptor createAdaptor()
          Creates and returns the adaptor
protected static org.eclipse.osgi.framework.log.FrameworkLog createFrameworkLog()
           
private static void ensureBundlesActive(org.osgi.framework.Bundle[] bundles)
           
private static void finalizeProperties()
           
private static java.lang.String[] getArrayFromList(java.lang.String prop, java.lang.String separator)
          Returns the result of converting a list of comma-separated tokens into an array
private static org.osgi.framework.Bundle getBundleByLocation(java.lang.String location, org.osgi.framework.Bundle[] bundles)
           
private static org.osgi.framework.Bundle[] getCurrentInitialBundles()
           
private static EclipseStarter.InitialBundle[] getInitialBundles(java.lang.String[] installEntries)
           
private static int getStartLevel()
           
protected static java.lang.String getSysPath()
           
private static java.lang.Object[] getVersionElements(java.lang.String version)
          Do a quick parse of version identifier so its elements can be correctly compared.
private static void initializeApplicationTracker()
           
private static boolean installBundles(EclipseStarter.InitialBundle[] initialBundles, org.osgi.framework.Bundle[] curInitBundles, java.util.ArrayList startBundles, java.util.ArrayList newInitBundles)
           
static boolean isRunning()
          Returns true if the platform is already running, false otherwise.
private static org.osgi.framework.Bundle[] loadBasicBundles()
           
private static void loadConfigurationInfo()
           
private static void loadDefaultProperties()
           
private static java.util.Properties loadProperties(java.net.URL location)
           
private static void logUnresolvedBundles(org.osgi.framework.Bundle[] bundles)
           
private static void mergeProperties(java.util.Properties destination, java.util.Properties source)
           
private static java.lang.String[] processCommandLine(java.lang.String[] args)
           
private static void publishSplashScreen(java.lang.Runnable endSplashHandler)
           
private static void refreshPackages(org.osgi.framework.Bundle[] bundles)
           
static java.lang.Object run(java.lang.Object argument)
          Runs the applicaiton for which the platform was started.
static java.lang.Object run(java.lang.String[] args, java.lang.Runnable endSplashHandler)
          Launches the platform and runs a single application.
private static java.lang.String searchFor(java.lang.String target, java.lang.String start)
          Searches for the given target directory starting in the "plugins" subdirectory of the given location.
private static java.net.URL searchForBundle(java.lang.String name, java.lang.String parent)
           
private static void setStartLevel(int value)
           
static void shutdown()
          Shuts down the Platform.
private static void startBundles(org.osgi.framework.Bundle[] bundles)
           
private static void startConsole(org.eclipse.osgi.framework.internal.core.OSGi osgi, java.lang.String[] consoleArgs, java.lang.String consolePort)
          Invokes the OSGi Console on another thread
static void startup(java.lang.String[] args, java.lang.Runnable endSplashHandler)
          Starts the platform and sets it up to run a single application.
private static void stopSystemBundle()
           
private static boolean uninstallBundles(org.osgi.framework.Bundle[] curInitBundles, EclipseStarter.InitialBundle[] newInitBundles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adaptor

private static org.eclipse.osgi.framework.adaptor.FrameworkAdaptor adaptor

context

private static org.osgi.framework.BundleContext context

applicationTracker

private static org.osgi.util.tracker.ServiceTracker applicationTracker

initialize

private static boolean initialize

debug

public static boolean debug

running

private static boolean running

CLEAN

private static final java.lang.String CLEAN
See Also:
Constant Field Values

CONSOLE

private static final java.lang.String CONSOLE
See Also:
Constant Field Values

CONSOLE_LOG

private static final java.lang.String CONSOLE_LOG
See Also:
Constant Field Values

DEBUG

private static final java.lang.String DEBUG
See Also:
Constant Field Values

INITIALIZE

private static final java.lang.String INITIALIZE
See Also:
Constant Field Values

DEV

private static final java.lang.String DEV
See Also:
Constant Field Values

WS

private static final java.lang.String WS
See Also:
Constant Field Values

OS

private static final java.lang.String OS
See Also:
Constant Field Values

ARCH

private static final java.lang.String ARCH
See Also:
Constant Field Values

NL

private static final java.lang.String NL
See Also:
Constant Field Values

CONFIGURATION

private static final java.lang.String CONFIGURATION
See Also:
Constant Field Values

USER

private static final java.lang.String USER
See Also:
Constant Field Values

DATA

private static final java.lang.String DATA
See Also:
Constant Field Values

PROP_BUNDLES

public static final java.lang.String PROP_BUNDLES
See Also:
Constant Field Values

PROP_BUNDLES_STARTLEVEL

public static final java.lang.String PROP_BUNDLES_STARTLEVEL
See Also:
Constant Field Values

PROP_INITIAL_STARTLEVEL

public static final java.lang.String PROP_INITIAL_STARTLEVEL
See Also:
Constant Field Values

PROP_DEBUG

public static final java.lang.String PROP_DEBUG
See Also:
Constant Field Values

PROP_DEV

public static final java.lang.String PROP_DEV
See Also:
Constant Field Values

PROP_CLEAN

public static final java.lang.String PROP_CLEAN
See Also:
Constant Field Values

PROP_CONSOLE

public static final java.lang.String PROP_CONSOLE
See Also:
Constant Field Values

PROP_CONSOLE_CLASS

public static final java.lang.String PROP_CONSOLE_CLASS
See Also:
Constant Field Values

PROP_CHECK_CONFIG

public static final java.lang.String PROP_CHECK_CONFIG
See Also:
Constant Field Values

PROP_OS

public static final java.lang.String PROP_OS
See Also:
Constant Field Values

PROP_WS

public static final java.lang.String PROP_WS
See Also:
Constant Field Values

PROP_NL

public static final java.lang.String PROP_NL
See Also:
Constant Field Values

PROP_ARCH

public static final java.lang.String PROP_ARCH
See Also:
Constant Field Values

PROP_ADAPTOR

public static final java.lang.String PROP_ADAPTOR
See Also:
Constant Field Values

PROP_SYSPATH

public static final java.lang.String PROP_SYSPATH
See Also:
Constant Field Values

PROP_LOGFILE

public static final java.lang.String PROP_LOGFILE
See Also:
Constant Field Values

PROP_EXITCODE

public static final java.lang.String PROP_EXITCODE
See Also:
Constant Field Values

PROP_EXITDATA

public static final java.lang.String PROP_EXITDATA
See Also:
Constant Field Values

PROP_CONSOLE_LOG

public static final java.lang.String PROP_CONSOLE_LOG
See Also:
Constant Field Values

PROP_VM

private static final java.lang.String PROP_VM
See Also:
Constant Field Values

PROP_VMARGS

private static final java.lang.String PROP_VMARGS
See Also:
Constant Field Values

PROP_COMMANDS

private static final java.lang.String PROP_COMMANDS
See Also:
Constant Field Values

FILE_SCHEME

private static final java.lang.String FILE_SCHEME
See Also:
Constant Field Values

FILE_PROTOCOL

private static final java.lang.String FILE_PROTOCOL
See Also:
Constant Field Values

REFERENCE_SCHEME

private static final java.lang.String REFERENCE_SCHEME
See Also:
Constant Field Values

REFERENCE_PROTOCOL

private static final java.lang.String REFERENCE_PROTOCOL
See Also:
Constant Field Values

INITIAL_LOCATION

private static final java.lang.String INITIAL_LOCATION
See Also:
Constant Field Values

DEFAULT_ADAPTOR_CLASS

protected static final java.lang.String DEFAULT_ADAPTOR_CLASS
string containing the classname of the adaptor to be used in this framework instance

See Also:
Constant Field Values

DEFAULT_CONSOLE_CLASS

protected static final java.lang.String DEFAULT_CONSOLE_CLASS
See Also:
Constant Field Values

CONSOLE_NAME

private static final java.lang.String CONSOLE_NAME
See Also:
Constant Field Values

log

private static org.eclipse.osgi.framework.log.FrameworkLog log
Constructor Detail

EclipseStarter

public EclipseStarter()
Method Detail

run

public static java.lang.Object run(java.lang.String[] args,
                                   java.lang.Runnable endSplashHandler)
                            throws java.lang.Exception
Launches the platform and runs a single application. The application is either identified in the given arguments (e.g., -application <app id>) or in the eclipse.application System property. This convenience method starts up the platform, runs the indicated application, and then shuts down the platform. The platform must not be running already.


isRunning

public static boolean isRunning()
Returns true if the platform is already running, false otherwise.


createFrameworkLog

protected static org.eclipse.osgi.framework.log.FrameworkLog createFrameworkLog()

startup

public static void startup(java.lang.String[] args,
                           java.lang.Runnable endSplashHandler)
                    throws java.lang.Exception
Starts the platform and sets it up to run a single application. The application is either identified in the given arguments (e.g., -application <app id>) or in the eclipse.application System property. The platform must not be running already.

The given runnable (if not null) is used to tear down the splash screen if required.


getStartLevel

private static int getStartLevel()

run

public static java.lang.Object run(java.lang.Object argument)
                            throws java.lang.Exception
Runs the applicaiton for which the platform was started. The platform must be running.

The given argument is passed to the application being run. If it is null then the command line arguments used in starting the platform, and not consumed by the platform code, are passed to the application as a String[].


shutdown

public static void shutdown()
                     throws java.lang.Exception
Shuts down the Platform. The state of the Platform is not automatically saved before shutting down.

On return, the Platform will no longer be running (but could be re-launched with another call to startup). If relaunching, care must be taken to reinitialize any System properties which the platform uses (e.g., osgi.instance.area) as some policies in the platform do not allow resetting of such properties on subsequent runs.

Any objects handed out by running Platform, including Platform runnables obtained via getRunnable, will be permanently invalid. The effects of attempting to invoke methods on invalid objects is undefined.


ensureBundlesActive

private static void ensureBundlesActive(org.osgi.framework.Bundle[] bundles)

logUnresolvedBundles

private static void logUnresolvedBundles(org.osgi.framework.Bundle[] bundles)

publishSplashScreen

private static void publishSplashScreen(java.lang.Runnable endSplashHandler)

searchForBundle

private static java.net.URL searchForBundle(java.lang.String name,
                                            java.lang.String parent)
                                     throws java.net.MalformedURLException

loadBasicBundles

private static org.osgi.framework.Bundle[] loadBasicBundles()
                                                     throws java.io.IOException

getInitialBundles

private static EclipseStarter.InitialBundle[] getInitialBundles(java.lang.String[] installEntries)
                                                         throws java.net.MalformedURLException

refreshPackages

private static void refreshPackages(org.osgi.framework.Bundle[] bundles)

startConsole

private static void startConsole(org.eclipse.osgi.framework.internal.core.OSGi osgi,
                                 java.lang.String[] consoleArgs,
                                 java.lang.String consolePort)
Invokes the OSGi Console on another thread


createAdaptor

private static org.eclipse.osgi.framework.adaptor.FrameworkAdaptor createAdaptor()
                                                                          throws java.lang.Exception
Creates and returns the adaptor


processCommandLine

private static java.lang.String[] processCommandLine(java.lang.String[] args)
                                              throws java.lang.Exception

getArrayFromList

private static java.lang.String[] getArrayFromList(java.lang.String prop,
                                                   java.lang.String separator)
Returns the result of converting a list of comma-separated tokens into an array


getSysPath

protected static java.lang.String getSysPath()

getCurrentInitialBundles

private static org.osgi.framework.Bundle[] getCurrentInitialBundles()

getBundleByLocation

private static org.osgi.framework.Bundle getBundleByLocation(java.lang.String location,
                                                             org.osgi.framework.Bundle[] bundles)

uninstallBundles

private static boolean uninstallBundles(org.osgi.framework.Bundle[] curInitBundles,
                                        EclipseStarter.InitialBundle[] newInitBundles)

installBundles

private static boolean installBundles(EclipseStarter.InitialBundle[] initialBundles,
                                      org.osgi.framework.Bundle[] curInitBundles,
                                      java.util.ArrayList startBundles,
                                      java.util.ArrayList newInitBundles)

startBundles

private static void startBundles(org.osgi.framework.Bundle[] bundles)

initializeApplicationTracker

private static void initializeApplicationTracker()

loadConfigurationInfo

private static void loadConfigurationInfo()

loadDefaultProperties

private static void loadDefaultProperties()

loadProperties

private static java.util.Properties loadProperties(java.net.URL location)

mergeProperties

private static void mergeProperties(java.util.Properties destination,
                                    java.util.Properties source)

stopSystemBundle

private static void stopSystemBundle()
                              throws org.osgi.framework.BundleException

setStartLevel

private static void setStartLevel(int value)

searchFor

private static java.lang.String searchFor(java.lang.String target,
                                          java.lang.String start)
Searches for the given target directory starting in the "plugins" subdirectory of the given location. If one is found then this location is returned; otherwise an exception is thrown.


getVersionElements

private static java.lang.Object[] getVersionElements(java.lang.String version)
Do a quick parse of version identifier so its elements can be correctly compared. If we are unable to parse the full version, remaining elements are initialized with suitable defaults.


compareVersion

private static int compareVersion(java.lang.Object[] left,
                                  java.lang.Object[] right)
Compares version strings.


buildCommandLine

private static java.lang.String buildCommandLine(java.lang.String arg,
                                                 java.lang.String value)

finalizeProperties

private static void finalizeProperties()