Commits

Anonymous committed f122e48

Comments (0)

Files changed (16)

src/java/com/opensymphony/xwork/ActionContext.java

      */
     public static ActionContext getContext() {
         ActionContext context = (ActionContext) actionContext.get();
+
         if (context == null) {
             OgnlValueStack vs = new OgnlValueStack();
             context = new ActionContext(vs.getContext());
             setContext(context);
         }
+
         return context;
     }
 

src/java/com/opensymphony/xwork/config/ExternalReferenceResolver.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
 
 import com.opensymphony.xwork.ActionInvocation;
 
+
 /**
  * Resolves references declared in the action configuration from an external source
  */
 public interface ExternalReferenceResolver {
-	
-	public void resolveReferences(ActionInvocation invocation) throws ReferenceResolverException;
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    public void resolveReferences(ActionInvocation invocation) throws ReferenceResolverException;
 }

src/java/com/opensymphony/xwork/config/ReferenceResolverException.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
 
 import com.opensymphony.xwork.XworkException;
 
+
 /**
  * @author Mike
  *
  * Window - Preferences - Java - Code Generation - Code and Comments
  */
 public class ReferenceResolverException extends XworkException {
-	
-	
-	/**
-	 * 
-	 */
-	public ReferenceResolverException() {
-		super();
-	}
+    //~ Constructors ///////////////////////////////////////////////////////////
 
-	/**
-	 * @param s
-	 */
-	public ReferenceResolverException(String s) {
-		super(s);
-	}
+    /**
+     *
+     */
+    public ReferenceResolverException() {
+        super();
+    }
 
-	/**
-	 * @param s
-	 * @param cause
-	 */
-	public ReferenceResolverException(String s, Throwable cause) {
-		super(s, cause);
-	}
+    /**
+     * @param s
+     */
+    public ReferenceResolverException(String s) {
+        super(s);
+    }
 
-	/**
-	 * @param cause
-	 */
-	public ReferenceResolverException(Throwable cause) {
-		super(cause);
-	}
+    /**
+     * @param s
+     * @param cause
+     */
+    public ReferenceResolverException(String s, Throwable cause) {
+        super(s, cause);
+    }
 
+    /**
+     * @param cause
+     */
+    public ReferenceResolverException(Throwable cause) {
+        super(cause);
+    }
 }

src/java/com/opensymphony/xwork/config/entities/PackageConfig.java

 package com.opensymphony.xwork.config.entities;
 
 import com.opensymphony.util.TextUtils;
+
 import com.opensymphony.xwork.config.ExternalReferenceResolver;
 
 import org.apache.commons.logging.Log;
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
+    private ExternalReferenceResolver externalRefResolver = null;
     private Map actionConfigs = new HashMap();
     private Map globalResultConfigs = new HashMap();
     private Map interceptorConfigs = new HashMap();
     private String name;
     private String namespace = "";
     private boolean isAbstract = false;
-    private ExternalReferenceResolver externalRefResolver = null;
 
     //~ Constructors ///////////////////////////////////////////////////////////
 
     }
 
     /**
+     * @param externalRefResolver The externalRefResolver to set.
+     */
+    public void setExternalRefResolver(ExternalReferenceResolver externalRefResolver) {
+        this.externalRefResolver = externalRefResolver;
+    }
+
+    /**
+     * Gets the Reference resolver for this package.  If the resolver for this package is
+     * not specified, the method will try and find one on one of the parent packages
+     * @return Returns the externalRefResolver.
+     */
+    public ExternalReferenceResolver getExternalRefResolver() {
+        //If this resolver is null, lets look to see if our parents have one
+        if (externalRefResolver == null) {
+            PackageConfig packageConfig;
+
+            for (Iterator iter = getParents().iterator(); iter.hasNext();) {
+                packageConfig = (PackageConfig) iter.next();
+
+                if (packageConfig.getExternalRefResolver() != null) {
+                    externalRefResolver = packageConfig.getExternalRefResolver();
+
+                    break;
+                }
+            }
+        }
+
+        return externalRefResolver;
+    }
+
+    /**
     * gets the default interceptor-ref name. If this is not set on this PackageConfig, it searches the parent
     * PackageConfigs in order until it finds one.
     * @return
     public String toString() {
         return "{PackageConfig Name:" + name + " namespace:" + namespace + " abstract:" + isAbstract + " parents:" + parents + "}";
     }
-    
-	/**
-	 * Gets the Reference resolver for this package.  If the resolver for this package is
-	 * not specified, the method will try and find one on one of the parent packages
-	 * @return Returns the externalRefResolver.
-	 */
-	public ExternalReferenceResolver getExternalRefResolver() {
-		//If this resolver is null, lets look to see if our parents have one
-		if(externalRefResolver==null) {
-			PackageConfig packageConfig;
-			for(Iterator iter = getParents().iterator(); iter.hasNext();)
-			{
-				packageConfig = (PackageConfig)iter.next();
-				if(packageConfig.getExternalRefResolver() != null )
-				{
-					externalRefResolver = packageConfig.getExternalRefResolver();
-					break;
-				}
-			}
-		}
-		return externalRefResolver;
-	}
-
-	/**
-	 * @param externalRefResolver The externalRefResolver to set.
-	 */
-	public void setExternalRefResolver(ExternalReferenceResolver externalRefResolver) {
-		this.externalRefResolver = externalRefResolver;
-	}
-
 }

