You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2008/08/20 13:13:30 UTC

How to get an org.apache.cocoon.environment.SourceResolver?

Hi all,

in forrest we are in the middle of updating our version of cocoon. In
the middle of this process I ran into following problem:

https://svn.apache.org/repos/asf/forrest/branches/update_cocoon_2.1.12-dev/main/java/org/apache/forrest/locationmap/lm/ActNode.java

in the locate method we had till now:
this.resolver = (SourceResolver)m_manager.lookup(SourceResolver.ROLE);
which will resolve the SourceResolver BUT from type of
org.apache.excalibur.source.SourceResolver and not
org.apache.cocoon.environment.SourceResolver which later on need when I
invoke an action (line 145):
Map substitutions = m_action.act(redirector, resolver, objectModel,
m_src, parameters);

With our former version (very old version of 2.2 - before maven) this
did not produced an error, now however it throws a ClassCastException:
ERROR (2008-08-20) 11:12.00:245 [core.modules.mapper.lm] (/index.html)
PoolThread-4/MountNode: Failure processing LocationMap. 
java.lang.ClassCastException:
org.apache.cocoon.components.CocoonComponentManager 
at org.apache.forrest.locationmap.lm.ActNode.locate(ActNode.java:140)

I was scanning the source of 2.1 but could not find an example for a
cast or a way to resolve an
org.apache.cocoon.environment.SourceResolver.

Does somebody has an idea?

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: How to get an org.apache.cocoon.environment.SourceResolver?

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-08-20 at 13:13 +0200, Thorsten Scherler wrote:
> Hi all,
> 
> in forrest we are in the middle of updating our version of cocoon. In
> the middle of this process I ran into following problem:
> 
> https://svn.apache.org/repos/asf/forrest/branches/update_cocoon_2.1.12-dev/main/java/org/apache/forrest/locationmap/lm/ActNode.java
> 
> in the locate method we had till now:
> this.resolver = (SourceResolver)m_manager.lookup(SourceResolver.ROLE);
> which will resolve the SourceResolver BUT from type of
> org.apache.excalibur.source.SourceResolver and not
> org.apache.cocoon.environment.SourceResolver which later on need when I
> invoke an action (line 145):
> Map substitutions = m_action.act(redirector, resolver, objectModel,
> m_src, parameters);
> 
> With our former version (very old version of 2.2 - before maven) this
> did not produced an error, now however it throws a ClassCastException:
> ERROR (2008-08-20) 11:12.00:245 [core.modules.mapper.lm] (/index.html)
> PoolThread-4/MountNode: Failure processing LocationMap. 
> java.lang.ClassCastException:
> org.apache.cocoon.components.CocoonComponentManager 
> at org.apache.forrest.locationmap.lm.ActNode.locate(ActNode.java:140)
> 
> I was scanning the source of 2.1 but could not find an example for a
> cast or a way to resolve an
> org.apache.cocoon.environment.SourceResolver.
> 
> Does somebody has an idea?

this.resolver =
(SourceResolver)CocoonComponentManager.getCurrentEnvironment();

> 
> salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions