geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1028155 - in /geronimo/tck/branches/3.0/geronimo-porting: pom.xml src/main/java/org/apache/geronimo/test/tck/ELImpl.java
Date Thu, 28 Oct 2010 00:57:36 GMT
Author: djencks
Date: Thu Oct 28 00:57:36 2010
New Revision: 1028155

URL: http://svn.apache.org/viewvc?rev=1028155&view=rev
Log:
Copy openwebbean's ELImpl

Modified:
    geronimo/tck/branches/3.0/geronimo-porting/pom.xml
    geronimo/tck/branches/3.0/geronimo-porting/src/main/java/org/apache/geronimo/test/tck/ELImpl.java

Modified: geronimo/tck/branches/3.0/geronimo-porting/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/tck/branches/3.0/geronimo-porting/pom.xml?rev=1028155&r1=1028154&r2=1028155&view=diff
==============================================================================
--- geronimo/tck/branches/3.0/geronimo-porting/pom.xml (original)
+++ geronimo/tck/branches/3.0/geronimo-porting/pom.xml Thu Oct 28 00:57:36 2010
@@ -63,6 +63,11 @@
             <groupId>org.apache.openwebbeans</groupId>
             <artifactId>openwebbeans-impl</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.ext.tomcat</groupId>
+            <artifactId>jasper-el</artifactId>
+            <version>7.0.0.2-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
 </project>

Modified: geronimo/tck/branches/3.0/geronimo-porting/src/main/java/org/apache/geronimo/test/tck/ELImpl.java
URL: http://svn.apache.org/viewvc/geronimo/tck/branches/3.0/geronimo-porting/src/main/java/org/apache/geronimo/test/tck/ELImpl.java?rev=1028155&r1=1028154&r2=1028155&view=diff
==============================================================================
--- geronimo/tck/branches/3.0/geronimo-porting/src/main/java/org/apache/geronimo/test/tck/ELImpl.java
(original)
+++ geronimo/tck/branches/3.0/geronimo-porting/src/main/java/org/apache/geronimo/test/tck/ELImpl.java
Thu Oct 28 00:57:36 2010
@@ -18,25 +18,98 @@
  */
 package org.apache.geronimo.test.tck;
 
+import javax.el.ArrayELResolver;
+import javax.el.BeanELResolver;
+import javax.el.CompositeELResolver;
 import javax.el.ELContext;
-
+import javax.el.ELContextEvent;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+import javax.el.VariableMapper;
+
+import org.apache.el.ExpressionFactoryImpl;
+import org.apache.el.lang.FunctionMapperImpl;
+import org.apache.el.lang.VariableMapperImpl;
+import org.apache.webbeans.el.WebBeansELResolver;
+import org.apache.webbeans.el.WrappedExpressionFactory;
 import org.jboss.jsr299.tck.spi.EL;
 
+/**
+ * this is a copy of openwebbean's ELImpl from webbeans-porting
+ */
 public class ELImpl implements EL {
 
-    public ELContext createELContext() {
-        System.out.println("createELContext");
-        return null;
+    private static final ExpressionFactory EXPRESSION_FACTORY = new WrappedExpressionFactory(new
ExpressionFactoryImpl());
+
+    public ELImpl()
+    {
+    }
+
+    public static ELResolver getELResolver()
+    {
+        CompositeELResolver composite = new CompositeELResolver();
+        composite.add(new BeanELResolver());
+        composite.add(new ArrayELResolver());
+        composite.add(new MapELResolver());
+        composite.add(new ListELResolver());
+        composite.add(new ResourceBundleELResolver());
+        composite.add(new WebBeansELResolver());
+
+        return composite;
     }
 
-    public <T> T evaluateMethodExpression(String arg0, Class<T> arg1, Class<?>[]
arg2, Object[] arg3) {
-        System.out.println("evaluateMethodExpression");
-        return null;
+    public static class ELContextImpl extends ELContext
+    {
+
+        @Override
+        public ELResolver getELResolver()
+        {
+            return ELImpl.getELResolver();
+        }
+
+        @Override
+        public FunctionMapper getFunctionMapper()
+        {
+            return new FunctionMapperImpl();
+        }
+
+        @Override
+        public VariableMapper getVariableMapper()
+        {
+            return new VariableMapperImpl();
+        }
+
     }
 
-    public <T> T evaluateValueExpression(String arg0, Class<T> arg1) {
-        System.out.println("evaluateValueExpression");
-        return null;
+    @SuppressWarnings("unchecked")
+    public <T> T evaluateMethodExpression(String expression, Class<T> expectedType,
Class<?>[] expectedParamTypes, Object[] expectedParams)
+    {
+        ELContext context = createELContext();
+        Object object = EXPRESSION_FACTORY.createMethodExpression(context, expression, expectedType,
expectedParamTypes).invoke(context, expectedParams);
+
+        return (T)object;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T evaluateValueExpression(String expression, Class<T> expectedType)
+    {
+        ELContext context = createELContext();
+        Object object = EXPRESSION_FACTORY.createValueExpression(context, expression, expectedType).getValue(context);
+
+        return (T)object;
+    }
+
+    @Override
+    public ELContext createELContext()
+    {
+        ELContext context = new ELContextImpl();
+        ELContextEvent event = new ELContextEvent(context);
+
+        return context;
     }
 
 }



Mime
View raw message