[seam-commits] Seam SVN: r7467 - in branches/Seam_1_2_1_AP/src: main/org/jboss/seam/jsf and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Feb 22 08:04:03 EST 2008


Author: manaRH
Date: 2008-02-22 08:04:03 -0500 (Fri, 22 Feb 2008)
New Revision: 7467

Added:
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/MethodExpressionHelper.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/OptionalParameterMethodExpression.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/ParamMethodExpression.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamExpressionFactory.java
Modified:
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/core/Expressions.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamApplication12.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamELFunctionMapper.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/EL.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELMethodBinding.java
   branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELValueBinding.java
   branches/Seam_1_2_1_AP/src/ui/org/jboss/seam/ui/facelet/SeamFaceletViewHandler.java
Log:
fix of JBAPP-631 issue, Pete rewrote the EL integration to mirror that used in Seam2 - which can be done now that we are targeting JSF2

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/core/Expressions.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/core/Expressions.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/core/Expressions.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -4,7 +4,6 @@
 import static org.jboss.seam.InterceptionType.NEVER;
 import static org.jboss.seam.annotations.Install.BUILT_IN;
 import static org.jboss.seam.util.EL.EL_CONTEXT;
-import static org.jboss.seam.util.EL.EXPRESSION_FACTORY;
 
 import java.io.Serializable;
 
