Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Include Page
FELIX:apache-felix-ipojo-headerFELIX:
apache-felix-ipojo-header

...

This document explains how developers can use iPOJO extensibility mechanism to extend the (primitive) component instance container. Such extensibility mechanism does not require to modify the iPOJO core.

Div
classtoc
Table of Contents
maxLevel4
minLevel2

...

First, iPOJO concepts are briefly explained. The second section explains the steps to create a handler. The two last sections describes the implementation and the usage of two small example handlers : a Log Handler, logging messages inside the OSGi log service, and a Property Handler, injecting properties values inside fields.

...

Once your handler has been declared, you can use it in iPOJO components. To do so, you first have to be bound to your handler's namespace (using standard XML namespace declaration). Then you can configure the handler in your components type description. An example of bundle's metadata.xml declaring components using the handler is shown hereafter :

Code Block
xml
xml
<ipojo xmlns:your-shortcut="the.namespace.of.your.handler">
    ...
    <component className="your.component.class">
        ...
        <your-shortcut:HandlerName param1="value1" ...>
            <!-- 
            Configuration of your handler for 
            this component type
             -->
        </your-shortcut{noformat}:HandlerName>
        ...
    </component>
    ...
</ipojo>

...

will be translated to:

Code Block
shell
shell
component { 
    $classname="org.apache.felix.ipojo.test.scenarios.component.jmx.JMXSimple"
    $public="true" $name="org.apache.felix.ipojo.test.scenarios.component.jmx.JMXSimple"
    org.apache.felix.ipojo.handlers.jmx:config { 
        $usesmosgi="false" $domain="my-domain" 
        org.apache.felix.ipojo.handlers.jmx:property { 
            $rights="w" $notification="true" $field="m_foo" $name="prop" }
        org.apache.felix.ipojo.handlers.jmx:method { 
            $description="set the foo prop" $method="setFoo" }
        org.apache.felix.ipojo.handlers.jmx:method { 
            $description="get the foo prop" $method="getFoo" }
    }
}

...

In this document, we present how-to develop handler for your components. We describe two small examples : a log handler and a properties handler. These handlers are plugged on (primitive) instance. However, it is possible to extends CompositeHandler too . See the handler proposition section of the iPOJO documentation to see available handlers or to propose your own handlerto customize the composition model.

If you develop handler and you want to share it, feel free to contact us by sending a mail on the Felix mailing list.


Include Page
FELIX:apache-felix-ipojo-footerFELIX:
apache-felix-ipojo-footer