I realized that servicefactory would do no good. As I browsed through the source of Equinox's DS, it became apparent what the specification meant. This is a bit unfortunate, I was sort of hoping that if I made my component implement ServiceFactory, then DS' ServiceFactory would simply delegate the call.
Too bad. Thanks anyway though. Fredrik. On Wed, Oct 22, 2008 at 16:05, BJ Hargrave <[EMAIL PROTECTED]> wrote: > > servicefactory will not help with your issue. It just tells SCR to create > and activate a unique instance of the component implementation class for > each bundle using the service. > > The use case you have (separate service implementation class from component > implementation class) can't be done with DS. DS is designed upon the premise > that the service and the component are one and the same. > > It is possible that your use case be handled by RFC 124[1] coming in 4.2 but > I am not sure. > > [1] http://www.osgi.org/Download/File?url=/download/osgi-4.2-early-draft.pdf > -- > > 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 > > > > > From: > "Fredrik Alströmer" <[EMAIL PROTECTED]> > To: > "OSGi Developer Mail List" <[email protected]> > Date: 2008/10/21 04:13 AM > Subject: [osgi-dev] Re: Declarative Services factory components. > ________________________________ > > > I just realized I should probably be dealing with the 'servicefactory' > attribute instead, I'm working on it right now, if anyone has any > input/ideas/concerns, please don't hesitate to voice them anyway. ;) > > I'm still interested in how factory components should be used though, > if anyone has got any guidelines or good examples... > > Thanks, > Fredrik. > > On Tue, Oct 21, 2008 at 09:30, Fredrik Alströmer <[EMAIL PROTECTED]> wrote: >> Hi! >> >> I'd like to have a component, with normal requires and provides, which >> are satisfied in the normal manner. However, when the component has >> been activated and a request for the service is made, I need to use an >> other object as implementation for the provided service, rather than >> an instance of the implementation mentioned in the component >> description. This is part of a legacy implementation, where the >> implementation of the interface provided is separated from the class >> doing the life cycle (this class incidentally creates the instance of >> the class providing the interface that I need, so I can't make a >> separate component which just depends on the life cycle component >> either). I also don't want to make a wrapper (or proxy..), as there >> are a bunch of these cases, and I would to solve it in a general >> manner. >> >> Can I use factory components for this? I tried to understand the >> compendium, but it appears to be very brief on this matter. If this >> cannot be done with factory components, could someone please explain >> how to use factory components? Who calls newInstance? (Does it have to >> be done explicitly?) >> >> I hope my question was halfway comprehensible, it felt pretty >> confusing to me... :) >> >> Thanks, >> Fredrik. >> > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