@@ -20,6 +19,7 @@
 import org.jboss.seam.annotations.Intercept;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.jsf.SeamExpressionFactory;
 import org.jboss.seam.util.UnifiedELMethodBinding;
 
 /**
@@ -107,7 +107,7 @@
          {
             if (cachedValueExpression==null)
             {
-               cachedValueExpression = EXPRESSION_FACTORY.createValueExpression(EL_CONTEXT, expression, Object.class);
+               cachedValueExpression = SeamExpressionFactory.INSTANCE.createValueExpression(EL_CONTEXT, expression, Object.class);
             }
             return cachedValueExpression;
          }

Added: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/MethodExpressionHelper.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/MethodExpressionHelper.java	                        (rev 0)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/MethodExpressionHelper.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.jsf;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.ValueExpression;
+
+import org.jboss.seam.actionparam.MethodExpressionParser;
+
+/**
+ * This is a helper class for the ParamMethodExpression.
+ *
+ * @author Stan Silvert
+ */
+class MethodExpressionHelper implements Serializable 
+{
+    
+    private String expWithParams;
+    private boolean isStringLiteral = false;
+
+   private MethodExpressionParser parser;
+    
+    // The wrapped expression
+    private MethodExpression methodExp;
+    
+    // used for equals and hashCode
+    private boolean expressionInitializedInCtor = false;
+    private String hashString;
+    
+    
+    MethodExpressionHelper(ELContext elContext, 
+                           MethodExpressionParser parser) 
+    {
+        this.expWithParams = parser.getUnparsedExpression();
+        this.parser = parser;
+        
+        if ( MethodExpressionParser.isStringLiteral(expWithParams) ) 
+        {
+            setMethodExpression(elContext, new Class[0]);
+            this.isStringLiteral = true;
+            this.expressionInitializedInCtor = true;
+            return;
+        }
+        
+        // if there are no params, we can go ahead and create the expression
+        if ( parser.getParams().length == 0 ) 
+        {
+            setMethodExpression(elContext, new Class[0]);
+            this.expressionInitializedInCtor = true;
+        }
+    }
+    
+    boolean isLiteralText() 
+    {
+        return this.isStringLiteral;
+    }
+    
+    MethodInfo getMethodInfo(ELContext elContext) 
+    {
+        if (this.methodExp == null) 
+        {
+            return new PartialMethodInfo(parser.getMethodName());
+        }
+        
+        return this.methodExp.getMethodInfo(elContext);
+    }
+    
+    Object invokeTheExpression(ELContext elContext) 
+    {
+        if (this.methodExp == null) 
+        {
+            setMethodExpression(elContext, findParamTypes(elContext));
+        }
+        
+        Object[] evaluatedParams = evaluateParams(elContext);
+        return this.methodExp.invoke(elContext, evaluatedParams);
+    }
+    
+    MethodExpression getExpression() 
+    {
+        return this.methodExp;
+    }
+    
+    // evaluate each param as a value expression and return the array of results
+    private Object[] evaluateParams(ELContext elContext) 
+    {
+        String[] params = parser.getParams();
+        
+        Object[] results = new Object[params.length];
+        
+        for (int i=0; i < results.length; i++) 
+        {
+            String param = params[i].trim();
+            
+            if ( MethodExpressionParser.isQuotedString(param) ) 
+            {
+                // strip quotes
+                results[i] = param.substring(1, param.length() - 1);
+                continue;
+            }
+            
+            ValueExpression ve = SeamExpressionFactory.INSTANCE
+                                         .createValueExpression(elContext, "#{" + param + "}", Object.class);
+            results[i] = ve.getValue(elContext);
+        }
+        
+        return results;
+    }
+    
+    // finds a public method that matches the method
+    // name and number of params
+    private Class[] findParamTypes(ELContext elContext) 
+    {
+        if (parser.getParams().length == 0) return new Class[0];
+        
+        String expression = "#{" + parser.getBaseExpression() + "}";
+        ValueExpression ve = SeamExpressionFactory.INSTANCE.
+                                     createValueExpression(elContext, expression, Object.class);
+        Object obj = ve.getValue(elContext);
+        Method[] publicMethods = obj.getClass().getMethods();
+        
+        Method methodMatch = null;
+        
+        for (int i=0; i < publicMethods.length; i++) 
+        {
+            if (methodMatches(publicMethods[i])) 
+            {
+                if (methodMatch != null) 
+                {
+                    throw new ELException("More than one method matched " + 
+                            this.expWithParams + ". Method name or number of params must be unique.");
+                }
+                
+                methodMatch = publicMethods[i];
+            }
+        }
+        
+        if (methodMatch == null) 
+        {
+            throw new ELException("No method found for expression " + 
+                                  this.expWithParams +
+                                  ".  Method name and number of params must match.");
+        }
+        
+        return methodMatch.getParameterTypes();
+    }
+    
+    // To match, method must return a String, match method name, and match 
+    // number of params
+    private boolean methodMatches(Method method) 
+    {
+        return method.getName().equals(parser.getMethodName()) && 
+              (method.getParameterTypes().length == parser.getParams().length);
+    }
+    
+    private void setMethodExpression(ELContext elContext, Class[] paramTypes) 
+    {
+        // note: returnType is always a String because this is an action method
+        this.methodExp = SeamExpressionFactory.INSTANCE.
+                                    createMethodExpression(elContext, 
+                                                           parser.getCombinedExpression(), 
+                                                           String.class, 
+                                                           paramTypes);
+    }
+    
+    private String getHashString() 
+    {
+        if (this.hashString == null) 
+        {
+            this.hashString = parser.getBaseExpression() + "." +
+                              parser.getMethodName() + "." +
+                              parser.getParams().length;
+        }
+        
+        return this.hashString;
+    }
+    
+    @Override
+    public boolean equals(Object object) 
+    {
+       if (this == object) return true;
+       
+       if (this.expressionInitializedInCtor) 
+       {
+           return this.methodExp.equals(object);
+       }
+       
+       if (!(object instanceof MethodExpressionHelper)) return false;
+       MethodExpressionHelper exp = (MethodExpressionHelper)object;
+              
+       return getHashString().equals(exp.getHashString());
+    }
+
+   @Override
+    public int hashCode() {
+        if (this.expressionInitializedInCtor) 
+        {
+            return this.methodExp.hashCode();
+        }
+        
+        return getHashString().hashCode();
+    }
+
+   /**
+     * Limited MethodInfo implementation that can be used when the param types are
+     * not yet known.
+     */
+    private static class PartialMethodInfo extends MethodInfo 
+    {
+        private PartialMethodInfo(String methodName) 
+        {
+            super(methodName, Object.class, new Class[0]);
+        }
+        
+        @Override
+        public Class<?>[] getParamTypes() 
+        {
+            throw new IllegalStateException("paramTypes unknown until MethodExpression is invoked.");
+        }
+    }
+}
+


