archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdu...@apache.org
Subject svn commit: r744819 - in /archiva/branches/archiva-with-new-repoapi/archiva-modules: archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/ archiva-b...
Date Mon, 16 Feb 2009 06:47:40 GMT
Author: jdumay
Date: Mon Feb 16 06:47:39 2009
New Revision: 744819

URL: http://svn.apache.org/viewvc?rev=744819&view=rev
Log:
Everything is still somewhat very broken. Fixed up the repo groups manager

Added:
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java
      - copied, changed from r744778, archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/MutableResourceContext.java
Removed:
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/MutableResourceContext.java
Modified:
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRepositoryManager.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/RepositoryManagerException.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/SystemRepositoryManager.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/GroupRepositoryManager.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/resources/META-INF/spring-context.xml
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/pom.xml
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/IndexWriter.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/RepositoryServlet.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/AbstractRepositoryServletTestCase.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/RepositoryServletBrowseTest.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
    archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRepositoryManager.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRepositoryManager.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRepositoryManager.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyRepositoryManager.java
Mon Feb 16 06:47:39 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.archiva.repository.api.MutableResourceContext;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
@@ -34,6 +35,8 @@
 import org.apache.archiva.repository.api.ResourceContext;
 import org.apache.archiva.repository.api.Status;
 import org.apache.archiva.repository.api.SystemRepositoryManager;
+import org.apache.maven.archiva.configuration.ConfigurationEvent;
+import org.apache.maven.archiva.configuration.ConfigurationListener;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.policies.ProxyDownloadException;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;

Copied: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java
(from r744778, archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/MutableResourceContext.java)
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java?p2=archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java&p1=archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/MutableResourceContext.java&r1=744778&r2=744819&rev=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/MutableResourceContext.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java
Mon Feb 16 06:47:39 2009
@@ -1,21 +1,4 @@
-/*
- *  Copyright 2009 jdumay.
- * 
- *  Licensed 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.
- *  under the License.
- */
-
-package org.apache.maven.archiva.proxy;
+package org.apache.archiva.repository.api;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -36,8 +19,10 @@
  * under the License.
  */
 
-import org.apache.archiva.repository.api.ResourceContext;
-
+/**
+ * Wraps a ResourceContext instance and allows its members to be overloaded
+ * @author jdumay
+ */
 public class MutableResourceContext implements ResourceContext
 {
     private final ResourceContext context;
@@ -69,11 +54,19 @@
         return repositoryId;
     }
 
+    /**
+     * Sets the logicalPath overriding the internal logical path value
+     * @param logicalPath
+     */
     public void setLogicalPath(String logicalPath)
     {
         this.logicalPath = logicalPath;
     }
 
