org.robokind.api.common.osgi.lifecycle
Class ConfiguredServiceLifecycle<T,C,P>
java.lang.Object
org.robokind.api.common.property.PropertyChangeNotifier
org.robokind.api.common.lifecycle.AbstractLifecycleProvider<T,T>
org.robokind.api.common.osgi.lifecycle.ConfiguredServiceLifecycle<T,C,P>
- All Implemented Interfaces:
- ServiceLifecycleProvider<T>, PropertyChangeSource
public class ConfiguredServiceLifecycle<T,C,P>
- extends AbstractLifecycleProvider<T,T>
- Author:
- Matthew Stevenson
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier |
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myServiceContext
protected ServiceContext<T,C,P> myServiceContext
- ServiceContext created from loading a service. If a config is set rather
than loaded, this may be null.
ConfiguredServiceLifecycle
public ConfiguredServiceLifecycle(ConfiguredServiceParams<T,C,P> params)
- Creates a lifecycle best fitting the given params.
- Parameters:
params
-
ConfiguredServiceLifecycle
public ConfiguredServiceLifecycle(ConfiguredServiceParams<T,C,P> params,
Properties props)
- Creates a lifecycle best fitting the given params.
- Parameters:
params
- props
- registration properties
getService
public T getService()
- Description copied from interface:
ServiceLifecycleProvider
- Returns the service managed by this lifecycle provider. Returns null if
the lifecycle has not been started or if the service is unavailable.
- Specified by:
getService
in interface ServiceLifecycleProvider<T>
- Overrides:
getService
in class AbstractLifecycleProvider<T,T>
- Returns:
- service the service managed by this lifecycle provider
create
protected T create(Map<String,Object> dependencies)
- Description copied from class:
AbstractLifecycleProvider
- Called when all dependencies are available. This should create and
return the service for this lifecycle.
- Specified by:
create
in class AbstractLifecycleProvider<T,T>
- Parameters:
dependencies
- validated map of the lifecycle's dependencies
- Returns:
- the service managed by this lifecycle, null if the service
cannot be created
stop
public void stop()
- Specified by:
stop
in interface ServiceLifecycleProvider<T>
- Overrides:
stop
in class AbstractLifecycleProvider<T,T>
handleChange
protected void handleChange(String name,
Object dependency,
Map<String,Object> availableDependencies)
- Description copied from class:
AbstractLifecycleProvider
- Called from
dependencyChanged
with validated values.
- Specified by:
handleChange
in class AbstractLifecycleProvider<T,T>
- Parameters:
name
- name of the dependency changeddependency
- new dependency value, null if it was removedavailableDependencies
- a map of all available dependencies and
their names
cleanupService
protected void cleanupService(T service)
getServiceClass
public Class<T> getServiceClass()
- Description copied from class:
AbstractLifecycleProvider
- Returns the Class of the service managed by this lifecycle provider.
- Specified by:
getServiceClass
in class AbstractLifecycleProvider<T,T>
- Returns:
- Class of the service managed by this lifecycle provider
Copyright © 2011-2013. All Rights Reserved.