On 10/12/09 7:58, Clement Escoffier wrote:
Hi,
On 12.10.2009, at 02:01, Vlatko Davidovski wrote:
Hi!
As I am new to iPojo, I have a couple of questions:
1. How to get the value of the annotated field managedservice
programmatically?
The Architecture service can give you such information. If not
disabled, every instance exposed an Architecture service allowing you
to get the InstanceDescription. Thanks to that object you can check
the current state of properties, provided services, dependencies...
2. Does immediate attribute of service A mean that required services
(B & C) are monitored and as soon as they are available, an instance
of the service A is created?
Immediate means that, as soon as valid (i.e.e service dependencies
resolved), a POJO instance will be created. It will not create a
component instance, but it will create a component implementation
class object.
Another way to think about it, is if you have this:
<instance component="myclass"/>
You are creating a component container to manage the POJO and lazily
create it once someone tries to use it (assuming it provides a service
and its dependencies are satisfied). If you annotate the component as
immediately, then the above is no longer lazy and it will create the
POJO immediately even if no one is using it (assuming its dependencies
are satisfied).
Also, if you have a component type that doesn't provide a service, then
component instances are always treated as immediate, since there would
be no way for someone to use it to trigger the POJO creation.
-> richard
3. What is the difference between @Property and @ServiceProperty?
@ServiceProperty are properties published with the provided services
(if the instance publishes services).
@Property are internal properties which are not published with the
provided services.
4. What is the usage of the attributes architecture, factory_method,
public_factory of @Component?
- architecture allows you to disable the introspection service. The
introspection is enabled by default.
- factory_method allows you to use a static method of the class to
create the POJO object. In that case, iPOJO call this method instead
of the regular constructor when the creation of one object is required.
- public_factory allows you to set if the component type factory is
public or not. Public factories (the default) are exposed as services
(Factory, and ManagedServiceFactory) and allows the creation of
component instances from others bundles (either declared inside a
metadata.xml, or with the API).
Regards,
Clement
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]