]> source.dussan.org Git - archiva.git/commitdiff
Adapting the web modules to the new repository api
authorMartin Stockhammer <martin_s@apache.org>
Wed, 1 Nov 2017 14:39:07 +0000 (15:39 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Wed, 1 Nov 2017 14:39:07 +0000 (15:39 +0100)
38 files changed:
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml

index fd293fa26e01289e77b645d2b6c66e8f3dddbf57..c3c8a2f99e2c0e49da45b58275de1291575b5356 100644 (file)
@@ -55,7 +55,6 @@
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-configuration</artifactId>
-      <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
index 30890246be8da2a931bb1e790c13b67afed27d92..4dacc86ff8f03cda90d5da266c1f63653f20ce7d 100644 (file)
@@ -37,8 +37,11 @@ import org.apache.archiva.redback.configuration.UserConfigurationKeys;
 import org.apache.archiva.redback.rest.services.RedbackAuthenticationThreadLocal;
 import org.apache.archiva.redback.rest.services.RedbackRequestInformation;
 import org.apache.archiva.redback.users.User;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.ManagedRepositoryContent;
 import org.apache.archiva.repository.RepositoryContentFactory;
 import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.events.AuditListener;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.services.utils.ArtifactBuilder;
@@ -98,6 +101,9 @@ public abstract class AbstractRestService
     @Inject
     protected ManagedRepositoryAdmin managedRepositoryAdmin;
 
+    @Inject
+    protected RepositoryRegistry repositoryRegistry;
+
     @Inject
     protected RepositoryContentFactory repositoryContentFactory;
 
@@ -322,10 +328,14 @@ public abstract class AbstractRestService
                     if ( repoId == null ) {
                         throw new IllegalStateException( "Repository Id is null" );
                     }
-
+                    ManagedRepository repo = repositoryRegistry.getManagedRepository( repoId );
+                    if (repo==null) {
+                        throw new RepositoryException( "Repository not found "+repoId );
+                    }
+                    ManagedRepositoryContent content = repo.getContent( );
                     ArtifactBuilder builder =
                         new ArtifactBuilder().forArtifactMetadata( artifact ).withManagedRepositoryContent(
-                            repositoryContentFactory.getManagedRepositoryContent( repoId ) );
+                            content );
                     Artifact art = builder.build();
                     art.setUrl( getArtifactUrl( art, repositoryId ) );
                     artifacts.add( art );
index aad3f287d8cc873536370f9c67e6ffcd45b52eb9..2a87462aaf02c32b8575ddb8a352e31dcd69e548 100644 (file)
@@ -42,6 +42,7 @@ import org.apache.archiva.repository.ManagedRepositoryContent;
 import org.apache.archiva.repository.RepositoryContentFactory;
 import org.apache.archiva.repository.RepositoryException;
 import org.apache.archiva.repository.RepositoryNotFoundException;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.metadata.MetadataTools;
 import org.apache.archiva.rest.api.model.*;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
@@ -82,9 +83,6 @@ public class DefaultBrowseService
     @Inject
     private DependencyTreeBuilder dependencyTreeBuilder;
 
-    @Inject
-    private RepositoryContentFactory repositoryContentFactory;
-
     @Inject
     @Named( value = "repositoryProxyConnectors#default" )
     private RepositoryProxyConnectors connectors;
@@ -93,6 +91,15 @@ public class DefaultBrowseService
     @Named( value = "browse#versionMetadata" )
     private Cache<String, ProjectVersionMetadata> versionMetadataCache;
 
+    private ManagedRepositoryContent getManagedRepositoryContent(String id) throws RepositoryException
+    {
+        org.apache.archiva.repository.ManagedRepository repo = repositoryRegistry.getManagedRepository( id );
+        if (repo==null) {
+            throw new RepositoryException( "Could not find repository "+id );
+        }
+        return repo.getContent();
+    }
+
     @Override
     public BrowseResult getRootGroups( String repositoryId )
         throws ArchivaRestServiceException
