public class StartLevelController extends java.lang.Object implements java.lang.Runnable, ServiceFactory<StartLevel>
| Modifier and Type | Class and Description |
|---|---|
static class |
StartLevelController.StartLevelImpl |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
API_SPEC_VERSION |
static java.lang.String |
SPEC_VERSION |
| Modifier and Type | Method and Description |
|---|---|
StartLevel |
getService(Bundle bundle,
ServiceRegistration<StartLevel> registration)
Returns a service object for a bundle.
|
void |
run() |
void |
ungetService(Bundle bundle,
ServiceRegistration<StartLevel> registration,
StartLevel service)
Releases a service object customized for a bundle.
|
public static final java.lang.String SPEC_VERSION
public static final java.lang.String API_SPEC_VERSION
public void run()
run in interface java.lang.Runnablepublic StartLevel getService(Bundle bundle, ServiceRegistration<StartLevel> registration)
ServiceFactory
The Framework invokes this method the first time the specified
bundle requests a service object using the
BundleContext.getService(ServiceReference) method. The factory
can then return a customized service object for each bundle.
The Framework must check that the returned service object is valid. If
the returned service object is null or is not an
instanceof all the classes named when the service was registered,
a framework event of type FrameworkEvent.ERROR is fired
containing a service exception of type
ServiceException.FACTORY_ERROR and null is returned to
the bundle. If this method throws an exception, a framework event of type
FrameworkEvent.ERROR is fired containing a service exception of
type ServiceException.FACTORY_EXCEPTION with the thrown exception
as the cause and null is returned to the bundle. If this method
is recursively called for the specified bundle, a framework event of type
FrameworkEvent.ERROR is fired containing a service exception of
type ServiceException.FACTORY_RECURSION and null is
returned to the bundle.
The Framework caches the valid service object and will return the same
service object on any future call to
BundleContext.getService(ServiceReference) for the specified
bundle. This means the Framework must not allow this method to be
concurrently called for the specified bundle.
getService in interface ServiceFactory<StartLevel>bundle - The bundle requesting the service.registration - The ServiceRegistration object for the
requested service.BundleContext.getService(ServiceReference)public void ungetService(Bundle bundle, ServiceRegistration<StartLevel> registration, StartLevel service)
ServiceFactoryThe Framework invokes this method when a service has been released by a bundle. The service object may then be destroyed.
If this method throws an exception, a framework event of type
FrameworkEvent.ERROR is fired containing a service exception of
type ServiceException.FACTORY_EXCEPTION with the thrown exception
as the cause.
ungetService in interface ServiceFactory<StartLevel>bundle - The bundle releasing the service.registration - The ServiceRegistration object for the
service being released.service - The service object returned by a previous call to the
getService
method.BundleContext.ungetService(ServiceReference)