Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To add a filter, just add a 'filter' attribute in your dependency containing the LDAP filter. IPOJO will select only provider matching with this filter.

Moreover, filters can be customize instance by instance. It is possible to specialize / change / add the filter of a component in the instance description. It is useful when you want to create different instances of the same component, with different filter. To do it, you have to identify your dependency with an 'id' attribute. Then you can specialize the filter of the dependency in the instance description by using the property "requires.filters". In this property you can specify each dependency identified by its id and the new value of the filter.

Code Block

<component className="org.apache.felix.ipojo.example.FilteredDependency" name="FOO">
	<requires field="m_foo" fiter="(foo.property=FOO)" id="id1">
		<callback type="bind" method="bind"/>
		<callback type="unbind" method="unbind"/>
	</requires>
</component>

<instance name="FOO1" component="FOO"/>

<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>

The FOO component type declares a service dependency with the 'id1' id. This dependency has no filter by default. The first instance is just an instance of the FOO component type and does not modify the dependency. The second one adds a filter to the declared dependency to target providers with foo.property = BAR. The last one add another filter to the declared dependency. By using instance filter customization, it is possible to create complex applications where you avoid boinding problem by filtering dependencies instance by instance.

Binding Policies 

Three binding policies are supported inside iPOJO.

...