cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Yates <ceya...@stanford.edu>
Subject Re: Using resolver inside a Selector
Date Fri, 02 May 2003 21:43:40 GMT
Hi,  This is what the CocoonComponentManager javadoc has to say:

/**
 * Cocoon Component Manager.
 * This manager extends the {@link ExcaliburComponentManager}
 * by a special lifecycle handling for a {@link RequestLifecycleComponent}
 * and by handling the lookup of the {@link SourceResolver}.
 * WARNING: This is a "private" Cocoon core class - do NOT use this class
 * directly - and do not assume that a {@link ComponentManager} you get
 * via the compose() method is an instance of CocoonComponentManager.


have your class implement Composable:

private ComponentManager myManager;


publc void compose(ComponentManager aManager) throws ComponentException {
    myManager = aManager;
}


then later you can get a SourceResolver from the manager. I see that 
ResourceExistsSelector implements ThreadSafe, so your Selector will too, 
so be careful with any member variables.

Charles

Bernhard Huber wrote:

> hi,
>
> i was trying to extend ResourceExistsSelector,
> extending the resource checking from resource existance
> in context of the webapp to resource checking using resolveURI().
>
> I have the impression that there are some hidden side-effects
> of using a SourceResolver inside a Selector.
>
> First a retrieve the CocoonComponentManager by
>
> CocoonComponentManager ccm = null;
> ccm = 
> (CocoonComponentManager)CocoonComponentManager.getSitemapComponentManager(); 
>
>
> Next i retrieve the Source via:
>
> Source src = ccm.resolveURI(expression);
>
> and try to open its stream:
>
> is = src.getInputStream();
>
> Finally in the final clause i close the InputStream, and
> release the source :
>
> is.close();
> ccm.release(src);
>
> My questions:
> 1.0 Is it allowed to access the CococoonComponentManager from
> inside a Selector?
> 1.1 Does the contract of a Selector allow to
> use the CocoonComponentManager.resolverURI()?
>
> 2. Is it allowed to use ComponentManager.resolveURI(), and
> just releasing the resolved Source via ComponentManager.release().
>
> 3. Are there any other side-effects of using the CocoonCompoentManager?
>
> any comments are welcome.
>
>
>



Mime
View raw message