Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
OSGi
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Life-cycle == {{Unreferenced section|date=September 2023}} [[Image:OSGi Bundle Life-Cycle.svg|thumb|OSGi Bundle Life-Cycle]] A Life Cycle layer adds bundles that can be dynamically installed, started, stopped, updated and uninstalled. Bundles rely on the module layer for class loading but add an API to manage the modules in run time. The life cycle layer introduces dynamics that are normally not part of an application. Extensive dependency mechanisms are used to assure the correct operation of the environment. Life cycle operations are fully protected with the security architecture. {| class="wikitable" ! Bundle State ! Description |- | '''INSTALLED''' | The bundle has been successfully installed. |- | '''RESOLVED''' | All Java classes that the bundle needs are available. This state indicates that the bundle is either ready to be started or has stopped. |- | '''STARTING''' | The bundle is being started, the <code>[http://www.osgi.org/javadoc/r4v41/org/osgi/framework/BundleActivator.html#start(org.osgi.framework.BundleContext) BundleActivator.start]</code> method has been called but the start method has not yet returned. When the bundle has an activation policy, the bundle will remain in the STARTING state until the bundle is activated according to its activation policy. |- | '''ACTIVE''' | The bundle has been successfully activated and is running; its Bundle Activator start method has been called and returned. |- | '''STOPPING''' | The bundle is being stopped. The <code>[http://www.osgi.org/javadoc/r4v41/org/osgi/framework/BundleActivator.html#stop(org.osgi.framework.BundleContext) BundleActivator.stop]</code> method has been called but the stop method has not yet returned. |- | '''UNINSTALLED''' | The bundle has been uninstalled. It cannot move into another state. |} Below is an example of a typical Java class implementing the <code>[http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleActivator.html BundleActivator]</code> interface: <syntaxhighlight lang="java"> package org.wikipedia; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { private BundleContext context; @Override public void start(BundleContext context) throws Exception { System.out.println("Starting: Hello World"); this.context = context; } @Override public void stop(BundleContext context) throws Exception { System.out.println("Stopping: Goodbye Cruel World"); this.context = null; } } </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)