Why not just use the whiteboard pattern? You said: "whiteboard ... does not make sure that all of the servlets are available at the time the server is started." Why is that important?
Regards Neil -- Neil Bartlett Sent from a phone On Wednesday, 26 February 2014 at 09:47, Balázs Zsoldos wrote: > 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