Hi,

On 12.10.2009, at 14:36, Vlatko Davidovski wrote:

Thanks Clement!

A small question.
I still cannot find how to get the managedservice parameter from the architecture.getInstanceDescription()

Currently I have:
@Component(architecture=true, immediate=true, propagation = true, managedservice = "ch .ethz.inf.vs.aparat.registry.osgi.services.DeviceRegistryServiceImpl")
@Provides
public class DeviceRegistryServiceImpl implements DeviceRegistryService {
.......
@Requires
private Architecture architecture;

@Validate
public void start() {
......
// I need the managedservice value here
}

Can you explain me a little bit what's your architecture and goal ?

ManagedService is a service. If enabled, iPOJO registers this service for you with the given PID, the instance.name and factory.name properties.

So if you know the name of your instance or of your factory (be care if you create several component instance), you just need a service dependencies on the service.

However, you should never directly access to the ManagedService which is a Configuration Admin service.

If you need to get a configuration:
- either you push it in the instance declaration:
<instance component="...">
<property name="p" value="v"/>
</instance>
- or you create a ManagedServiceFactory configuration (using your component type name as ManagedServiceFactory PID.

If you just need to reconfigure yourself, then, you just use the (direct) reconfigure method of the Factory service.

Regards,

Clement


On Oct 12, 2009, at 7:58 AM, 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.

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]

Reply via email to