@@ -687,7 +694,7 @@ public class DefaultBrowseService
             {
 
                 ManagedRepositoryContent managedRepositoryContent =
-                    repositoryContentFactory.getManagedRepositoryContent( repoId );
+                    getManagedRepositoryContent( repoId );
                 ArchivaArtifact archivaArtifact = new ArchivaArtifact( groupId, artifactId, version, classifier,
                                                                        StringUtils.isEmpty( type ) ? "jar" : type,
                                                                        repoId );
@@ -763,8 +770,16 @@ public class DefaultBrowseService
             for ( String repoId : selectedRepos )
             {
 
-                ManagedRepositoryContent managedRepositoryContent =
-                    repositoryContentFactory.getManagedRepositoryContent( repoId );
+                ManagedRepositoryContent managedRepositoryContent = null;
+                try
+                {
+                    managedRepositoryContent = getManagedRepositoryContent( repoId );
+                }
+                catch ( RepositoryException e )
+                {
+                    log.error("No repository content found for "+repoId);
+                    continue;
+                }
                 ArchivaArtifact archivaArtifact = new ArchivaArtifact( groupId, artifactId, version, classifier,
                                                                        StringUtils.isEmpty( type ) ? "jar" : type,
                                                                        repoId );
@@ -797,18 +812,6 @@ public class DefaultBrowseService
             throw new ArchivaRestServiceException( e.getMessage(),
                                                    Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
-        catch ( RepositoryNotFoundException e )
-        {
-            log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
-        }
-        catch ( RepositoryException e )
-        {
-            log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
-        }
         log.debug( "artifact: {}:{}:{}:{}:{} not found", groupId, artifactId, version, classifier, type );
         // 404 ?
         return new ArtifactContent();
@@ -835,8 +838,8 @@ public class DefaultBrowseService
                 {
                     continue;
                 }
-                ManagedRepositoryContent managedRepositoryContent =
-                    repositoryContentFactory.getManagedRepositoryContent( repoId );
+                ManagedRepositoryContent managedRepositoryContent = getManagedRepositoryContent( repoId );
+
                 // FIXME default to jar which can be wrong for war zip etc....
                 ArchivaArtifact archivaArtifact = new ArchivaArtifact( groupId, artifactId, version,
                                                                        StringUtils.isEmpty( classifier )
index 697cadc60110b86549a444c194dd89763c20980c..155546d4a0b396370c2ae29a4c0852888c63c215 100644 (file)
@@ -48,6 +48,7 @@ import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.UserManagerException;
 import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.repository.*;
+import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.archiva.repository.metadata.MetadataTools;
 import org.apache.archiva.repository.metadata.RepositoryMetadataException;
@@ -101,6 +102,9 @@ public class DefaultRepositoriesService
     @Named(value = "taskExecutor#indexing")
     private ArchivaIndexingTaskExecutor archivaIndexingTaskExecutor;
 
+    @Inject
+    private RepositoryRegistry repositoryRegistry;
+
     @Inject
     private ManagedRepositoryAdmin managedRepositoryAdmin;
 
@@ -110,9 +114,6 @@ public class DefaultRepositoriesService
     @Inject
     private SecuritySystem securitySystem;
 
-    @Inject
-    private RepositoryContentFactory repositoryFactory;
-
     @Inject
     @Named(value = "archivaTaskScheduler#repository")
     private ArchivaTaskScheduler scheduler;
@@ -180,6 +181,15 @@ public class DefaultRepositoriesService
         }
     }
 
+    private ManagedRepositoryContent getManagedRepositoryContent(String id) throws RepositoryException
+    {
+        org.apache.archiva.repository.ManagedRepository repo = repositoryRegistry.getManagedRepository( id );
+        if (repo==null) {
+            throw new RepositoryException( "Repository not found "+id );
+        }
+        return repo.getContent();
+    }
+
     @Override
     public Boolean scanRepositoryNow( String repositoryId, boolean fullScan )
         throws ArchivaRestServiceException
@@ -187,7 +197,8 @@ public class DefaultRepositoriesService
 
         try
         {
-            ManagedRepository repository = managedRepositoryAdmin.getManagedRepository( repositoryId );
+
+            org.apache.archiva.repository.ManagedRepository repository = repositoryRegistry.getManagedRepository( repositoryId );
 
             IndexingContext context = managedRepositoryAdmin.createIndexContext( repository );
 
@@ -367,7 +378,7 @@ public class DefaultRepositoriesService
         {
 
             ManagedRepositoryContent sourceRepository =
-                repositoryFactory.getManagedRepositoryContent( artifactTransferRequest.getRepositoryId() );
+                getManagedRepositoryContent( artifactTransferRequest.getRepositoryId() );
 
             String artifactSourcePath = sourceRepository.toPath( artifactReference );
 
@@ -388,7 +399,7 @@ public class DefaultRepositoriesService
             }
 
             ManagedRepositoryContent targetRepository =
-                repositoryFactory.getManagedRepositoryContent( artifactTransferRequest.getTargetRepositoryId() );
+                getManagedRepositoryContent( artifactTransferRequest.getTargetRepositoryId() );
 
             String artifactPath = targetRepository.toPath( artifactReference );
 
@@ -646,7 +657,7 @@ public class DefaultRepositoriesService
 
         try
         {
-            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
+            ManagedRepositoryContent repository = getManagedRepositoryContent( repositoryId );
 
             VersionedReference ref = new VersionedReference();
             ref.setArtifactId( projectId );
@@ -767,7 +778,7 @@ public class DefaultRepositoriesService
             ref.setGroupId( artifact.getGroupId() );
             ref.setVersion( artifact.getVersion() );
 
-            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
+            ManagedRepositoryContent repository = getManagedRepositoryContent( repositoryId );
 
             ArtifactReference artifactReference = new ArtifactReference();
             artifactReference.setArtifactId( artifact.getArtifactId() );
@@ -977,7 +988,7 @@ public class DefaultRepositoriesService
 
         try
         {
-            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
+            ManagedRepositoryContent repository = getManagedRepositoryContent( repositoryId );
 
             repository.deleteGroupId( groupId );
 
@@ -1038,7 +1049,7 @@ public class DefaultRepositoriesService
 
         try
         {
-            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
+            ManagedRepositoryContent repository = getManagedRepositoryContent( repositoryId );
 
             repository.deleteProject( groupId, projectId );
         }
@@ -1100,18 +1111,13 @@ public class DefaultRepositoriesService
         long sinceWhen = RepositoryScanner.FRESH_SCAN;
         try
         {
-            return repoScanner.scan( getManagedRepositoryAdmin().getManagedRepository( repositoryId ), sinceWhen );
+            return repoScanner.scan( repositoryRegistry.getManagedRepository( repositoryId ), sinceWhen );
         }
         catch ( RepositoryScannerException e )
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e );
         }
-        catch ( RepositoryAdminException e )
-        {
-            log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e );
-        }
     }
 
     /**
@@ -1191,16 +1197,6 @@ public class DefaultRepositoriesService
         this.managedRepositoryAdmin = managedRepositoryAdmin;
     }
 
-    public RepositoryContentFactory getRepositoryFactory()
-    {
-        return repositoryFactory;
-    }
-
-    public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
-    {
-        this.repositoryFactory = repositoryFactory;
-    }
-
     public RepositorySessionFactory getRepositorySessionFactory()
     {
         return repositorySessionFactory;
index 89663e1b6d5123dc356e7a21b0a72a7af610a06c..ab49702616b72183bd328aa30a96b62078804bd5 100644 (file)
@@ -18,6 +18,8 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.redback.components.cache.Cache;
 import org.apache.archiva.redback.components.cache.CacheStatistics;
 import org.apache.archiva.redback.components.taskqueue.TaskQueue;
@@ -57,6 +59,8 @@ public class DefaultSystemStatusService
 
     private RepositoryScanner scanner;
 
+    ManagedRepositoryAdmin managedRepositoryAdmin;
+
     // display spring scheduled
     //@Inject @Named (value="springScheduler");
 
@@ -69,6 +73,8 @@ public class DefaultSystemStatusService
         queues = getBeansOfType( applicationContext, TaskQueue.class );
 
         caches = getBeansOfType( applicationContext, Cache.class );
+
+        managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
     }
 
     @Override
@@ -178,11 +184,19 @@ public class DefaultSystemStatusService
         List<RepositoryScannerStatistics> repositoryScannerStatisticsList =
             new ArrayList<RepositoryScannerStatistics>( repositoryScannerInstances.size() );
 
+
         for ( RepositoryScannerInstance instance : repositoryScannerInstances )
         {
             RepositoryScannerStatistics repositoryScannerStatistics = new RepositoryScannerStatistics();
             repositoryScannerStatisticsList.add( repositoryScannerStatistics );
-            repositoryScannerStatistics.setManagedRepository( instance.getRepository() );
+            try
+            {
+                repositoryScannerStatistics.setManagedRepository( managedRepositoryAdmin.getManagedRepository( instance.getRepository().getId())  );
+            }
+            catch ( RepositoryAdminException e )
+            {
+                log.error("Could not retrieve repository '{}'", instance.getRepository().getId());
+            }
             repositoryScannerStatistics.setNewFileCount( instance.getStats().getNewFileCount() );
             repositoryScannerStatistics.setTotalFileCount( instance.getStats().getTotalFileCount() );
             repositoryScannerStatistics.setConsumerScanningStatistics( mapConsumerScanningStatistics( instance ) );
index 22e599b757de73255c76e6d2030bad72c7a09fee..c055aeeec32b26e2c9d80afee735c06a9a9d62bd 100644 (file)
@@ -43,6 +43,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.Date;
+import java.util.Locale;
 
 /**
  * @author Olivier Lamy
@@ -320,7 +321,7 @@ public abstract class AbstractArchivaRestTest
     protected ManagedRepository getTestManagedRepository()
     {
         String location = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-repo" ).toAbsolutePath().toString();
-        return new ManagedRepository( "TEST", "test", location, "default", true, true, false, "2 * * * * ?", null,
+        return new ManagedRepository( Locale.getDefault(),  "TEST", "test", location, "default", true, true, false, "2 * * * * ?", null,
                                       false, 2, 3, true, false, "my nice repo", false );
 
     }
@@ -429,7 +430,7 @@ public abstract class AbstractArchivaRestTest
             getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( testRepoId, false );
         }
 
-        ManagedRepository managedRepository = new ManagedRepository();
+        ManagedRepository managedRepository = new ManagedRepository(Locale.getDefault());
         managedRepository.setId( testRepoId );
         managedRepository.setName( "test repo" );
 
index d3d66728338ee3228078f562decfc47828a9e21c..77605ed28279cf8444cb0f55b6922a4a0c9caf2d 100644 (file)
@@ -26,6 +26,7 @@ import org.junit.Test;
 
 import javax.ws.rs.ForbiddenException;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * @author Olivier Lamy
@@ -201,21 +202,21 @@ public class RemoteRepositoriesServiceTest
 
     RemoteRepository getRemoteRepository()
     {
-        return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120,
+        return new RemoteRepository( Locale.getDefault( ), "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120,
                                      "cool repo" );
     }
 
 
     RemoteRepository getRemoteMavenRepository()
     {
-        return new RemoteRepository( "id-maven1", "Maven1", "http://repo.maven.apache.org/maven2", "default", "foo", "foopassword", 120,
+        return new RemoteRepository( Locale.getDefault( ),"id-maven1", "Maven1", "http://repo.maven.apache.org/maven2", "default", "foo", "foopassword", 120,
                 "cool repo3" );
     }
 
 
     RemoteRepository getRemoteOracleRepository()
     {
-        return new RemoteRepository( "id-oracle", "Oracle", "http://download.oracle.com/maven", "default", "foo", "foopassword", 120,
+        return new RemoteRepository( Locale.getDefault( ),"id-oracle", "Oracle", "http://download.oracle.com/maven", "default", "foo", "foopassword", 120,
                 "cool repo4" );
     }
 
index 934bfc693384842a694229dc8747f48dc8728495..de7df457f90687034c6a916d09cc054e148f01b0 100644 (file)
@@ -37,6 +37,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
+import java.util.Locale;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -544,7 +545,7 @@ public class RepositoriesServiceTest
     protected ManagedRepository getTestManagedRepository( String id, String path )
     {
         String location = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/" + path ).toAbsolutePath().toString();
-        return new ManagedRepository( id, id, location, "default", true, true, true, "2 * * * * ?", null, false, 80, 80,
+        return new ManagedRepository( Locale.getDefault(), id, id, location, "default", true, true, true, "2 * * * * ?", null, false, 80, 80,
                                       true, false );
     }
 
index 8e0df07c12a16c5c55e3d0f02948c951f109ca28..d77b8453a5505df27ba8e250018d097c2b114352 100644 (file)
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils,org.apache.archiva.repository.content.maven2"/>
+  
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index 0d61740c320eaa58d20addc9b1b12975efd4bef4..25b0ed67d776444751287d41da535dca6a916c45 100644 (file)
@@ -32,6 +32,7 @@ import org.apache.archiva.redback.system.SecuritySystem;
 import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.UserManager;
 import org.apache.archiva.redback.users.UserManagerException;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.io.FileUtils;
@@ -79,6 +80,9 @@ public abstract class AbstractSecurityTest
     @Named(value = "archivaConfiguration#default")
     private ArchivaConfiguration archivaConfiguration;
 
+    @Inject
+    private RepositoryRegistry repositoryRegistry;
+
     @Inject
     protected UserRepositories userRepos;
 
@@ -94,6 +98,7 @@ public abstract class AbstractSecurityTest
         {
             archivaConfiguration.getConfiguration().addManagedRepository( repoConfig );
         }
+        repositoryRegistry.reload();
 
         // Add repo roles to security.
         userRepos.createMissingRepositoryRoles( repoId );
index d513a3539e298cfbb924825a1fd40f494242e96b..9480019a03ae3427724738ec6de053b3c1940aa4 100644 (file)
@@ -156,7 +156,7 @@ public class MockBeanServices
     }
 
     @Override
-    public String getFilePath( String requestPath, ManagedRepository managedRepository )
+    public String getFilePath( String requestPath, org.apache.archiva.repository.ManagedRepository managedRepository )
     {
         return null;
     }
index 696514868fb6ce9db6e6104b7df6e868aa5ad916..fcc22aeccce2cd6539a111f048b4baa3790f806c 100644 (file)
@@ -27,6 +27,9 @@
             http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
        default-lazy-init="true">
 
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+
   <bean name="securitySystem#testable" class="org.apache.archiva.redback.system.DefaultSecuritySystem">
     <property name="userManager" ref="userManager#memory"/>
     <property name="keyManager" ref="keyManager#memory"/>
index e3981bcbdf2e171a7bb33751943bb4388062f46a..f51795786837bf7fec3f60919259813c33284621 100644 (file)
@@ -18,10 +18,10 @@ package org.apache.archiva.web.mocks;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.ConsumerMonitor;
 import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.archiva.repository.ManagedRepository;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
index 666d997b8ff4e9458d2d6da0850d369ef816c7af..bbaf02df289d28a2fcbbd611e45a99ac31c80474 100644 (file)
@@ -84,7 +84,7 @@ index.directory=Index Directory
 retentionCount=Retention Count
 snapshots=Snapshots
 blockRedeployments=Block Redeployments
-retentionTime=Days Older
+retentionPeriod=Days Older
 cronExpression=Cron Expression
 cronExpression.help.title=Cron Expression Format
 cronExpression.help.content= Quartz cron is used. Documentation is: <a target="_blank" href="http://quartz-scheduler.org/documentation/quartz-2.1.x/cookbook/">here</a>
@@ -129,8 +129,8 @@ managedRepository.location.help.title=Location
 managedRepository.location.help.content=Location on File System (can be relative to Archiva base directory or absolute path)
 managedRepository.indexDirectory.help.title=Index Directory
 managedRepository.indexDirectory.help.content=Path to the Maven Index directory
-managedRepository.retentionTime.help.title=Days Older
-managedRepository.retentionTime.help.content=For snapshots repositories, maximum file days age you want to keep
+managedRepository.retentionPeriod.help.title=Days Older
+managedRepository.retentionPeriod.help.content=For snapshots repositories, maximum file days age you want to keep
 managedRepository.retentionCount.help.title=Retention Count
 managedRepository.retentionCount.help.content=For snapshots repositories, maximum of files you want to keep.
 managedRepository.description.help.content=A free description for your repository
index 94a048f3c7b4e5a5781fe0c2c8d48925d0abc5de..beedae587052eed35a01fbbba6bee7ca93f322c5 100644 (file)
@@ -34,6 +34,7 @@ import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Locale;
 
 /**
  * @author Olivier Lamy
@@ -88,7 +89,7 @@ public class DownloadArtifactFromQueryTest
             FileUtils.deleteDirectory( tmpIndexDir.toFile() );
         }
         String id = Long.toString( System.currentTimeMillis() );
-        ManagedRepository managedRepository = new ManagedRepository();
+        ManagedRepository managedRepository = new ManagedRepository( Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" );
index 0d0bbab8318eb1d5a817033e478102383948d150..95f56ab1dad2a5556f07175a41f8eb4bd54b9f33 100644 (file)
@@ -39,6 +39,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -92,7 +93,7 @@ public class DownloadMergedIndexNonDefaultPathTest
             org.apache.archiva.common.utils.FileUtils.deleteDirectory( tmpIndexDir );
         }
         String id = Long.toString( System.currentTimeMillis() );
-        ManagedRepository managedRepository = new ManagedRepository();
+        ManagedRepository managedRepository = new ManagedRepository( Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" );
@@ -138,7 +139,7 @@ public class DownloadMergedIndexNonDefaultPathTest
 
         // create a repo with a remote on the one with index
         id = Long.toString( System.currentTimeMillis() );
-        managedRepository = new ManagedRepository();
+        managedRepository = new ManagedRepository(Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" );
@@ -153,7 +154,7 @@ public class DownloadMergedIndexNonDefaultPathTest
 
         String remoteId = Long.toString( System.currentTimeMillis() );
 
-        RemoteRepository remoteRepository = new RemoteRepository();
+        RemoteRepository remoteRepository = new RemoteRepository(Locale.getDefault());
         remoteRepository.setId( remoteId );
         remoteRepository.setName( remoteId );
         remoteRepository.setDownloadRemoteIndex( true );
index c5cf891c9a578aca162d0d731adb83434dc75913..f870d42f672e07fb4523d3f4a3e2c6ad3fd7d76e 100644 (file)
@@ -41,6 +41,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -98,7 +99,7 @@ public class DownloadMergedIndexTest
             FileUtils.deleteDirectory( tmpIndexDir.toFile() );
         }
         String id = Long.toString( System.currentTimeMillis() );
-        ManagedRepository managedRepository = new ManagedRepository();
+        ManagedRepository managedRepository = new ManagedRepository( Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" );
@@ -142,7 +143,7 @@ public class DownloadMergedIndexTest
 
         // create a repo with a remote on the one with index
         id = Long.toString( System.currentTimeMillis() );
-        managedRepository = new ManagedRepository();
+        managedRepository = new ManagedRepository(Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" );
@@ -155,7 +156,7 @@ public class DownloadMergedIndexTest
 
         getManagedRepositoriesService().addManagedRepository( managedRepository );
 
-        RemoteRepository remoteRepository = new RemoteRepository();
+        RemoteRepository remoteRepository = new RemoteRepository(Locale.getDefault());
         remoteRepository.setId( "all-merged" );
         remoteRepository.setName( "all-merged" );
         remoteRepository.setDownloadRemoteIndex( true );
index f5913b7d43cacc8bc38dc932516164254e89fa7a..024e1b855eb70a58b8d9cbcfa43c96f5ae7426b6 100644 (file)
@@ -38,6 +38,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
+import java.util.Locale;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
@@ -82,7 +83,7 @@ public class DownloadSnapshotTest
             org.apache.archiva.common.utils.FileUtils.deleteDirectory( tmpIndexDir );
         }
         String id = Long.toString( System.currentTimeMillis() );
-        ManagedRepository managedRepository = new ManagedRepository();
+        ManagedRepository managedRepository = new ManagedRepository( Locale.getDefault());
         managedRepository.setId( id );
         managedRepository.setName( "name of " + id );
         managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/snapshot-repo" );
index 256a9be503c0188bdeba998990521662ba0ea4e4..e9d156c2e6874cc7fd94543fa304518dfc83c582 100644 (file)
@@ -36,6 +36,7 @@ import org.junit.Test;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Locale;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -184,7 +185,7 @@ public class RemoteRepositoryConnectivityCheckTest
 
     RemoteRepository getRemoteRepository()
     {
-        return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120,
+        return new RemoteRepository( Locale.getDefault( ), "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120,
                                      "cool repo" );
     }
 
index 570eeb588035f3157b39563acdf98d1af3b5ae9c..cdec7b4fe19858f8061db45c94c25fdc1f6006b2 100644 (file)
 
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
 
+  <context:component-scan base-package="org.apache.archiva.repository.content.maven2" />
+  
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+
   <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
     <property name="properties">
       <value>
index 7a06a884d1a8c5e3c871a3ba1cf6676a44408d77..7388de11deddd3d562e7bbd24fbc19e254a85719 100644 (file)
        default-lazy-init="true">
 
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
+  <context:component-scan base-package="org.apache.archiva.repository.content.maven2" />
+
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
 
 
   <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
index 5f9f77153e7990b096db4ecbfffca611bf56eae8..e35f0ac7aaa73973534b937ed1c6a5ec94924dfa 100644 (file)
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.webtest.memory"/>
+  <context:component-scan base-package="org.apache.archiva.webtest.memory,org.apache.archiva.repository.content.maven2"/>
+
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+
 
   <alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
 
index d62446b45286b0daa887fb98b1209dce779f60a5..d7083d210dce04cc5ede4ca89d8c1c3f7c27d0a8 100644 (file)
@@ -29,7 +29,9 @@
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.rest.services.utils,org.apache.archiva.repository.content.maven2"/>
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index f29dbcb16dc2a23a9c8341a014a0486838aa7b8f..7eb96452ca133d8406656eaf8124ff666bf987c9 100644 (file)
   </bean>
   -->
 
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
+
+
   <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
 
   <bean name="TestRepositorySessionFactoryBean" class="org.apache.archiva.TestRepositorySessionFactoryBean">
index 0e703723051171aa018c14b8fb85489f01909b5b..b169712cfdbaabe3f3a634f0840f9b7b6657856e 100644 (file)
@@ -32,7 +32,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
             ];
 
   ManagedRepository=function(id,name,layout,indexDirectory,location,snapshots,releases,blockRedeployments,cronExpression,
-                             scanned,retentionTime,retentionCount,deleteReleasedSnapshots,stageRepoNeeded,description,
+                             scanned,retentionPeriod,retentionCount,deleteReleasedSnapshots,stageRepoNeeded,description,
                              skipPackedIndexCreation,feedsUrl,url){
 
     var self=this;
@@ -63,9 +63,9 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
 
     //private ManagedRepository stagingRepository;
 
-    //private int retentionTime = 100;
-    this.retentionTime=ko.observable(retentionTime);
-    this.retentionTime.subscribe(function(newValue){self.modified(true)});
+    //private int retentionPeriod = 100;
+    this.retentionPeriod=ko.observable(retentionPeriod);
+    this.retentionPeriod.subscribe(function(newValue){self.modified(true)});
 
     //private int retentionCount = 2;
     this.retentionCount=ko.observable(retentionCount);
@@ -167,7 +167,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
     return new ManagedRepository(data.id,data.name,data.layout,data.indexDirectory,data.location,data.snapshots
                                  ,data.releases,
                                  data.blockRedeployments,data.cronExpression,
-                                 data.scanned,data.retentionTime,data.retentionCount,data.deleteReleasedSnapshots,
+                                 data.scanned,data.retentionPeriod,data.retentionCount,data.deleteReleasedSnapshots,
                                  data.stageRepoNeeded,data.description,data.skipPackedIndexCreation);
   }
 
index 5629b5553e4adb241945782e8228a21c0cafb19e..17735c66dab69e51033923aaa7d41678bd879205 100644 (file)
         </div>
       </div>
       <div class="control-group">
-        <label class="control-label" for="retentionTime">${$.i18n.prop('retentionTime')}</label>
+        <label class="control-label" for="retentionPeriod">${$.i18n.prop('retentionPeriod')}</label>
 
         <div class="controls">
-          <input type="text" id="retentionTime" class="digits" name="retentionTime" size="5"
-                 data-bind="value: managedRepository.retentionTime"/>
-          <a class="btn btn-warning btn-mini popover-doc" id="managedRepository-retentionTime-info-button"
-             data-original-title="${$.i18n.prop('managedRepository.retentionTime.help.title')}"
-             data-content="${$.i18n.prop('managedRepository.retentionTime.help.content')}">
+          <input type="text" id="retentionPeriod" class="digits" name="retentionPeriod" size="5"
+                 data-bind="value: managedRepository.retentionPeriod"/>
+          <a class="btn btn-warning btn-mini popover-doc" id="managedRepository-retentionPeriod-info-button"
+             data-original-title="${$.i18n.prop('managedRepository.retentionPeriod.help.title')}"
+             data-content="${$.i18n.prop('managedRepository.retentionPeriod.help.content')}">
             <i class="icon-question-sign icon-white"></i>
           </a>
         </div>
         <label class="control-label" for="timeout">${$.i18n.prop('timeout')}</label>
 
         <div class="controls">
-          <input type="text" id="timeout" class="digits" name="retentionTime" size="5"
+          <input type="text" id="timeout" class="digits" name="retentionPeriod" size="5"
                  data-bind="value: remoteRepository.timeout"/>
           <a class="btn btn-warning btn-mini popover-doc" id="remoteRepository-timeout-info-button"
              data-original-title="${$.i18n.prop('remoteRepository.timeout.help.title')}"
index b152e8980db0416d5ae40721e03ce8a00aedb251..c13f03939c1f5f123b2a725116c7c15bbe2b8875 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.archiva.webdav;
  * under the License.
  */
 
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.filelock.FileLockException;
 import org.apache.archiva.common.filelock.FileLockManager;
 import org.apache.archiva.common.filelock.FileLockTimeoutException;
@@ -35,11 +34,28 @@ import org.apache.archiva.webdav.util.MimeTypes;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.webdav.DavResourceFactory;
+import org.apache.jackrabbit.webdav.DavResourceIterator;
+import org.apache.jackrabbit.webdav.DavResourceIteratorImpl;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavSession;
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
 import org.apache.jackrabbit.webdav.io.InputContext;
 import org.apache.jackrabbit.webdav.io.OutputContext;
-import org.apache.jackrabbit.webdav.lock.*;
-import org.apache.jackrabbit.webdav.property.*;
+import org.apache.jackrabbit.webdav.lock.ActiveLock;
+import org.apache.jackrabbit.webdav.lock.LockInfo;
+import org.apache.jackrabbit.webdav.lock.LockManager;
+import org.apache.jackrabbit.webdav.lock.Scope;
+import org.apache.jackrabbit.webdav.lock.Type;
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
+import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
+import org.apache.jackrabbit.webdav.property.ResourceType;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.ISODateTimeFormat;
@@ -80,7 +96,7 @@ public class ArchivaDavResource
 
     private String remoteAddr;
 
-    private final ManagedRepository repository;
+    private final org.apache.archiva.repository.ManagedRepository repository;
 
     private final MimeTypes mimeTypes;
 
@@ -96,7 +112,7 @@ public class ArchivaDavResource
 
     private Logger log = LoggerFactory.getLogger( ArchivaDavResource.class );
 
-    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepository repository,
+    public ArchivaDavResource( String localResource, String logicalResource, org.apache.archiva.repository.ManagedRepository repository,
                                DavSession session, ArchivaDavResourceLocator locator, DavResourceFactory factory,
                                MimeTypes mimeTypes, List<AuditListener> auditListeners,
                                RepositoryArchivaTaskScheduler scheduler, FileLockManager fileLockManager )
@@ -117,7 +133,7 @@ public class ArchivaDavResource
         this.fileLockManager = fileLockManager;
     }
 