Property changes on: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/MethodExpressionHelper.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/OptionalParameterMethodExpression.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/OptionalParameterMethodExpression.java	                        (rev 0)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/OptionalParameterMethodExpression.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -0,0 +1,75 @@
+/**
+ * 
+ */
+package org.jboss.seam.jsf;
+
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.MethodNotFoundException;
+
+public class OptionalParameterMethodExpression extends MethodExpression
+ {
+    
+    private MethodExpression withParam;
+    private MethodExpression withNoParam;
+    
+   public OptionalParameterMethodExpression(MethodExpression withParam, MethodExpression withNoParam)
+   {
+      this.withParam = withParam;
+      this.withNoParam = withNoParam;
+   }
+
+  @Override
+   public MethodInfo getMethodInfo(ELContext ctx)
+   {
+      return withParam.getMethodInfo(ctx);
+   }
+
+  @Override
+   public Object invoke(ELContext ctx, Object[] args)
+   {
+      try
+      {
+         return withParam.invoke(ctx, args);
+      }
+      catch (MethodNotFoundException mnfe)
+      {
+         try
+         {
+            return withNoParam.invoke(ctx, new Object[0]);
+         }
+         catch (MethodNotFoundException mnfe2)
+         {
+            throw mnfe;
+         }
+      }
+   }
+
+  @Override
+   public String getExpressionString()
+   {
+      return withParam.getExpressionString();
+   }
+
+  @Override
+   public boolean isLiteralText()
+   {
+      return withParam.isLiteralText();
+   }
+
+  @Override
+   public boolean equals(Object object)
+   {
+      if ( !(object instanceof OptionalParameterMethodExpression) ) return false;
+      OptionalParameterMethodExpression other = (OptionalParameterMethodExpression) object;
+      return withParam.equals(other.withParam);
+   }
+
+  @Override
+   public int hashCode()
+   {
+      return withParam.hashCode();
+   }
+
+}
\ No newline at end of file


Property changes on: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/OptionalParameterMethodExpression.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/ParamMethodExpression.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/ParamMethodExpression.java	                        (rev 0)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/ParamMethodExpression.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.jsf;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.MethodNotFoundException;
+import javax.el.PropertyNotFoundException;
+
+import org.jboss.seam.actionparam.MethodExpressionParser;
+
+/**
+ * TODO: make this into a StateHolder?
+ *
+ * @author Stan Silvert
+ */
+public class ParamMethodExpression extends MethodExpression 
+{
+    
+    private MethodExpressionHelper helper;
+    private String expString;
+    
+    public ParamMethodExpression(MethodExpressionParser parser,
+                                 ELContext elContext) 
+    {
+        this.expString = parser.getUnparsedExpression();
+        this.helper = new MethodExpressionHelper(elContext, parser);
+    }
+    
+    @Override
+    public MethodInfo getMethodInfo(ELContext elContext) throws NullPointerException, PropertyNotFoundException, MethodNotFoundException, ELException 
+    {
+        return this.helper.getMethodInfo(elContext);
+    }
+
+   @Override
+    public Object invoke(ELContext elContext, Object[] params) throws NullPointerException, PropertyNotFoundException, MethodNotFoundException, ELException 
+    {
+        // note that the params are ignored - they were cached by the helper
+        return this.helper.invokeTheExpression(elContext);
+    }
+
+   @Override
+    public boolean isLiteralText() 
+    {
+        return this.helper.isLiteralText();
+    }
+
+   @Override
+    public String getExpressionString() 
+    {
+        return this.expString;
+    }
+
+   @Override
+    public boolean equals(Object object) 
+    {
+       if (this == object) return true;
+       if (!(object instanceof ParamMethodExpression)) return false;
+       ParamMethodExpression actionExpression = (ParamMethodExpression)object;
+       
+       return this.helper.equals(actionExpression.helper);
+    }
+
+   @Override
+    public int hashCode() 
+    {
+        return this.helper.hashCode();
+    }
+}


Property changes on: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/ParamMethodExpression.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamApplication12.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamApplication12.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamApplication12.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -73,14 +73,7 @@
    
    public ExpressionFactory getExpressionFactory() 
    {
-      try
-      {
-         return (ExpressionFactory) getExpressionFactoryMethod.invoke(application);
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
+      return SeamExpressionFactory.INSTANCE;
    }
    
    public Object evaluateExpressionGet(FacesContext context, String expression, 

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamELFunctionMapper.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamELFunctionMapper.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamELFunctionMapper.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -4,6 +4,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.el.FunctionMapper;
+
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.security.SecurityFunctions;
@@ -31,13 +33,28 @@
                new Class[] { String.class });      
    }
 
