cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Ezkovich <g...@hard-bop.com>
Subject Getting an actual Instance of a Component using ServiceManager.lookup()
Date Mon, 19 Jul 2004 02:55:22 GMT
I have a non-sitemap component that I have marked as ThreadSafe, when I 
try to access it in another component using the ServiceManager, I get 
an instance of java.lang.reflect.Proxy. Obviously, I am missing 
something. I could get its InvocationHandler, but to use it seems 
cumbersome. There must be some way to get an actual instance of my 
class.

Here's what I am doing. In cocoon.xconf I declare a component

   <component class="com.hardBop.workFlow.Processor" logger="hardbop" 
role="com.hardBop.workFlow.Processor">
         <parameter name="datasource" value="hardbop"/>
         <parameter name="mail.smtp.host" value="smtp.hard-bop.com"/>
         <parameter name="from_address" value="manager@hard-bop.com"/>
   </component>

I attempt to access the component in another components initialize 
method

	 this.processor = 
(Processor)this.serviceManager.lookup(Processor.ROLE);

Of course this causes a ClassCastException to be thrown.


I could always implement these classes as plain Java objects but I 
would really like to take advantage of the built in pooling and 
SourceResolver.

So my question is, what do I need to do to get an actual instance of my 
Component.

Any help is greatly appreciated.


Glen Ezkovich
HardBop Consulting
glen@hard-bop.com
http://www.hard-bop.com - new and improved site coming soon



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


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


Mime
View raw message