public abstract class AbstractRegistry extends Object implements BundleActivator, BundleRegistry
BundleActivator.State
Constructor and Description |
---|
AbstractRegistry()
Creates a new registry.
|
Modifier and Type | Method and Description |
---|---|
BundleActivator.State |
getCurrentState()
Gets the current state of the registry.
|
<T> T |
getService(Class<T> service)
Gets the instance of the given service.
|
void |
initialize()
Initializes the bundle.
|
void |
link()
Prepares the bundle.
|
protected abstract BundleActivator[] |
loadBundles()
Gets the loaded bundles.
|
<T> void |
register(Class<T> service,
T implementation)
Registers a service implementation.
|
void |
reset()
Stops the registry and all its environment and prepare it to be restarted.
|
void |
start()
Starts the bundle.
|
void |
stop()
Stops the bundle.
|
public BundleActivator.State getCurrentState()
BundleRegistry
getCurrentState
in interface BundleRegistry
BundleActivator.State
public <T> T getService(Class<T> service)
ServiceProvider
getService
in interface ServiceProvider
T
- the service type.service
- the service.public void initialize()
BundleActivator
Initializes and registers bundle services in the BundleRegistry
instance.
initialize
in interface BundleActivator
ServiceRegistry.register(Class, Object)
public void link()
BundleActivator
Links bundle services to other services.
link
in interface BundleActivator
ServiceProvider.getService(Class)
protected abstract BundleActivator[] loadBundles()
public <T> void register(Class<T> service, T implementation)
ServiceRegistry
The given instance is returned each time the service is requested by ServiceProvider.getService(Class)
.
register
in interface ServiceRegistry
T
- the service type.service
- the implemented service.implementation
- the service implementation.public void reset()
BundleRegistry
reset
in interface BundleRegistry
public void start()
BundleActivator
At this step, all the bundles are prepared and ready. The services could be started.
start
in interface BundleActivator
public void stop()
BundleActivator
Unlinks it from the others services and clean possible resources and threads.
stop
in interface BundleActivator