Hi Leo,

        Thanks very much for your input. Much appreciated. :-)

On Thu, Nov 01, 2001 at 06:11:58PM +0100, Leo Sutic wrote:
> Marcus,
> 
> the ParentCM was intended to be used with JNDI. The rationale is as follows:
> Component settings for the individual servlet is specified in cocoon.xconf.
> Therefore, the per-servlet settings are already addressed and there is no
> need for a ParentCM. However, in order to configure multiple servlets you
> need to break out of the webapp context, and then JNDI is the only safe and
> standard way. (There is, of course, more to the security aspects, but I
> won't pretend to know it. The above was the reasons I implemented it as I
> did.)

        *nod*. I understand your rationale.

        I had intended to use the parent CM concept to create a second CM that
        would manage my application's components, separately from cocoon's CM.

        I had thought that using cocoon's CM to manage my application's
        components was the wrong thing to do, because it required modifying the
        cocoon.xconf and cocoon.roles files - part of cocoon and not our
        application. Was this assumption false ?

> That said, the string being passed *is* a general string argument. You can
> use it as you see fit. As for the resolving of paths relative to the webapp
> context, currently Cocoon will only honor Loggable and Initializable
> contracts, but this is not an obstacle - it would be relatively simple to
> make it honor another contract as well, maybe Contextualizable (?), and pass
> the servlet context.

        Ok. Thanks for the tip mate - How does this patch look ? :-)

        Cheers,

        Marcus

Index: src/org/apache/cocoon/servlet/CocoonServlet.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.13.2.28
diff -u -r1.13.2.28 CocoonServlet.java
--- src/org/apache/cocoon/servlet/CocoonServlet.java    2001/10/11 09:11:02     
1.13.2.28
+++ src/org/apache/cocoon/servlet/CocoonServlet.java    2001/11/02 15:45:40
@@ -14,6 +14,7 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.Loggable;
 import org.apache.cocoon.*;
 import org.apache.cocoon.components.classloader.RepositoryClassLoader;
@@ -731,12 +732,17 @@
                     parentComponentManagerClass = 
parentComponentManagerClass.substring (0, dividerPos);
                 }
 
+                log.debug("Creating parent component manager.");
+
                 Class pcm = ClassUtils.loadClass(parentComponentManagerClass);
                 Constructor pcmc = pcm.getConstructor(new Class[]{String.class});
                 parentComponentManager = (ComponentManager) pcmc.newInstance(new 
Object[]{initParam});
 
                 if (parentComponentManager instanceof Loggable) {
                     ((Loggable) parentComponentManager).setLogger(log);
+                }
+                if (parentComponentManager instanceof Contextualizable) {
+                    ((Contextualizable) 
+parentComponentManager).contextualize(this.appContext);
                 }
                 if (parentComponentManager instanceof Initializable) {
                     ((Initializable) parentComponentManager).initialize();

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Managesoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : [EMAIL PROTECTED]
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to