Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • Lotus Expeditor wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 6.2.1
  • 6.2.2
  • 6.2.3
  • access services
  • accounts
  • administer
  • application
  • applications
  • broker
  • client
  • client for desktop
  • client management
  • cluster
  • collecting data
  • configuration
  • configure
  • data integrity check tools
  • database
  • db2
  • db2e
  • deleting log entries automatically
  • demo
  • demonstration
  • desktop overview
  • develop
  • device
  • device client
  • diagnosis of problems. See troubleshooting
  • diagnostic data
  • diagnostic tool
  • documentation
  • download
  • environment variables
  • error messages
  • expeditor
  • expeditor server
  • expeditor toolkit
  • files
  • fix pack
  • gettingstarted
  • Help
  • how-to
  • IBM Support
  • install
  • installation
  • integration
  • integrator
  • interaction services
  • Interrogation Windows Tab
  • introduce
  • introduction
  • log files
  • messaging
  • micro
  • mobile databases
  • mobile databases
  • mobile devices
  • mqe
  • nci
  • notes
  • OpenSpan
  • OpenSpan Scripting Container
  • OpenSpan Windows Container
  • overview
  • platform
  • portlet
  • prerequisites
  • presentation
  • problems with synchronization. See troubleshooting.
  • purging log entries automatically
  • Release Notes
  • replication
  • resources on the Web
  • rich client application
  • samples
  • scripts
  • security
  • server
  • software
  • software prerequisites
  • support
  • support troubleshooting
  • Sync Client
  • Sync Server
  • synchronization
  • synchronization problems
  • tool
  • toolkit
  • tools
  • trace files
  • trace level
  • troubleshoot
  • troubleshooting
  • tutorial
  • use
  • was
  • web services
  • What's New
  • xcm
  • xpdt
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > Expeditor Client for Desktop > Sample: Starting Plugins
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Sample: Starting Plugins 

expanded Abstract
collapsed Abstract
No abstract provided.
ShowTable of Contents
HideTable of Contents
  • 1 Overview
  • 2 Startup
  • 3 Lifecycle
  • 4 OSGI Config

Overview


By default, Eclipse plugins are lazy. Lazy is the technical term (located in the bundle's manifest) that means that plugins are started when a request is either directly made by the Platform to start the plugin or indirectly through class loading. For example, the latter case implies that when another plugin (A) instantiates a class from plugin (B), plugin (B) is started if not already. But developers may require a daemon-type plugin, one that starts and runs by itself. With such a requirement, what are the options?

Startup


Eclipse provides the org.eclipse.ui.startup extension. This allows developers to implement an interface, add the extension to their plugin, and expect the Platform to launch the plugin when the Platform starts. The startup extension loads when the user interface (PlatformUI) has loaded; consequently, developers whose code relies upon UI elements should use this pattern. Since plugins that are indirectly used by a developer's plugin could also require the UI, this is the safest method when developing plugins have dependencies on existing Expeditor plugins.

To provide an example, the OSGI Agent generally starts "some time" after the Platform has launched. Assuming the developer needs to launch the OSGI Agent as soon as possible, he or she can use the startup extension.

 <extension point="org.eclipse.ui.startup">
	<startup class="com.ibm.rcp.support.startup.OsgiAgentStartup">
      </startup>
</extension> 


The extension forces the Platform to call the referenced class' earlyStartup method. Additionally, because the class has been loaded, the Activator's start method will be called as well.

 public class OsgiAgentStartup implements IStartup {

	@Override
	public void earlyStartup() {
		OSGiAgentServiceFactory factory = new OSGiAgentServiceFactory();
		try {
			OSGiAgentService service = factory.getAgentServiceObject();

			if (service != null) {
				service.connectToManagementServer();
			} else {
				System.err.println("No OSGiAgentService Available");
			}
		} catch (BundleException e) {
			e.printStackTrace();
		}
	}
} 


Lifecycle


Expeditor provides an extension that allows developers to declare which plugins they would like to be started. The Expeditor product ensures that this controller is launched when the Platform launches and then starts the developer contributed bundles. The following contribution demonstrates how a plugin may be started when the Platform launches.

 <extension point="com.ibm.rcp.lifecycle.personality.startBundles">
	<personality id="com.ibm.rcp.platform.personality">
		<bundle id="com.ibm.rcp.support.lifecycle.extension">
		</bundle>
	</personality>
</extension> 


The personality ID com.ibm.rcp.platform.personality is the default personality of the Expeditor product. This causes the Expeditor framework to call the plugin's start method in the declared plugin com.ibm.rcp.support.lifecycle.extension. In other words, com.ibm.rcp.support.lifecycle.extension is our plugin that we want loaded when Platform launches.

Unlike the startup extension, the startBundles extension loads "immediately" when the Platform launches. Specifically, this occurs during the initialize and preStartup phases of the WorkbenchAdvisor. As a consequence, developers can not expect the UI to be available because the first window has yet to be opened. Developers should either use the startup pattern or write defensive code to check to ensure the PlatformUI is started.

Additionally, there is a similar extension com.ibm.rcp.lifecycle.application.startBundles that uses the application rather than personality ID.

OSGI Config


While it's beyond the scope of Expeditor, the OSGI specification defines the starting behavior of bundles. For completeness, it's worth mentioning that plugin startup may be controlled through the workspace's .config/config.ini file. This also allows developers to control the start behavior of bundles. Notice that some bundles that we expect to start earlier than others have lower start values. Bundles that do not list the start value, such as developer contributed plugins, inherit the defaultStartLevel value. It should be noted that those plugins within the default level (and any specific start level) do not have a defined ordering of starting.

 osgi.bundles=org.eclipse.equinox.common@2:start, \
 org.eclipse.core.jobs@4:start,\
 org.eclipse.equinox.registry@4:start,\
 org.eclipse.core.runtime.compatibility.registry,\
 org.eclipse.equinox.preferences@4,\
 org.eclipse.core.contenttype@4,\
 org.eclipse.core.runtime@4:start,\
 org.eclipse.core.runtime.compatibility@4:start,\
 org.eclipse.equinox.app@4:start,\
  org.eclipse.update.configurator@3:start, \
  com.ibm.rcp.lifecycle.platform@5:start
osgi.bundles.defaultStartLevel=10 


Because both Expeditor and Eclipse provide mechanisms for controlling the startup of plugins, modification of the above should only be considered in rare circumstances.

expanded Article information
collapsed Article information
Category:
Expeditor Client for Desktop
Tags:
samples

This Version: Version 2 May 6, 2011 10:19:02 AM by Van Staub  IBMer

expanded Attachments (0)
collapsed Attachments (0)

 


expanded Versions (2)
collapsed Versions (2)
Version Comparison     
Version Date Changed by               Summary of changes
This version (2) May 6, 2011 10:19:02 AM Van Staub  
1 May 6, 2011 10:18:24 AM Van Staub  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use