The extender pattern handlerThe objective of this handler is to simplify the development of extender-based architecture. This architecture-style is based on two different roles:
Using the handlerFirst of all, you need to configure the component type to use the handler such as: <iPOJO xmlns:extender="org.apache.felix.ipojo.extender"> <Component className="org.apache.felix.ipojo.extender.myextender"> <!—Extender Pattern handler configuration --> <extender:extender extension="My-Extension" onArrival="onBundleArrival" onDeparture="onBundleDeparture" /> <callback transition="invalidate" method="stopping" /> <callback transition="validate" method="starting" /> <provides /> </Component> </iPOJO> Notice that, this handler is an external handler. So, it uses the "org.apache.felix.ipojo.extender" namespace. void onBundleArrival(Bundle bundle, String header) { // Do something } void onBundleDeparture(Bundle bundle) { // Do something } Notice the different signatures of the methods. The arrival method is called with the arriving bundle and the matching header value (i.e. the value of the My-Extension header of the bundle manifest). The departure method just receives the leaving bundle. ConfigurationThe handler has only three mandatory attributes:
DownloadThe handler is available on the download page. A more realistic exampleThe Junit4OSGi framework, available here , uses this handler to track Junit Test Suite offered by the installed bundles. The Junit4Osgi bundle has a component using this handler to be notified when a bundle with the "Test-Suite" header appears or leaves. |
OverviewGetting StartedUser Guide
ToolsDeveloper GuideMisc & Contact
|