-    public ArchivaDavResource( String localResource, String logicalResource, ManagedRepository repository,
+    public ArchivaDavResource( String localResource, String logicalResource, org.apache.archiva.repository.ManagedRepository repository,
                                String remoteAddr, String principal, DavSession session,
                                ArchivaDavResourceLocator locator, DavResourceFactory factory, MimeTypes mimeTypes,
                                List<AuditListener> auditListeners, RepositoryArchivaTaskScheduler scheduler,
index 1f5e0be5e125ad0aac085471caae76db65898f34..6774e85580ad72f3173d70ab9187c9ef6721f8df 100644 (file)
@@ -20,7 +20,6 @@ package org.apache.archiva.webdav;
  */
 
 import org.apache.archiva.admin.model.RepositoryAdminException;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.beans.RemoteRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
@@ -32,7 +31,12 @@ import org.apache.archiva.common.utils.PathUtil;
 import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.indexer.merger.*;
+import org.apache.archiva.indexer.merger.IndexMerger;
+import org.apache.archiva.indexer.merger.IndexMergerException;
+import org.apache.archiva.indexer.merger.IndexMergerRequest;
+import org.apache.archiva.indexer.merger.MergedRemoteIndexesTask;
+import org.apache.archiva.indexer.merger.MergedRemoteIndexesTaskRequest;
+import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
 import org.apache.archiva.indexer.search.RepositorySearch;
 import org.apache.archiva.maven2.metadata.MavenMetadataReader;
 import org.apache.archiva.metadata.model.facets.AuditEvent;
@@ -52,12 +56,16 @@ import org.apache.archiva.redback.policy.MustChangePasswordException;
 import org.apache.archiva.redback.system.SecuritySession;
 import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.ReleaseScheme;
 import org.apache.archiva.repository.RepositoryContentFactory;
 import org.apache.archiva.repository.RepositoryException;
 import org.apache.archiva.repository.RepositoryNotFoundException;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.content.maven2.RepositoryRequest;
 import org.apache.archiva.repository.events.AuditListener;
+import org.apache.archiva.repository.features.IndexCreationFeature;
 import org.apache.archiva.repository.layout.LayoutException;
 import org.apache.archiva.repository.metadata.MetadataTools;
 import org.apache.archiva.repository.metadata.RepositoryMetadataException;
@@ -72,7 +80,13 @@ import org.apache.archiva.xml.XMLException;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.SystemUtils;
-import org.apache.jackrabbit.webdav.*;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.webdav.DavResourceFactory;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+import org.apache.jackrabbit.webdav.DavServletRequest;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavSession;
 import org.apache.jackrabbit.webdav.lock.LockManager;
 import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
 import org.apache.maven.index.context.IndexingContext;
@@ -94,7 +108,13 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  *
@@ -142,6 +162,9 @@ public class ArchivaDavResourceFactory
     @Inject
     private ManagedRepositoryAdmin managedRepositoryAdmin;
 
+    @Inject
+    private RepositoryRegistry repositoryRegistry;
+
     @Inject
     private IndexMerger indexMerger;
 
@@ -283,40 +306,28 @@ public class ArchivaDavResourceFactory
                            archivaLocator.getRepositoryId(), e.getMessage() );
             }
 
