You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robin Rigby <ro...@gondolier.org.uk> on 2008/08/06 02:30:20 UTC

DAOSecurityHandler

Where do I find docs and / or samples for DAOSecurityHandler and UserDAO,
please?
 
I am looking for the Java equivalent of the JavaScript
 
var parser =
cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
 
and the same for SourceResolver.
 
Sitemap components seem to get them from an Avalon ServiceManager and I
found a thread 
suggesting to copy from ContainerTestCase.  Is there not a simpler way?
 
Many thanks
 
Robin

Re: DAOSecurityHandler

Posted by Joerg Heinicke <jo...@gmx.de>.
On 06.08.2008 02:30, Robin Rigby wrote:

> I am looking for the Java equivalent of the JavaScript
>  
> var parser =
> cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
>  
> and the same for SourceResolver.
>  
> Sitemap components seem to get them from an Avalon ServiceManager and I
> found a thread 
> suggesting to copy from ContainerTestCase.  Is there not a simpler way?

Hi Robin,

you need indeed a ServiceManager to retrieve the components as follows:

DOMParser domParser;
try {
   domParser = serviceManager.lookup(DOMParser.Role);
   // do something with the DOMParser
} catch (ServiceException e) {
   ...
} finally {
   serviceManager.release(domParser);
}

It depends on your use case if you can release the DOMParser instance 
immediately in the finally block or want to keep it and release it for 
example in a recycle method.

And: The Java code needs access to a Service Manager what means more or 
less that it has to be a Avalon component itself.

Joerg


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