hummm... think I got the idea now...

I will create another component to consume the registered service and see if the activate method is being called...

thanks again,

Cristiano

On 27/06/2016 19:08, Neil Bartlett wrote:
On 27 Jun 2016, at 23:05, Cristiano Gavião <[email protected]> wrote:

Thanks David and Neil,

Humm, I don't think I understood yet.

Ok, I don't have any other bundle/component consuming this service, yet.

but in this case why I have an instance of the service that received the 
configuration from CM registered ?
You don’t have an instance… you have a service registration. When another 
bundle sees this in the service registry and calls getService(), then an 
instance of the class will be created in order to provide the service. This is 
a key laziness feature offered by DS.

Regards,
Neil


Look at the log below:

   18:54:13.557 INFO : com.c4biz.feast.kernel.lib [ OSGI_BUNDLE ]:
   ServiceEvent REGISTERED
   
[S:{com.c4biz.feast.FixedControllerService}={service.pid=fixed.controller-1467064453446-0,
   service.factoryPid=fixed.controller,
   component.name=com.c4biz.feast.ComponentControllerServiceProvider,
   extenderAlias=ConfigurationManifestHeaderExtender,
   targetBundleStateMask=32, component.id=4,
   targetTrackingMode=manifest_header, service.id=56,
   service.bundleid=18, service.scope=prototype}]



On 27/06/2016 18:47, Neil Bartlett wrote:
Probably lazy activation. Your component is a service, of type 
FixedControllerService. No instances will be created until a consumer binds to 
it.

Neil


On 27 Jun 2016, at 22:42, Cristiano Gavião <[email protected]> wrote:

Hello,

I'm facing a situation that I'm not understanding. I'm using 
org.apache.felix.scr 2.0.2.
I've set a component with this annotation:

   @Component(enabled = true, configurationPolicy =
   ConfigurationPolicy.REQUIRE,
            scope = ServiceScope.PROTOTYPE, service =
   FixedControllerService.class,
            configurationPid = {SERVICE_FACTORY_PID_CONTROLLER})

   <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0";
   name="com.c4biz.feast.ComponentControllerServiceProvider"
   configuration-policy="require" enabled="true" activate="activate"
   deactivate="deactivate" modified="modified"
   configuration-pid="fixed.controller">
      <implementation
   class="com.c4biz.feast.ComponentControllerServiceProvider"/>
      <service scope="prototype">
        <provide interface="com.c4biz.feast.FixedControllerService"/>
      </service>
   </scr:component>

In this component class I have a method (activate()) tagged with @Activate 
annotation. And there are any reference bind being used for now.

 From another bundle I'm creating a configuration using factoryPID = 
SERVICE_FACTORY_PID_CONTROLLER.
Interesting is that the service are being created and with in a proper 
autogenerated PID and passed properties. At least I can see it when listing the 
services using gogo console.

also scr:list tells me that the component is enabled and satisfied.

What I'm not understanding is that the activate method is not being called...

could someone explain me what am I missing here?

thanks,

Cristiano
---------------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to