+   private FunctionMapper functionMapper;
+   
+   public SeamELFunctionMapper(FunctionMapper functionMapper)
+   {
+      this.functionMapper = functionMapper;
+   }
+
    @Override 
    public Method resolveFunction(String prefix, String localName) 
    {
       if (SEAM_EL_PREFIX.equals(prefix))
+      {
          return methodCache.get(localName);
+      }
+      else if (functionMapper != null)
+      {
+         return functionMapper.resolveFunction(prefix, localName);
+      }
       else
-         return super.resolveFunction(prefix, localName);
+      {
+         return null;
+      }
    }  
    
    private static void cacheMethod(String localName, Class cls, String name, Class[] params)

Added: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamExpressionFactory.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamExpressionFactory.java	                        (rev 0)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamExpressionFactory.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.jsf;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+import javax.faces.event.FacesEvent;
+
+import org.jboss.seam.actionparam.MethodExpressionParser;
+import org.jboss.seam.util.EL;
+
+/**
+ * This ExpressionFactory replaces the one normally used in Facelets.  It
+ * recognizes if an EL expression is using params.  If so, it will return a
+ * special implementation of MethodExpression or ValueExpression to handle it.
+ *
+ * @author Stan Silvert
+ */
+public class SeamExpressionFactory extends ExpressionFactory 
+{
+   
+    public static final ExpressionFactory INSTANCE = new SeamExpressionFactory(EL.EXPRESSION_FACTORY);
+   
+    private final ExpressionFactory expressionFactory;
+    
+    public SeamExpressionFactory(ExpressionFactory expressionFactory) 
+    {
+       this.expressionFactory = expressionFactory;
+    }
+    
+    public SeamExpressionFactory()
+    {
+       this.expressionFactory = EL.EXPRESSION_FACTORY;
+    }
+    
+    /**
+     * Wrap the base ELContext, adding Seam's FunctionMapper.
+     * 
+     * Thus, any expressions with s:hasRole, s:hasPermission 
+     * must be evaluated either via Facelets/JSP (since they
+     * are declared in the tld/taglib.xml or via the 
+     * Expressions component.
+     * 
+     * @param context the JSF ELContext
+     */
+    private static ELContext decorateELContext(final ELContext context)
+    {
+       return new ELContext()
+       {
+
+        @Override
+         public ELResolver getELResolver()
+         {
+            return context.getELResolver();
+         }
+
+        @Override
+         public FunctionMapper getFunctionMapper()
+         {
+            return new SeamELFunctionMapper(context.getFunctionMapper());
+         }
+
+        @Override
+         public VariableMapper getVariableMapper()
+         {
+            return context.getVariableMapper();
+         }
+          
+       };
+    }
+    
+    @Override
+    public Object coerceToType(Object obj, Class targetType) 
+    {
+        return expressionFactory.coerceToType(obj, targetType);
+    }
+
+   @Override
+    public MethodExpression createMethodExpression(ELContext elContext, 
+                                                   String expression, 
+                                                   Class returnType, 
+                                                   Class[] paramTypes) 
+    {
+        MethodExpressionParser parser = new MethodExpressionParser(expression);
+        if ( parser.isParamExpression() )
+        {
+            return new ParamMethodExpression(parser, elContext);
+        }
+        else if ( paramTypes.length==1 && FacesEvent.class.isAssignableFrom( paramTypes[0] ) )
+        {
+           //so that JSF action listeners don't have to declare 
+           //the totally frickin useless ActionEvent parameter
+           return new OptionalParameterMethodExpression(
+                 expressionFactory.createMethodExpression(decorateELContext(elContext), expression, returnType, paramTypes),
+                 expressionFactory.createMethodExpression(decorateELContext(elContext), expression, returnType, new Class[0])
+              );
+        }
+        else
+        {
+           return expressionFactory.createMethodExpression(decorateELContext(elContext), expression, returnType, paramTypes);
+        }
+    }
+    
+    @Override
+    public ValueExpression createValueExpression(Object instance, Class expectedType) 
+    {
+        return expressionFactory.createValueExpression(instance, expectedType);
+    }
+
+   @Override
+    public ValueExpression createValueExpression(ELContext elContext,
+                                                 String expression,
+                                                 Class expectedType) 
+    {   
+        return expressionFactory.createValueExpression(decorateELContext(elContext), expression, expectedType);
+    }
+
+}
+


