<artifactId>dom4j</artifactId>\r
<version>1.6.1</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>com.opensymphony</groupId>\r
+ <artifactId>webwork</artifactId>\r
+ <version>2.2.6</version>\r
+ <optional>true</optional>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.servlet</groupId>\r
+ <artifactId>servlet-api</artifactId>\r
+ <version>2.3</version>\r
+ <optional>true</optional>\r
+ </dependency>\r
+\r
<dependency>\r
<groupId>junit</groupId>\r
<artifactId>junit</artifactId>\r
* under the License.
*/
-import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import org.apache.commons.lang.ClassUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
--- /dev/null
+package org.codehaus.plexus.spring;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Map;
+
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.core.NestedRuntimeException;
+
+import com.opensymphony.webwork.spring.WebWorkSpringObjectFactory;
+import com.opensymphony.xwork.Action;
+import com.opensymphony.xwork.Result;
+import com.opensymphony.xwork.interceptor.Interceptor;
+
+/**
+ * Replacement for WebWorkSpringObjectFactory ("webwork.objectFactory = spring") to support
+ * plexus components lookup as expected by plexus-xwork integration.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class WebWorkPlexusInSpringObjectFactory
+ extends WebWorkSpringObjectFactory
+{
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see com.opensymphony.xwork.spring.SpringObjectFactory#buildBean(java.lang.String,
+ * java.util.Map)
+ */
+ public Object buildBean( String name, Map map )
+ throws Exception
+ {
+ String id = PlexusToSpringUtils.buildSpringId( Action.class, name );
+ if ( appContext.containsBean( id ) )
+ {
+ return super.buildBean( id, map );
+ }
+
+ id = PlexusToSpringUtils.buildSpringId( Result.class, name );
+ if ( appContext.containsBean( id ) )
+ {
+ return super.buildBean( id, map );
+ }
+
+ id = PlexusToSpringUtils.buildSpringId( Interceptor.class, name );
+ if ( appContext.containsBean( id ) )
+ {
+ return super.buildBean( id, map );
+ }
+ return super.buildBean( name, map );
+ }
+}