-            ManagedRepositoryContent managedRepositoryContent = null;
 
-            try
-            {
-                managedRepositoryContent =
-                    repositoryFactory.getManagedRepositoryContent( archivaLocator.getRepositoryId() );
-            }
-            catch ( RepositoryNotFoundException e )
-            {
+            ManagedRepository repo = repositoryRegistry.getManagedRepository( archivaLocator.getRepositoryId() );
+            if (repo==null) {
                 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
-                                        "Invalid repository: " + archivaLocator.getRepositoryId() );
+                    "Invalid repository: " + archivaLocator.getRepositoryId() );
             }
-            catch ( RepositoryException e )
-            {
-                throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+            ManagedRepositoryContent managedRepositoryContent = repo.getContent( );
+            if (managedRepositoryContent==null) {
+                log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
+                throw new DavException( HttpServletResponse.SC_NOT_FOUND,
+                    "Invalid repository: " + archivaLocator.getRepositoryId() );
             }
 
             log.debug( "Managed repository '{}' accessed by '{}'", managedRepositoryContent.getId(), activePrincipal );
 
-            try
-            {
-                resource = processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
-                                              managedRepositoryAdmin.getManagedRepository(
-                                                  archivaLocator.getRepositoryId() ) );
+            resource = processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
+                                          repo);
 
