|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.robokind.api.common.property.PropertyChangeNotifier
org.robokind.api.common.osgi.lifecycle.OSGiComponent<T>
T
- type of the service to be launchedpublic class OSGiComponent<T>
An OSGi Service managed with a ServiceLifecycleProvider. Creates a ServiceDependenciesTracker to drive the service lifecycle from the OSGi Service Registry. The the service lifecycle changes, the OSGiComponent registers/unregisters the managed service in the OSGi ServiceRegistry. An OSGiComponent Registers itself to the OSGi ServiceRegistry when started.
Field Summary |
---|
Fields inherited from interface org.robokind.api.common.lifecycle.ManagedService |
---|
PROP_DEPENDENCY_CHANGED, PROP_SERVICE_CHANGED, PROP_SERVICE_TYPE |
Constructor Summary | |
---|---|
OSGiComponent(org.osgi.framework.BundleContext context,
ServiceLifecycleProvider<T> lifecycle)
Creates a new OSGiComponent from the given lifecycle provider. |
|
OSGiComponent(org.osgi.framework.BundleContext context,
ServiceLifecycleProvider<T> lifecycle,
Properties registrationProps)
Creates a new OSGiComponent from the given lifecycle provider. |
|
OSGiComponent(org.osgi.framework.BundleContext context,
ServiceLifecycleProvider<T> lifecycle,
Properties registrationProps,
boolean selfRegister)
Creates a new OSGiComponent from the given lifecycle provider. |
|
OSGiComponent(org.osgi.framework.BundleContext context,
ServiceLifecycleProvider<T> lifecycle,
Properties registrationProps,
Properties uniqueProps,
boolean selfRegister)
Creates a new OSGiComponent from the given lifecycle provider. |
Method Summary | |
---|---|
void |
dispose()
Stops and unregisters the service, cleans up the service lifecycle and management, and stops and unregisters the ManagedService. |
int |
getAvailableDependencyCount()
Returns the number of satisfied dependencies. |
List<DependencyDescriptor> |
getDependencies()
Returns a list describing the service dependencies of this ManagedService. |
int |
getDependencyCount()
Returns the number of dependencies for this ManagedService. |
boolean |
getDependencyStatus(String dependencyId)
Returns true if the specified dependency is available. |
org.slf4j.Logger |
getLogger()
|
boolean |
getRegistrationEnabled()
Returns true if automatic service registration is enabled. |
Properties |
getRegistrationProperties()
Returns the registration properties to use when registering the service. |
boolean |
getSelfRegistrationEnabled()
Returns true if this OSGiComponent should register itself. |
String[] |
getServiceClassNames()
Returns the class names of service being managed. |
boolean |
isAvailable()
Returns true if the service is available and ready to use. |
boolean |
isRegistered()
Returns true if the service has been added to the Service Registry. |
void |
register()
Registers the service if it is available. |
void |
registerSelf()
Add this OSGiComponent to the OSGi Service Registry. |
void |
setRegistrationEnabled(boolean enabled)
If set true, the Service being managed will be automatically added to the Service Registry when available. |
void |
setSelfRegistrationEnabled(boolean enabled)
If set true, this OSGiComponent will register itself when start() is called, or immediately if start has already been called. |
void |
start()
Starts the OSGiComponent. |
void |
stop()
Stops tracking dependency changes. |
void |
unregister()
Unregisters the service if it is registered. |
void |
unregisterSelf()
Removes this OSGiComponent from the OSGi Service Registry |
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 |
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource |
---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Constructor Detail |
---|
public OSGiComponent(org.osgi.framework.BundleContext context, ServiceLifecycleProvider<T> lifecycle)
context
- BundleContext for accessing the OSGi Service Registrylifecycle
- lifecycle provider for the managed servicepublic OSGiComponent(org.osgi.framework.BundleContext context, ServiceLifecycleProvider<T> lifecycle, Properties registrationProps)
context
- BundleContext for accessing the OSGi Service Registrylifecycle
- lifecycle provider for the managed serviceregistrationProps
- optional properties to be used when registering
the managed service to the OSGi Service Registry. These are combined
with any properties from the ServiceLifecycleProviderpublic OSGiComponent(org.osgi.framework.BundleContext context, ServiceLifecycleProvider<T> lifecycle, Properties registrationProps, boolean selfRegister)
context
- BundleContext for accessing the OSGi Service Registrylifecycle
- lifecycle provider for the managed serviceregistrationProps
- optional properties to be used when registering
the managed service to the OSGi Service Registry. These are combined
with any properties from the ServiceLifecycleProviderselfRegister
- determines if this OSGiComponent should register
itself when started, by default this is truepublic OSGiComponent(org.osgi.framework.BundleContext context, ServiceLifecycleProvider<T> lifecycle, Properties registrationProps, Properties uniqueProps, boolean selfRegister)
context
- BundleContext for accessing the OSGi Service Registrylifecycle
- lifecycle provider for the managed serviceregistrationProps
- optional properties to be used when registering
the managed service to the OSGi Service Registry. These are combined
with any properties from the ServiceLifecycleProviderregistrationClassNames
- class names to be used when registering the
managed service to the OSGi Service Registry. By default, this value is
taken from the ServiceLifecycleProvider's getServiceClass().Method Detail |
---|
public void start()
start
in interface ManagedService<T>
public void stop()
stop
in interface ManagedService<T>
public void dispose()
ManagedService
dispose
in interface ManagedService<T>
public void setSelfRegistrationEnabled(boolean enabled)
enabled
- true to enable self-registration of the OSGiComponentpublic boolean getSelfRegistrationEnabled()
public void registerSelf()
public void unregisterSelf()
public void setRegistrationEnabled(boolean enabled)
ManagedService
setRegistrationEnabled
in interface ManagedService<T>
enabled
- if true the service will be automatically registered to
the Service Registry when available.public boolean getRegistrationEnabled()
ManagedService
getRegistrationEnabled
in interface ManagedService<T>
public void unregister()
ManagedService
unregister
in interface ManagedService<T>
public void register()
ManagedService
register
in interface ManagedService<T>
public List<DependencyDescriptor> getDependencies()
ManagedService
getDependencies
in interface ManagedService<T>
public boolean getDependencyStatus(String dependencyId)
ManagedService
getDependencyStatus
in interface ManagedService<T>
dependencyId
- name of the dependency to check
public Properties getRegistrationProperties()
ManagedService
getRegistrationProperties
in interface ManagedService<T>
public boolean isAvailable()
ManagedService
isAvailable
in interface ManagedService<T>
public boolean isRegistered()
ManagedService
isRegistered
in interface ManagedService<T>
public String[] getServiceClassNames()
ManagedService
getServiceClassNames
in interface ManagedService<T>
public int getDependencyCount()
ManagedService
getDependencyCount
in interface ManagedService<T>
public int getAvailableDependencyCount()
ManagedService
getAvailableDependencyCount
in interface ManagedService<T>
public org.slf4j.Logger getLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |