mirror of https://github.com/apache/archiva.git
Moving references to repositoryRegistry
This commit is contained in:
parent
2ef9315447
commit
d3564941d5
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -106,9 +104,6 @@ public abstract class AbstractRestService
|
|||
@Inject
|
||||
protected RepositoryRegistry repositoryRegistry;
|
||||
|
||||
@Inject
|
||||
protected RepositoryContentFactory repositoryContentFactory;
|
||||
|
||||
@Inject
|
||||
@Named(value = "archivaTaskScheduler#repository")
|
||||
protected RepositoryArchivaTaskScheduler repositoryTaskScheduler;
|
||||
|
|
|
@ -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;
|
||||
|
@ -122,10 +121,6 @@ public class DefaultRepositoriesService
|
|||
@Inject
|
||||
private RepositoryRegistry repositoryRegistry;
|
||||
|
||||
@Inject
|
||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||
|
||||
|
||||
@Inject
|
||||
private SecuritySystem securitySystem;
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue