You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/02/14 08:38:07 UTC

svn commit: r507427 - in /cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components: DefaultAuthenticationManager.java DefaultHandlerManager.java

Author: cziegeler
Date: Tue Feb 13 23:38:06 2007
New Revision: 507427

URL: http://svn.apache.org/viewvc?view=rev&rev=507427
Log:
Lazy initialization. Possible fix for #COCOON-1987

Modified:
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultHandlerManager.java

Modified: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java?view=diff&rev=507427&r1=507426&r2=507427
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java (original)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultAuthenticationManager.java Tue Feb 13 23:38:06 2007
@@ -101,12 +101,15 @@
     /** The map containing the handler configurations for this sitemap. */
     protected Map handlerConfigs;
 
+    /** The handler configuration. */
+    protected Configuration configuration;
+
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
     public void configure(Configuration config) throws ConfigurationException {
         Deprecation.logger.warn("The authentication-fw block is deprecated. Please use the auth block instead.");
-        this.handlerConfigs = DefaultHandlerManager.prepareHandlerConfiguration(ContextHelper.getObjectModel(this.context), config);
+        this.configuration = config;
     }
 
     /**
@@ -115,6 +118,14 @@
     private Map getHandlerConfigurations()
     throws ProcessingException {
         // TODO - we have to find a way to get the parent handlers!
+        // we have to do a lazy initialization as we need an object model (request)
+        if ( this.handlerConfigs == null ) {
+            synchronized ( this ) {
+                if ( this.handlerConfigs == null ) {
+                    this.handlerConfigs = DefaultHandlerManager.prepareHandlerConfiguration(ContextHelper.getObjectModel(this.context), this.configuration);
+                }                
+            }
+        }
         return this.handlerConfigs;
     }
 

Modified: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultHandlerManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultHandlerManager.java?view=diff&rev=507427&r1=507426&r2=507427
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultHandlerManager.java (original)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/java/org/apache/cocoon/webapps/authentication/components/DefaultHandlerManager.java Tue Feb 13 23:38:06 2007
@@ -40,8 +40,12 @@
      */
     static public Map prepareHandlerConfiguration(Map           objectModel,
                                                   Configuration configs)
-    throws ConfigurationException {
-        return prepare( objectModel, configs );
+    throws ProcessingException {
+        try {
+            return prepare( objectModel, configs );
+        } catch (ConfigurationException ce) {
+            throw new ProcessingException("Exception during handler configuration.", ce);
+        }
     }
     /**
      * Prepare the handler configuration