archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r632271 - in /maven/archiva/branches/springy: archiva-web/archiva-webapp/src/main/resources/ archiva-web/archiva-webapp/src/main/webapp/WEB-INF/ plexus-spring/ plexus-spring/src/main/java/org/codehaus/plexus/spring/
Date Fri, 29 Feb 2008 09:31:51 GMT
Author: nicolas
Date: Fri Feb 29 01:31:42 2008
New Revision: 632271

URL: http://svn.apache.org/viewvc?rev=632271&view=rev
Log:
move plexus-webwork to spring adapter code in plexus-spring

Added:
    maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
  (with props)
Modified:
    maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/resources/webwork.properties
    maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
    maven/archiva/branches/springy/plexus-spring/pom.xml
    maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusApplicationContextDelegate.java
    maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusToSpringUtils.java
    maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusWebApplicationContext.java

Modified: maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/resources/webwork.properties
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/resources/webwork.properties?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/resources/webwork.properties
(original)
+++ maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/resources/webwork.properties
Fri Feb 29 01:31:42 2008
@@ -19,7 +19,7 @@
 
 # define our own action mapper here
 webwork.mapper.class = org.apache.maven.archiva.web.mapper.RepositoryActionMapper
-webwork.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
+webwork.objectFactory = org.codehaus.plexus.spring.WebWorkPlexusInSpringObjectFactory
 webwork.url.includeParams = none
 
 # webwork.devMode = true

Modified: maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
(original)
+++ maven/archiva/branches/springy/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
Fri Feb 29 01:31:42 2008
@@ -11,13 +11,4 @@
     <constructor-arg ref="cache#url-failures-cache" type="org.codehaus.plexus.cache.Cache"/>
   </bean>
 
-  <bean class="org.springframework.web.context.support.ServletContextAttributeExporter"
-        lazy-init="false" >
-    <property name="attributes">
-        <map>
-            <entry key="webwork.plexus.container" value-ref="plexusContainer"/>
-        </map>
-    </property>
-  </bean>
-
 </beans>

Modified: maven/archiva/branches/springy/plexus-spring/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/plexus-spring/pom.xml?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/plexus-spring/pom.xml (original)
+++ maven/archiva/branches/springy/plexus-spring/pom.xml Fri Feb 29 01:31:42 2008
@@ -61,6 +61,19 @@
       <version>1.6.1</version>
     </dependency>
     <dependency>
+      <groupId>com.opensymphony</groupId>
+      <artifactId>webwork</artifactId>
+      <version>2.2.6</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.3</version>
+      <optional>true</optional>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.2</version>

Modified: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusApplicationContextDelegate.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusApplicationContextDelegate.java?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusApplicationContextDelegate.java
(original)
+++ maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusApplicationContextDelegate.java
Fri Feb 29 01:31:42 2008
@@ -19,22 +19,11 @@
  * 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;

Modified: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusToSpringUtils.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusToSpringUtils.java?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusToSpringUtils.java
(original)
+++ maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusToSpringUtils.java
Fri Feb 29 01:31:42 2008
@@ -101,6 +101,11 @@
         return disposable;
     }
 
+    public static String buildSpringId( Class role, String roleHint )
+    {
+        return buildSpringId( role.getName(), roleHint );
+    }
+
     public static String buildSpringId( String role, String roleHint )
     {
         int i = role.lastIndexOf( '.' ) + 1;

Modified: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusWebApplicationContext.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusWebApplicationContext.java?rev=632271&r1=632270&r2=632271&view=diff
==============================================================================
--- maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusWebApplicationContext.java
(original)
+++ maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/PlexusWebApplicationContext.java
Fri Feb 29 01:31:42 2008
@@ -58,6 +58,7 @@
     protected void postProcessBeanFactory( ConfigurableListableBeanFactory beanFactory )
     {
         delegate.postProcessBeanFactory( beanFactory, this );
+        getServletContext().setAttribute( "webwork.plexus.container", beanFactory.getBean(
"plexusContainer" ) );
         super.postProcessBeanFactory( beanFactory );
     }
 

Added: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java?rev=632271&view=auto
==============================================================================
--- maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
(added)
+++ maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
Fri Feb 29 01:31:42 2008
@@ -0,0 +1,70 @@
+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 );
+    }
+}

Propchange: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: maven/archiva/branches/springy/plexus-spring/src/main/java/org/codehaus/plexus/spring/WebWorkPlexusInSpringObjectFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message