Property changes on: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/jsf/SeamExpressionFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/EL.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/EL.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/EL.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -11,10 +11,10 @@
 import javax.el.ResourceBundleELResolver;
 import javax.el.VariableMapper;
 
-import org.jboss.seam.jsf.SeamELFunctionMapper;
 import org.jboss.seam.jsf.SeamELResolver;
 
 import com.sun.el.ExpressionFactoryImpl;
+import com.sun.el.lang.FunctionMapperImpl;
 import com.sun.el.lang.VariableMapperImpl;
 
 public class EL
@@ -40,6 +40,9 @@
       return new ELContext()
       {
 
+         private final VariableMapper variableMapper = new VariableMapperImpl();
+         private final FunctionMapper functionMapper = new FunctionMapperImpl();
+         
          @Override
          public ELResolver getELResolver()
          {
@@ -49,13 +52,13 @@
          @Override
          public FunctionMapper getFunctionMapper()
          {
-            return new SeamELFunctionMapper();
+            return functionMapper;
          }
 
          @Override
          public VariableMapper getVariableMapper()
          {
-            return new VariableMapperImpl();
+            return variableMapper;
          }
          
       };

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELMethodBinding.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELMethodBinding.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELMethodBinding.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -1,7 +1,6 @@
 package org.jboss.seam.util;
 
 import static org.jboss.seam.util.EL.EL_CONTEXT;
-import static org.jboss.seam.util.EL.EXPRESSION_FACTORY;
 
 import javax.el.MethodExpression;
 import javax.faces.context.FacesContext;
@@ -9,13 +8,15 @@
 import javax.faces.el.MethodBinding;
 import javax.faces.el.MethodNotFoundException;
 
+import org.jboss.seam.jsf.SeamExpressionFactory;
+
 public class UnifiedELMethodBinding extends MethodBinding
 {
    private MethodExpression me;
 
    public UnifiedELMethodBinding(String expression, Class[] args)
    {
-      me = EXPRESSION_FACTORY.createMethodExpression(EL_CONTEXT, expression, Object.class, args);
+      me = SeamExpressionFactory.INSTANCE.createMethodExpression(EL_CONTEXT, expression, Object.class, args);
    }
 
    @Override

Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELValueBinding.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELValueBinding.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/util/UnifiedELValueBinding.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -1,7 +1,6 @@
 package org.jboss.seam.util;
 
 import static org.jboss.seam.util.EL.EL_CONTEXT;
-import static org.jboss.seam.util.EL.EXPRESSION_FACTORY;
 
 import javax.el.ValueExpression;
 import javax.faces.context.FacesContext;
@@ -9,13 +8,15 @@
 import javax.faces.el.PropertyNotFoundException;
 import javax.faces.el.ValueBinding;
 
+import org.jboss.seam.jsf.SeamExpressionFactory;
+
 public class UnifiedELValueBinding extends ValueBinding
 {
    private ValueExpression ve;
 
    public UnifiedELValueBinding(String expression)
    {
-      ve = EXPRESSION_FACTORY.createValueExpression(EL_CONTEXT, expression, Object.class);
+      ve = SeamExpressionFactory.INSTANCE.createValueExpression(EL_CONTEXT, expression, Object.class);
    }
 
    @Override

Modified: branches/Seam_1_2_1_AP/src/ui/org/jboss/seam/ui/facelet/SeamFaceletViewHandler.java
===================================================================
--- branches/Seam_1_2_1_AP/src/ui/org/jboss/seam/ui/facelet/SeamFaceletViewHandler.java	2008-02-22 07:52:48 UTC (rev 7466)
+++ branches/Seam_1_2_1_AP/src/ui/org/jboss/seam/ui/facelet/SeamFaceletViewHandler.java	2008-02-22 13:04:03 UTC (rev 7467)
@@ -35,7 +35,7 @@
  */
 public class SeamFaceletViewHandler extends FaceletViewHandler 
 {
-    private static final String SEAM_EXPRESSION_FACTORY = "org.jboss.seam.ui.facelet.SeamExpressionFactory";
+    private static final String SEAM_EXPRESSION_FACTORY = "org.jboss.seam.jsf.SeamExpressionFactory";
     
     public SeamFaceletViewHandler(ViewHandler parent)
     {




More information about the seam-commits mailing list