When using eclipse to develop osgi bundle, you will find that many existing bundle can be used. But how to use these bundle? In addition to searching for information on the Internet, reading the bundle source code is also a good method.
This document usesOrg. Eclipse. osgi. ServicesFor example, it describes how to use eclipse to read its source code.
Step 1: Open eclipse and selectRun> run commands...Open the run configuration dialog box and findOsgi framework, ClickNewButton, such. Find the corresponding version of osgi. Here is3.7.2, Write down, and then clickCloseButton, there is no need to save it here.
Step 2: Open your browser and go to the Equinox download URLHttp://download.eclipse.org/equinox/, Find the corresponding version:
Click to enter and selectAll of equinoxDownload type:
Step 3: Decompress the package and enterPlguinsDirectory, find the bundle source code file to read its source code, here you need to pay attention to the corresponding version issues. EclipseIs org. Eclipse. osgi. services_3.0.v20110513, InPluginsThe Directory should have two jar files:Org. Eclipse. osgi. services_3.0.v20110513.jarAndOrg. Eclipse. osgi. Services. source_3.0.v20110513.jarThe following file is the bundle source code file. Copy the corresponding source code file to the eclipse installation location for downloadPluginsDirectory.
Step 4: Create a bundle project in eclipseManifest. MFAdd filesOrg. Eclipse. osgi. ServicesImport:
Step 5: ImportOrg. Eclipse. osgi. ServicesAfterPlug-in DependenciesThe bundle will appear under the category. Expand the package below and double-click the class name to see the corresponding source code.