Hi,
You can configure the filters of each service dependency from the instance
configuration. To achieve this, you need to add the 'requires.filters' key
inside the configuration. The value is a map dependency id -> filter.
For example, the XML version of this is:
<instance name="FOO2" component="FOO">
<property name="requires.filters">
<property name="id1" value="(foo.property=BAR)"/>
</property></instance>
<instance name="FOO3" component="FOO">
<property name="requires.filters">
<property name="id1" value="(foo.property=BAZ)"/>
</property></instance>
If you want something more dynamic (that you can change at runtime), you
can either retrieve the `Dependency` object from the instance architecture
(and from here use the `setFilter` method), or implement an interceptor (
http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/service-binding-interceptors.html
).
Cheers,
Clement
2015-02-25 22:20 GMT+01:00 Craig Niles <[email protected]>:
> Hi,
>
> I'm trying to have services created at runtime using the iPOJO Factory
> API. The component I want to create an instance of has a requirement on
> another service, and I use the @Requires annotation. I know I can define a
> filter for the requirement directly in the @Requires annotation, but how
> could I achieve the same effect through another API, such as @Configuration
> annotation or Factory API, or even have the requirement use one of the
> components properties to define which factory it should use?
>