> On Sep 7, 2015, at 8:07 PM, Benson Margulies <ben...@basistech.com> wrote:
> 
> The cardinality in the config admin does not seem to be sticking:
> 
> @Component(configurationPolicy = ConfigurationPolicy.REQUIRE,
> configurationPid = "com.basistech.ws.worker")
> 
> And:
> 
> @Reference(cardinality = ReferenceCardinality.MULTIPLE, policyOption =
> ReferencePolicyOption.GREEDY)
> public void setWorkerComponentService(WorkerComponentService
> workerComponentService) {
> 
> And in the relevant Karaf cfg file (com.basistech.ws.worker.cfg):
> 
> # This is a DS property. It tells DS that there is one component
> service that we are consuming.
> WorkerComponentService.cardinality.minimum=1
> 
> And the reference name in the DS metadata is WorkerComponentService.
> 
> but the component goes ahead and activates when it has none (due to
> leaving out the component); the activation throws an exception due to
> my own code complaining.
> 
> In spite of the exception thrown in the @Activate method, the
> component goes to REGISTERED, is there some particular exception that
> would prevent that?
> 
> I have it working (up to the point of fun with Json deserialization
> from CXF, which is also working mostly) by putting the component in
> place, but eventually I need the constraint to hold things up; and it
> would be nice to have a way for an exception in activation to stop the
> train.

The spec says:

        • Once the component config- uration is deactivated or fails to 
activate due to an exception, SCR must unbind all the component's bound 
services and discard all references to the component instance associated with 
the activation. 

Note that this doesn’t disable the component or unregister any services it may 
be exposing, because the exception may be highly transient, and e.g. the next 
time someone gets the service all may work smoothly and activate succeed.

I don’t know what version of ds you are “stuck” with, at some point in the 
distant past I think that an exception on activation did something like 
disabling the component.  Due to all the cool new 1.3 features you should use 
the latest release 2.0 but the previous release may have also had the 
cardinality.minimum support… but don’t quote me :-)

thanks
david jencks


> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to