src/java/com/opensymphony/xwork/config/impl/DefaultConfiguration.java

                 interceptors.addAll(InterceptorBuilder.constructInterceptorReference(packageContext, defaultInterceptorRefName, new HashMap()));
             }
         }
-        
+
         List externalRefs = baseConfig.getExternalRefs();
-        
-        ActionConfig config = new ActionConfig(baseConfig.getMethodName(), baseConfig.getClazz(), 
-        		params, results, interceptors, baseConfig.getExternalRefs(), packageContext.getName());
+
+        ActionConfig config = new ActionConfig(baseConfig.getMethodName(), baseConfig.getClazz(), params, results, interceptors, baseConfig.getExternalRefs(), packageContext.getName());
 
         return config;
     }

src/java/com/opensymphony/xwork/interceptor/ExternalReferencesInterceptor.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
 import com.opensymphony.xwork.config.ExternalReferenceResolver;
 import com.opensymphony.xwork.config.entities.PackageConfig;
 
+
 /**
  * @author Ross
  *
  * Reference Resolution is encapsulated in an interceptor so that the user can configure when references should
  * be resloved
  */
-public class ExternalReferencesInterceptor  extends AroundInterceptor {
-	//~ Methods ////////////////////////////////////////////////////////////////
+public class ExternalReferencesInterceptor extends AroundInterceptor {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    protected void after(ActionInvocation dispatcher, String result) throws Exception {
+    }
+
+    protected void before(ActionInvocation invocation) throws Exception {
+        String packageName = invocation.getProxy().getConfig().getPackageName();
+        PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig(packageName);
 
-	protected void after(ActionInvocation dispatcher, String result) throws Exception {
-	}
+        if (packageConfig != null) {
+            ExternalReferenceResolver erResolver = packageConfig.getExternalRefResolver();
 
-	protected void before(ActionInvocation invocation) throws Exception 
-	{
-		String packageName = invocation.getProxy().getConfig().getPackageName();
-		PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig(packageName);
-		
-		if(packageConfig!=null)
-		{	
-			ExternalReferenceResolver erResolver = packageConfig.getExternalRefResolver();
-			
-			if(erResolver!=null)
-			{
-				erResolver.resolveReferences(invocation);
-			}
-		}
-	}
+            if (erResolver != null) {
+                erResolver.resolveReferences(invocation);
+            }
+        }
+    }
 }

src/java/com/opensymphony/xwork/interceptor/LoggingInterceptor.java

     private void logMessage(ActionInvocation invocation, String baseMessage) {
         StringBuffer message = new StringBuffer(baseMessage);
         String namespace = invocation.getProxy().getNamespace();
+
         if ((namespace != null) && (namespace.trim().length() > 0)) {
             message.append(namespace).append("/");
         }
+
         message.append(invocation.getProxy().getActionName());
         log.info(message.toString());
     }

src/java/com/opensymphony/xwork/validator/validators/ConversionErrorFieldValidator.java

     //~ Methods ////////////////////////////////////////////////////////////////
 
     /**
- * The validation implementation must guarantee that setValidatorContext will
- * be called with a non-null ValidatorContext before validate is called.
- * @param object
- * @throws ValidationException
- */
+    * The validation implementation must guarantee that setValidatorContext will
+    * be called with a non-null ValidatorContext before validate is called.
+    * @param object
+    * @throws ValidationException
+    */
     public void validate(Object object) throws ValidationException {
         String fieldName = getFieldName();
         String fullFieldName = getValidatorContext().getFullFieldName(fieldName);

src/java/com/opensymphony/xwork/validator/validators/ExpressionValidator.java

     public void validate(Object object) throws ValidationException {
         Boolean answer = Boolean.FALSE;
         Object obj = null;
+
         try {
             obj = getFieldValue(expression, object);
         } catch (ValidationException e) {

src/java/com/opensymphony/xwork/validator/validators/FieldExpressionValidator.java

 
         Boolean answer = Boolean.FALSE;
         Object obj = null;
+
         try {
             obj = getFieldValue(expression, object);
         } catch (ValidationException e) {

src/test/com/opensymphony/xwork/ExternalReferenceAction.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
- * 
+ *
  * To change the template for this generated file go to Window - Preferences -
  * Java - Code Generation - Code and Comments
  */
 package com.opensymphony.xwork;
 
+
 /**
  * @author Mike
- * 
+ *
  * To change the template for this generated type comment go to Window -
  * Preferences - Java - Code Generation - Code and Comments
  */
 public class ExternalReferenceAction implements Action {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    private Foo foo;
 
-	private Foo foo;
+    //~ Methods ////////////////////////////////////////////////////////////////
 
-	public String execute() throws Exception {
-		return SUCCESS;
-	}
-	
-	/**
-	 * @return Returns the foo.
-	 */
-	public Foo getFoo() {
-		return foo;
-	}
+    /**
+     * @param foo
+     *            The foo to set.
+     */
+    public void setFoo(Foo foo) {
+        this.foo = foo;
+    }
 
-	/**
-	 * @param foo
-	 *            The foo to set.
-	 */
-	public void setFoo(Foo foo) {
-		this.foo = foo;
-	}
+    /**
+     * @return Returns the foo.
+     */
+    public Foo getFoo() {
+        return foo;
+    }
 
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
 }

src/test/com/opensymphony/xwork/Foo.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
  */
 package com.opensymphony.xwork;
 
+
 /**
  * @author Mike
  *
  * Window - Preferences - Java - Code Generation - Code and Comments
  */
 public class Foo {
-	
-	String name = null;
-	
-	public Foo() {
-		name = "not set";
-	}
-	
-	public Foo(String name) {
-		this.name = name;
-	}
-	public String getName()
-	{
-		return name;
-	}
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    String name = null;
+
+    //~ Constructors ///////////////////////////////////////////////////////////
+
+    public Foo() {
+        name = "not set";
+    }
+
+    public Foo(String name) {
+        this.name = name;
+    }
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    public String getName() {
+        return name;
+    }
 }

src/test/com/opensymphony/xwork/config/ExternalReferenceResolverTest.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
 
 import java.util.HashMap;
 
+
 /**
  * @author Ross
  *
  * to be used by an action
  */
 public class ExternalReferenceResolverTest extends TestCase {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    /**
+     * test that resolver has been loaded and given to the package config
+     */
+    public void testResolverIsInstanciated() throws Exception {
+        RuntimeConfiguration config = ConfigurationManager.getConfiguration().getRuntimeConfiguration();
+        PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig("default");
+
+        assertNotNull("There should be a package called 'default'", packageConfig);
+
+        ExternalReferenceResolver err = packageConfig.getExternalRefResolver();
+        assertNotNull(err);
+        assertTrue(err instanceof TestExternalReferenceResolver);
+    }
+
+    /**
+     * The TestExternalRefResolver5 is defined in a child package which doesn't have an external
+     * reference resolver defined on it, so the resolver should be used from its parent
+     * @throws Exception
+     */
+    public void testResolverOnParentPackage() throws Exception {
+        ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("test/externalRef/", "TestExternalRefResolver4", null);
+
+        ExternalReferenceAction erAction = (ExternalReferenceAction) proxy.getAction();
+
+        proxy.getInvocation().invoke();
+
+        assertNotNull("The Foo object should have been resolved", erAction.getFoo());
+        assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
+    }
 
-	protected void setUp() throws Exception {
-		super.setUp();
+    /**
+     * Test that the ActionInvocation implementation uses the resolver to resolve
+     * external references
+     * @throws Exception because it wants to!
+     */
+    public void testResolverResolvesDependancies() throws Exception {
+        ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver", null);
+        Action action = proxy.getAction();
+        assertNotNull("Action should be null", action);
+        assertTrue("Action should be an ExternalReferenceAction", action instanceof ExternalReferenceAction);
+
+        ExternalReferenceAction erAction = (ExternalReferenceAction) action;
+        assertNull("The Foo object should not have been resolved yet", erAction.getFoo());
+
+        proxy.getInvocation().invoke();
+
+        assertNotNull("The Foo object should have been resolved", erAction.getFoo());
+        assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
+    }
+
+    /**
+     * Test that required dependacies cause exception when not found and non-dependant do not
+     * TestExternalRefResolver2 has two external-refs, one of which doesn't exist but is also not required
+     * @throws Exception
+     */
+    public void testResolverRespectsRequiredDependancies() throws Exception {
+        ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver2", null);
+        Action action = proxy.getAction();
+        assertNotNull("Action should be null", action);
+        assertTrue("Action should be an ExternalReferenceAction", action instanceof ExternalReferenceAction);
+
+        ExternalReferenceAction erAction = (ExternalReferenceAction) action;
+        assertNull("The Foo object should not have been resolved yet", erAction.getFoo());
+
+        proxy.getInvocation().invoke();
+
+        assertNotNull("The Foo object should have been resolved", erAction.getFoo());
+        assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
+
+        //now test that a required dependacy that is missing will throw an exception
+        proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver3", null);
+        action = proxy.getAction();
+        assertNotNull("Action should be null", action);
+        erAction = (ExternalReferenceAction) action;
+
+        try {
+            proxy.getInvocation().invoke();
+            fail("Invoking the action should have thrown ReferenceResolverException");
+        } catch (ReferenceResolverException e) {
+            // expected
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
 
         ActionContext.setContext(new ActionContext(new HashMap()));
-        
-		// ensure we're using the default configuration, not simple config
-		XmlConfigurationProvider c = new XmlConfigurationProvider();
-		ConfigurationManager.addConfigurationProvider(c);
-		ConfigurationManager.getConfiguration().reload();
-	}
-
-    protected void tearDown() throws Exception
-    {
+
+        // ensure we're using the default configuration, not simple config
+        XmlConfigurationProvider c = new XmlConfigurationProvider();
+        ConfigurationManager.addConfigurationProvider(c);
+        ConfigurationManager.getConfiguration().reload();
+    }
+
+    protected void tearDown() throws Exception {
         ActionContext.setContext(null);
         super.tearDown();
     }
-
-	/**
-	 * test that resolver has been loaded and given to the package config
-	 */
-	public void testResolverIsInstanciated() throws Exception
-	{
-		RuntimeConfiguration config = ConfigurationManager.getConfiguration().getRuntimeConfiguration();
-		PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig("default");
-		
-		assertNotNull("There should be a package called 'default'", packageConfig);
-		
-		ExternalReferenceResolver err = packageConfig.getExternalRefResolver();
-		assertNotNull(err);
-		assertTrue(err instanceof TestExternalReferenceResolver);
-	}
-	
-	/**
-	 * Test that the ActionInvocation implementation uses the resolver to resolve 
-	 * external references
-	 * @throws Exception because it wants to!
-	 */
-	public void testResolverResolvesDependancies() throws Exception
-	{
-		ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver", null);
-		Action action = proxy.getAction();
-		assertNotNull("Action should be null", action);
-		assertTrue("Action should be an ExternalReferenceAction", action instanceof ExternalReferenceAction);
-		
-		ExternalReferenceAction erAction = (ExternalReferenceAction)action;
-		assertNull("The Foo object should not have been resolved yet", erAction.getFoo());
-		
-		proxy.getInvocation().invoke();
-		
-		assertNotNull("The Foo object should have been resolved", erAction.getFoo());
-		assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
-	}
-	
-	/**
-	 * Test that required dependacies cause exception when not found and non-dependant do not
-	 * TestExternalRefResolver2 has two external-refs, one of which doesn't exist but is also not required
-	 * @throws Exception 
-	 */
-	public void testResolverRespectsRequiredDependancies() throws Exception
-	{
-		ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver2", null);
-		Action action = proxy.getAction();
-		assertNotNull("Action should be null", action);
-		assertTrue("Action should be an ExternalReferenceAction", action instanceof ExternalReferenceAction);
-
-		ExternalReferenceAction erAction = (ExternalReferenceAction)action;
-		assertNull("The Foo object should not have been resolved yet", erAction.getFoo());
-
-		proxy.getInvocation().invoke();
-
-		assertNotNull("The Foo object should have been resolved", erAction.getFoo());
-		assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
-		
-		//now test that a required dependacy that is missing will throw an exception
-		proxy = ActionProxyFactory.getFactory().createActionProxy(null, "TestExternalRefResolver3", null);
-		action = proxy.getAction();
-		assertNotNull("Action should be null", action);
-		erAction = (ExternalReferenceAction)action;
-
-		try {
-			proxy.getInvocation().invoke();
-			fail("Invoking the action should have thrown ReferenceResolverException");
-		} catch (ReferenceResolverException e) {
-			// expected
-		}
-	}
-	
-	
-	/**
-	 * The TestExternalRefResolver5 is defined in a child package which doesn't have an external
-	 * reference resolver defined on it, so the resolver should be used from its parent
-	 * @throws Exception
-	 */
-	public void testResolverOnParentPackage() throws Exception 
-	{
-		ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(
-				"test/externalRef/","TestExternalRefResolver4", null);
-
-		ExternalReferenceAction erAction = (ExternalReferenceAction) proxy.getAction();
-
-		proxy.getInvocation().invoke();
-
-		assertNotNull("The Foo object should have been resolved", erAction.getFoo());
-		assertEquals("Foos name should be 'Little Foo'", "Little Foo", erAction.getFoo().getName());
-
-	}
 }

src/test/com/opensymphony/xwork/config/TestExternalReferenceResolver.java

 /*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+/*
  * Created on Nov 11, 2003
  *
  * To change the template for this generated file go to
  */
 package com.opensymphony.xwork.config;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import ognl.Ognl;
-
 import com.opensymphony.xwork.ActionInvocation;
 import com.opensymphony.xwork.Foo;
 import com.opensymphony.xwork.config.entities.ExternalReference;
 import com.opensymphony.xwork.util.OgnlUtil;
 
+import ognl.Ognl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * Test resolver
  */
-public class TestExternalReferenceResolver implements ExternalReferenceResolver 
-{
-	private Map references;				
-	
-	public TestExternalReferenceResolver()
-	{
-		references = new HashMap();
-		references.put("entity1", "I am entity 1");
-		references.put("entity2", "I am entity 2");
-		references.put("myFoo", new Foo("Little Foo"));
-	}
-	
-	/* (non-Javadoc)
-	 * @see com.opensymphony.xwork.config.ExternalReferenceResolver#resolveReference(java.lang.String)
-	 */
-	public void resolveReferences(ActionInvocation invocation) throws ReferenceResolverException {
-		List refs = invocation.getProxy().getConfig().getExternalRefs();
-
-		ExternalReference reference;
-		String method;
-		for(Iterator iter = refs.iterator(); iter.hasNext(); )
-		{
-			reference = (ExternalReference)iter.next();
-			Object obj = null;
-			
-			try {
-				obj = getReference(reference.getExternalRef());
-			} catch (IllegalArgumentException e1) {
-				if(reference.isRequired()) {
-					//if a dependacy is required but wasn't found throw an exception
-					throw new ReferenceResolverException("Could not resolve external references using key: " + reference.getExternalRef());
-				} else {
-					return;
-				}
-			}
-
-			try {
-				Map context = Ognl.createDefaultContext(invocation.getAction());
-			    OgnlUtil.setProperty(reference.getName(), obj, invocation.getAction(), context);
-				
-			} catch (Exception e) {
-				throw new ReferenceResolverException("Failed to set external reference: " + 
-						reference.getExternalRef() + " for bean attribute: " + reference.getName() + ". " + 
-						e.getMessage(), e );
-			}  
-		}
-	}
-	
-	private Object getReference(Object key) throws IllegalArgumentException
-	{
-		Object result = references.get(key);
-		if(result==null) throw new IllegalArgumentException("Object was not found for key: " + key);
-		
-		return result;
-	}
+public class TestExternalReferenceResolver implements ExternalReferenceResolver {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    private Map references;
+
+    //~ Constructors ///////////////////////////////////////////////////////////
+
+    public TestExternalReferenceResolver() {
+        references = new HashMap();
+        references.put("entity1", "I am entity 1");
+        references.put("entity2", "I am entity 2");
+        references.put("myFoo", new Foo("Little Foo"));
+    }
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    /* (non-Javadoc)
+     * @see com.opensymphony.xwork.config.ExternalReferenceResolver#resolveReference(java.lang.String)
+     */
+    public void resolveReferences(ActionInvocation invocation) throws ReferenceResolverException {
+        List refs = invocation.getProxy().getConfig().getExternalRefs();
+
+        ExternalReference reference;
+        String method;
+
+        for (Iterator iter = refs.iterator(); iter.hasNext();) {
+            reference = (ExternalReference) iter.next();
+
+            Object obj = null;
+
+            try {
+                obj = getReference(reference.getExternalRef());
+            } catch (IllegalArgumentException e1) {
+                if (reference.isRequired()) {
+                    //if a dependacy is required but wasn't found throw an exception
+                    throw new ReferenceResolverException("Could not resolve external references using key: " + reference.getExternalRef());
+                } else {
+                    return;
+                }
+            }
+
+            try {
+                Map context = Ognl.createDefaultContext(invocation.getAction());
+                OgnlUtil.setProperty(reference.getName(), obj, invocation.getAction(), context);
+            } catch (Exception e) {
+                throw new ReferenceResolverException("Failed to set external reference: " + reference.getExternalRef() + " for bean attribute: " + reference.getName() + ". " + e.getMessage(), e);
+            }
+        }
+    }
+
+    private Object getReference(Object key) throws IllegalArgumentException {
+        Object result = references.get(key);
+
+        if (result == null) {
+            throw new IllegalArgumentException("Object was not found for key: " + key);
+        }
 
+        return result;
+    }
 }

src/test/com/opensymphony/xwork/interceptor/ParametersInterceptorTest.java

 public class ParametersInterceptorTest extends TestCase {
     //~ Methods ////////////////////////////////////////////////////////////////
 
+    public void testDoesNotAllowMethodInvocations() {
+        Map params = new HashMap();
+        params.put("@java.lang.System@exit(1).dummy", "dumb value");
+
+        HashMap extraContext = new HashMap();
+        extraContext.put(ActionContext.PARAMETERS, params);
+
+        try {
+            ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("", MockConfigurationProvider.MODEL_DRIVEN_PARAM_TEST, extraContext);
+            assertEquals(Action.SUCCESS, proxy.execute());
+
+            ModelDrivenAction action = (ModelDrivenAction) proxy.getAction();
+            TestBean model = (TestBean) action.getModel();
+
+            String property = System.getProperty("webwork.security.test");
+            assertNull(property);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
     public void testModelDrivenParameters() {
         Map params = new HashMap();
         final String fooVal = "com.opensymphony.xwork.interceptor.ParametersInterceptorTest.foo";
         }
     }
 
-    public void testDoesNotAllowMethodInvocations() {
-        Map params = new HashMap();
-        params.put("@java.lang.System@exit(1).dummy", "dumb value");
-
-        HashMap extraContext = new HashMap();
-        extraContext.put(ActionContext.PARAMETERS, params);
-
-        try {
-            ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("", MockConfigurationProvider.MODEL_DRIVEN_PARAM_TEST, extraContext);
-            assertEquals(Action.SUCCESS, proxy.execute());
-
-            ModelDrivenAction action = (ModelDrivenAction) proxy.getAction();
-            TestBean model = (TestBean) action.getModel();
-
-            String property = System.getProperty("webwork.security.test");
-            assertNull(property);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-
-    }
-
     protected void setUp() throws Exception {
         ConfigurationManager.clearConfigurationProviders();
         ConfigurationManager.addConfigurationProvider(new MockConfigurationProvider());

src/test/com/opensymphony/xwork/util/Owner.java

  */
 package com.opensymphony.xwork.util;
 
+
 /**
  * DOCUMENT ME!
  *