Upgrade to Spring M2 and correct expression classes and pom files to match changes

This commit is contained in:
Luke Taylor 2009-03-19 01:17:16 +00:00
parent 98593b7c78
commit 591681c180
9 changed files with 36 additions and 28 deletions

View File

@ -14,15 +14,11 @@
<groupId>org.springframework</groupId>
<artifactId>org.springframework.expression</artifactId>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
<dependency>
<!-- Used by SPEL -->
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
@ -31,6 +27,10 @@
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>

View File

@ -2,7 +2,7 @@ package org.springframework.security.expression.method;
import org.springframework.expression.Expression;
import org.springframework.expression.ParseException;
import org.springframework.expression.spel.SpelExpressionParser;
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
import org.springframework.security.ConfigAttribute;
import org.springframework.util.Assert;
@ -26,7 +26,7 @@ abstract class AbstractExpressionBasedMethodConfigAttribute implements ConfigAtt
*/
AbstractExpressionBasedMethodConfigAttribute(String filterExpression, String authorizeExpression) throws ParseException {
Assert.isTrue(filterExpression != null || authorizeExpression != null, "Filter and authorization Expressions cannot both be null");
SpelExpressionParser parser = new SpelExpressionParser();
SpelAntlrExpressionParser parser = new SpelAntlrExpressionParser();
this.filterExpression = filterExpression == null ? null : parser.parseExpression(filterExpression);
this.authorizeExpression = authorizeExpression == null ? null : parser.parseExpression(authorizeExpression);
}

View File

@ -10,7 +10,7 @@ import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.ParseException;
import org.springframework.expression.spel.SpelExpressionParser;
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
import org.springframework.security.ConfigAttribute;
import org.springframework.security.config.SecurityConfigurationException;
import org.springframework.security.expression.SecurityExpressionHandler;
@ -42,7 +42,7 @@ public class ExpressionAnnotationMethodDefinitionSource extends AbstractMethodDe
private ExpressionParser parser;
public ExpressionAnnotationMethodDefinitionSource() {
parser = new SpelExpressionParser();
parser = new SpelAntlrExpressionParser();
}
/**

View File

@ -13,8 +13,8 @@ import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.SpelExpressionParser;
import org.springframework.expression.spel.standard.StandardEvaluationContext;
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationTrustResolver;
import org.springframework.security.AuthenticationTrustResolverImpl;
@ -39,7 +39,7 @@ public class DefaultSecurityExpressionHandler implements SecurityExpressionHandl
private ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
private PermissionEvaluator permissionEvaluator = new DenyAllPermissionEvaluator();
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
private ExpressionParser expressionParser = new SpelExpressionParser();
private ExpressionParser expressionParser = new SpelAntlrExpressionParser();
public DefaultSecurityExpressionHandler() {
}
@ -69,7 +69,7 @@ public class DefaultSecurityExpressionHandler implements SecurityExpressionHandl
@SuppressWarnings("unchecked")
public Object filter(Object filterTarget, Expression filterExpression, EvaluationContext ctx) {
MethodSecurityExpressionRoot rootObject = (MethodSecurityExpressionRoot) ctx.getRootContextObject();
MethodSecurityExpressionRoot rootObject = (MethodSecurityExpressionRoot) ctx.getRootObject();
List retainList;
if (logger.isDebugEnabled()) {
@ -150,7 +150,7 @@ public class DefaultSecurityExpressionHandler implements SecurityExpressionHandl
}
public void setReturnObject(Object returnObject, EvaluationContext ctx) {
((MethodSecurityExpressionRoot)ctx.getRootContextObject()).setReturnObject(returnObject);
((MethodSecurityExpressionRoot)ctx.getRootObject()).setReturnObject(returnObject);
}
}

View File

@ -5,7 +5,7 @@ import java.lang.reflect.Method;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.spel.standard.StandardEvaluationContext;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.security.Authentication;
import org.springframework.util.ClassUtils;

View File

@ -7,8 +7,8 @@ import org.jmock.Mockery;
import org.junit.Before;
import org.junit.Test;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.SpelExpressionParser;
import org.springframework.expression.spel.standard.StandardEvaluationContext;
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationTrustResolver;
import org.springframework.security.expression.ExpressionUtils;
@ -21,7 +21,7 @@ import org.springframework.security.expression.PermissionEvaluator;
* @version $Id$
*/
public class MethodSecurityExpressionRootTests {
SpelExpressionParser parser = new SpelExpressionParser();
SpelAntlrExpressionParser parser = new SpelAntlrExpressionParser();
MethodSecurityExpressionRoot root;
StandardEvaluationContext ctx;
Mockery jmock = new Mockery();

View File

@ -35,7 +35,7 @@
<artifactId>jetty-naming</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-plus</artifactId>
@ -44,14 +44,16 @@
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
<artifactId>jsp-2.1-jetty</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependency>
-->
</dependencies>
</project>

17
pom.xml
View File

@ -9,7 +9,7 @@
<modules>
<module>core</module>
<module>portlet</module>
<!-- module>portlet</module -->
<module>ntlm</module>
<module>openid</module>
<module>samples</module>
@ -633,10 +633,12 @@
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
</exclusion>
<!--
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>com.springsource.org.antlr</artifactId>
</exclusion>
-->
</exclusions>
<optional>true</optional>
</dependency>
@ -731,7 +733,7 @@
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.0.RC1</version>
<version>1.3.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
@ -757,16 +759,19 @@
<artifactId>com.springsource.org.aspectj.weaver</artifactId>
<version>1.6.2.RELEASE</version>
</dependency>
<!-- Used by SPEL
<dependency>
<!-- Used by SPEL -->
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.0.1</version>
<optional>true</optional>
<scope>runtime</scope>
</dependency>
-->
<dependency>
<!-- Used by SPEL -->
<!-- Required by SPEL -->
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>2.2.3</version>
@ -841,9 +846,9 @@
</dependencies>
</dependencyManagement>
<properties>
<spring.version>3.0.0.M1</spring.version>
<spring.version>3.0.0.M2</spring.version>
<jstl.version>1.1.2</jstl.version>
<jetty.version>6.1.14</jetty.version>
<jetty.version>6.1.15</jetty.version>
<docbook.source>${basedir}/src/docbkx</docbook.source>
<docbook.target>${basedir}/target/site/guide</docbook.target>

View File

@ -55,6 +55,7 @@
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>