cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Wyles <...@robinwyles.com>
Subject Re: C2.2 Avalon/Spring component look up
Date Thu, 22 May 2008 12:18:30 GMT
Hi Grzegrorz!

On 22 May 2008, at 13:07, Grzegorz Kossakowski wrote:

> Robin Wyles pisze:
>> Hi All,
>
> Hi Robin!
>
>> What I hope are some simple questions...
>> 1. What is the correct/preferred way to look up Avalon components  
>> from within a Spring bean?
>
> Use dependency injection as they components were plain Spring  
> beans. This will work fine.
>
> You may wonder what's bean id in such case. There is some generic  
> template for Avalon-based components ids but I guess it will be  
> simpler if you tell me what components you are interested in.

In this particular case it's an extension of the JackrabbitRepository  
from the JCR block.

I have it defined like so in my xconf:

<components>
     <include src="resource://org/apache/cocoon/jcr/jcr.roles"/>
     <jcr-repository class="com.jac.james.library.JamesRepository">
         <credentials login="guest" password="guest"/>
         <home src="file://users/robinwyles/work/james-data/james- 
library/repos"/>
         <configuration src="resource://META-INF/cocoon/jackrabbit/ 
repository.xml"/>
         <workspace name="james-library"/>
         <nodetypes src="resource://META-INF/cocoon/jackrabbit/ 
nodetypes.cnd"/>
     </jcr-repository>
</components>

.. The included jcr.roles looks like this...

<role-list>
   <role name="javax.jcr.Repository"
         shorthand="jcr-repository"/>
</role-list>


>
>> 2. How best to obtain the WebApplicationContext from within a java  
>> class?
>
> Is this class a Spring bean itself?

It might be, or it might not be :) This was a more general question  
really... Most likely I guess it will be a Spring bean.

Thanks as always!

Robin



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


Mime
View raw message