-                String logicalResource = getLogicalResource( archivaLocator, null, false );
-                resourcesInAbsolutePath.add(
-                    Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
+            String logicalResource = getLogicalResource( archivaLocator, null, false );
+            resourcesInAbsolutePath.add(
+                Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
 
-            }
-            catch ( RepositoryAdminException e )
-            {
-                throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
-            }
         }
 
         String requestedResource = request.getRequestURI();
@@ -457,22 +468,17 @@ public class ArchivaDavResourceFactory
             for ( String repositoryId : repositories )
             {
                 ManagedRepositoryContent managedRepositoryContent;
-                try
-                {
-                    managedRepositoryContent = repositoryFactory.getManagedRepositoryContent( repositoryId );
+                ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( repositoryId );
+                if (managedRepository==null) {
+                    throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository with id "+repositoryId );
                 }
-                catch ( RepositoryNotFoundException e )
-                {
-                    throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
-                }
-                catch ( RepositoryException e )
-                {
-                    throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+                managedRepositoryContent = managedRepository.getContent();
+                if (managedRepositoryContent==null) {
+                    log.error("Inconsistency detected. Repository content not found for '{}'",repositoryId);
+                    throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository content with id "+repositoryId );
                 }
-
                 try
                 {
-                    ManagedRepository managedRepository = managedRepositoryAdmin.getManagedRepository( repositoryId );
                     DavResource updatedResource =
                         processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
                                            managedRepository );
@@ -493,10 +499,6 @@ public class ArchivaDavResourceFactory
                 {
                     storedExceptions.add( e );
                 }
-                catch ( RepositoryAdminException e )
-                {
-                    storedExceptions.add( new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e ) );
-                }
             }
         }
         if ( resource == null )
