You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by rw...@apache.org on 2011/08/23 08:37:47 UTC
svn commit: r1160559 - in /geronimo/server/trunk: framework/
framework/configs/client-system/
framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/
framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/
framework/configs/j2ee-sys...
Author: rwonly
Date: Tue Aug 23 06:37:46 2011
New Revision: 1160559
URL: http://svn.apache.org/viewvc?rev=1160559&view=rev
Log:
GERONIMO-6119 upgrade geronimo-system to use commons-jexl 2.0
Modified:
geronimo/server/trunk/framework/configs/client-system/pom.xml
geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/pom.xml
geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/pom.xml
geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/pom.xml
geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
geronimo/server/trunk/framework/configs/online-deployer/pom.xml
geronimo/server/trunk/framework/modules/geronimo-system/pom.xml
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlConditionParser.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java
geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/ParserUtils.java
geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/ServerOverrideTest.java
geronimo/server/trunk/framework/pom.xml
geronimo/server/trunk/plugins/tomcat/tomcat7/src/main/filtered-resources/tomcat-base/server.xml
Modified: geronimo/server/trunk/framework/configs/client-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/client-system/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/client-system/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/client-system/pom.xml Tue Aug 23 06:37:46 2011
@@ -65,8 +65,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it1/pom.xml Tue Aug 23 06:37:46 2011
@@ -87,8 +87,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/it/j2ee-system-it2/pom.xml Tue Aug 23 06:37:46 2011
@@ -93,8 +93,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/pom.xml Tue Aug 23 06:37:46 2011
@@ -94,8 +94,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/pom.xml Tue Aug 23 06:37:46 2011
@@ -77,8 +77,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties Tue Aug 23 06:37:46 2011
@@ -83,7 +83,7 @@ asm/asm-all/3.2/asm-all-3.2.jar=32
org/apache/servicemix/bundles/org.apache.servicemix.bundles.xstream/1.3_3/org.apache.servicemix.bundles.xstream-1.3_3.jar=40
org/apache/servicemix/bundles/org.apache.servicemix.bundles.xpp3/1.1.4c_3/org.apache.servicemix.bundles.xpp3-1.1.4c_3.jar=40
org/apache/servicemix/bundles/org.apache.servicemix.bundles.cglib/2.1_3_4/org.apache.servicemix.bundles.cglib-2.1_3_4.jar=40
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-jexl/1.1_3/org.apache.servicemix.bundles.commons-jexl-1.1_3.jar=40
+org/apache/commons/commons-jexl/2.0/commons-jexl-2.0.jar=40
commons-lang/commons-lang/2.6/commons-lang-2.6.jar=40
commons-cli/commons-cli/1.2/commons-cli-1.2.jar=40
org/apache/geronimo/bundles/sxc-jaxb/${sxcVersion}/sxc-jaxb-${sxcVersion}.jar=40
Modified: geronimo/server/trunk/framework/configs/online-deployer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/online-deployer/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/online-deployer/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/online-deployer/pom.xml Tue Aug 23 06:37:46 2011
@@ -67,8 +67,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/modules/geronimo-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/pom.xml Tue Aug 23 06:37:46 2011
@@ -85,8 +85,8 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Tue Aug 23 06:37:46 2011
@@ -86,7 +86,7 @@ public class LocalAttributeManager imple
private final ServerInfo serverInfo;
private final String configFile;
private final boolean readOnly;
- private final JexlExpressionParser expressionParser;
+ private JexlExpressionParser expressionParser;
private File attributeFile;
private File backupFile;
@@ -264,7 +264,7 @@ public class LocalAttributeManager imple
}
Map<String, Object> configSubstutions = loadAllConfigSubstitutions(localConfigSubstitutions, prefix);
storeConfigSubstitutions(configSubstitutionsFile, localConfigSubstitutions);
- expressionParser.setVariables(configSubstutions);
+ expressionParser = new JexlExpressionParser(configSubstutions);
}
public synchronized void setValue(Artifact configurationName, AbstractName gbeanName, GAttributeInfo attribute, Object value, Bundle bundle) {
Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlConditionParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlConditionParser.java?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlConditionParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlConditionParser.java Tue Aug 23 06:37:46 2011
@@ -18,13 +18,11 @@ package org.apache.geronimo.system.confi
import java.util.HashMap;
import java.util.Map;
-import java.util.Properties;
-import org.apache.commons.jexl.Expression;
-import org.apache.commons.jexl.ExpressionFactory;
-import org.apache.commons.jexl.JexlContext;
-import org.apache.commons.jexl.JexlHelper;
-import org.apache.commons.jexl.context.HashMapContext;
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.MapContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,18 +42,23 @@ public class JexlConditionParser
private static final Logger log = LoggerFactory.getLogger(JexlConditionParser.class);
private final Map<String, Object> vars;
+
+ private final JexlEngine engine;
- public JexlConditionParser(final Map vars) {
+ public JexlConditionParser(final Map<String, Object> vars) {
if (vars == null) {
throw new IllegalArgumentException("vars");
}
this.vars = vars;
+ engine = new JexlEngine();
}
public JexlConditionParser() {
// Setup the default vars
vars = new HashMap<String, Object>();
ParserUtils.addDefaultVariables(vars);
+
+ engine = new JexlEngine();
}
/**
@@ -99,10 +102,9 @@ public class JexlConditionParser
log.debug("Evaluating expression: {}", expression);
- Expression expr = ExpressionFactory.createExpression(expression);
+ Expression expr = engine.createExpression(expression);
- JexlContext ctx = JexlHelper.createContext();
- ctx.setVars(vars);
+ JexlContext ctx = new MapContext(vars);
Object result = expr.evaluate(ctx);
log.debug("Result: {}", result);
Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/JexlExpressionParser.java Tue Aug 23 06:37:46 2011
@@ -16,13 +16,14 @@
*/
package org.apache.geronimo.system.configuration.condition;
+import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
-import org.apache.commons.jexl.Expression;
-import org.apache.commons.jexl.ExpressionFactory;
-import org.apache.commons.jexl.JexlContext;
-import org.apache.commons.jexl.JexlHelper;
-import org.apache.commons.jexl.resolver.FlatResolver;
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.MapContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,75 +35,66 @@ import org.slf4j.LoggerFactory;
public class JexlExpressionParser
{
private static final Logger log = LoggerFactory.getLogger(JexlExpressionParser.class);
-
- protected JexlContext context;
-
- public JexlExpressionParser(final Map vars) {
+
+ private final JexlEngine engine;
+ private final JexlContext context;
+ private final Map<String, Object> variables;
+
+ public JexlExpressionParser(final Map<String, Object> vars) {
if (vars == null) {
throw new IllegalArgumentException("vars");
}
-
- context = JexlHelper.createContext();
- context.setVars(vars);
-
- log.trace("Using variables: {}", context.getVars());
+
+ engine = new JexlEngine();
+ context = new MapContext(vars);
+ variables = vars;
+
+ log.trace("Using variables: {}", vars);
}
public JexlExpressionParser() {
- this(System.getProperties());
+ Map<String, Object> sysVars = new HashMap<String, Object>();
+ for (Entry<Object,Object> entry : System.getProperties().entrySet()){
+ sysVars.put((String)entry.getKey(), entry.getValue());
+ }
+
+ engine = new JexlEngine();
+ context = new MapContext(sysVars);
+ variables = sysVars;
+
+ log.trace("Using variables: {}", sysVars);
}
- public Map getVariables() {
- return context.getVars();
- }
-
- public Object getVariable(final Object name) {
+ public boolean hasVariable(final String name) {
if (name == null) {
throw new IllegalArgumentException("name");
}
- return getVariables().get(name);
+ return context.has(name);
}
-
- public Object setVariable(final Object name, final Object value) {
+
+ public Object getVariable(final String name) {
if (name == null) {
throw new IllegalArgumentException("name");
}
- return getVariables().put(name, value);
+ return context.get(name);
}
- public Object unsetVariable(final Object name) {
+ public void setVariable(final String name, final Object value) {
if (name == null) {
throw new IllegalArgumentException("name");
}
- return getVariables().remove(name);
+ context.set(name, value);
}
-
- public void addVariables(final Map map) {
- if (map == null) {
- throw new IllegalArgumentException("map");
- }
-
- getVariables().putAll(map);
- }
-
- public void setVariables(final Map map) {
- if (map == null) {
- throw new IllegalArgumentException("map");
- }
- context.setVars(map);
+
+ public Map<String, Object> getVariables() {
+ return variables;
}
- private FlatResolver resolver = new FlatResolver(true);
-
protected Expression createExpression(final String expression) throws Exception {
- // assert expression != null;
-
- Expression expr = ExpressionFactory.createExpression(expression);
- expr.addPreResolver(resolver);
-
+ Expression expr = engine.createExpression(expression);
return expr;
}
@@ -112,7 +104,6 @@ public class JexlExpressionParser
}
log.trace("Evaluating expression: {}", expression);
-
Expression expr = createExpression(expression);
Object obj = expr.evaluate(context);
log.trace("Result: {}", obj);
Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/ParserUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/ParserUtils.java?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/ParserUtils.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/condition/ParserUtils.java Tue Aug 23 06:37:46 2011
@@ -19,7 +19,7 @@ package org.apache.geronimo.system.confi
import java.util.Map;
import java.util.Properties;
-import org.apache.commons.jexl.context.HashMapContext;
+import org.apache.commons.jexl2.MapContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
*/
public class ParserUtils
{
- public static void addDefaultVariables(Map vars) {
+ public static void addDefaultVariables(Map<String, Object> vars) {
vars.put("java", new JavaVariable());
vars.put("os", new OsVariable());
@@ -40,13 +40,13 @@ public class ParserUtils
vars.put("props", props);
}
- public static class DebugHashMapContext extends HashMapContext {
+ public static class DebugHashMapContext extends MapContext {
private static final Logger log = LoggerFactory.getLogger(DebugHashMapContext.class);
- public Object get(Object o) {
- Object r = super.get(o);
+ public Object get(String str) {
+ Object r = super.get(str);
- log.debug("Get property: {} {}", o, r);
+ log.debug("Get property: {} {}", str, r);
return r;
}
Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/ServerOverrideTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/ServerOverrideTest.java?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/ServerOverrideTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/test/java/org/apache/geronimo/system/configuration/ServerOverrideTest.java Tue Aug 23 06:37:46 2011
@@ -55,7 +55,7 @@ public class ServerOverrideTest extends
private Bundle bundle = new MockBundle(getClass().getClassLoader(), null, 0L);
protected void setUp() throws java.lang.Exception {
- HashMap<String, String> subs = new HashMap<String, String>();
+ Map<String, Object> subs = new HashMap<String, Object>();
subs.put("host", "localhost");
subs.put("port", "8080");
subs.put("portOffset", "1");
Modified: geronimo/server/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/pom.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/framework/pom.xml (original)
+++ geronimo/server/trunk/framework/pom.xml Tue Aug 23 06:37:46 2011
@@ -136,18 +136,14 @@
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.commons-jexl</artifactId>
- <version>1.1_3</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
+ <version>2.0</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
</exclusions>
</dependency>
Modified: geronimo/server/trunk/plugins/tomcat/tomcat7/src/main/filtered-resources/tomcat-base/server.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat7/src/main/filtered-resources/tomcat-base/server.xml?rev=1160559&r1=1160558&r2=1160559&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat7/src/main/filtered-resources/tomcat-base/server.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat7/src/main/filtered-resources/tomcat-base/server.xml Tue Aug 23 06:37:46 2011
@@ -132,7 +132,7 @@
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
- <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" name="${clusterName}" channelSendOptions="6" mapSendOptions="6"/>
+ <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" name="${ClusterName}" channelSendOptions="6" mapSendOptions="6"/>
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000" />
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4000" autoBind="100" selectorTimeout="5000" maxThreads="6" />