org.flexiblepower.observation.ext
public class ObservationProviderRegistrationHelper extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_BASE
This is the base for all the property-keys that will be registered.
|
static java.lang.String |
KEY_OBSERVATION_OF
The is the key that will be used for describing what is being observed.
|
static java.lang.String |
KEY_OBSERVATION_TYPE
This is the base for the key that will be used to describe the type.
|
static java.lang.String |
KEY_OBSERVED_BY
This is the key that will be used for describing who is going to do the observing.
|
Constructor and Description |
---|
ObservationProviderRegistrationHelper(org.osgi.framework.BundleContext context)
Creates a new instance of this class.
|
ObservationProviderRegistrationHelper(java.lang.Object serviceObject)
Creates a new instance of this class.
|
ObservationProviderRegistrationHelper(java.lang.Object serviceObject,
org.osgi.framework.BundleContext context)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
ObservationProviderRegistrationHelper |
observationOf(java.lang.String observationOf)
Sets the observationOf property.
|
ObservationProviderRegistrationHelper |
observationType(java.lang.Class<?> observationClass)
Sets all of the type.* properties using the given type of observations.
|
ObservationProviderRegistrationHelper |
observedBy(java.lang.String observedBy)
Sets the observedBy property.
|
org.osgi.framework.ServiceRegistration<?> |
register(java.lang.Class<?>... otherInterfaces)
Registers the service object with all of the set properties in the service registry.
|
ObservationProviderRegistrationHelper |
serviceObject(java.lang.Object serviceObject)
Changes the object that is to be registered as a
ObservationProvider . |
ObservationProviderRegistrationHelper |
setProperty(java.lang.String key,
java.lang.Object value)
Set a custom property.
|
public static final java.lang.String KEY_BASE
public static final java.lang.String KEY_OBSERVED_BY
public static final java.lang.String KEY_OBSERVATION_OF
public static final java.lang.String KEY_OBSERVATION_TYPE
public ObservationProviderRegistrationHelper(org.osgi.framework.BundleContext context)
context
- The BundleContext
that is used to register the service.public ObservationProviderRegistrationHelper(java.lang.Object serviceObject)
serviceObject
- The object that will be put into the service registry during the register(Class...)
method.public ObservationProviderRegistrationHelper(java.lang.Object serviceObject, org.osgi.framework.BundleContext context)
serviceObject
- The object that will be put into the service registry during the register(Class...)
method.context
- The bundleContext that will be used for service registration.public ObservationProviderRegistrationHelper serviceObject(java.lang.Object serviceObject)
ObservationProvider
. This object may also be a
ManagedServiceFactory
to be able to create many instances.
This method set the default observationOf(String)
to the string "unkown" and observedBy(String)
to the classname of the service, if they have not been set yet.serviceObject
- The object that is to be registeren as a ObservationProvider
.public ObservationProviderRegistrationHelper setProperty(java.lang.String key, java.lang.Object value)
key
- The key of the property.value
- The value of the property.public ObservationProviderRegistrationHelper observedBy(java.lang.String observedBy)
observedBy
- A short description of the thing that is being observed. By default this is the classname of the
service object.public ObservationProviderRegistrationHelper observationOf(java.lang.String observationOf)
observationOf
- A short description of the thing that is being observed. Usually this is the resource identifier.public ObservationProviderRegistrationHelper observationType(java.lang.Class<?> observationClass)
observationClass
- The type of the observations.public org.osgi.framework.ServiceRegistration<?> register(java.lang.Class<?>... otherInterfaces)
otherInterfaces
- Any other interfaces (next to the default ObservationProvider
) that this service should
register itself by.