Class EclipseStarter
The Eclipse Platform makes heavy use of Java class loaders for loading plug-ins. Even the Eclipse 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
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static String
static BundleContext
Returns the context of the system bundle.static boolean
Returns true if the platform is already running, false otherwise.static void
This is the main to start osgi.static Object
Runs the application for which the platform was started.static Object
Launches the platform and runs a single application.static void
setInitialProperties
(Map<String, String> initialProperties) Sets the initial properties for the platform.static void
shutdown()
Shuts down the Platform.static BundleContext
Starts the platform and sets it up to run a single application.
-
Field Details
-
debug
public static boolean debug -
PROP_BUNDLES
- See Also:
-
PROP_BUNDLES_STARTLEVEL
- See Also:
-
PROP_EXTENSIONS
- See Also:
-
PROP_INITIAL_STARTLEVEL
- See Also:
-
PROP_DEBUG
- See Also:
-
PROP_DEV
- See Also:
-
PROP_CLEAN
- See Also:
-
PROP_CONSOLE
- See Also:
-
PROP_CONSOLE_CLASS
- See Also:
-
PROP_CHECK_CONFIG
- See Also:
-
PROP_OS
- See Also:
-
PROP_WS
- See Also:
-
PROP_NL
- See Also:
-
PROP_ARCH
- See Also:
-
PROP_ADAPTOR
- See Also:
-
PROP_SYSPATH
- See Also:
-
PROP_LOGFILE
- See Also:
-
PROP_FRAMEWORK
- See Also:
-
PROP_INSTALL_AREA
- See Also:
-
PROP_FRAMEWORK_SHAPE
- See Also:
-
PROP_NOSHUTDOWN
- See Also:
-
PROP_EXITCODE
- See Also:
-
PROP_EXITDATA
- See Also:
-
PROP_CONSOLE_LOG
- See Also:
-
PROP_IGNOREAPP
- See Also:
-
PROP_REFRESH_BUNDLES
- See Also:
-
PROP_ALLOW_APPRELAUNCH
- See Also:
-
-
Constructor Details
-
EclipseStarter
public EclipseStarter()
-
-
Method Details
-
main
This is the main to start osgi. It only works when the framework is being jared as a single jar- Throws:
Exception
-
run
Launches the platform and runs a single application. The application is either identified in the given arguments (e.g., -application <app id>) or in theeclipse.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.- Parameters:
args
- the command line-style arguments used to configure the platformendSplashHandler
- the block of code to run to tear down the splash screen ornull
if no tear down is required- Returns:
- the result of running the application
- Throws:
Exception
- if anything goes wrong
-
isRunning
public static boolean isRunning()Returns true if the platform is already running, false otherwise.- Returns:
- whether or not the platform is already running
-
startup
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 theeclipse.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.- Parameters:
args
- the arguments passed to the application- Returns:
- BundleContext the context of the system bundle
- Throws:
Exception
- if anything goes wrong
-
run
Runs the application 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 aString[]
.- Parameters:
argument
- the argument passed to the application. May benull
- Returns:
- the result of running the application
- Throws:
Exception
- if anything goes wrong
-
shutdown
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.
- Throws:
Exception
- if anything goes wrong
-
getSysPath
-
setInitialProperties
Sets the initial properties for the platform. This method must be called before calling therun(String[], Runnable)
orstartup(String[], Runnable)
methods for the properties to be used in a launched instance of the platform.If the specified properties contains a null value then the key for that value will be cleared from the properties of the platform.
- Parameters:
initialProperties
- the initial properties to set for the platform.- Since:
- 3.2
-
getSystemBundleContext
Returns the context of the system bundle. A value ofnull
is returned if the platform is not running.- Returns:
- the context of the system bundle
- Throws:
SecurityException
- If the caller does not have the appropriateAdminPermission[system.bundle,CONTEXT]
, and the Java Runtime Environment supports permissions.
-