@@ -522,12 +524,12 @@ public class ArchivaDavResourceFactory
         return resource;
     }
 
-    private String getLogicalResource( ArchivaDavResourceLocator archivaLocator, ManagedRepository managedRepository,
+    private String getLogicalResource( ArchivaDavResourceLocator archivaLocator, org.apache.archiva.repository.ManagedRepository managedRepository,
                                        boolean useOrigResourcePath )
     {
         // FIXME remove this hack
         // but currently managedRepository can be null in case of group
-        String layout = managedRepository == null ? new ManagedRepository().getLayout() : managedRepository.getLayout();
+        String layout = managedRepository == null ? "default" : managedRepository.getLayout();
         RepositoryStorage repositoryStorage =
             this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
         String path = repositoryStorage.getFilePath(
@@ -545,7 +547,7 @@ public class ArchivaDavResourceFactory
         throws DavException
     {
         String layout = managedRepositoryContent.getRepository() == null
-            ? new ManagedRepository().getLayout()
+            ? "default"
             : managedRepositoryContent.getRepository().getLayout();
         RepositoryStorage repositoryStorage =
             this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
@@ -570,7 +572,7 @@ public class ArchivaDavResourceFactory
 
     private DavResource processRepository( final DavServletRequest request, ArchivaDavResourceLocator archivaLocator,
                                            String activePrincipal, ManagedRepositoryContent managedRepositoryContent,
-                                           ManagedRepository managedRepository )
+                                           org.apache.archiva.repository.ManagedRepository managedRepository )
         throws DavException
     {
         DavResource resource = null;
@@ -659,7 +661,7 @@ public class ArchivaDavResourceFactory
 
                 // check if target repo is enabled for releases
                 // we suppose that release-artifacts can be deployed only to repos enabled for releases
-                if ( managedRepositoryContent.getRepository().isReleases() && !repositoryRequest.isMetadata(
+                if ( managedRepositoryContent.getRepository().getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE ) && !repositoryRequest.isMetadata(
                     resourcePath ) && !repositoryRequest.isSupportFile( resourcePath ) )
                 {
                     ArtifactReference artifact = null;
@@ -671,7 +673,7 @@ public class ArchivaDavResourceFactory
                         {
                             // check if artifact already exists and if artifact re-deployment to the repository is allowed
                             if ( managedRepositoryContent.hasContent( artifact )
-                                && managedRepositoryContent.getRepository().isBlockRedeployments() )
+                                && managedRepositoryContent.getRepository().blocksRedeployments())
                             {
                                 log.warn( "Overwriting released artifacts in repository '{}' is not allowed.",
                                           managedRepositoryContent.getId() );
@@ -727,41 +729,30 @@ public class ArchivaDavResourceFactory
         ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
 
         ManagedRepositoryContent managedRepositoryContent;
-        try
-        {
-            managedRepositoryContent =
-                repositoryFactory.getManagedRepositoryContent( archivaLocator.getRepositoryId() );
-        }
-        catch ( RepositoryNotFoundException e )
-        {
+        ManagedRepository repo = repositoryRegistry.getManagedRepository( archivaLocator.getRepositoryId( ) );
+        if (repo==null) {
             throw new DavException( HttpServletResponse.SC_NOT_FOUND,
-                                    "Invalid repository: " + archivaLocator.getRepositoryId() );
+                "Invalid repository: " + archivaLocator.getRepositoryId() );
         }
-        catch ( RepositoryException e )
-        {
-            throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+        managedRepositoryContent = repo.getContent();
+        if (managedRepositoryContent==null) {
+            log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
+            throw new DavException( HttpServletResponse.SC_NOT_FOUND,
+                "Invalid repository: " + archivaLocator.getRepositoryId() );
         }
 
         DavResource resource = null;
-        try
-        {
-            String logicalResource = getLogicalResource( archivaLocator, managedRepositoryAdmin.getManagedRepository(
-                archivaLocator.getRepositoryId() ), false );
-            if ( logicalResource.startsWith( "/" ) )
-            {
-                logicalResource = logicalResource.substring( 1 );
-            }
-            Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource );
-            resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource,
-                                               managedRepositoryContent.getRepository(), davSession, archivaLocator,
-                                               this, mimeTypes, auditListeners, scheduler, fileLockManager );
-
-            resource.addLockManager( lockManager );
-        }
-        catch ( RepositoryAdminException e )
+        String logicalResource = getLogicalResource( archivaLocator, repo, false );
+        if ( logicalResource.startsWith( "/" ) )
         {
-            throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+            logicalResource = logicalResource.substring( 1 );
         }
+        Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource );
+        resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource,
+                                           repo, davSession, archivaLocator,
+                                           this, mimeTypes, auditListeners, scheduler, fileLockManager );
+
+        resource.addLockManager( lockManager );
         return resource;
     }
 
@@ -1027,7 +1018,7 @@ public class ArchivaDavResourceFactory
         // FIXME add a method with group in the repository storage
         String firstRepoId = repositoryGroupConfiguration.getRepositories().get( 0 );
 
-        String path = getLogicalResource( locator, managedRepositoryAdmin.getManagedRepository( firstRepoId ), false );
+        String path = getLogicalResource( locator, repositoryRegistry.getManagedRepository( firstRepoId ), false );
         if ( path.startsWith( "/" ) )
         {
             path = path.substring( 1 );
@@ -1084,32 +1075,28 @@ public class ArchivaDavResourceFactory
                 for ( String repository : repositories )
                 {
                     ManagedRepositoryContent managedRepository = null;
-
-                    try
-                    {
-                        managedRepository = repositoryFactory.getManagedRepositoryContent( repository );
-                    }
-                    catch ( RepositoryNotFoundException e )
-                    {
+                    ManagedRepository repo = repositoryRegistry.getManagedRepository( repository );
+                    if (repo == null) {
                         throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                                                "Invalid managed repository <" + repository + ">: " + e.getMessage() );
+                            "Invalid managed repository <" + repository + ">");
                     }
-                    catch ( RepositoryException e )
-                    {
+                    managedRepository = repo.getContent();
+                    if (managedRepository==null) {
+                        log.error("Inconsistency detected. Repository content not found for '{}'",repository);
                         throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                                                "Invalid managed repository <" + repository + ">: " + e.getMessage() );
+                            "Invalid managed repository <" + repository + ">");
                     }
-
                     Path resourceFile = Paths.get( managedRepository.getRepoRoot(), logicalResource.getPath() );
                     if ( Files.exists(resourceFile) )
                     {
                         // in case of group displaying index directory doesn't have sense !!
-                        String repoIndexDirectory = managedRepository.getRepository().getIndexDirectory();
+                        IndexCreationFeature idf = managedRepository.getRepository().getFeature(IndexCreationFeature.class).get();
+                        String repoIndexDirectory = idf.getIndexPath().toString();
                         if ( StringUtils.isNotEmpty( repoIndexDirectory ) )
                         {
                             if ( !Paths.get( repoIndexDirectory ).isAbsolute() )
                             {
-                                repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation(),
+                                repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation() ).resolve(
                                                                StringUtils.isEmpty( repoIndexDirectory )
                                                                    ? ".indexer"
                                                                    : repoIndexDirectory ).toAbsolutePath().toString();
@@ -1117,7 +1104,7 @@ public class ArchivaDavResourceFactory
                         }
                         if ( StringUtils.isEmpty( repoIndexDirectory ) )
                         {
-                            repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation(),
+                            repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation() ).resolve(
                                                            ".indexer" ).toAbsolutePath().toString();
                         }
 
@@ -1460,4 +1447,14 @@ public class ArchivaDavResourceFactory
     {
         this.managedRepositoryAdmin = managedRepositoryAdmin;
     }
+
+    public RepositoryRegistry getRepositoryRegistry( )
+    {
+        return repositoryRegistry;
+    }
+
+    public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+    {
+        this.repositoryRegistry = repositoryRegistry;
+    }
 }
index 27a90360f048835a24865b071dfa3047d1953b08..24f2db36aaaa04b7f5b8a400cf680cb63dc8f041 100644 (file)
@@ -204,7 +204,7 @@ public class RepositoryServlet
 
         long end = System.currentTimeMillis();
 
-        log.info( "initServers done in {} ms", (end - start) );
+        log.debug( "initServers done in {} ms", (end - start) );
     }
 
     @Override
index 1fbe41751c88a2167557a1f20ba7fffffbe7408a..ce2d8510b767b1f25c04df7ea31dade5e5768284 100644 (file)
@@ -28,6 +28,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest;
 import org.apache.archiva.webdav.util.MavenIndexerCleaner;
@@ -99,6 +100,9 @@ public abstract class AbstractRepositoryServletTestCase
     @Inject
     protected ManagedRepositoryAdmin managedRepositoryAdmin;
 
+    @Inject
+    RepositoryRegistry repositoryRegistry;
+
     protected Logger log = LoggerFactory.getLogger( getClass() );
 
 
@@ -106,6 +110,7 @@ public abstract class AbstractRepositoryServletTestCase
         throws Exception
     {
         saveConfiguration( archivaConfiguration );
+        repositoryRegistry.reload();
     }
 
     @Before
@@ -135,6 +140,7 @@ public abstract class AbstractRepositoryServletTestCase
 
         config.addManagedRepository(
             createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal, true ) );
