|
|||||||||
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.
Constructor Summary | |
---|---|
ConfigurationDependency(org.osgi.framework.BundleContext context)
|
Method Summary | |
---|---|
java.util.Dictionary |
getConfiguration()
|
boolean |
isAvailable()
Returns true if the dependency is available. |
boolean |
isPropagated()
|
boolean |
isRequired()
Returns true if this a required dependency. |
ConfigurationDependency |
setPid(java.lang.String pid)
|
ConfigurationDependency |
setPropagate(boolean propagate)
|
void |
start(Service service)
Starts tracking the dependency. |
void |
stop(Service service)
Stops tracking the dependency. |
java.lang.String |
toString()
|
void |
updated(java.util.Dictionary settings)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConfigurationDependency(org.osgi.framework.BundleContext context)
Method Detail |
---|
public boolean isAvailable()
Dependency
true
if the dependency is available.
isAvailable
in interface Dependency
true
if the dependency is availablepublic boolean isRequired()
Dependency
true
if this a required dependency. Required dependencies
are dependencies that must be available before the service can be activated.
isRequired
in interface Dependency
true
if the dependency is requiredpublic boolean isPropagated()
public java.util.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(java.util.Dictionary settings) throws org.osgi.service.cm.ConfigurationException
updated
in interface org.osgi.service.cm.ManagedService
org.osgi.service.cm.ConfigurationException
public ConfigurationDependency setPid(java.lang.String pid)
public ConfigurationDependency setPropagate(boolean propagate)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |