Those decorators describe the component. They must decorate the factory class itself.
The factory definition decorator must be unique per class and must always be the last one executed, i.e. the top one in the source code.
Note that some properties have a special meaning for iPOPO and Pelix.
||The name of the iPOPO component instance|
||The registration number of a service|
||The rank (priority) of the services provided by this component|
@ComponentFactory() @Property('_name', 'instance.name') # Special property @Property('_value', 'my.value') # Some property @Property('_answer', 'the.answer', 42) # Some property, with a default value class Foo(object): def __init__(self): self._name = None # This will overwritten by iPOPO self._value = 12 # 12 will be used if this property is not configured self._answer = None # 42 will be used by default
Those decorators store behavioural information on component methods. They must decorate methods in the component class.
When all its requirements are fulfilled, the component goes into the VALID state. During the transition, it is in VALIDATING state and the following decorators indicate which method must be called at that time. If the decorated method raises an exception, the component goes into the ERRONEOUS state.
When one of its requirements is missing, or when it is killed, the component goes into the INVALID state. During the transition, it is in INVALIDATING state and the following decorators indicate which method must be called at that time.
Exceptions raised by the decorated method are ignored.