You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/09/22 03:11:17 UTC

svn commit: rev 47010 - cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables

Author: vgritsenko
Date: Tue Sep 21 18:11:17 2004
New Revision: 47010

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolverFactory.java
Log:
backport (partially) from 2.2


Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolverFactory.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolverFactory.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolverFactory.java	Tue Sep 21 18:11:17 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,18 +16,21 @@
 package org.apache.cocoon.components.treeprocessor.variables;
 
 import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.WrapperComponentManager;
+import org.apache.avalon.framework.service.ServiceManager;
+
 import org.apache.cocoon.sitemap.PatternException;
 
 import java.util.List;
 
 /**
  *
- * @version CVS $Id: VariableResolverFactory.java,v 1.4 2004/03/05 13:02:53 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class VariableResolverFactory {
-    
+
     private static ThreadLocal disposableCollector = new ThreadLocal();
-    
+
     /**
      * Set the thread-local list where all created resolvers that need to be
      * disposed will be collected.
@@ -69,7 +72,7 @@
         // Nothing found...
         return false;
     }
-    
+
     /**
      * Unescape an expression that doesn't need to be resolved, but may contain
      * escaped '{' characters.
@@ -98,19 +101,25 @@
      * Get a resolver for a given expression. Chooses the most efficient implementation
      * depending on <code>expression</code>.
      */
+    public static VariableResolver getResolver(String expression, ServiceManager manager) throws PatternException {
+        return getResolver(expression, new WrapperComponentManager(manager));
+    }
+
+    /**
+     * Get a resolver for a given expression. Chooses the most efficient implementation
+     * depending on <code>expression</code>.
+     */
     public static VariableResolver getResolver(String expression, ComponentManager manager) throws PatternException {
         if (needsResolve(expression)) {
             VariableResolver resolver = new PreparedVariableResolver(expression, manager);
             List collector = (List)disposableCollector.get();
             if (collector != null)
                 collector.add(resolver);
-            
+
             return resolver;
-            
+
         } else {
             return new NOPVariableResolver(expression);
         }
     }
 }
-
-