aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2018-04-08 00:32:46 +0200
committerMartin Stockhammer <martin_s@apache.org>2018-04-08 00:32:46 +0200
commitd3564941d5f87bacd189187f757f1c937ded1146 (patch)
tree8155a77056039f697e60d35dc587a6e21a46b56b /archiva-modules/archiva-web
parent2ef9315447eee184b0b473d3364246a435dacb96 (diff)
downloadarchiva-d3564941d5f87bacd189187f757f1c937ded1146.tar.gz
archiva-d3564941d5f87bacd189187f757f1c937ded1146.zip
Moving references to repositoryRegistry
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.java1
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java5
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java54
3 files changed, 11 insertions, 49 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 5115f1aef..831650796 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
@@ -20,6 +20,7 @@ package org.apache.archiva.rest.api.model;
+
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/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 7981b4658..aa62b0392 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
@@ -23,7 +23,6 @@ import org.apache.archiva.admin.model.AuditInformation;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.ProxyConnector;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.indexer.search.SearchResultHit;
@@ -39,7 +38,6 @@ 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;
@@ -107,9 +105,6 @@ public abstract class AbstractRestService
protected RepositoryRegistry repositoryRegistry;
@Inject
- protected RepositoryContentFactory repositoryContentFactory;
-
- @Inject
@Named(value = "archivaTaskScheduler#repository")
protected RepositoryArchivaTaskScheduler repositoryTaskScheduler;
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 b0b4119b0..8367c7866 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
@@ -21,8 +21,6 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
-import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksummedFile;
import org.apache.archiva.common.utils.VersionComparator;
@@ -51,6 +49,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.ContentNotFoundException;
+import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryNotFoundException;
@@ -123,10 +122,6 @@ public class DefaultRepositoriesService
private RepositoryRegistry repositoryRegistry;
@Inject
- private ManagedRepositoryAdmin managedRepositoryAdmin;
-
-
- @Inject
private SecuritySystem securitySystem;
@Inject
@@ -273,14 +268,7 @@ public class DefaultRepositoriesService
}
ManagedRepository source = null;
- try
- {
- source = managedRepositoryAdmin.getManagedRepository( artifactTransferRequest.getRepositoryId() );
- }
- catch ( RepositoryAdminException e )
- {
- throw new ArchivaRestServiceException( e.getMessage(), e );
- }
+ source = repositoryRegistry.getManagedRepository( artifactTransferRequest.getRepositoryId() );
if ( source == null )
{
@@ -289,14 +277,7 @@ public class DefaultRepositoriesService
}
ManagedRepository target = null;
- try
- {
- target = managedRepositoryAdmin.getManagedRepository( artifactTransferRequest.getTargetRepositoryId() );
- }
- catch ( RepositoryAdminException e )
- {
- throw new ArchivaRestServiceException( e.getMessage(), e );
- }
+ target = repositoryRegistry.getManagedRepository( artifactTransferRequest.getTargetRepositoryId() );
if ( target == null )
{
@@ -403,7 +384,7 @@ public class DefaultRepositoriesService
null );
}
- Path artifactFile = Paths.get( source.getLocation(), artifactSourcePath );
+ Path artifactFile = source.getLocalPath().resolve( artifactSourcePath );
if ( !Files.exists(artifactFile) )
{
@@ -420,7 +401,7 @@ public class DefaultRepositoriesService
int lastIndex = artifactPath.lastIndexOf( '/' );
String path = artifactPath.substring( 0, lastIndex );
- Path targetPath = Paths.get( target.getLocation(), path );
+ Path targetPath = target.getLocalPath().resolve( path );
Date lastUpdatedTimestamp = Calendar.getInstance().getTime();
int newBuildNumber = 1;
@@ -440,7 +421,7 @@ public class DefaultRepositoriesService
!( archivaAdministration.getKnownContentConsumers().contains( "create-missing-checksums" ) );
Path targetFile = targetPath.resolve( filename );
- if ( Files.exists(targetFile) && target.isBlockRedeployments() )
+ if ( Files.exists(targetFile) && target.blocksRedeployments())
{
throw new ArchivaRestServiceException(
"artifact already exists in target repo: " + artifactTransferRequest.getTargetRepositoryId()
@@ -461,9 +442,8 @@ public class DefaultRepositoriesService
}
pomFilename = FilenameUtils.removeExtension( pomFilename ) + ".pom";
- Path pomFile = Paths.get(source.getLocation(),
- artifactSourcePath.substring( 0, artifactPath.lastIndexOf( '/' ) ) ,
- pomFilename );
+ Path pomFile = source.getLocalPath().resolve(
+ artifactSourcePath.substring( 0, artifactPath.lastIndexOf( '/' ) )).resolve( pomFilename );
if ( pomFile != null && Files.size( pomFile ) > 0 )
{
@@ -785,7 +765,7 @@ public class DefaultRepositoriesService
TimeZone timezone = TimeZone.getTimeZone( "UTC" );
DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
fmt.setTimeZone( timezone );
- ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repositoryId );
+ ManagedRepository repoConfig = repositoryRegistry.getManagedRepository( repositoryId );
VersionedReference ref = new VersionedReference();
ref.setArtifactId( artifact.getArtifactId() );
@@ -821,7 +801,7 @@ public class DefaultRepositoriesService
int index = path.lastIndexOf( '/' );
path = path.substring( 0, index );
- Path targetPath = Paths.get( repoConfig.getLocation(), path );
+ Path targetPath = repoConfig.getLocalPath().resolve( path );
if ( !Files.exists(targetPath) )
{
@@ -965,10 +945,6 @@ public class DefaultRepositoriesService
{
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e );
}
- catch ( RepositoryAdminException e )
- {
- throw new ArchivaRestServiceException( "RepositoryAdmin exception: " + e.getMessage(), 500, e );
- }
finally
{
@@ -1201,16 +1177,6 @@ public class DefaultRepositoriesService
return new StringList( downloadRemoteIndexScheduler.getRunningRemoteDownloadIds() );
}
- public ManagedRepositoryAdmin getManagedRepositoryAdmin()
- {
- return managedRepositoryAdmin;
- }
-
- public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
- {
- this.managedRepositoryAdmin = managedRepositoryAdmin;
- }
-
public RepositorySessionFactory getRepositorySessionFactory()
{
return repositorySessionFactory;