+        repositoryRegistry.reload();
 
         managedRepositoryAdmin.createIndexContext( managedRepositoryAdmin.getManagedRepository( REPOID_INTERNAL ) );
 
@@ -776,6 +782,7 @@ public abstract class AbstractRepositoryServletTestCase
     protected void saveConfiguration( ArchivaConfiguration archivaConfiguration )
         throws Exception
     {
+        repositoryRegistry.reload();
         archivaConfiguration.save( archivaConfiguration.getConfiguration() );
     }
 
index dbfbc1d0fe938bdf1b5bc7979dc95ab70d832260..ba1fdebd8f76d41590311a9edf8208a98d8a9da0 100644 (file)
@@ -34,8 +34,10 @@ import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.archiva.proxy.DefaultRepositoryProxyConnectors;
 import org.apache.archiva.proxy.model.ProxyFetchResult;
+import org.apache.archiva.repository.EditableManagedRepository;
 import org.apache.archiva.repository.ManagedRepositoryContent;
 import org.apache.archiva.repository.RepositoryContentFactory;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent;
 import org.apache.archiva.repository.content.maven2.RepositoryRequest;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
@@ -44,12 +46,15 @@ import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResourceLocator;
 import org.apache.jackrabbit.webdav.DavServletRequest;
 import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
 
 import javax.inject.Inject;
@@ -58,6 +63,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import static org.easymock.EasyMock.*;
 
@@ -112,6 +118,9 @@ public class ArchivaDavResourceFactoryTest
     @Inject
     DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin;
 
+    @Inject
+    RepositoryRegistry repositoryRegistry;
+
     @Inject
     RemoteRepositoryAdmin remoteRepositoryAdmin;
 
@@ -138,13 +147,18 @@ public class ArchivaDavResourceFactoryTest
         archivaConfiguration = archivaConfigurationControl.createMock( ArchivaConfiguration.class );
 
         config = new Configuration();
-        expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 5, 20 );
+        expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 2, 20 );
+        expect (archivaConfiguration.getDefaultLocale()).andReturn( Locale.getDefault() ).anyTimes();
+        archivaConfiguration.addListener( EasyMock.anyObject(  ) );
+        expectLastCall().times(0, 4);
         archivaConfiguration.save( config );
 
-        expectLastCall().times( 1, 4 );
+        expectLastCall().times( 0, 4 );
         archivaConfigurationControl.replay();
 
         defaultManagedRepositoryAdmin.setArchivaConfiguration( archivaConfiguration );
+        repositoryRegistry.setArchivaConfiguration( archivaConfiguration );
+        repositoryRegistry.reload();
         ( (DefaultRepositoryCommonValidator) defaultManagedRepositoryAdmin.getRepositoryCommonValidator() ).setArchivaConfiguration(
             archivaConfiguration );
         if ( defaultManagedRepositoryAdmin.getManagedRepository( RELEASES_REPO ) == null )
