You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Martinson, Theresa" <Th...@personneldecisions.com> on 2005/03/07 20:19:48 UTC

Using DefaultServiceSelector

I'm trying to use the Selector functionality to select a particular
component based on a hint.
(I use cocoon 2.1.6, Tomcat 5.5.4.)

I'm having trouble as I attempt to use
org.apache.avalon.framework.service.DefaultServiceSelector
When I attempt to get this Selector, I get a class of type   "$Proxy15"
rather than a DefaultServiceSelector.  I was hoping to get a
DefaultServiceSelector, on which I could call the select (hint) method.

Here is what I have set up in the configuration files:

ROLES FILE:
<role-list>

<!-- This Example Role Works Fine! -->
<role name="FirstTry" 
	shorthand="persistence1"
	default-class="com.foo.bar.MyImpl">
</role>		

<!--  This One Is Causing Me Problems! -->  		
<role name="SecondTry"
	shorthand="persistence2"
	
default-class="org.apache.avalon.framework.service.DefaultServiceSelecto
r">
     <hint shorthand="type1" class="com.foo.bar.MyType1Impl"/>
     <hint shorthand="type2" class="com.foo.bar.MyType2Impl"/>
</role>
</role-list>

COCOON.XCONF:
<component
class="org.apache.avalon.framework.service.DefaultServiceSelector"
role="SecondTry"/>

APPLICATION CODE THAT ATTEMPTS TO USE IT:
In the compose method of a composable action:

THIS WORKS FINE: 		
MyImpl temp = (MyImpl) manager.lookup("FirstTry");	

THIS GIVES ME A CLASS OF TYPE $Proxy15:
Object temp2 =  manager.lookup("SecondTry");

I'm not sure whether I'm on the right track in attempting to use the
DefaultServiceSelector for my basic selector functionality.  Is there
some other way to accomplish what I'm trying to do?    I've attempted to
search the wiki's and the mailing list for an example, but haven't found
one yet.


Any help is appreciated.

Theresa


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