Have you seen 5.10 of RFC 190 [1] ?

[1] 
https://github.com/osgi/design/raw/master/rfcs/rfc0190/rfc-0190-Declarative_Services_Enhancements.pdf
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788




From:   Balázs Zsoldos <balazs.zsol...@everit.biz>
To:     OSGi Developer Mail List <osgi-dev@mail.osgi.org>
Date:   2014/02/26 04:47
Subject:        [osgi-dev] Declarative Services and references with 
configurable    cardinality
Sent by:        osgi-dev-boun...@mail.osgi.org



Hi,

an issue came up a couple of times that I could not solve with Declarative 
Services. First, I thought I had a very special use-case but it came up 
more and more times so I think it is time to share my thoughts.

Imagine you have a servlet container as a component. The component will be 
instantiated if there is configuration and it will listen on the 
configured port. You want to specify the servlets that are available on 
that server instance. If you use whiteboard pattern, that does not make 
sure that all of the servlets are available at the time the server is 
started.

What I was imagine is to create in the ServerComponent an array 
references:
    
  @Property(name="servlet.target", cardinality = 1)
  @Reference(cardinality = 
ReferenceCardinality.MANDATORY_BY_CONFIGURATION)
  Servlet[] servlet

Now if the property servlet.target has the following value

  servlet.target = {"(servletName=myServlet1)", 
"(servletName=myServlet2)"}

than the component will be active when the two servlet OSGi services are 
available that match the OSGi filters defined in the property.

The logic comes up very often. Every time, when we want to allow extension 
points in our components in the way that our component should start only 
when all the configured extension points are available, this feature would 
be really helpful.

What do you think?

Regards,
Balazs Zsoldos
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to