mirror of https://github.com/apache/archiva.git
[MRM-1509] change xmlrpc to use new repository administration management api : switch for remote repositories
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86d521a12b
commit
7961aeb46a
|
@ -73,7 +73,8 @@ public interface AdministrationService
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RemoteRepository> getAllRemoteRepositories();
|
List<RemoteRepository> getAllRemoteRepositories()
|
||||||
|
throws RepositoryAdminException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes given artifact from the specified repository.
|
* Deletes given artifact from the specified repository.
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.archiva.web.xmlrpc.services;
|
||||||
import org.apache.archiva.admin.AuditInformation;
|
import org.apache.archiva.admin.AuditInformation;
|
||||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||||
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
|
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
|
||||||
|
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
|
||||||
import org.apache.archiva.audit.AuditEvent;
|
import org.apache.archiva.audit.AuditEvent;
|
||||||
import org.apache.archiva.audit.AuditListener;
|
import org.apache.archiva.audit.AuditListener;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
|
@ -46,7 +47,6 @@ import org.apache.maven.archiva.configuration.Configuration;
|
||||||
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
|
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
|
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
|
||||||
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
||||||
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
||||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||||
|
@ -100,6 +100,8 @@ public class AdministrationServiceImpl
|
||||||
|
|
||||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||||
|
|
||||||
|
private RemoteRepositoryAdmin remoteRepositoryAdmin;
|
||||||
|
|
||||||
private static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
|
private static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$";
|
||||||
|
|
||||||
private static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
|
private static final String REPOSITORY_NAME_VALID_EXPRESSION = "^([a-zA-Z0-9.)/_(-]|\\s)+$";
|
||||||
|
@ -113,7 +115,8 @@ public class AdministrationServiceImpl
|
||||||
Collection<RepositoryListener> listeners,
|
Collection<RepositoryListener> listeners,
|
||||||
RepositoryStatisticsManager repositoryStatisticsManager,
|
RepositoryStatisticsManager repositoryStatisticsManager,
|
||||||
RepositoryMerger repositoryMerger, AuditListener auditListener,
|
RepositoryMerger repositoryMerger, AuditListener auditListener,
|
||||||
ManagedRepositoryAdmin managedRepositoryAdmin )
|
ManagedRepositoryAdmin managedRepositoryAdmin,
|
||||||
|
RemoteRepositoryAdmin remoteRepositoryAdmin )
|
||||||
{
|
{
|
||||||
this.archivaConfiguration = archivaConfig;
|
this.archivaConfiguration = archivaConfig;
|
||||||
this.repoConsumersUtil = repoConsumersUtil;
|
this.repoConsumersUtil = repoConsumersUtil;
|
||||||
|
@ -125,6 +128,7 @@ public class AdministrationServiceImpl
|
||||||
this.repositoryMerger = repositoryMerger;
|
this.repositoryMerger = repositoryMerger;
|
||||||
this.auditListener = auditListener;
|
this.auditListener = auditListener;
|
||||||
this.managedRepositoryAdmin = managedRepositoryAdmin;
|
this.managedRepositoryAdmin = managedRepositoryAdmin;
|
||||||
|
this.remoteRepositoryAdmin = remoteRepositoryAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,13 +330,11 @@ public class AdministrationServiceImpl
|
||||||
* @see AdministrationService#getAllRemoteRepositories()
|
* @see AdministrationService#getAllRemoteRepositories()
|
||||||
*/
|
*/
|
||||||
public List<RemoteRepository> getAllRemoteRepositories()
|
public List<RemoteRepository> getAllRemoteRepositories()
|
||||||
|
throws RepositoryAdminException
|
||||||
{
|
{
|
||||||
List<RemoteRepository> remoteRepos = new ArrayList<RemoteRepository>();
|
List<RemoteRepository> remoteRepos = new ArrayList<RemoteRepository>();
|
||||||
|
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
for ( org.apache.archiva.admin.repository.remote.RemoteRepository repoConfig : remoteRepositoryAdmin.getRemoteRepositories() )
|
||||||
List<RemoteRepositoryConfiguration> remoteRepoConfigs = config.getRemoteRepositories();
|
|
||||||
|
|
||||||
for ( RemoteRepositoryConfiguration repoConfig : remoteRepoConfigs )
|
|
||||||
{
|
{
|
||||||
RemoteRepository repo = new RemoteRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl(),
|
RemoteRepository repo = new RemoteRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl(),
|
||||||
repoConfig.getLayout() );
|
repoConfig.getLayout() );
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.archiva.web.xmlrpc.services;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.apache.archiva.admin.repository.RepositoryCommonValidator;
|
import org.apache.archiva.admin.repository.RepositoryCommonValidator;
|
||||||
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||||
|
import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
|
||||||
import org.apache.archiva.audit.AuditEvent;
|
import org.apache.archiva.audit.AuditEvent;
|
||||||
import org.apache.archiva.audit.AuditListener;
|
import org.apache.archiva.audit.AuditListener;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
|
@ -158,6 +159,8 @@ public class AdministrationServiceImplTest
|
||||||
|
|
||||||
private DefaultManagedRepositoryAdmin managedRepositoryAdmin;
|
private DefaultManagedRepositoryAdmin managedRepositoryAdmin;
|
||||||
|
|
||||||
|
private DefaultRemoteRepositoryAdmin remoteRepositoryAdmin;
|
||||||
|
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -233,10 +236,17 @@ public class AdministrationServiceImplTest
|
||||||
|
|
||||||
managedRepositoryAdmin.setRepositoryCommonValidator( repositoryCommonValidator );
|
managedRepositoryAdmin.setRepositoryCommonValidator( repositoryCommonValidator );
|
||||||
|
|
||||||
|
remoteRepositoryAdmin = new DefaultRemoteRepositoryAdmin();
|
||||||
|
remoteRepositoryAdmin.setArchivaConfiguration( archivaConfig );
|
||||||
|
remoteRepositoryAdmin.setAuditListeners( Arrays.asList( auditListener ) );
|
||||||
|
|
||||||
|
remoteRepositoryAdmin.setRepositoryCommonValidator( repositoryCommonValidator );
|
||||||
|
|
||||||
service = new AdministrationServiceImpl( archivaConfig, repoConsumersUtil, repositoryFactory,
|
service = new AdministrationServiceImpl( archivaConfig, repoConsumersUtil, repositoryFactory,
|
||||||
repositorySessionFactory, repositoryTaskScheduler,
|
repositorySessionFactory, repositoryTaskScheduler,
|
||||||
Collections.singletonList( listener ), repositoryStatisticsManager,
|
Collections.singletonList( listener ), repositoryStatisticsManager,
|
||||||
repositoryMerger, auditListener, managedRepositoryAdmin );
|
repositoryMerger, auditListener, managedRepositoryAdmin,
|
||||||
|
remoteRepositoryAdmin );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tests for repository consumers */
|
/* Tests for repository consumers */
|
||||||
|
|
Loading…
Reference in New Issue