aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin.stockhammer@ars.de>2018-03-27 07:57:29 +0200
committerMartin Stockhammer <martin.stockhammer@ars.de>2018-03-27 07:57:29 +0200
commit663768d83ab7230848ff742cb74cdc1106608181 (patch)
treeed4ec1a7933f08c08d3c7c17e3f0d603a67209a4
parent58a377b3723a8c599321f020420e08414390ba3f (diff)
downloadarchiva-663768d83ab7230848ff742cb74cdc1106608181.tar.gz
archiva-663768d83ab7230848ff742cb74cdc1106608181.zip
Moving code to repository registry
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java38
1 files changed, 11 insertions, 27 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
index 3f8c58bbe..add16ee83 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
@@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.AuditInformation;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
+import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
@@ -33,6 +34,8 @@ import org.apache.archiva.repository.PasswordCredentials;
import org.apache.archiva.repository.RepositoryCredentials;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryRegistry;
+import org.apache.archiva.repository.features.IndexCreationEvent;
+import org.apache.archiva.repository.features.IndexCreationFeature;
import org.apache.archiva.repository.features.RemoteIndexFeature;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.index.NexusIndexer;
@@ -46,6 +49,7 @@ import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import java.io.IOException;
+import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -137,6 +141,11 @@ public class DefaultRemoteRepositoryAdmin
adminRepo.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup() );
adminRepo.setRemoteDownloadTimeout( (int) rif.getDownloadTimeout().getSeconds() );
}
+ if (repo.supportsFeature(IndexCreationFeature.class)) {
+ IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
+ adminRepo.setIndexDirectory(PathUtil.getPathFromUri(icf.getIndexPath()).toString());
+ }
+ adminRepo.setDescription(repo.getDescription());
return adminRepo;
}
@@ -156,6 +165,8 @@ public class DefaultRemoteRepositoryAdmin
repoConfig.setRemoteDownloadNetworkProxyId( repo.getRemoteDownloadNetworkProxyId() );
repoConfig.setDownloadRemoteIndexOnStartup( repo.isDownloadRemoteIndexOnStartup() );
repoConfig.setRemoteDownloadTimeout( repo.getRemoteDownloadTimeout() );
+ repoConfig.setDescription(repo.getDescription());
+ repoConfig.setIndexDir(repo.getIndexDirectory());
return repoConfig;
}
@@ -245,17 +256,6 @@ public class DefaultRemoteRepositoryAdmin
throw new RepositoryAdminException( "Could not delete remote repository"+(e.getMessage()==null?"":": "+e.getMessage()) );
}
- // TODO use ProxyConnectorAdmin interface ?
- // [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
- List<ProxyConnectorConfiguration> proxyConnectors = new ArrayList<>( configuration.getProxyConnectors() );
- for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
- {
- if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) )
- {
- configuration.removeProxyConnector( proxyConnector );
- }
- }
-
saveConfiguration( configuration );
return Boolean.TRUE;
@@ -369,22 +369,6 @@ public class DefaultRemoteRepositoryAdmin
}
- protected String calculateIndexRemoteUrl( org.apache.archiva.admin.model.beans.RemoteRepository remoteRepository )
- {
- if ( StringUtils.startsWith( remoteRepository.getRemoteIndexUrl(), "http" ) )
- {
- String baseUrl = remoteRepository.getRemoteIndexUrl();
- return baseUrl.endsWith( "/" ) ? StringUtils.substringBeforeLast( baseUrl, "/" ) : baseUrl;
- }
- String baseUrl = StringUtils.endsWith( remoteRepository.getUrl(), "/" ) ? StringUtils.substringBeforeLast(
- remoteRepository.getUrl(), "/" ) : remoteRepository.getUrl();
-
- baseUrl = StringUtils.isEmpty( remoteRepository.getRemoteIndexUrl() )
- ? baseUrl + "/.index"
- : baseUrl + "/" + remoteRepository.getRemoteIndexUrl();
- return baseUrl;
-
- }