|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.dependencymanager.ConfigurationDependency
public class ConfigurationDependency
Configuration dependency that can track the availability of a (valid) configuration.
To use it, specify a PID for the configuration. The dependency is always required,
because if it is not, it does not make sense to use the dependency manager. In that
scenario, simply register your service as a ManagedService(Factory>
and
handle everything yourself. Also, only managed services are supported, not factories.
There are a couple of things you need to be aware of when implementing the
updated(Dictionary)
method:
ConfigurationException
when you get a
configuration that is invalid. In this case, the dependency will not change:
if it was not available, it will still not be. If it was available, it will
remain available and implicitly assume you keep working with your old
configuration.
Field Summary |
---|
Fields inherited from interface org.apache.felix.dependencymanager.ServiceComponentDependency |
---|
STATE_AVAILABLE_OPTIONAL, STATE_AVAILABLE_REQUIRED, STATE_NAMES, STATE_UNAVAILABLE_OPTIONAL, STATE_UNAVAILABLE_REQUIRED |
Constructor Summary | |
---|---|
ConfigurationDependency(BundleContext context,
Logger logger)
|
Method Summary | |
---|---|
Dictionary |
getConfiguration()
|
String |
getName()
Returns the name of this dependency. |
int |
getState()
Returns the state of this dependency. |
String |
getType()
Returns the name of the type of this dependency. |
boolean |
isAvailable()
Returns true if the dependency is available. |
boolean |
isPropagated()
Returns true when configuration properties should be propagated
as service properties. |
boolean |
isRequired()
Will always return true as optional configuration dependencies
do not make sense. |
ConfigurationDependency |
setPid(String pid)
Sets the service.pid of the configuration you
are depending on. |
ConfigurationDependency |
setPropagate(boolean propagate)
Sets propagation of the configuration properties to the service properties. |
void |
start(Service service)
Starts tracking the dependency. |
void |
stop(Service service)
Stops tracking the dependency. |
String |
toString()
|
void |
updated(Dictionary settings)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConfigurationDependency(BundleContext context, Logger logger)
Method Detail |
---|
public boolean isAvailable()
Dependency
true
if the dependency is available.
isAvailable
in interface Dependency
true
if the dependency is availablepublic boolean isRequired()
true
as optional configuration dependencies
do not make sense. You might as well just implement ManagedService
yourself in those cases.
isRequired
in interface Dependency
true
if the dependency is requiredpublic boolean isPropagated()
true
when configuration properties should be propagated
as service properties.
public Dictionary getConfiguration()
public void start(Service service)
Dependency
dependencyAvailable()
on the service.
start
in interface Dependency
service
- the service that is associated with this dependencypublic void stop(Service service)
Dependency
dependencyUnavaible()
before stopping itself to ensure
that dependencies that aren't "active" are unavailable.
stop
in interface Dependency
public void updated(Dictionary settings) throws ConfigurationException
updated
in interface ManagedService
ConfigurationException
public ConfigurationDependency setPid(String pid)
service.pid
of the configuration you
are depending on.
public ConfigurationDependency setPropagate(boolean propagate)
public String toString()
toString
in class Object
public String getName()
ServiceComponentDependency
getName
in interface ServiceComponentDependency
public int getState()
ServiceComponentDependency
getState
in interface ServiceComponentDependency
public String getType()
ServiceComponentDependency
getType
in interface ServiceComponentDependency
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |