On 27/06/2016 18:48, David Jencks wrote:
You’ve specified prototype scope, so there is never going to be “ONE” canonical
instance. You need something to request the service from the service reference
or from the ServiceObjects interface from the service reference.
With the default scope, you aren’t going to get an instance created without a
user either unless you specify immediate=true as well.
if I understood the spec right, when I use immediate=true then I get a
Singleton scope, right?
Would a component with scope singleton use ConfigurationPolicy.REQUIRE ?
I generally don’t specify enabled=true since that is the default value.
then you let your components as enabled=false and then will use a master
component to enable the others ?
david jencks
On Jun 27, 2016, at 2:42 PM, 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]