Author: hadrian
Date: Sun Nov 29 18:21:48 2009
New Revision: 885253

URL: http://svn.apache.org/viewvc?rev=885253&view=rev
Log:
Added javax.el.varArgs and javax.el.nullProperties to juel

Modified:
    
camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java
    camel/trunk/components/camel-juel/src/main/resources/el.properties

Modified: 
camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java?rev=885253&r1=885252&r2=885253&view=diff
==============================================================================
--- 
camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java
 (original)
+++ 
camel/trunk/components/camel-juel/src/main/java/org/apache/camel/language/juel/JuelExpression.java
 Sun Nov 29 18:21:48 2009
@@ -52,7 +52,6 @@
     private final String expression;
     private final Class<?> type;
     private ExpressionFactory expressionFactory;
-    private Properties expressionFactoryProperties;
 
     public JuelExpression(String expression, Class<?> type) {
         this.expression = expression;
@@ -66,8 +65,11 @@
     public <T> T evaluate(Exchange exchange, Class<T> tClass) {
         // TODO we could use caching here but then we'd have possible 
concurrency issues
         // so lets assume that the provider caches
+        
+        // Create (if needed) the ExpressionFactory first from the 
CamelContext using FactoryFinder
+        ExpressionFactory factory = 
getExpressionFactory(exchange.getContext());
         ELContext context = populateContext(createContext(), exchange);
-        ValueExpression valueExpression = 
getExpressionFactory(exchange.getContext()).createValueExpression(context, 
expression, type);
+        ValueExpression valueExpression = 
factory.createValueExpression(context, expression, type);
         Object value = valueExpression.getValue(context);
         return exchange.getContext().getTypeConverter().convertTo(tClass, 
value);
     }
@@ -95,8 +97,7 @@
 
     public ExpressionFactory getExpressionFactory() {
         if (expressionFactory == null) {
-            Properties properties = getExpressionFactoryProperties();
-            expressionFactory = new ExpressionFactoryImpl(properties);
+            expressionFactory = new ExpressionFactoryImpl();
         }
         return expressionFactory;
     }
@@ -105,18 +106,6 @@
         this.expressionFactory = expressionFactory;
     }
 
-    public Properties getExpressionFactoryProperties() {
-        if (expressionFactoryProperties == null) {
-            expressionFactoryProperties = new Properties();
-            populateDefaultExpressionProperties(expressionFactoryProperties);
-        }
-        return expressionFactoryProperties;
-    }
-
-    public void setExpressionFactoryProperties(Properties 
expressionFactoryProperties) {
-        this.expressionFactoryProperties = expressionFactoryProperties;
-    }
-
     protected ELContext populateContext(ELContext context, Exchange exchange) {
         setVariable(context, "exchange", exchange, Exchange.class);
         setVariable(context, "in", exchange.getIn(), Message.class);
@@ -126,14 +115,6 @@
         return context;
     }
 
-    /**
-     * A Strategy Method to populate the default properties used to create the 
expression factory
-     */
-    protected void populateDefaultExpressionProperties(Properties properties) {
-        // lets enable method invocations
-        properties.setProperty("javax.el.methodInvocations", "true");
-    }
-
     protected void setVariable(ELContext context, String name, Object value, 
Class<?> type) {
         ValueExpression valueExpression = 
getExpressionFactory().createValueExpression(value, type);
         SimpleContext simpleContext = (SimpleContext) context;

Modified: camel/trunk/components/camel-juel/src/main/resources/el.properties
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-juel/src/main/resources/el.properties?rev=885253&r1=885252&r2=885253&view=diff
==============================================================================
--- camel/trunk/components/camel-juel/src/main/resources/el.properties 
(original)
+++ camel/trunk/components/camel-juel/src/main/resources/el.properties Sun Nov 
29 18:21:48 2009
@@ -16,4 +16,6 @@
 #
 
 javax.el.methodInvocations=true
+javax.el.varArgs=true
+javax.el.nullProperties=true
 


Reply via email to