+    /**
+     * Sets the repositoryId overriding the internal logical path value
+     * @param repositoryId
+     */
     public void setRepositoryId(String repositoryId)
     {
         this.repositoryId = repositoryId;

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/RepositoryManagerException.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/RepositoryManagerException.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/RepositoryManagerException.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/RepositoryManagerException.java
Mon Feb 16 06:47:39 2009
@@ -24,6 +24,11 @@
  */
 public class RepositoryManagerException extends RuntimeException
 {
+    public RepositoryManagerException(String message)
+    {
+        super(message);
+    }
+
     public RepositoryManagerException(String message, Throwable cause)
     {
         super(message, cause);

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/SystemRepositoryManager.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/SystemRepositoryManager.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/SystemRepositoryManager.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/SystemRepositoryManager.java
Mon Feb 16 06:47:39 2009
@@ -25,4 +25,5 @@
  */
 public interface SystemRepositoryManager extends RepositoryManager
 {
+//    boolean delete(ResourceContext resourceContext);
 }

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/GroupRepositoryManager.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/GroupRepositoryManager.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/GroupRepositoryManager.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/GroupRepositoryManager.java
Mon Feb 16 06:47:39 2009
@@ -21,48 +21,107 @@
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
+import org.apache.archiva.repository.api.MutableResourceContext;
 import org.apache.archiva.repository.api.RepositoryManager;
+import org.apache.archiva.repository.api.RepositoryManagerException;
 import org.apache.archiva.repository.api.RepositoryManagerWeight;
 import org.apache.archiva.repository.api.ResourceContext;
 import org.apache.archiva.repository.api.Status;
 import org.apache.archiva.repository.api.SystemRepositoryManager;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 
 @RepositoryManagerWeight(400)
 public class GroupRepositoryManager implements RepositoryManager
 {
+    private final ArchivaConfiguration archivaConfiguration;
+
     private final RepositoryManager proxyRepositoryManager;
 
-    private final SystemRepositoryManager repositoryManager;
+    private final SystemRepositoryManager systemRepositoryManager;
 
-    public GroupRepositoryManager(RepositoryManager proxyRepositoryManager, SystemRepositoryManager
repositoryManager)
+    public GroupRepositoryManager(ArchivaConfiguration archivaConfiguration, RepositoryManager
proxyRepositoryManager, SystemRepositoryManager systemRepositoryManager)
     {
+        this.archivaConfiguration = archivaConfiguration;
         this.proxyRepositoryManager = proxyRepositoryManager;
-        this.repositoryManager = repositoryManager;
+        this.systemRepositoryManager = systemRepositoryManager;
     }
 
     public boolean exists(String repositoryId)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return (getGroupConfiguration(repositoryId) != null);
     }
 
     public ResourceContext handles(ResourceContext context)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        if (getGroupConfiguration(context.getRepositoryId()) != null)
+        {
+            return context;
+        }
+        return null;
     }
 
     public boolean read(ResourceContext context, OutputStream os)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        final RepositoryGroupConfiguration groupConfiguration = getGroupConfiguration(context.getRepositoryId());
+        for (String repositoryId : groupConfiguration.getRepositories() )
+        {
+            final MutableResourceContext resourceContext = new MutableResourceContext(context);
+            resourceContext.setRepositoryId(repositoryId);
+            if (systemRepositoryManager.read(context, os))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public boolean write(ResourceContext context, InputStream is)
+    {
+        throw new RepositoryManagerException("Repository Groups are not writable: " + context.getRepositoryId());
     }
 
     public List<Status> stat(ResourceContext context)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        final RepositoryGroupConfiguration groupConfiguration = getGroupConfiguration(context.getRepositoryId());
+
+        final LinkedHashMap<String, Status> statusMap = new LinkedHashMap<String,
Status>();
+        for (final String repositoryId : groupConfiguration.getRepositories())
+        {
+            final MutableResourceContext resourceContext = new MutableResourceContext(context);
+            resourceContext.setRepositoryId(repositoryId);
+
+            ResourceContext rc = proxyRepositoryManager.handles(resourceContext);
+            if (rc != null)
+            {
+                addStatResultToMap(statusMap, rc, proxyRepositoryManager);
+            }
+            else
+            {
+                rc = systemRepositoryManager.handles(resourceContext);
+                if (rc != null)
+                {
+                    addStatResultToMap(statusMap, rc, systemRepositoryManager);
+                }
+            }
+        }
+        return new ArrayList<Status>(statusMap.values());
+    }
+
+    private void addStatResultToMap(final Map<String, Status> statusMap, final ResourceContext
resourceContext, final RepositoryManager repositoryManager)
+    {
+        for (final Status status : repositoryManager.stat(resourceContext))
+        {
+            statusMap.put(status.getName(), status);
+        }
     }
 
-    public boolean write(ResourceContext context, InputStream is)
+    private RepositoryGroupConfiguration getGroupConfiguration(final String repositoryId)
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return archivaConfiguration.getConfiguration().getRepositoryGroupsAsMap().get( repositoryId
);
     }
 }

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/resources/META-INF/spring-context.xml?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/resources/META-INF/spring-context.xml
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-base/archiva-repository/src/main/resources/META-INF/spring-context.xml
Mon Feb 16 06:47:39 2009
@@ -6,9 +6,16 @@
        <bean name="repositoryFactory" class="org.apache.archiva.repository.DefaultRepositoryFactory">
            <constructor-arg ref="archivaConfiguration"/>
        </bean>
-       <bean name="systemRepositoryManager" class="org.apache.archiva.repository.DefaultRepositoryManager">
+       <bean name="systemRepositoryManager" class="org.apache.archiva.repository.DefaultRepositoryManager"
lazy-init="true">
            <constructor-arg ref="repositoryFactory"/>
        </bean>
