Include Page |
---|
| FELIX:apache-felix-ipojo-headerFELIX: |
---|
| apache-felix-ipojo-header |
---|
|
Wiki Markup |
---|
{html} |
HTML |
---|
<div class="content">
{html} |
Introspecting instances
iPOJO provides mechanisms to introspect and reconfigure instances. Those features are available from the instance description. Currently, only the reconfiguration of primitive instances is supported.
...
- By using the
architecture
service exposed by an instance providing introspection support. - By calling the getInstanceDescription() method on a ComponentInstance object (that you create thanks to a Factory)
Code Block |
java |
---|
| java |
---|
1 | Getting the instance description from the ComponentInstance object |
---|
| java |
---|
|
/**
* Returns the instance description.
* @return the instance description of the current instance
*/
InstanceDescription getInstanceDescription();
|
...
Once you get the InstanceDescription
object, cast it in PrimitiveInstanceDescription
(be sure that it is really a primitive instance).
Then, you have access to every primitive instance aspects:
service dependencies
provided services
configuration properties
get created implementation objects
Code Block |
---|
| java | java |
---|
title | Primitive Instance Description methods |
---|
| java |
---|
|
/**
* Gets the list of object created by the described instance.
* @return the created objects.
*/
public String[] getCreatedObjects() {
...
}
/**
* Gets the instance service dependencies.
* @return the set of dependency description or an empty array if
* no dependencies.
*/
public DependencyDescription[] getDependencies() {
...
}
/**
* Gets the instance service dependency matching with the given service specification or id.
* @param specification the service specification of the looked specification.
* @return the dependency description matching with the given service specification or id.
* <code>null</code> is not found.
* no dependencies.
*/
public DependencyDescription getDependency(String specification) {
...
}
/**
* Gets the instance provided service matching with the given service specification.
* @param specification the provided specification of the looked provided service.
* @return the provided service description matching with the given service specification.
* <code>null</code> is not found.
*/
public ProvidedServiceDescription getProvidedService(String specification) {
...
}
/**
* Gets the instance provided service.
* @return the set of provided service description or an empty array if
* no provided services.
*/
public ProvidedServiceDescription[] getProvidedServices() {
...
}
/**
* Gets the instance properties.
* @return the set of property descriptions or an empty array if
* no properties.
*/
public PropertyDescription[] getProperties() {
...
}
|
...
With these methods you can get a property object and update its value dynamically.
Include Page |
---|
| FELIX:apache-felix-ipojo-footerFELIX: |
---|
| apache-felix-ipojo-footer |
---|
|