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:22:53 UTC
svn commit: rev 47013 - cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables
Author: vgritsenko
Date: Tue Sep 21 18:22:52 2004
New Revision: 47013
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolverFactory.java
Log:
sync ServiceManager changes with 2.2
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java Tue Sep 21 18:22:52 2004
@@ -20,7 +20,11 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.WrapperServiceManager;
import org.apache.avalon.framework.thread.ThreadSafe;
+
import org.apache.cocoon.components.modules.input.InputModule;
import org.apache.cocoon.components.treeprocessor.InvokeContext;
import org.apache.cocoon.sitemap.PatternException;
@@ -39,7 +43,7 @@
*/
final public class PreparedVariableResolver extends VariableResolver implements Disposable {
- private ComponentManager manager;
+ private ServiceManager manager;
private ComponentSelector selector;
private List tokens;
private boolean needsMapStack;
@@ -60,7 +64,14 @@
private static Token CLOSE_TOKEN = new Token(CLOSE);
private static Token EMPTY_TOKEN = new Token(EXPR);
+ /**
+ * @deprecated use the version with <code>ServiceManager</service>
+ */
public PreparedVariableResolver(String expr, ComponentManager manager) throws PatternException {
+ this(expr, new WrapperServiceManager(manager));
+ }
+
+ public PreparedVariableResolver(String expr, ServiceManager manager) throws PatternException {
super(expr);
this.manager = manager;
@@ -194,8 +205,8 @@
if (this.selector == null) {
try {
// First access to a module : lookup selector
- this.selector = (ComponentSelector)this.manager.lookup(InputModule.ROLE + "Selector");
- } catch(ComponentException ce) {
+ this.selector = (ComponentSelector) this.manager.lookup(InputModule.ROLE + "Selector");
+ } catch(ServiceException ce) {
throw new PatternException("Cannot access input modules selector", ce);
}
}
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:22:52 2004
@@ -16,8 +16,8 @@
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.avalon.framework.service.WrapperServiceManager;
import org.apache.cocoon.sitemap.PatternException;
@@ -104,6 +104,14 @@
* @deprecated use the version with <code>ServiceManager</service>
*/
public static VariableResolver getResolver(String expression, ComponentManager manager) throws PatternException {
+ return getResolver(expression, new WrapperServiceManager(manager));
+ }
+
+ /**
+ * 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 {
if (needsResolve(expression)) {
VariableResolver resolver = new PreparedVariableResolver(expression, manager);
List collector = (List)disposableCollector.get();
@@ -115,14 +123,5 @@
} else {
return new NOPVariableResolver(expression);
}
- }
-
-
- /**
- * 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));
}
}