+
+       <bean name="groupRepositoryManager" class="org.apache.archiva.repository.GroupRepositoryManager">
+           <constructor-arg ref="archivaConfiguration"/>
+           <constructor-arg ref="proxyRepositoryManager"/>
+           <constructor-arg ref="systemRepositoryManager"/>
+       </bean>
+
        <bean name="repositoryManagerFactory" class="org.apache.archiva.repository.DefaultRepositoryManagerFactory"/>
        <bean name="preRepositoryInterceptorFactory" class="org.apache.archiva.repository.DefaultRepositoryInterceptorFactory">
            <constructor-arg value="org.apache.archiva.repository.api.interceptor.PreRepositoryInterceptor"/>

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/pom.xml?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/pom.xml
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/pom.xml
Mon Feb 16 06:47:39 2009
@@ -43,6 +43,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.archiva</groupId>
+            <artifactId>archiva-proxy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.archiva</groupId>
             <artifactId>archiva-repository</artifactId>
             <scope>test</scope>
         </dependency>

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/IndexWriter.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/IndexWriter.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/IndexWriter.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/IndexWriter.java
Mon Feb 16 06:47:39 2009
@@ -96,7 +96,7 @@
         for( Status status : sortedResources)
         {
             //Ignore hidden directories
-            if (!status.getName().startsWith("."))
+            if (!status.getName().startsWith(".") || status.getName().startsWith(".index"))
             {
                 writeHyperlink(writer, status);
             }

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/RepositoryServlet.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/RepositoryServlet.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/main/java/org/apache/archiva/web/servlet/RepositoryServlet.java
Mon Feb 16 06:47:39 2009
@@ -55,11 +55,11 @@
 
     private static final String LAST_MODIFIED = "last-modified";
 
-    private static final String REPOSITORY_MANAGER_FACTORY = "repositoryManagerFactoryName";
+    public static final String REPOSITORY_MANAGER_FACTORY = "repositoryManagerFactoryName";
 
-    private static final String PREREPOSITORY_INTERCEPTOR_FACTORY = "preRepositoryInterceptorFactoryName";
+    public static final String PREREPOSITORY_INTERCEPTOR_FACTORY = "preRepositoryInterceptorFactoryName";
 
-    private static final String POSTREPOSITORY_INTERCEPTOR_FACTORY = "postRepositoryInterceptorFactoryName";
+    public static final String POSTREPOSITORY_INTERCEPTOR_FACTORY = "postRepositoryInterceptorFactoryName";
 
     @Override
     public void init(ServletConfig config) throws ServletException

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/AbstractRepositoryServletTestCase.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/AbstractRepositoryServletTestCase.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/AbstractRepositoryServletTestCase.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/AbstractRepositoryServletTestCase.java
Mon Feb 16 06:47:39 2009
@@ -35,6 +35,7 @@
 import java.io.File;
 import java.io.IOException;
 
+import java.util.Hashtable;
 import junit.framework.Assert;
 
 /**
@@ -147,8 +148,6 @@
     protected void setUp()
         throws Exception
     {
-        super.setUp();
-
         String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
         System.setProperty( "appserver.base", appserverBase );
 
@@ -156,6 +155,8 @@
         File testConfDest = new File( appserverBase, "conf/archiva.xml" );
         FileUtils.copyFile( testConf, testConfDest );
 
+        super.setUp();
+
         archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class
);
         repoRootInternal = new File( appserverBase, "data/repositories/internal" );
         Configuration config = archivaConfiguration.getConfiguration();
@@ -168,7 +169,13 @@
         HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );                
 
         sr = new ServletRunner( getTestFile( "src/test/resources/WEB-INF/web.xml" ) );
-        sr.registerServlet( "/repository/*", RepositoryServlet.class.getName() );
+
+        final Hashtable<String, String> params = new Hashtable<String, String>();
+        params.put(RepositoryServlet.REPOSITORY_MANAGER_FACTORY, "repositoryManagerFactory");
+        params.put(RepositoryServlet.PREREPOSITORY_INTERCEPTOR_FACTORY, "preRepositoryInterceptorFactory");
+        params.put(RepositoryServlet.POSTREPOSITORY_INTERCEPTOR_FACTORY, "postRepositoryInterceptorFactory");
+
+        sr.registerServlet( "/repository/*", RepositoryServlet.class.getName(), params );
         sc = sr.newClient();
     }
 
@@ -179,6 +186,12 @@
     }
 
     @Override
+    protected String getSpringConfigLocation()
+    {
+        return super.getSpringConfigLocation();
+    }
+
+    @Override
     protected void tearDown()
         throws Exception
     {

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/RepositoryServletBrowseTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/RepositoryServletBrowseTest.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/RepositoryServletBrowseTest.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/java/org/apache/archiva/web/servlet/RepositoryServletBrowseTest.java
Mon Feb 16 06:47:39 2009
@@ -92,7 +92,7 @@
         
         request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId/1.0/artifactId-1.0.jar/"
);
         response = sc.getResponse( request );
-        assertEquals( "Response", HttpServletResponse.SC_NOT_FOUND, response.getResponseCode()
);
+        assertEquals( "Response", HttpServletResponse.SC_OK, response.getResponseCode() );
     }
     
     

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml
Mon Feb 16 06:47:39 2009
@@ -22,12 +22,12 @@
   <components>
     <!--
      | Logger manager
-     -->
     <component>
       <role>org.codehaus.plexus.logging.LoggerManager</role>
       <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
       <lifecycle-handler>basic</lifecycle-handler>
     </component>
+      -->
 
     <!--
      | Configuration
@@ -83,12 +83,6 @@
         <time-to-live-seconds>1800</time-to-live-seconds>
       </configuration>
     </component>
-    
-    <component>
-      <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
-      <role-hint>default</role-hint>
-      <implementation>org.apache.maven.archiva.webdav.BypassSecuritySystem</implementation>
-    </component>
 
   </components>
 </plexus>

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
Mon Feb 16 06:47:39 2009
@@ -26,6 +26,8 @@
 import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
 import org.codehaus.plexus.spring.PlexusToSpringUtils;
 import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
@@ -59,6 +61,12 @@
         }
     }
 
-    public void contextDestroyed(ServletContextEvent contextEvent) {
+    public void contextDestroyed(ServletContextEvent contextEvent)
+    {
+        ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(contextEvent.getServletContext());
+        if (applicationContext != null && applicationContext instanceof ClassPathXmlApplicationContext)
+        {
+            ((ClassPathXmlApplicationContext)applicationContext).close();
+        }
     }
 }

Modified: archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml?rev=744819&r1=744818&r2=744819&view=diff
==============================================================================
--- archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
(original)
+++ archiva/branches/archiva-with-new-repoapi/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
Mon Feb 16 06:47:39 2009
@@ -19,76 +19,76 @@
   -->
 <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
-	<display-name>Apache Archiva</display-name>
+    <display-name>Apache Archiva</display-name>
 
-        <filter>
-          <filter-name>webwork-cleanup</filter-name>
-          <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
-        </filter>
-
-	<filter>
-		<filter-name>sitemesh</filter-name>
-		<filter-class>
+    <filter>
+        <filter-name>webwork-cleanup</filter-name>
+        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
+    </filter>
+
+    <filter>
+        <filter-name>sitemesh</filter-name>
+        <filter-class>
 			com.opensymphony.module.sitemesh.filter.PageFilter
-		</filter-class>
-	</filter>
+        </filter-class>
+    </filter>
 
-        <filter>
-          <filter-name>webwork</filter-name>
-          <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
-        </filter>
+    <filter>
+        <filter-name>webwork</filter-name>
+        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+    </filter>
 
 	<!-- this must be before the sitemesh filter -->
-	<filter-mapping>
-		<filter-name>webwork-cleanup</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-
-	<filter-mapping>
-		<filter-name>sitemesh</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-
-	<filter-mapping>
-		<filter-name>webwork</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
+    <filter-mapping>
+        <filter-name>webwork-cleanup</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>sitemesh</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>webwork</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
 
-	<listener>
-		<listener-class>
+    <listener>
+        <listener-class>
 			org.springframework.web.context.ContextLoaderListener
-		</listener-class>
-	</listener>
-	<listener>
+        </listener-class>
+    </listener>
+    <listener>
 		<!-- TODO: some Spring technique for this? -->
-		<listener-class>
+        <listener-class>
 			org.apache.maven.archiva.web.startup.ArchivaStartup
-		</listener-class>
-	</listener>
+        </listener-class>
+    </listener>
 
-	<context-param>
-		<param-name>contextClass</param-name>
-		<param-value>
+    <context-param>
+        <param-name>contextClass</param-name>
+        <param-value>
 			org.codehaus.plexus.spring.PlexusWebApplicationContext
-		</param-value>
-	</context-param>
+        </param-value>
+    </context-param>
 
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
 			classpath*:META-INF/plexus/components.xml
 			classpath*:META-INF/spring-context.xml
 			/WEB-INF/classes/META-INF/plexus/application.xml
 			/WEB-INF/classes/META-INF/plexus/components.xml
 			/WEB-INF/applicationContext.xml
-		</param-value>
-	</context-param>
+        </param-value>
+    </context-param>
 
-	<servlet>
-		<servlet-name>RepositoryServlet</servlet-name>
-		<servlet-class>
+    <servlet>
+        <servlet-name>RepositoryServlet</servlet-name>
+        <servlet-class>
 			org.apache.archiva.web.servlet.RepositoryServlet
-		</servlet-class>
+        </servlet-class>
 		<!-- Loading this on startup so as to take advantage of configuration listeners -->
         <init-param>
             <param-name>preRepositoryInterceptorFactoryName</param-name>
@@ -103,67 +103,67 @@
             <param-value>repositoryManagerFactory</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
-	</servlet>
+    </servlet>
 
-	<servlet>
-		<servlet-name>XmlRpcServlet</servlet-name>
-		<servlet-class>
+    <servlet>
+        <servlet-name>XmlRpcServlet</servlet-name>
+        <servlet-class>
 			com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet
-		</servlet-class>
-		<init-param>
-			<param-name>serviceListBeanName</param-name>
-			<param-value>xmlrpcServicesList</param-value>
-		</init-param>
-		<init-param>
-			<param-name>authHandlerBeanName</param-name>
-			<param-value>xmlRpcAuthenticator</param-value>
-		</init-param>
-		<init-param>
-		  <param-name>enabledForExtensions</param-name>
-		  <param-value>true</param-value>
-		</init-param>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-
-	<servlet>
-		<servlet-name>RssFeedServlet</servlet-name>
-		<servlet-class>
+        </servlet-class>
+        <init-param>
+            <param-name>serviceListBeanName</param-name>
+            <param-value>xmlrpcServicesList</param-value>
+        </init-param>
+        <init-param>
+            <param-name>authHandlerBeanName</param-name>
+            <param-value>xmlRpcAuthenticator</param-value>
+        </init-param>
+        <init-param>
+            <param-name>enabledForExtensions</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet>
+        <servlet-name>RssFeedServlet</servlet-name>
+        <servlet-class>
 			org.apache.maven.archiva.web.rss.RssFeedServlet
-		</servlet-class>
-	</servlet>
+        </servlet-class>
+    </servlet>
 
-	<servlet-mapping>
-		<servlet-name>RssFeedServlet</servlet-name>
-		<url-pattern>/feeds/*</url-pattern>
-	</servlet-mapping>
-
-	<servlet-mapping>
-		<servlet-name>RepositoryServlet</servlet-name>
-		<url-pattern>/repository/*</url-pattern>
-	</servlet-mapping>
-
-	<servlet-mapping>
-		<servlet-name>XmlRpcServlet</servlet-name>
-		<url-pattern>/xmlrpc</url-pattern>
-	</servlet-mapping>
-
-	<resource-ref>
-		<res-ref-name>jdbc/users</res-ref-name>
-		<res-type>javax.sql.DataSource</res-type>
-		<res-auth>Container</res-auth>
-		<res-sharing-scope>Shareable</res-sharing-scope>
-	</resource-ref>
-	<resource-ref>
-		<res-ref-name>jdbc/archiva</res-ref-name>
-		<res-type>javax.sql.DataSource</res-type>
-		<res-auth>Container</res-auth>
-		<res-sharing-scope>Shareable</res-sharing-scope>
-	</resource-ref>
-	<resource-ref>
-		<res-ref-name>mail/Session</res-ref-name>
-		<res-type>javax.mail.Session</res-type>
-		<res-auth>Container</res-auth>
-		<res-sharing-scope>Shareable</res-sharing-scope>
-	</resource-ref>
+    <servlet-mapping>
+        <servlet-name>RssFeedServlet</servlet-name>
+        <url-pattern>/feeds/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>RepositoryServlet</servlet-name>
+        <url-pattern>/repository/*</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>XmlRpcServlet</servlet-name>
+        <url-pattern>/xmlrpc</url-pattern>
+    </servlet-mapping>
+
+    <resource-ref>
+        <res-ref-name>jdbc/users</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+    <resource-ref>
+        <res-ref-name>jdbc/archiva</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+    <resource-ref>
+        <res-ref-name>mail/Session</res-ref-name>
+        <res-type>javax.mail.Session</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
 
 </web-app>



Mime
View raw message