|
|||||||||
| 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()
Dependencytrue if the dependency is available.
isAvailable in interface Dependencytrue 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 Dependencytrue 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)
DependencydependencyAvailable() on the service.
start in interface Dependencyservice - the service that is associated with this dependencypublic void stop(Service service)
DependencydependencyUnavaible() 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 ManagedServiceConfigurationExceptionpublic ConfigurationDependency setPid(String pid)
service.pid of the configuration you
are depending on.
public ConfigurationDependency setPropagate(boolean propagate)
public String toString()
toString in class Objectpublic String getName()
ServiceComponentDependency
getName in interface ServiceComponentDependencypublic int getState()
ServiceComponentDependency
getState in interface ServiceComponentDependencypublic String getType()
ServiceComponentDependency
getType in interface ServiceComponentDependency
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||