felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Ottinger <mottin...@tacitknowledge.com>
Subject Design pattern for working with multiple implementations of an interface
Date Fri, 22 Jul 2011 22:55:47 GMT
Hi All,

	I'm using Felix with SCR annotations. I'm investigating a couple of approaches with declaring
a component that makes use of a collection of objects representing various classes that all
implement the same interface. This would be something similar I suppose to a configuration
factory, although each instance would not be of the same type, rather they would be separate
implementations to the same interface. One approach I know would work is to use the target
attribute of the @Reference annotation to "handpick" each implementation as a separate dependency.
So three implementations of my interface would result in three dependencies each with a unique
property I can use as a value for the target attribute. This seems less that ideal as I'd
need to add a new dependency for each implementation I make. I'm looking for something similar
to a configuration factory where my bindXXX and unbindXXX methods can be called as each implementation
is presented to Felix. Is such a thing possible?

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

View raw message