Go The basics of Eclipse plug-in development (4) OSGi framework

Source: Internet
Author: User

Original Address: http://www.cnblogs.com/liuzhuo/archive/2010/08/18/eclipse_plugin_1_2_1.html

1. What is the OSGi framework

The OSGi (Open Service Gateway Initiative) framework is a service platform running in the JAVAVM environment. The main function provided by the framework is to manage the lifecycle of applications and components, and the system can remotely manipulate the installation, startup, and stop of components without rebooting.

The OSGi framework is used not only for eclipse, but also for mobile and on-board systems, all in a variety of applications.

2. The relationship between OSGi and eclipse

Eclipse uses the OSGi framework to manage plug-in installation, start, stop, and lifecycle. The OSGi framework used in Eclipse is called Equinox. Equinox is used at Eclipse3.0, at 3.3, Equinox through the Equinox PDE, not only to develop plug-ins, but also to make components on other OSGi frameworks.

3. OSGi Console

By adding the-console parameter when the eclipse is launched, you can create an OSGI framework console at the same time as Eclipse starts.

Figure 4-1,4-2 Starting the OSGi console

The various applications built on OSGi are called OSGi bundles. The OSGi console can perform the actions shown in the following table.

Table 4-1 OSGi Console commands

Command Description
Start Start bundle
Stop Stop bundle
Install Install the specified bundle
Uninstall Uninstalling the specified bundle
Update Update the specified bundle
Active Lists the bundles that are registered and active
Ss List all the bundles that are registered

We can look at the state change of the bundle after executing Eclipse's action. The SS command is executed first. After the SS command, add a parameter [Help], which lists all bundles that have a name that contains the.

Code 1

?
1 2 3 4 5 6 7 8 9 10 id      State       Bundle 78      RESOLVED    org.eclipse.epp.mpc.help.ui_1.0.0.v20100611-0430 136     ACTIVE      org.eclipse.help_3.5.0.v20100524 137     <<LAZY>>    org.eclipse.help.appserver_3.1.400.v20100427 138     <<LAZY>>    org.eclipse.help.base_3.5.0.v201006080911 139     <<LAZY>>    org.eclipse.help.ui_3.5.0.v20100517 140     <<LAZY>>    org.eclipse.help.webapp_3.5.0.v20100507 178     <<LAZY>>    org.eclipse.mylyn.help.ui_3.4.0.v20100608-0100-e3x 196     RESOLVED    org.eclipse.mylyn.wikitext.help.ui_1.3.0.v20100608-0100-e3x 228     RESOLVED    org.eclipse.rap.help_1.3.0.20100615-1734

Note the line where the status is lazy, which indicates that the bundle has not been loaded into memory. Loaded into memory when necessary.

Let's turn on Eclipse's help first. Then look at the state of the bundle.

Code 2

?
1 2 3 4 5 6 7 8 9 10 id      State       Bundle 78      RESOLVED    org.eclipse.epp.mpc.help.ui_1.0.0.v20100611-0430 136     ACTIVE      org.eclipse.help_3.5.0.v20100524 137     <<LAZY>>    org.eclipse.help.appserver_3.1.400.v20100427 138     ACTIVE      org.eclipse.help.base_3.5.0.v201006080911 139     ACTIVE      org.eclipse.help.ui_3.5.0.v20100517 140     <<LAZY>>    org.eclipse.help.webapp_3.5.0.v20100507 178     <<LAZY>>    org.eclipse.mylyn.help.ui_3.4.0.v20100608-0100-e3x 196     RESOLVED    org.eclipse.mylyn.wikitext.help.ui_1.3.0.v20100608-0100-e3x 228     RESOLVED    org.eclipse.rap.help_1.3.0.20100615-1734

We saw that the two bundles of org.eclipse.help.base_3.5.0.v201006080911 and org.eclipse.help.ui_3.5.0.v20100517 became active from the lazy state.

From the above example we know that using the OSGi console can confirm the active state of the Eclipse plug-in, or you can use the console to control the start and stop of the plug-in.

Go The basics of Eclipse plug-in development (4) OSGi framework

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.