aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2017-11-01 15:39:07 +0100
committerMartin Stockhammer <martin_s@apache.org>2017-11-01 15:39:07 +0100
commitd6120d6c22acd9996531716ae77806795277c9c7 (patch)
tree1a1e0fae2fa9478a6561ba31d48f9e02e1f57b91 /archiva-modules/archiva-web
parent32ff2ca265ac92be20f2941c7d4a291834e950f9 (diff)
downloadarchiva-d6120d6c22acd9996531716ae77806795277c9c7.tar.gz
archiva-d6120d6c22acd9996531716ae77806795277c9c7.zip
Adapting the web modules to the new repository api
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java2
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java14
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java43
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java48
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java16
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java2
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml3
-rw-r--r--archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java2
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties6
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html14
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java30
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java187
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java37
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml5
38 files changed, 328 insertions, 204 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java
index b6143ac94..5115f1aef 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScannerStatistics.java
@@ -18,6 +18,8 @@ package org.apache.archiva.rest.api.model;
* under the License.
*/
+
+
import org.apache.archiva.admin.model.beans.ManagedRepository;
import javax.xml.bind.annotation.XmlRootElement;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
index fd293fa26..c3c8a2f99 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
@@ -55,7 +55,6 @@
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
index 30890246b..4dacc86ff 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
@@ -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;
@@ -99,6 +102,9 @@ public abstract class AbstractRestService
protected ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
+ protected RepositoryRegistry repositoryRegistry;
+
+ @Inject
protected RepositoryContentFactory repositoryContentFactory;
@Inject
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
index aad3f287d..2a87462aa 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
@@ -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;
@@ -83,9 +84,6 @@ public class DefaultBrowseService
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 )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
index 697cadc60..155546d4a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
@@ -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;
@@ -102,6 +103,9 @@ public class DefaultRepositoriesService
private ArchivaIndexingTaskExecutor archivaIndexingTaskExecutor;
@Inject
+ private RepositoryRegistry repositoryRegistry;
+
+ @Inject
private ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
@@ -111,9 +115,6 @@ public class DefaultRepositoriesService
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;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
index 89663e1b6..ab4970261 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
@@ -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 ) );
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index 22e599b75..c055aeeec 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
index d3d667283..77605ed28 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
@@ -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" );
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
index 934bfc693..de7df457f 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
@@ -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 );
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
index 8e0df07c1..d77b8453a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
@@ -32,7 +32,10 @@
<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">
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
index 0d61740c3..25b0ed67d 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
@@ -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;
@@ -80,6 +81,9 @@ public abstract class AbstractSecurityTest
private ArchivaConfiguration archivaConfiguration;
@Inject
+ private RepositoryRegistry repositoryRegistry;
+
+ @Inject
protected UserRepositories userRepos;
protected void setupRepository( String repoId )
@@ -94,6 +98,7 @@ public abstract class AbstractSecurityTest
{
archivaConfiguration.getConfiguration().addManagedRepository( repoConfig );
}
+ repositoryRegistry.reload();
// Add repo roles to security.
userRepos.createMissingRepositoryRoles( repoId );
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
index d513a3539..9480019a0 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
@@ -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;
}
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml
index 696514868..fcc22aecc 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-security/src/test/resources/spring-context.xml
@@ -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"/>
diff --git a/archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java b/archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java
index e3981bcbd..f51795786 100644
--- a/archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java
+++ b/archiva-modules/archiva-web/archiva-test-mocks/src/main/java/org/apache/archiva/web/mocks/MockInvalidRepositoryContentConsumer.java
@@ -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;
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
index 666d997b8..bbaf02df2 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
index 94a048f3c..beedae587 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactFromQueryTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java
index 0d0bbab83..95f56ab1d 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexNonDefaultPathTest.java
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java
index c5cf891c9..f870d42f6 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadMergedIndexTest.java
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java
index f5913b7d4..024e1b855 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java
index 256a9be50..e9d156c2e 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java
@@ -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" );
}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml
index 570eeb588..cdec7b4fe 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-artifacts-download.xml
@@ -30,6 +30,11 @@
<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>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml
index 7a06a884d..7388de11d 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-merge-index-download.xml
@@ -29,6 +29,10 @@
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">
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
index 5f9f77153..e35f0ac7a 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
@@ -30,7 +30,11 @@
<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"/>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml
index d62446b45..d7083d210 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml
@@ -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">
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
index f29dbcb16..7eb96452c 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
@@ -37,6 +37,10 @@
</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">
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js
index 0e7037230..b169712cf 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js
@@ -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);
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html
index 5629b5553..17735c66d 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html
@@ -282,14 +282,14 @@
</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>
@@ -604,7 +604,7 @@
<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')}"
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
index b152e8980..c13f03939 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java
@@ -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,
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
index 1f5e0be5e..6774e8558 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
@@ -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;
/**
*
@@ -143,6 +163,9 @@ public class ArchivaDavResourceFactory
private ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
+ private RepositoryRegistry repositoryRegistry;
+
+ @Inject
private IndexMerger indexMerger;
@Inject
@@ -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;
+ }
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
index 27a90360f..24f2db36a 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/RepositoryServlet.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
index 1fbe41751..ce2d8510b 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -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() );
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
index dbfbc1d0f..ba1fdebd8 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -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.*;
@@ -113,6 +119,9 @@ public class ArchivaDavResourceFactoryTest
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( );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
index 0559f6400..48027766a 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
index 3ee62a188..c07ce0d57 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
@@ -125,6 +125,7 @@ public class RepositoryServletRepositoryGroupTest
configuration.removeManagedRepository( managedRepositoryConfiguration );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( repoRootInvalid );
+ repositoryRegistry.reload();
saveConfiguration( archivaConfiguration );
startRepository();
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
index aabd74c69..f6d6f2670 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
@@ -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() );
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml
index 997d62b00..d3b9733ba 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-archiva.xml
@@ -20,7 +20,7 @@
<configuration>
- <version>2</version>
+ <version>3.0.0</version>
<repositoryScanning>
<fileTypes>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml
index 9f38b827d..693816099 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml
@@ -31,7 +31,10 @@
<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">
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
index 5601082fe..28f59f75d 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context.xml
@@ -30,7 +30,10 @@
<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">