@@ -184,11 +198,12 @@ public class ArchivaDavResourceFactoryTest
         resourceFactory.setConnectors( new OverridingRepositoryProxyConnectors() );
         resourceFactory.setRemoteRepositoryAdmin( remoteRepositoryAdmin );
         resourceFactory.setManagedRepositoryAdmin( defaultManagedRepositoryAdmin );
+        resourceFactory.setRepositoryRegistry( repositoryRegistry );
     }
 
     private ManagedRepository createManagedRepository( String id, String location, String layout )
     {
-        ManagedRepository repoConfig = new ManagedRepository();
+        ManagedRepository repoConfig = new ManagedRepository( Locale.getDefault());
         repoConfig.setId( id );
         repoConfig.setName( id );
         repoConfig.setLocation( location );
@@ -201,8 +216,12 @@ public class ArchivaDavResourceFactoryTest
         throws RepositoryAdminException
     {
         ManagedRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
-        repoContent.setRepository( defaultManagedRepositoryAdmin.getManagedRepository( repoId ) );
-
+        org.apache.archiva.repository.ManagedRepository repo = repositoryRegistry.getManagedRepository( repoId );
+        repoContent.setRepository( repo );
+        if (repo!=null && repo instanceof EditableManagedRepository)
+        {
+            ( (EditableManagedRepository) repo ).setContent( repoContent );
+        }
         return repoContent;
     }
 
@@ -466,9 +485,7 @@ public class ArchivaDavResourceFactoryTest
         {
             archivaConfigurationControl.reset();
 
-            expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 2 );
-
-            expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
+            expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 1 );
 
             expect( request.getMethod() ).andReturn( "GET" ).times( 4 );
 
@@ -561,6 +578,9 @@ public class ArchivaDavResourceFactoryTest
     public void testRequestMetadataRepoIsLegacy()
         throws Exception
     {
+        ManagedRepositoryContent legacyRepo = createManagedRepositoryContent( LEGACY_REPO );
+        ConfigurableListableBeanFactory beanFactory = ((ConfigurableApplicationContext) applicationContext).getBeanFactory();
+        beanFactory.registerSingleton("managedRepositoryContent#legacy", legacyRepo);
         defaultManagedRepositoryAdmin.addManagedRepository(
             createManagedRepository( LEGACY_REPO, Paths.get( "target/test-classes/" + LEGACY_REPO ).toString(),
                                      "legacy" ), false, null );
@@ -568,7 +588,6 @@ public class ArchivaDavResourceFactoryTest
             new ArchivaDavResourceLocator( "", "/repository/" + LEGACY_REPO + "/eclipse/maven-metadata.xml",
                                            LEGACY_REPO, new ArchivaDavLocatorFactory() );
 
-        ManagedRepositoryContent legacyRepo = createManagedRepositoryContent( LEGACY_REPO );
 
         // use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
         RepositoryRequest repoRequest = new RepositoryRequest( );
index 0559f64009e2b52ef11ae42c411ce60af92e701d..48027766a501e8bbfdf9224d3a06e4b49deea76e 100644 (file)
@@ -20,13 +20,24 @@ package org.apache.archiva.webdav;
  */
 
 import junit.framework.TestCase;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.filelock.FileLockManager;
 import org.apache.archiva.repository.events.AuditListener;
+import org.apache.archiva.repository.maven2.MavenManagedRepository;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.archiva.webdav.util.MimeTypes;
-import org.apache.jackrabbit.webdav.*;
-import org.apache.jackrabbit.webdav.lock.*;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResource;
+import org.apache.jackrabbit.webdav.DavResourceFactory;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+import org.apache.jackrabbit.webdav.DavServletRequest;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavSession;
+import org.apache.jackrabbit.webdav.lock.ActiveLock;
+import org.apache.jackrabbit.webdav.lock.LockInfo;
+import org.apache.jackrabbit.webdav.lock.LockManager;
+import org.apache.jackrabbit.webdav.lock.Scope;
+import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
+import org.apache.jackrabbit.webdav.lock.Type;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -66,7 +77,7 @@ public class DavResourceTest
 
     private LockManager lockManager;
 
-    private ManagedRepository repository = new ManagedRepository();
+    private MavenManagedRepository repository = new MavenManagedRepository( "repo001", "repo001");
     
     @Override
     @Before
index 3ee62a188ef6b68e842dff4d6dae4ced6ac479ca..c07ce0d574b3059198fb668c9aac94aac44e7d11 100644 (file)
@@ -125,6 +125,7 @@ public class RepositoryServletRepositoryGroupTest
         configuration.removeManagedRepository( managedRepositoryConfiguration );
         org.apache.archiva.common.utils.FileUtils.deleteDirectory( repoRootInvalid );
 
+        repositoryRegistry.reload();
         saveConfiguration( archivaConfiguration );
 
         startRepository();
index aabd74c69858322caaea6f12e8d490de1389f4c2..f6d6f2670aef616845cc31e58ae903cd65122478 100644 (file)
@@ -33,6 +33,7 @@ import org.apache.archiva.redback.system.DefaultSecuritySession;
 import org.apache.archiva.redback.system.SecuritySession;
 import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.memory.SimpleUser;
+import org.apache.archiva.repository.RepositoryRegistry;
 import org.apache.archiva.repository.audit.TestAuditListener;
 import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
@@ -86,6 +87,9 @@ public class RepositoryServletSecurityTest
     @Inject
     protected ArchivaConfiguration archivaConfiguration;
 
+    @Inject
+    protected RepositoryRegistry repositoryRegistry;
+
     private DavSessionProvider davSessionProvider;
 
     private IMocksControl servletAuthControl;
@@ -188,6 +192,7 @@ public class RepositoryServletSecurityTest
     protected void saveConfiguration( ArchivaConfiguration archivaConfiguration )
         throws Exception
     {
+        repositoryRegistry.reload();
         archivaConfiguration.save( archivaConfiguration.getConfiguration() );        
     }
 
index 997d62b00a1baeda19787ea114f6e3b45998efc2..d3b9733bafd786e00a2f26f1225b5383d64f5f0e 100644 (file)
@@ -20,7 +20,7 @@
 
 <configuration>
 
-  <version>2</version>
+  <version>3.0.0</version>
   
   <repositoryScanning>
     <fileTypes>
index 9f38b827d6fff943bcf1b346b391660ecad59346..69381609910b0ecc389c77cc9fd7ada46d4fc272 100644 (file)
 
   <context:annotation-config/>
   <context:component-scan
-      base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
+      base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge,org.apache.archiva.repository.content.maven2,org.apache.archiva.repository"/>
+
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">
index 5601082fe076190223b83138cdc3a1c7b1b5c84e..28f59f75d94fb69ad9f4caf1035898bc1e4b87cc 100644 (file)
   <context:property-placeholder system-properties-mode="OVERRIDE"/>
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository"/>
+  <context:component-scan base-package="org.apache.archiva.redback.keys,org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.repository,org.apache.archiva.repository.content.maven2"/>
+
+  <alias name="managedRepositoryContent#maven" alias="managedRepositoryContent#default" />
+  <alias name="remoteRepositoryContent#maven" alias="remoteRepositoryContent#default" />
 
   <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
     <property name="properties">