cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r615993 - in /cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables: PreparedVariableResolver.java VariableExpressionTokenizer.java
Date Mon, 28 Jan 2008 18:52:35 GMT
Author: gkossakowski
Date: Mon Jan 28 10:52:33 2008
New Revision: 615993

URL: http://svn.apache.org/viewvc?rev=615993&view=rev
Log:
Remove integration with new expressions in PreparedVariableResolver.
This class is going to be removed in the future and new expressions will be used directly.

Modified:
    cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
    cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/VariableExpressionTokenizer.java

Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java?rev=615993&r1=615992&r2=615993&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
(original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
Mon Jan 28 10:52:33 2008
@@ -29,10 +29,6 @@
 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.el.Expression;
-import org.apache.cocoon.el.ExpressionException;
-import org.apache.cocoon.el.ExpressionFactory;
-import org.apache.cocoon.el.objectmodel.ObjectModel;
 import org.apache.cocoon.sitemap.PatternException;
 
 /**
@@ -100,9 +96,6 @@
                     case VariableExpressionTokenizer.TokenReciever.TEXT:
                         tokens.add(new Token(value));
                         break;
-                    case VariableExpressionTokenizer.TokenReciever.NEW_EXPRESSION:
-                        tokens.add(new Token(NEW_EXPRESSION, value));
-                        break;
                     case VariableExpressionTokenizer.TokenReciever.MODULE:
                         Token token;
                         if (value.equals("sitemap")) {
@@ -208,23 +201,6 @@
                         Token module = (Token)stack.pop();
                         stack.pop(); // Pop the OPEN
                         result = processModule(module, expr, objectModel, context, mapStack,
stackSize);
-                    } else if (lastButOne.hasType(VariableExpressionTokenizer.TokenReciever.NEW_EXPRESSION))
{
-                        stack.pop(); // Pop the OPEN
-                        ExpressionFactory expressionFactory = null;
-                        ObjectModel newObjectModel = null;
-                        try {
-                            expressionFactory = (ExpressionFactory)manager.lookup(ExpressionFactory.ROLE);
-                            newObjectModel = (ObjectModel)manager.lookup(ObjectModel.ROLE);
-                            result = processNewExpression(lastButOne, expressionFactory,
newObjectModel);
-                        } catch (ServiceException e) {
-                            throw new PatternException("Cannot obtain necessary components
to evaluate new expression '"
-                                    + lastButOne.getStringValue() + "' in expression '" +
this.originalExpr + "'", e);
-                        } finally {
-                            if (expressionFactory != null)
-                                manager.release(expressionFactory);
-                            if (newObjectModel != null)
-                                manager.release(newObjectModel);
-                        }
                     } else {
                         result = processVariable(expr, mapStack, stackSize);
                     }
@@ -338,18 +314,6 @@
 
         Object result = ((Map)mapStack.get(stackSize - type)).get(value);
         return new Token(EXPR, result==null ? "" : result.toString());
-    }
-    
-    private Token processNewExpression(Token expr, ExpressionFactory expressionFactory, ObjectModel
newObjectModel) throws PatternException {
-        Object result;
-        try {
-            Expression newExpression = expressionFactory.getExpression(expr.getStringValue());
-            result = newExpression.evaluate(newObjectModel);
-        } catch (ExpressionException e) {
-            throw new PatternException("Cannot evaluate new expression '" + expr.getStringValue()
+ "' in expression "
-                                       + "'" + this.originalExpr + "'", e);
-        }
-        return new Token(EXPR, result == null ? "" : result.toString());
     }
 
     /**

Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/VariableExpressionTokenizer.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/VariableExpressionTokenizer.java?rev=615993&r1=615992&r2=615993&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/VariableExpressionTokenizer.java
(original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/variables/VariableExpressionTokenizer.java
Mon Jan 28 10:52:33 2008
@@ -37,7 +37,6 @@
         int TEXT = -5;
         int MODULE = -6;
         int VARIABLE = -8;
-        int NEW_EXPRESSION = -12;
 
         /**
          * Reports parsed tokens.
@@ -74,26 +73,6 @@
                     escape = true;
                     i--;
                 }
-            } else if (c == '$') {
-                if (expression.charAt(i+1) != '{')
-                    //it's not an expression like ${cocoon.request}, skipping
-                    continue;
-                
-                if (i > pos) {
-                    reciever.addToken(lastTokenType = TokenReciever.TEXT, expression.substring(pos,
i));
-                }
-                
-                i++;
-                openCount++;
-                reciever.addToken(lastTokenType = TokenReciever.OPEN, null);
-                
-                int closePos = indexOf(expression, '}', i);
-
-                //expression conforming cocoon-expression-language
-                String newExpression = expression.substring(i+1, closePos);
-                reciever.addToken(lastTokenType = TokenReciever.NEW_EXPRESSION, newExpression);
-                i = closePos - 1;
-                
             } else if (c == '{') {
                 if (i > pos) {
                     reciever.addToken(lastTokenType = TokenReciever.TEXT, expression.substring(pos,
i));



Mime
View raw message