public interface BundleActivator
Customizes the starting and stopping of a bundle. BundleActivator is an interface that may be implemented by a bundle programmer that is called when the bundle is started or stopped. A bundle can only specify a single BundleActivator in the manifest.
When a bundle is started or stopped, the BundleActivator is called.
The framework can create instances of the bundle's BundleActivator as required. It is guaranteed, however, that if an instance's start(BundleContext) method executes successfully, that same instance's stop(BundleContext) method will be called when the bundle is to be stopped.
A bundle programmer specifies the BundleActivator through the Bundle-Activator Manifest header. The form of the header is:
Bundle-Activator: class-name
where class-name is a fully qualified Java classname. The specified BundleActivator class must have a public constructor that takes no parameters so that a BundleActivator object can be created by Class.newInstance().
Member Summary | |
---|---|
Methods | |
public void | start(BundleContext) |
Called when the bundle is started so that the bundle can perform any bundle specific activities to start the bundle. | |
public void | stop(BundleContext) |
Called when the bundle is stopped so that the bundle can perform any bundle specific activities necessary to stop the bundle. |
public void start(BundleContext context)
throws java.lang.Exception
Called when the bundle is started so that the bundle can perform any bundle specific activities to start the bundle. Bundle programmers can use this method to register the bundle's services or to allocate any resources that the bundle needs.
This method must complete and return to its caller in a timely manner.
Parameters:
Throws:
javalang.Exception— If this method throws an exception, the bundle is marked as stopped and the framework will remove the bundle's listeners, unregister all service's registered by the bundle, release all service's used by the bundle.
See Also: Bundle.start()
public void stop(BundleContext context)
throws java.lang.Exception
Called when the bundle is stopped so that the bundle can perform any bundle specific activities necessary to stop the bundle. In general, this method should undo the work that the start(BundleContext) method did. When this method returns the bundle should have no active threads. A stopped bundle should be stopped and should not be calling any framework objects.
This method must complete and return to its caller in a timely manner.
Parameters:
Throws:
java.lang.Exception— If this method throws an exception, the bundle is still marked as stopped and the framework will remove the bundle's listeners, unregister all service's registered by the bundle, release all service's used by the bundle.
See Also: Bundle.stop()
3.141.28.107