cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <>
Subject SourceResolving in non-sitemap components
Date Wed, 12 Jun 2002 12:58:20 GMT
I'm trying to get my head round SourceResolving and would be grateful 
for clarification.

There appear to be at a number of SourceResolver classes:

> 	org.apache.excalibur.source.SourceResolver
>  	org.apache.avalon.excalibur.source.SourceResolver
>  	org.apache.cocoon.environment.SourceResolver

I want to use a SourceResolver in one Component but in two different 
kinds of context.

In the first case, I would like to use a SourceResolver during 
Configuration to obtain a ModifiableSource relative to the root context, 
and then refer to it from time to time.  I think that I need something 
like this...

>        this.resolver = (SourceResolver) 
> this.manager.lookup(SourceResolver.ROLE);
> 		Source source = this.resolver.resolveURI("context://path/to/file");
> 		// Do something with source
> 		// After a while... (when source may have changed)
> 		if (source instanceof ModifiableSource) {
> 			( (ModifiableSource) source).refresh()
> 			}
> 		// Do something else with source
> 		// Finally (not sure if this is required)
> 		this.resolver.release(source);

In the second case I would like to be able to use a SourceResolver to 
obtain a Source relative to current context when this component is 
called from within another sitemap component.  In these cases a 
SourceResolver is already passed to the Action or Generator, so I can 
pass this on to my component for use.


            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
Stuart Roebuck                        
Systems Architect                             Java, XML, MacOS X, XP, 
ADOLOS                                           <>

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

View raw message