mirror of https://github.com/apache/archiva.git
[MRM-1504] Add a new module for repository administration management : remove some direct use of archivaconfiguration in the webapp
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170171 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
667064686c
commit
4b9ef913f9
|
@ -21,6 +21,9 @@ package org.apache.maven.archiva.web.action;
|
||||||
|
|
||||||
import com.opensymphony.xwork2.Preparable;
|
import com.opensymphony.xwork2.Preparable;
|
||||||
import com.opensymphony.xwork2.Validateable;
|
import com.opensymphony.xwork2.Validateable;
|
||||||
|
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||||
|
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||||
|
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||||
import org.apache.archiva.audit.AuditEvent;
|
import org.apache.archiva.audit.AuditEvent;
|
||||||
import org.apache.archiva.audit.Auditable;
|
import org.apache.archiva.audit.Auditable;
|
||||||
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
||||||
|
@ -31,11 +34,13 @@ import org.apache.archiva.metadata.repository.MetadataRepositoryException;
|
||||||
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.repository.events.RepositoryListener;
|
import org.apache.archiva.repository.events.RepositoryListener;
|
||||||
|
import org.apache.archiva.security.AccessDeniedException;
|
||||||
|
import org.apache.archiva.security.ArchivaSecurityException;
|
||||||
|
import org.apache.archiva.security.PrincipalNotFoundException;
|
||||||
|
import org.apache.archiva.security.UserRepositories;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||||
import org.apache.maven.archiva.common.utils.VersionUtil;
|
import org.apache.maven.archiva.common.utils.VersionUtil;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
|
||||||
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
||||||
import org.apache.maven.archiva.model.VersionedReference;
|
import org.apache.maven.archiva.model.VersionedReference;
|
||||||
import org.apache.maven.archiva.repository.ContentNotFoundException;
|
import org.apache.maven.archiva.repository.ContentNotFoundException;
|
||||||
|
@ -47,10 +52,6 @@ import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
|
||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
|
||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
|
||||||
import org.apache.archiva.security.AccessDeniedException;
|
|
||||||
import org.apache.archiva.security.ArchivaSecurityException;
|
|
||||||
import org.apache.archiva.security.PrincipalNotFoundException;
|
|
||||||
import org.apache.archiva.security.UserRepositories;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
@ -104,15 +105,15 @@ public class DeleteArtifactAction
|
||||||
@Inject
|
@Inject
|
||||||
private UserRepositories userRepositories;
|
private UserRepositories userRepositories;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ArchivaConfiguration configuration;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RepositoryContentFactory repositoryFactory;
|
private RepositoryContentFactory repositoryFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private List<RepositoryListener> listeners;
|
private List<RepositoryListener> listeners;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||||
|
|
||||||
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
|
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
@ -193,22 +194,21 @@ public class DeleteArtifactAction
|
||||||
|
|
||||||
public String doDelete()
|
public String doDelete()
|
||||||
{
|
{
|
||||||
Date lastUpdatedTimestamp = Calendar.getInstance().getTime();
|
|
||||||
|
|
||||||
TimeZone timezone = TimeZone.getTimeZone( "UTC" );
|
|
||||||
DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
|
|
||||||
fmt.setTimeZone( timezone );
|
|
||||||
ManagedRepositoryConfiguration repoConfig =
|
|
||||||
configuration.getConfiguration().findManagedRepositoryById( repositoryId );
|
|
||||||
|
|
||||||
VersionedReference ref = new VersionedReference();
|
|
||||||
ref.setArtifactId( artifactId );
|
|
||||||
ref.setGroupId( groupId );
|
|
||||||
ref.setVersion( version );
|
|
||||||
|
|
||||||
RepositorySession repositorySession = repositorySessionFactory.createSession();
|
RepositorySession repositorySession = repositorySessionFactory.createSession();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Date lastUpdatedTimestamp = Calendar.getInstance().getTime();
|
||||||
|
|
||||||
|
TimeZone timezone = TimeZone.getTimeZone( "UTC" );
|
||||||
|
DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
|
||||||
|
fmt.setTimeZone( timezone );
|
||||||
|
ManagedRepository repoConfig = getManagedRepositoryAdmin().getManagedRepository( repositoryId );
|
||||||
|
|
||||||
|
VersionedReference ref = new VersionedReference();
|
||||||
|
ref.setArtifactId( artifactId );
|
||||||
|
ref.setGroupId( groupId );
|
||||||
|
ref.setVersion( version );
|
||||||
ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
|
ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );
|
||||||
|
|
||||||
String path = repository.toMetadataPath( ref );
|
String path = repository.toMetadataPath( ref );
|
||||||
|
@ -280,6 +280,11 @@ public class DeleteArtifactAction
|
||||||
addActionError( "Repository exception: " + e.getMessage() );
|
addActionError( "Repository exception: " + e.getMessage() );
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
catch ( RepositoryAdminException e )
|
||||||
|
{
|
||||||
|
addActionError( "RepositoryAdmin exception: " + e.getMessage() );
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
repositorySession.close();
|
repositorySession.close();
|
||||||
|
@ -453,8 +458,13 @@ public class DeleteArtifactAction
|
||||||
this.repositoryFactory = repositoryFactory;
|
this.repositoryFactory = repositoryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfiguration( ArchivaConfiguration configuration )
|
public ManagedRepositoryAdmin getManagedRepositoryAdmin()
|
||||||
{
|
{
|
||||||
this.configuration = configuration;
|
return managedRepositoryAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
|
||||||
|
{
|
||||||
|
this.managedRepositoryAdmin = managedRepositoryAdmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,19 +50,12 @@ public abstract class AbstractRepositoriesAdminAction
|
||||||
implements SecureAction, Auditable
|
implements SecureAction, Auditable
|
||||||
{
|
{
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected ArchivaConfiguration archivaConfiguration;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
private ManagedRepositoryAdmin managedRepositoryAdmin;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RepositoryCommonValidator repositoryCommonValidator;
|
private RepositoryCommonValidator repositoryCommonValidator;
|
||||||
|
|
||||||
public ArchivaConfiguration getArchivaConfiguration()
|
|
||||||
{
|
|
||||||
return archivaConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SecureActionBundle getSecureActionBundle()
|
public SecureActionBundle getSecureActionBundle()
|
||||||
throws SecureActionException
|
throws SecureActionException
|
||||||
|
@ -75,40 +68,7 @@ public abstract class AbstractRepositoriesAdminAction
|
||||||
return bundle;
|
return bundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
|
|
||||||
{
|
|
||||||
this.archivaConfiguration = archivaConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save the configuration.
|
|
||||||
*
|
|
||||||
* @param configuration the configuration to save.
|
|
||||||
* @return the webwork result code to issue.
|
|
||||||
* @throws IOException thrown if unable to save file to disk.
|
|
||||||
* @throws InvalidConfigurationException thrown if configuration is invalid.
|
|
||||||
* @throws RegistryException thrown if configuration subsystem has a problem saving the configuration to disk.
|
|
||||||
*/
|
|
||||||
protected String saveConfiguration( Configuration configuration )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
archivaConfiguration.save( configuration );
|
|
||||||
addActionMessage( "Successfully saved configuration" );
|
|
||||||
}
|
|
||||||
catch ( IndeterminateConfigurationException e )
|
|
||||||
{
|
|
||||||
addActionError( e.getMessage() );
|
|
||||||
return INPUT;
|
|
||||||
}
|
|
||||||
catch ( RegistryException e )
|
|
||||||
{
|
|
||||||
addActionError( "Configuration Registry Exception: " + e.getMessage() );
|
|
||||||
return INPUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ManagedRepositoryAdmin getManagedRepositoryAdmin()
|
public ManagedRepositoryAdmin getManagedRepositoryAdmin()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,8 +24,6 @@ import com.opensymphony.xwork2.Validateable;
|
||||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
|
||||||
import org.codehaus.redback.components.scheduler.CronExpressionValidator;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
@ -101,41 +99,9 @@ public class AddManagedRepositoryAction
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME olamy dupe with admin repo component
|
|
||||||
@Override
|
@Override
|
||||||
public void validate()
|
public void validate()
|
||||||
{
|
{
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
|
||||||
|
|
||||||
CronExpressionValidator validator = new CronExpressionValidator();
|
|
||||||
String repoId = repository.getId();
|
|
||||||
|
|
||||||
if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a managed repository." );
|
|
||||||
}
|
|
||||||
else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a remote repository." );
|
|
||||||
}
|
|
||||||
else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a repository group." );
|
|
||||||
}
|
|
||||||
else if ( repoId.toLowerCase().contains( "stage" ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], repository id cannot contains word stage" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !validator.validate( repository.getCronExpression() ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.refreshCronExpression", "Invalid cron expression." );
|
|
||||||
}
|
|
||||||
|
|
||||||
// trim all unecessary trailing/leading white-spaces; always put this statement before the closing braces(after all validation).
|
// trim all unecessary trailing/leading white-spaces; always put this statement before the closing braces(after all validation).
|
||||||
trimAllRequestParameterValues();
|
trimAllRequestParameterValues();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.opensymphony.xwork2.Preparable;
|
||||||
import com.opensymphony.xwork2.Validateable;
|
import com.opensymphony.xwork2.Validateable;
|
||||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||||
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
import org.apache.archiva.admin.model.remote.RemoteRepository;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
@ -70,30 +69,6 @@ public class AddRemoteRepositoryAction
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME olamy dupe with admin repo component
|
|
||||||
@Override
|
|
||||||
public void validate()
|
|
||||||
{
|
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
|
||||||
|
|
||||||
String repoId = repository.getId();
|
|
||||||
|
|
||||||
if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a managed repository." );
|
|
||||||
}
|
|
||||||
else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a remote repository." );
|
|
||||||
}
|
|
||||||
else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
|
|
||||||
{
|
|
||||||
addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
|
|
||||||
+ "], that id already exists as a repository group." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RemoteRepository getRepository()
|
public RemoteRepository getRepository()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ import com.opensymphony.xwork2.Validateable;
|
||||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
|
||||||
import org.codehaus.redback.components.scheduler.CronExpressionValidator;
|
import org.codehaus.redback.components.scheduler.CronExpressionValidator;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -87,11 +86,10 @@ public class EditManagedRepositoryAction
|
||||||
return save( true );
|
return save( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME olamy use ManagedRepositoryAdmin rather tha, directly archivaConfiguration
|
|
||||||
public String commit()
|
public String commit()
|
||||||
|
throws RepositoryAdminException
|
||||||
{
|
{
|
||||||
ManagedRepositoryConfiguration existingConfig =
|
ManagedRepository existingConfig = getManagedRepositoryAdmin().getManagedRepository( repository.getId() );
|
||||||
archivaConfiguration.getConfiguration().findManagedRepositoryById( repository.getId() );
|
|
||||||
boolean resetStats = false;
|
boolean resetStats = false;
|
||||||
|
|
||||||
// check if the location was changed
|
// check if the location was changed
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
||||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||||
import org.apache.archiva.web.util.ContextUtils;
|
import org.apache.archiva.web.util.ContextUtils;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
|
||||||
import org.apache.maven.archiva.web.action.AbstractActionSupport;
|
import org.apache.maven.archiva.web.action.AbstractActionSupport;
|
||||||
import org.apache.struts2.interceptor.ServletRequestAware;
|
import org.apache.struts2.interceptor.ServletRequestAware;
|
||||||
import org.codehaus.plexus.redback.rbac.Resource;
|
import org.codehaus.plexus.redback.rbac.Resource;
|
||||||
|
|
|
@ -20,11 +20,15 @@ package org.apache.maven.archiva.web.action.admin.repositories;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
import org.apache.maven.archiva.configuration.Configuration;
|
||||||
|
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
|
||||||
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
||||||
|
import org.codehaus.plexus.registry.RegistryException;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,6 +45,9 @@ public class SortRepositoriesAction
|
||||||
|
|
||||||
private String targetRepo;
|
private String targetRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
public String sortDown()
|
public String sortDown()
|
||||||
{
|
{
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
Configuration config = archivaConfiguration.getConfiguration();
|
||||||
|
@ -75,6 +82,36 @@ public class SortRepositoriesAction
|
||||||
return saveConfiguration( config );
|
return saveConfiguration( config );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the configuration.
|
||||||
|
*
|
||||||
|
* @param configuration the configuration to save.
|
||||||
|
* @return the webwork result code to issue.
|
||||||
|
* @throws java.io.IOException thrown if unable to save file to disk.
|
||||||
|
* @throws org.apache.maven.archiva.configuration.InvalidConfigurationException thrown if configuration is invalid.
|
||||||
|
* @throws org.codehaus.plexus.registry.RegistryException thrown if configuration subsystem has a problem saving the configuration to disk.
|
||||||
|
*/
|
||||||
|
protected String saveConfiguration( Configuration configuration )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
archivaConfiguration.save( configuration );
|
||||||
|
addActionMessage( "Successfully saved configuration" );
|
||||||
|
}
|
||||||
|
catch ( IndeterminateConfigurationException e )
|
||||||
|
{
|
||||||
|
addActionError( e.getMessage() );
|
||||||
|
return INPUT;
|
||||||
|
}
|
||||||
|
catch ( RegistryException e )
|
||||||
|
{
|
||||||
|
addActionError( "Configuration Registry Exception: " + e.getMessage() );
|
||||||
|
return INPUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRepoGroupId()
|
public String getRepoGroupId()
|
||||||
{
|
{
|
||||||
return repoGroupId;
|
return repoGroupId;
|
||||||
|
@ -121,4 +158,14 @@ public class SortRepositoriesAction
|
||||||
{
|
{
|
||||||
return ( idx >= 0 ) && ( idx < repositories.size() );
|
return ( idx >= 0 ) && ( idx < repositories.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArchivaConfiguration getArchivaConfiguration()
|
||||||
|
{
|
||||||
|
return archivaConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
|
||||||
|
{
|
||||||
|
this.archivaConfiguration = archivaConfiguration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.archiva.web.action;
|
||||||
|
|
||||||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||||
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
import org.apache.archiva.admin.model.managed.ManagedRepository;
|
||||||
|
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
|
@ -102,7 +103,7 @@ public class DeleteArtifactActionTest
|
||||||
|
|
||||||
repositorySessionFactory.setRepositorySession( repositorySession );
|
repositorySessionFactory.setRepositorySession( repositorySession );
|
||||||
|
|
||||||
action.setConfiguration( configuration );
|
(( DefaultManagedRepositoryAdmin)action.getManagedRepositoryAdmin()).setArchivaConfiguration( configuration );
|
||||||
action.setRepositoryFactory( repositoryFactory );
|
action.setRepositoryFactory( repositoryFactory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ public class AddManagedRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
roleManagerControl = MockControl.createControl( RoleManager.class );
|
roleManagerControl = MockControl.createControl( RoleManager.class );
|
||||||
roleManager = (RoleManager) roleManagerControl.getMock();
|
roleManager = (RoleManager) roleManagerControl.getMock();
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class AddRemoteRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
||||||
archivaConfiguration );
|
archivaConfiguration );
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@ public class DeleteManagedRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
roleManagerControl = MockControl.createControl( RoleManager.class );
|
roleManagerControl = MockControl.createControl( RoleManager.class );
|
||||||
roleManager = (RoleManager) roleManagerControl.getMock();
|
roleManager = (RoleManager) roleManagerControl.getMock();
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class DeleteRemoteRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
||||||
archivaConfiguration );
|
archivaConfiguration );
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class DeleteRepositoryGroupActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration(
|
( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration(
|
||||||
archivaConfiguration );
|
archivaConfiguration );
|
||||||
|
|
|
@ -92,7 +92,6 @@ public class EditManagedRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
roleManagerControl = MockControl.createControl( RoleManager.class );
|
roleManagerControl = MockControl.createControl( RoleManager.class );
|
||||||
roleManager = (RoleManager) roleManagerControl.getMock();
|
roleManager = (RoleManager) roleManagerControl.getMock();
|
||||||
|
|
|
@ -64,7 +64,6 @@ public class EditRemoteRepositoryActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
|
|
||||||
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration(
|
||||||
archivaConfiguration );
|
archivaConfiguration );
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class RepositoryGroupsActionTest
|
||||||
|
|
||||||
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
action.setArchivaConfiguration( archivaConfiguration );
|
|
||||||
( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration(
|
( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration(
|
||||||
archivaConfiguration );
|
archivaConfiguration );
|
||||||
( (DefaultManagedRepositoryAdmin) ( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).getManagedRepositoryAdmin() ).setArchivaConfiguration(
|
( (DefaultManagedRepositoryAdmin) ( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).getManagedRepositoryAdmin() ).setArchivaConfiguration(
|
||||||
|
|
Loading…
Reference in New Issue