Versions Compared

Key

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

...

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

...