Include Page |
---|
| apache-felix-ipojo-header |
---|
| apache-felix-ipojo-header |
---|
|
HTML |
---|
Wiki Markup |
---|
{html}
<div class="content">
{html} |
How to use iPOJO annotations
You can use annotations to define your component types. This page presents supported annotations.
Div |
---|
|
|
Wiki Markup |
---|
{div:class=toc}
{toc:maxLevel=4|minLevel=2}
{div} |
Getting iPOJO Annotations:
...
- specifications: defines the provided interface (optional, default = all implemented interfaces)
- strategy : the service object creation strategy. Possible values : SINGLETON, SERVICE, METHOD, INSTANCE or the strategy class name. With SINGLETON there is only one POJO per component instance, SERVICE means OSGi Service factory, METHOD delegates the creation to the factory-method of the component, INSTANCE creates one service object per requiring instance. For other strategies, specify the qualified name of the CreationStrategy class. (optional, default = SINGLETON)
- properties : array containing
@StaticServiceProperties
defining service properties not attached to fields.
HTML |
---|
Wiki Markup |
---|
{html}
<div class="box">
<div class="box-blue-header">
<div class="box-blue-title">
<img src="http://people.apache.org/~clement/ipojo/site/information.gif"> <b>OSGi Service Factory</b>
</div>
</div>
<div class="box-blue-content">
The <tt>SERVICE</tt> strategy refers to the OSGi service factory. So, one service object per asking bundle will be created.
</div>
<div class="box-blue-footer"></div>
</div>
{ |
HTML |
} |
---|
Wiki Markup |
---|
{html}
<div class="box">
<div class="box-blue-header">
<div class="box-blue-title">
<img src="http://people.apache.org/~clement/ipojo/site/information.gif"> <b>Changes between the 1.0.0 and the 1.2.0</b>
</div>
</div>
<div class="box-blue-content">
The <tt>factory</tt> attribute became <tt>strategy</tt>. A third policy is now available (<tt>instance</tt>) allowing to create one service object per asking instance. Moreover, it is also possible to indicates the <tt>CreationStrategy</tt> class name.
</div>
<div class="box-blue-footer"></div>
</div>
{html} |
@Requires
Goal: Defines a service dependency
Target: Field
Attributes:
...
- name: property name (optional, default=field name
- value: property value (optional, default=no value)
- mandatory : is the property mandatory? (optional, default=false)
HTML |
---|
Wiki Markup |
---|
{html}
<div class="box">
<div class="box-blue-header">
<div class="box-blue-title">
<img src="http://people.apache.org/~clement/ipojo/site/information.gif"> <b>Mandatory property</b>
</div>
</div>
<div class="box-blue-content">
A mandatory property must receive a value either from the component type description (<tt>value</tt> attribute, or the instance configuration.
</div>
<div class="box-blue-footer"></div>
</div>
{html} |
@ServiceController
Goal: Control the service exposition
Target: Field (Boolean)
Attributes:
...
- name: property name (optional, default=field name computed by removing "set" from the method name (for instance setFoo(String ff) will get the Foo name))
- value: property value (optional, default=no value)
- mandatory : is the property mandatory? (optional, default=false)
HTML |
---|
Wiki Markup |
---|
{html}
<div class="box">
<div class="box-blue-header">
<div class="box-blue-title">
<img src="http://people.apache.org/~clement/ipojo/site/information.gif"> <b>Field and Method</b>
</div>
</div>
<div class="box-blue-content">
If another property with the same name is defined the method or the field is added to the existing property.
</div>
<div class="box-blue-footer"></div>
</div>
{html} |
@Updated
Goal: Defines method called when a reconfiguration is completed.
Target: a method (receiving a dictionary in argument)
...