Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
OSGi
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
OSGi
(section)
Add topic