public class ProvidedService
extends java.lang.Object
implements org.osgi.framework.ServiceFactory
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_SPECIFICATIONS_FOR_CONTROLLERS |
static int |
CUSTOM_STRATEGY
Factory policy : CUSTOMIZED.
|
static int |
INSTANCE_STRATEGY
Factory policy : INSTANCE.
|
static int |
REGISTERED
Service State : REGISTRED.
|
static int |
SERVICE_STRATEGY
Factory policy : SERVICE_FACTORY.
|
static int |
SINGLETON_STRATEGY
Factory Policy : SINGLETON_FACTORY.
|
static int |
STATIC_STRATEGY
Factory policy : STATIC_FACTORY.
|
static int |
UNREGISTERED
Service State : UNREGISTRED.
|
Constructor and Description |
---|
ProvidedService(ProvidedServiceHandler handler,
java.lang.String[] specification,
int factoryPolicy,
java.lang.Class creationStrategyClass,
java.util.Dictionary conf)
Creates a provided service object.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ProvidedServiceListener listener)
Add the given listener to the provided service handler's list of listeners.
|
protected void |
addProperties(java.util.Dictionary props)
Add properties to the list.
|
void |
cleanup()
Removes all the listeners from this provided service before it gets disposed.
|
protected void |
deleteProperties(java.util.Dictionary props)
Remove properties from the list.
|
org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController |
getController(java.lang.String field)
Gets the service controller attached to the given field.
|
org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController |
getControllerBySpecification(java.lang.String spec)
Gets the service controller handling the service publishing the given specification.
|
java.lang.Class<? extends CreationStrategy> |
getCreationStrategy() |
protected InstanceManager |
getInstanceManager() |
int |
getPolicy() |
Property[] |
getProperties()
Get the list of properties attached to the service registration.
|
java.lang.Object |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration registration)
Returns a service object for the dependency.
|
org.osgi.framework.ServiceReference |
getServiceReference()
Get the service reference of the service registration.
|
org.osgi.framework.ServiceRegistration |
getServiceRegistration()
Get the service registration.
|
java.lang.String[] |
getServiceSpecifications()
Get the published service specifications.
|
int |
getState()
Get the current provided service state.
|
void |
registerService()
Registers the service.
|
void |
removeListener(ProvidedServiceListener listener)
Remove the given listener from the provided service handler's list of listeners.
|
void |
setController(java.lang.String field,
boolean value,
java.lang.String specification)
Sets the service controller on this provided service.
|
void |
setPostRegistrationCallback(Callback cb) |
void |
setPostUnregistrationCallback(Callback cb) |
protected void |
setProperties(Property[] props)
Add properties to the provided service.
|
void |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration registration,
java.lang.Object service)
The unget method.
|
void |
unregisterService()
Withdraws the service from the service registry.
|
void |
update()
Update the service properties.
|
public static final int REGISTERED
public static final int UNREGISTERED
public static final int SINGLETON_STRATEGY
public static final int SERVICE_STRATEGY
public static final int STATIC_STRATEGY
public static final int INSTANCE_STRATEGY
public static final int CUSTOM_STRATEGY
public static final java.lang.String ALL_SPECIFICATIONS_FOR_CONTROLLERS
public ProvidedService(ProvidedServiceHandler handler, java.lang.String[] specification, int factoryPolicy, java.lang.Class creationStrategyClass, java.util.Dictionary conf)
handler
- the the provided service handler.specification
- the specifications provided by this provided servicefactoryPolicy
- the service providing policycreationStrategyClass
- the customized service object creation strategy.conf
- the instance configuration.protected void setProperties(Property[] props)
props
- : the properties to attached to the service registrationpublic org.osgi.framework.ServiceReference getServiceReference()
public java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration)
getService
in interface org.osgi.framework.ServiceFactory
bundle
- : the bundleregistration
- : the service registration of the registered servicenull
if the instance is no more valid.ServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)
public void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration, java.lang.Object service)
ungetService
in interface org.osgi.framework.ServiceFactory
bundle
- : bundleregistration
- : service registrationservice
- : service objectServiceFactory.ungetService(org.osgi.framework.Bundle,
org.osgi.framework.ServiceRegistration, java.lang.Object)
public void registerService()
public void unregisterService()
public int getState()
protected InstanceManager getInstanceManager()
public Property[] getProperties()
public void update()
protected void addProperties(java.util.Dictionary props)
props
- : properties to addprotected void deleteProperties(java.util.Dictionary props)
props
- : properties to removepublic java.lang.String[] getServiceSpecifications()
public org.osgi.framework.ServiceRegistration getServiceRegistration()
public void setController(java.lang.String field, boolean value, java.lang.String specification)
field
- the field attached to this controllervalue
- the value the initial valuespecification
- the target specification, if null
affect all specifications.public org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController getController(java.lang.String field)
field
- the field namenull
if there is no service controller attached to the given field
name.public org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController getControllerBySpecification(java.lang.String spec)
spec
- the specification (qualified class name)null
if there is no service controller handling the service publishing
the given service specificationpublic void setPostRegistrationCallback(Callback cb)
public void setPostUnregistrationCallback(Callback cb)
public int getPolicy()
public java.lang.Class<? extends CreationStrategy> getCreationStrategy()
public void addListener(ProvidedServiceListener listener)
listener
- the ProvidedServiceListener
object to be addedjava.lang.NullPointerException
- if listener
is null
public void removeListener(ProvidedServiceListener listener)
listener
- the ProvidedServiceListener
object to be removedjava.lang.NullPointerException
- if listener
is null
java.util.NoSuchElementException
- if listener
wasn't present the in provided service handler's list of listenerspublic void cleanup()
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.