> Hi all, > > I have several questions on DS Spec. > > ============================================== > [Background] > > In 112.3.3 Reference Policy of R4.2 cmpn spec, "Static policy is usually > also not applicable if the cardinality specifies multiple bound > services.". > > However, spec doesn't specifies what will happen if static policy with > the cardinality which specifies multiple bound.
That sentence is just commentary. If a component depends upon multiple services, then is probably wants that to be a dynamic dependency. I think the spec quite well addresses the use of static policy with multiple cardinality. > > This caused several questions on DS: > > ============================================== > > Precondition1: component1 has a static reference with cardinaliry of > "0..n" for serviceA. There is no serviceA registered. > ==> component1 has been already activated. > > Q1. What will happen if serviceA is registered at Precondition1 ? If component1 is activated with 0 bound serviceA and a serviceA is then registered, component1 should be deactivated. Then a new component1 is created, bound to 1 serviceA and activated. > > c.f. In Equinox DS impl, activation will be done after deactivation is done. This is correct. > > --------------------------- > > Precondition2: component1 has a STATIC reference with cardinaliry of > "1..n" for serviceA. There is one serviceA registered. > ==> component1 has been already activated. > > Q2. What will happen if serviceA is registered at Precondition2 ? If component1 is activated with 1 bound serviceA and a serviceA is then registered, component1 should be deactivated. Then a new component1 is created, bound to 2 serviceA and activated. > > c.f. In Equinox DS impl, activation will be done after deactivation is done. This is correct. > > --------------------------- > > Precondition3: component1 has a STATIC reference with cardinaliry of > "1..1" for serviceA. There is one serviceA registered. > ==> component1 has been already activated. > > Q3. What will happen if another serviceA with higher SERVICE_RANKING than > the bound service is registered at Precondition3 ? > > Should it be bound service replaced (and re-activate after > deactivattion) ? or not. There is no need to replace the service since 1..1 static dependencies do not require replacement as long as the current bound service is still available. > > # I guess NO, although there is no description about it, > # as far as I see in the spec. > > --------------------------- > > Precondition4: component1 has a DYNAMIC reference with cardinaliry of > "1..1" for serviceA. There is one serviceA registered. > ==> component1 has been already activated. > > Q3. What will happen if another serviceA with higher SERVICE_RANKING than > the bound service is registered at Precondition4 ? > > Should it be bound service replaced (and re-bind the new and unbind the > old) ? or not. There is no need to replace the service since the currently bound service is still available. But since the policy is dynamic, a DS impl could replace the service if it wanted to. > > # I guess NO, although there is no description about it, > # as far as I see in the spec. > > --------------------------- -- BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance [email protected] office: +1 386 848 1781 mobile: +1 386 848 3788
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
