Johan, I imagined that the return values would be serviceIds. So, the method name would be better as...
public List getServiceIds( Class serviceInterface ); That would be quite trivial to do. James -----Original Message----- From: Johan Lindquist [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 11:08 AM To: [email protected] Subject: Re: Multiple implementations for service If you got a list of interfaces, which instance would you use in that case? The criteria for the service that you are interested need to be specified somehow (as james mentions) You can solve this to an extent by defining a configuration point that collects all service instances and allow you to write a factory that provides the implementations that you need: FooFactory fooFactory = registry.getService(FooFactory.class); Foo foo = (Foo)fooFactory.getFoo(<some-criteria>) Johan On 28 Apr 2005 17:51:31 +0300, Igor Laberov <[EMAIL PROTECTED]> wrote: > Now I see your point, it much more clear now :) > > The only issue that is still opened - ability to get list of services > that implement the same interface, something like that: > public List getServices(Class interfaceClass){ > List l = (List) _servicePointsByInterface.get(interfaceClass); > return l; > } > > Is it possible to add getServices(Class) to Registry interface? > > On Thu, 2005-04-28 at 17:19, James Carman wrote: >> So, you want to allow the users to choose which implementation type >> they want, right? Then, define two different service points with the >> same interface, but give them different ids (of course) corresponding >> to the different implementations. Another approach would involve writing your >> own >> service model which chooses which implementation type to instantiate >> using >> some sort of thread-local parameter (which you'd have to set prior to >> invoking of course). >> >> -----Original Message----- >> From: Igor Laberov [mailto:[EMAIL PROTECTED] >> Sent: Thursday, April 28, 2005 10:11 AM >> To: [email protected] >> Subject: Re: Multiple implementations for service >> >> >> These 2 options don't allow to have more than one service >> implementation in >> the same time. Current Registry interface doesn't allow this, because it >> have only >> getService() that returns single implementation only. >> >> Is it possible to override Registry service? >> >> Thanks, >> Igor >> >> On Wed, 2005-04-27 at 14:35, Johan Lindquist wrote: >> > Two options - have two service points (same service interface is >> > allowed, just name the service point will be have to differ) or use >> > the >> override >> > functionality >> (http://jakarta.apache.org/hivemind/current/override.html) >> > >> > Cheers, >> > >> > Johan >> > >> > On 27 Apr 2005 14:33:46 +0300, Igor Laberov <[EMAIL PROTECTED]> >> > wrote: >> > >> > > Hi again, >> > > In our application we want to have multiple implementation >> > > classes for one service. So .xml file will look like >> > > <service-point id="Part" /> <implementation service-id="Part"> >> > > <create-instance class="one.PartImpl"/> </implementation> >> > > <implementation service-id="Part"> >> > > <create-instance class="two.PartImpl"/> >> > > </implementation> >> > > >> > > At startup user will choose implementation that he want to work >> > > with (and its id will be stored), and later user operations will >> > > be associated with selected implementation. >> > > >> > > As I see from RegistryBuilder code, it is not allowed to have 2 >> > > implementation. Can you point me to other way having several >> > > service implementation? Or may be I can override some system >> > > service? >> > > >> > > Thank you, >> > > Igor Laberov >> > > Qlusters, Inc. >> > > >> > > >> > > >> > > ----------------------------------------------------------------- >> > > --- >> > > - >> > > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > > For additional commands, e-mail: >> [EMAIL PROTECTED] >> > > >> > > >> > >> > >> > >> > -- >> > you too? >> > >> > ------------------------------------------------------------------- >> > -- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: >> [EMAIL PROTECTED] >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: >> [EMAIL PROTECTED] >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- you too? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
