commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Huegen <>
Subject [HiveMind] Setting multiple services
Date Wed, 10 Mar 2004 14:37:39 GMT

I have a problem and wonder what is the best solution.
My application has an authentication service which is responsible for
realizing a single signon to different middleware systems. For each 
there is a special Connector class that is realized as a sevice too.
No I have to tell the Authentication service which other services to use
as "authenticators". My first solution was to use <set-service> :

<service-point id="Authentication" interface="AuthenticationService">
	<invoke-factory service-id="hivemind.BuilderFactory">
		<construct class="AuthenticationServiceImpl" >
		  <set-service service-id="AuthenticatorA" property="nextAuthenticator"/>
		  <set-service service-id="AuthenticatorB" property="nextAuthenticator"/>

Actually "nextAuthenticator" is not really a property, since it adds the 
authenticator to a list. Maybe one could add a "method" attribute to 
set-service for such cases, where you want to add multiple services of the 
same type (listeners for example) :

<set-service service-id="AuthenticatorA" method="addAuthenticator" />

But this doesn't solve the next problem: I want to add more authenticators 
 from different modules. Obviously I should use a configuration instead, 
but it's not so clean as it should be:

<configuration-point id="Authenticators">
		<element name="authenticator">
			<attribute name="service-id" required="true"/>
			<conversion class="InstanceHolder" >
				<map attribute="service-id" property="instance" translator="service" />

What is bugging me here, is that I have to use the InstanceHolder class 
which is just a wrapper around an object.
The method AuthenticationServiceImpl.setAuthenticators(List 
authenticators) that is used for setting the configuration, receives a 
list of InstanceHolders that contains instances of Authenticator. Kind of 
ugly in my opinion.
Is there another solution that gets rid of the InstanceHolder class 
(custom rule?) ?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message