From: Brett Porter
Date: Mon, 17 Oct 2011 12:34:20 +0000 (+0000)
Subject: initial work on removing hardcoded staging repositories. Still several tasks to do...
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F48%2Fhead;p=archiva.git
initial work on removing hardcoded staging repositories. Still several tasks to do and some tests are failing in this state
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/staging-refactor@1185127 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java
index 384567fe0..c8c27f909 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java
@@ -19,12 +19,12 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.configuration.CombinedConfiguration;
import org.apache.archiva.common.FileTypeUtils;
import org.apache.archiva.configuration.functors.FiletypeSelectionPredicate;
import org.apache.archiva.configuration.io.registry.ConfigurationRegistryReader;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.configuration.CombinedConfiguration;
import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.plexus.registry.RegistryListener;
@@ -32,15 +32,15 @@ import org.codehaus.plexus.util.SelectorUtils;
import org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
/**
* FileTypes
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
index 9473f9b6e..e5fb1d1e1 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
@@ -136,6 +136,7 @@
The repository scanning configuration.
+
webapp
1.0.0+
@@ -567,6 +568,15 @@
The file system location for this repository.
+
+ stagingLocation
+ 1.4.0+
+ String
+ false
+
+ The file system location for any attached staging repositories.
+
+
releases
1.0.0+
@@ -595,6 +605,14 @@
True if this repository should be scanned and processed.
true
+
+ stagingRequired
+ 1.4.0+
+ boolean
+
+ Whether staging repositories can be created for this repository.
+
+
refreshCronExpression
1.0.0+
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
index 78b66596b..bcdb33a7d 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
@@ -99,7 +99,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
- getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
+ getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), null );
String repoRoot = prepareTestRepos();
@@ -160,7 +160,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
- getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
+ getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), null );
String repoRoot = prepareTestRepos();
@@ -195,10 +195,10 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
*/
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
- getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
+ getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), null );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
- getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ), false, null );
+ getRepoConfiguration( RELEASES_TEST_REPO_ID, RELEASES_TEST_REPO_NAME ), null );
String repoRoot = prepareTestRepos();
@@ -248,7 +248,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
*/
applicationContext.getBean( ManagedRepositoryAdmin.class ).deleteManagedRepository( TEST_REPO_ID, null, false );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository(
- getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), false, null );
+ getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ), null );
String repoRoot = prepareTestRepos();
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
index 01fe6a594..4facf4623 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
@@ -196,7 +196,7 @@ public class RepositoryPurgeConsumerTest
{
managedRepositoryAdmin.deleteManagedRepository( repoConfiguration.getId(), null, false );
}
- managedRepositoryAdmin.addManagedRepository( repoConfiguration, false, null );
+ managedRepositoryAdmin.addManagedRepository( repoConfiguration, null );
}
private void removeRepoFromConfiguration( String configHint, ManagedRepository repoConfiguration )
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index 7ae48d384..94a94693b 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -160,7 +160,7 @@ public abstract class AbstractProxyTestCase
( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
- applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
+ applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, null );
//config.getConfiguration().addManagedRepository( repoConfig );
// Setup source repository (using legacy layout)
@@ -180,7 +180,7 @@ public abstract class AbstractProxyTestCase
repoConfig = managedLegacyRepository.getRepository();
//config.getConfiguration().addManagedRepository( repoConfig );
- applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
+ applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, null );
// Setup target (proxied to) repository.
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
index 8af5ea536..ea3c905c3 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
@@ -128,7 +128,7 @@ public class HttpProxyTransferTest
ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null )
{
- managedRepositoryAdmin.addManagedRepository( repo, false, null );
+ managedRepositoryAdmin.addManagedRepository( repo, null );
}
//config.getConfiguration().addManagedRepository( repo );
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
index 394631990..7ee3d6714 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
@@ -45,15 +45,8 @@ public class ManagedRepository
*/
private String cronExpression = "0 0 * * * ?";
-
- /**
- * not need when creating the repo : only available when reading
- */
- private ManagedRepository stagingRepository;
-
private boolean scanned = false;
-
/**
* default model value
*/
@@ -66,7 +59,8 @@ public class ManagedRepository
private boolean deleteReleasedSnapshots;
- private boolean stageRepoNeeded;
+ // TODO: move to staging plugin and allow custom per-repository configuration from plugins
+ private boolean stagingRequired;
private boolean resetStats;
@@ -78,7 +72,7 @@ public class ManagedRepository
public ManagedRepository( String id, String name, String location, String layout, boolean snapshots,
boolean releases, boolean blockRedeployments, String cronExpression, String indexDir,
boolean scanned, int daysOlder, int retentionCount, boolean deleteReleasedSnapshots,
- boolean stageRepoNeeded )
+ boolean stagingRequired )
{
super( id, name, layout );
@@ -92,7 +86,7 @@ public class ManagedRepository
this.daysOlder = daysOlder;
this.retentionCount = retentionCount;
this.deleteReleasedSnapshots = deleteReleasedSnapshots;
- this.stageRepoNeeded = stageRepoNeeded;
+ this.stagingRequired = stagingRequired;
}
public String getCronExpression()
@@ -151,16 +145,6 @@ public class ManagedRepository
}
- public ManagedRepository getStagingRepository()
- {
- return stagingRepository;
- }
-
-
- public void setStagingRepository( ManagedRepository stagingRepository )
- {
- this.stagingRepository = stagingRepository;
- }
public boolean isScanned()
{
@@ -203,14 +187,14 @@ public class ManagedRepository
this.deleteReleasedSnapshots = deleteReleasedSnapshots;
}
- public boolean isStageRepoNeeded()
+ public boolean isStagingRequired()
{
- return stageRepoNeeded;
+ return stagingRequired;
}
- public void setStageRepoNeeded( boolean stageRepoNeeded )
+ public void setStagingRequired( boolean stagingRequired )
{
- this.stageRepoNeeded = stageRepoNeeded;
+ this.stagingRequired = stagingRequired;
}
public boolean isResetStats()
@@ -233,17 +217,15 @@ public class ManagedRepository
sb.append( ", snapshots=" ).append( snapshots );
sb.append( ", releases=" ).append( releases );
sb.append( ", blockRedeployments=" ).append( blockRedeployments );
+ sb.append( ", stagingRequired=" ).append( stagingRequired );
sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
- sb.append( ", stagingRepository=" ).append( stagingRepository );
sb.append( ", scanned=" ).append( scanned );
sb.append( ", daysOlder=" ).append( daysOlder );
sb.append( ", retentionCount=" ).append( retentionCount );
sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
- sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
+ sb.append( ", stagingRequired=" ).append( stagingRequired );
sb.append( ", resetStats=" ).append( resetStats );
sb.append( '}' );
return sb.toString();
}
-
-
-}
\ No newline at end of file
+}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java
index ff3c1ed03..bdc7643f0 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/managed/ManagedRepositoryAdmin.java
@@ -44,13 +44,12 @@ public interface ManagedRepositoryAdmin
Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation, boolean deleteContent )
throws RepositoryAdminException;
- Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation )
+ Boolean addManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation )
throws RepositoryAdminException;
- Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation, boolean resetStats )
+ Boolean updateManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation,
+ boolean resetStats )
throws RepositoryAdminException;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
index ea385ff47..eb7ec0994 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
@@ -51,8 +51,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-import javax.inject.Inject;
-import javax.inject.Named;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -60,6 +58,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.inject.Inject;
+import javax.inject.Named;
/**
* FIXME remove all generic Exception to have usefull ones
@@ -77,8 +77,6 @@ public class DefaultManagedRepositoryAdmin
private Logger log = LoggerFactory.getLogger( getClass() );
- public static final String STAGE_REPO_ID_END = "-stage";
-
@Inject
@Named( value = "archivaTaskScheduler#repository" )
@@ -107,13 +105,13 @@ public class DefaultManagedRepositoryAdmin
for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
{
- // TODO add staging repo information back too
ManagedRepository repo =
new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
- repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), false );
+ repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(),
+ repoConfig.isStagingRequired() );
managedRepos.add( repo );
}
@@ -148,8 +146,7 @@ public class DefaultManagedRepositoryAdmin
return null;
}
- public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation )
+ public Boolean addManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation )
throws RepositoryAdminException
{
@@ -158,18 +155,18 @@ public class DefaultManagedRepositoryAdmin
return
addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
- managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
- managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
- managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
- managedRepository.isDeleteReleasedSnapshots(), auditInformation,
- getArchivaConfiguration().getConfiguration() ) != null;
+ managedRepository.isReleases(), managedRepository.isSnapshots(),
+ managedRepository.isStagingRequired(), managedRepository.getCronExpression(),
+ managedRepository.getIndexDirectory(), managedRepository.getDaysOlder(),
+ managedRepository.getRetentionCount(), managedRepository.isDeleteReleasedSnapshots(),
+ auditInformation, getArchivaConfiguration().getConfiguration() ) != null;
}
private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
String location, boolean blockRedeployments,
boolean releasesIncluded, boolean snapshotsIncluded,
- boolean stageRepoNeeded, String cronExpression,
+ boolean stagingRequired, String cronExpression,
String indexDir, int daysOlder, int retentionCount,
boolean deteleReleasedSnapshots,
AuditInformation auditInformation,
@@ -205,6 +202,7 @@ public class DefaultManagedRepositoryAdmin
repository.setId( repoId );
repository.setBlockRedeployments( blockRedeployments );
+ repository.setStagingRequired( stagingRequired );
repository.setReleases( releasesIncluded );
repository.setSnapshots( snapshotsIncluded );
repository.setName( name );
@@ -221,14 +219,6 @@ public class DefaultManagedRepositoryAdmin
{
addRepository( repository, config );
addRepositoryRoles( repository );
-
- if ( stageRepoNeeded )
- {
- ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
- addRepository( stagingRepository, config );
- addRepositoryRoles( stagingRepository );
- triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
- }
}
catch ( RoleManagerException e )
{
@@ -246,13 +236,6 @@ public class DefaultManagedRepositoryAdmin
try
{
scanRepository( repoId, true );
- // olamy no need of scanning staged repo
- /*
- if ( stageRepoNeeded )
- {
- ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
- scanRepository( stagingRepository.getId(), true );
- }*/
}
catch ( Exception e )
{
@@ -282,14 +265,7 @@ public class DefaultManagedRepositoryAdmin
deleteManagedRepository( repository, deleteContent, config, false );
- // stage repo exists ?
- ManagedRepositoryConfiguration stagingRepository =
- getArchivaConfiguration().getConfiguration().findManagedRepositoryById( repositoryId + STAGE_REPO_ID_END );
- if ( stagingRepository != null )
- {
- // do not trigger event when deleting the staged one
- deleteManagedRepository( stagingRepository, deleteContent, config, true );
- }
+ // STAGE FIXME: delete staging location too
try
{
@@ -405,13 +381,14 @@ public class DefaultManagedRepositoryAdmin
}
- public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation, boolean resetStats )
+ public Boolean updateManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation,
+ boolean resetStats )
throws RepositoryAdminException
{
-
- log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ",
- Arrays.asList( managedRepository, needStageRepo, resetStats ).toArray() );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "updateManagedConfiguration repo {} resetStats {} ", Arrays.asList( managedRepository, resetStats ).toArray() );
+ }
// Ensure that the fields are valid.
@@ -426,23 +403,16 @@ public class DefaultManagedRepositoryAdmin
configuration.removeManagedRepository( toremove );
}
- ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
-
// TODO remove content from old if path has changed !!!!!
- if ( stagingRepository != null )
- {
- configuration.removeManagedRepository( stagingRepository );
- }
-
ManagedRepositoryConfiguration managedRepositoryConfiguration =
addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
- managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
- managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
- managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
- managedRepository.isDeleteReleasedSnapshots(), auditInformation,
- getArchivaConfiguration().getConfiguration() );
+ managedRepository.isReleases(), managedRepository.isSnapshots(),
+ managedRepository.isStagingRequired(), managedRepository.getCronExpression(),
+ managedRepository.getIndexDirectory(), managedRepository.getDaysOlder(),
+ managedRepository.getRetentionCount(), managedRepository.isDeleteReleasedSnapshots(),
+ auditInformation, getArchivaConfiguration().getConfiguration() );
// Save the repository configuration.
RepositorySession repositorySession = getRepositorySessionFactory().createSession();
@@ -498,27 +468,6 @@ public class DefaultManagedRepositoryAdmin
configuration.addManagedRepository( repository );
}
- private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
- {
- ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
- stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
- stagingRepository.setLayout( repository.getLayout() );
- stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
- stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
- stagingRepository.setDaysOlder( repository.getDaysOlder() );
- stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
- stagingRepository.setIndexDir( repository.getIndexDir() );
- String path = repository.getLocation();
- int lastIndex = path.lastIndexOf( '/' );
- stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
- stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
- stagingRepository.setReleases( repository.isReleases() );
- stagingRepository.setRetentionCount( repository.getRetentionCount() );
- stagingRepository.setScanned( repository.isScanned() );
- stagingRepository.setSnapshots( repository.isSnapshots() );
- return stagingRepository;
- }
-
public Boolean scanRepository( String repositoryId, boolean fullScan )
{
if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
index d16feade0..c1e88b287 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
@@ -93,8 +93,8 @@ public abstract class AbstractRepositoryAdminTest
protected ManagedRepository getTestManagedRepository( String repoId, String repoLocation )
{
- return new ManagedRepository( repoId, "test repo", repoLocation, "default", false, true, true, "0 0 * * * ?",
- repoLocation + "/.index", false, 1, 2, true, false );
+ return new ManagedRepository( repoId, "test repo", repoLocation, "default", false, true, true,
+ "0 0 * * * ?", repoLocation + "/.index", false, 1, 2, true, false );
}
protected File clearRepoLocation( String path )
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java
index 84135d4d8..3057d1b2e 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java
@@ -50,9 +50,9 @@ public class RepositoryGroupAdminTest
ManagedRepository managedRepositoryTwo =
getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, getFakeAuditInformation() );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, getFakeAuditInformation() );
RepositoryGroup repositoryGroup =
new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
@@ -96,9 +96,9 @@ public class RepositoryGroupAdminTest
ManagedRepository managedRepositoryTwo =
getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, getFakeAuditInformation() );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, getFakeAuditInformation() );
RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) );
@@ -156,9 +156,9 @@ public class RepositoryGroupAdminTest
ManagedRepository managedRepositoryTwo =
getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, getFakeAuditInformation() );
- managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, getFakeAuditInformation() );
RepositoryGroup repositoryGroup =
new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) );
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java
index e4f60e4bf..25876229a 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java
@@ -33,7 +33,6 @@ import java.util.List;
public class ManagedRepositoryAdminTest
extends AbstractRepositoryAdminTest
{
- public static final String STAGE_REPO_ID_END = DefaultManagedRepositoryAdmin.STAGE_REPO_ID_END;
@Test
public void getAllManagedRepos()
@@ -85,7 +84,7 @@ public class ManagedRepositoryAdminTest
repo.setName( "test repo" );
repo.setLocation( repoLocation );
repo.setCronExpression( "0 0 * * * ?" );
- managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( repo, getFakeAuditInformation() );
repos = managedRepositoryAdmin.getManagedRepositories();
assertNotNull( repos );
assertEquals( initialSize + 1, repos.size() );
@@ -133,7 +132,7 @@ public class ManagedRepositoryAdminTest
repo.setName( "test repo" );
repo.setLocation( repoLocation );
repo.setCronExpression( "0 0 * * * ?" );
- managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( repo, getFakeAuditInformation() );
assertTemplateRoleExists( repoId );
@@ -148,7 +147,7 @@ public class ManagedRepositoryAdminTest
repo.setLocation( repoLocation );
repo.setCronExpression( "0 0 * * * ?" );
- managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false );
+ managedRepositoryAdmin.updateManagedRepository( repo, getFakeAuditInformation(), false );
repo = managedRepositoryAdmin.getManagedRepository( repoId );
assertNotNull( repo );
@@ -193,7 +192,8 @@ public class ManagedRepositoryAdminTest
repo.setName( "test repo" );
repo.setLocation( repoLocation );
repo.setCronExpression( "0 0 * * * ?" );
- managedRepositoryAdmin.addManagedRepository( repo, true, getFakeAuditInformation() );
+ repo.setStagingRequired( true );
+ managedRepositoryAdmin.addManagedRepository( repo, getFakeAuditInformation() );
repos = managedRepositoryAdmin.getManagedRepositories();
assertNotNull( repos );
assertEquals( initialSize + 2, repos.size() );
@@ -204,27 +204,32 @@ public class ManagedRepositoryAdminTest
assertTrue( repoDir.exists() );
+ // STAGE FIXME: check the things that should exist here
+ /*
assertNotNull( managedRepositoryAdmin.getManagedRepository( repoId + STAGE_REPO_ID_END ) );
assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
assertTrue( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
-
+*/
managedRepositoryAdmin.deleteManagedRepository( repoId, getFakeAuditInformation(), true );
assertFalse( repoDir.exists() );
+ // STAGE FIXME: check the things that should have been removed
+/*
assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
-
+*/
repos = managedRepositoryAdmin.getManagedRepositories();
assertNotNull( repos );
assertEquals( initialSize, repos.size() );
assertTemplateRoleNotExists( repoId );
- assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+ // STAGE FIXME: check the things that should have been removed
+// assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
mockAuditListener.clearEvents();
@@ -250,13 +255,16 @@ public class ManagedRepositoryAdminTest
ManagedRepository repo = getTestManagedRepository( repoId, repoLocation );
- managedRepositoryAdmin.addManagedRepository( repo, false, getFakeAuditInformation() );
+ managedRepositoryAdmin.addManagedRepository( repo, getFakeAuditInformation() );
assertTemplateRoleExists( repoId );
+ // STAGE FIXME: check the things that should have been removed
+ /*
assertFalse( new File( repoLocation + STAGE_REPO_ID_END ).exists() );
assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+ */
repos = managedRepositoryAdmin.getManagedRepositories();
assertNotNull( repos );
@@ -272,7 +280,9 @@ public class ManagedRepositoryAdminTest
repo.setLocation( repoLocation );
- managedRepositoryAdmin.updateManagedRepository( repo, true, getFakeAuditInformation(), false );
+ repo.setStagingRequired( true );
+
+ managedRepositoryAdmin.updateManagedRepository( repo, getFakeAuditInformation(), false );
repo = managedRepositoryAdmin.getManagedRepository( repoId );
assertNotNull( repo );
@@ -291,9 +301,12 @@ public class ManagedRepositoryAdminTest
assertTemplateRoleExists( repoId );
+ // STAGE FIXME: check the things that should have been removed
+ /*
assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
assertTemplateRoleExists( repoId + STAGE_REPO_ID_END );
+ */
managedRepositoryAdmin.deleteManagedRepository( repo.getId(), getFakeAuditInformation(), false );
@@ -302,9 +315,12 @@ public class ManagedRepositoryAdminTest
assertTemplateRoleNotExists( repoId );
+ // STAGE FIXME: check the things that should have been removed
+ /*
assertTrue( new File( stageRepoLocation + STAGE_REPO_ID_END ).exists() );
assertTemplateRoleNotExists( repoId + STAGE_REPO_ID_END );
+ */
assertAuditListenerCallAndUpdateAddAndDelete( true );
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java
index 2883675ea..c753db991 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/MockManagedRepositoryAdmin.java
@@ -48,13 +48,14 @@ public class MockManagedRepositoryAdmin
for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
{
- // TODO add staging repo information back too
ManagedRepository repo =
- new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
- repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
- repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
- repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
- repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), true );
+ new ManagedRepository( repoConfig.getId(), repoConfig.getName(),
+ repoConfig.getLocation(), repoConfig.getLayout(), repoConfig.isSnapshots(),
+ repoConfig.isReleases(), repoConfig.isBlockRedeployments(),
+ repoConfig.getRefreshCronExpression(), repoConfig.getIndexDir(),
+ repoConfig.isScanned(), repoConfig.getDaysOlder(),
+ repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(),
+ repoConfig.isStagingRequired() );
managedRepos.add( repo );
}
@@ -89,15 +90,14 @@ public class MockManagedRepositoryAdmin
return null;
}
- public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation )
+ public Boolean addManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation )
throws RepositoryAdminException
{
return null;
}
- public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
- AuditInformation auditInformation, boolean resetStats )
+ public Boolean updateManagedRepository( ManagedRepository managedRepository, AuditInformation auditInformation,
+ boolean resetStats )
throws RepositoryAdminException
{
return null;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
index 7de4cc5c6..fcfa074a8 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
@@ -99,9 +99,7 @@ public class DefaultManagedRepositoriesService
try
{
- return managedRepositoryAdmin.addManagedRepository( managedRepository,
- managedRepository.isStageRepoNeeded(),
- getAuditInformation() );
+ return managedRepositoryAdmin.addManagedRepository( managedRepository, getAuditInformation() );
}
catch ( RepositoryAdminException e )
{
@@ -116,9 +114,7 @@ public class DefaultManagedRepositoriesService
try
{
- return managedRepositoryAdmin.updateManagedRepository( managedRepository,
- managedRepository.isStageRepoNeeded(),
- getAuditInformation(),
+ return managedRepositoryAdmin.updateManagedRepository( managedRepository, getAuditInformation(),
managedRepository.isResetStats() );
}
catch ( RepositoryAdminException e )
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java
index a93748b43..dd5f2b44e 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/MergingRepositoriesTest.java
@@ -41,9 +41,9 @@ public class MergingRepositoriesTest
public void testAddArtifactToStagingRepository()
{
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
- "merging-repo-stage", true );
+ "merging-repo", true );
assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
- "' was successfully deployed to repository 'merging-repo-stage'" );
+ "' was successfully staged for repository 'merging-repo'" );
}
// here we test the merging (no conflicts artifacts are available)
@@ -92,6 +92,7 @@ public class MergingRepositoriesTest
@Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
public void testConfigurationChangesOfStagingRepository()
{
+ // STAGE FIXME: hardcoded ID
editManagedRepository();
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
"merging-repo-stage", true );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
index bf02d1f6c..1a2ac8a33 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
@@ -730,7 +730,7 @@ public abstract class AbstractArchivaTest
setFieldValue( "repository.cronExpression", cron );
setFieldValue( "repository.daysOlder", daysOlder );
setFieldValue( "repository.retentionCount", retentionCount );
- checkField( "stageNeeded" );
+ checkField( "repository.stagingRequired" );
clickButtonWithValue( "Add Repository" );
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java
index 52fc9324a..3cdac2686 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java
@@ -21,7 +21,6 @@ package org.apache.archiva.web.action;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.Validateable;
-import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.audit.AuditEvent;
@@ -38,11 +37,13 @@ import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Named;
/**
*
@@ -69,104 +70,72 @@ public class MergeAction
private String repoid;
- private String sourceRepoId;
+ private Collection conflictSourceArtifactsToBeDisplayed;
- private final String action = "merge";
+ private static String SESSION_KEY = "default";
- private final String hasConflicts = "CONFLICTS";
-
- private List conflictSourceArtifacts;
-
- private List conflictSourceArtifactsToBeDisplayed;
-
- public String getConflicts()
+ public String requestMerge()
+ throws Exception
{
- try
+ if ( !repository.isStagingRequired() )
{
- sourceRepoId = repoid + "-stage";
- ManagedRepository targetRepoConfig = managedRepositoryAdmin.getManagedRepository( sourceRepoId );
-
- if ( targetRepoConfig != null )
- {
- return hasConflicts;
- }
- else
- {
- return ERROR;
- }
+ addActionError( "Repository [" + repository.getId() + "] is not configured for staging" );
+ return ERROR;
}
- catch ( RepositoryAdminException e )
+
+ // check for conflicts to display
+ HashMap map = new LinkedHashMap();
+ for ( ArtifactMetadata metadata : getConflictSourceArtifacts() )
{
- addActionError( "RepositoryAdminException " + e.getMessage() );
- return ERROR;
+ String metadataId = metadata.getNamespace() + ":" + metadata.getProject() + ":" + metadata.getVersion();
+ map.put( metadataId, metadata );
}
+ conflictSourceArtifactsToBeDisplayed = map.values();
+
+ return "confirm";
}
public String doMerge()
{
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- MetadataRepository metadataRepository = repositorySession.getRepository();
- List sourceArtifacts = metadataRepository.getArtifacts( sourceRepoId );
-
- if ( repository.isReleases() && !repository.isSnapshots() )
- {
- mergeWithOutSnapshots( metadataRepository, sourceArtifacts, sourceRepoId, repoid );
- }
- else
- {
- repositoryMerger.merge( metadataRepository, sourceRepoId, repoid );
-
- for ( ArtifactMetadata metadata : sourceArtifacts )
- {
- triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES );
- }
- }
-
- scanRepository();
-
- addActionMessage( "Repository '" + sourceRepoId + "' successfully merged to '" + repoid + "'." );
-
- return SUCCESS;
- }
- catch ( Exception e )
- {
- log.error( e.getMessage(), e );
- addActionError( "Error occurred while merging the repositories: " + e.getMessage() );
- return ERROR;
- }
- finally
- {
- repositorySession.close();
- }
+ return merge( true );
}
public String mergeBySkippingConflicts()
{
+ return merge( false );
+ }
+
+ private String merge( boolean overwriteConflicts )
+ {
+ // FIXME: stage repo should only need the repoid
+ String sourceRepoId = null;
+
RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
MetadataRepository metadataRepository = repositorySession.getRepository();
List sourceArtifacts = metadataRepository.getArtifacts( sourceRepoId );
- sourceArtifacts.removeAll( conflictSourceArtifacts );
-
- if ( repository.isReleases() && !repository.isSnapshots() )
+ if ( !overwriteConflicts )
{
- mergeWithOutSnapshots( metadataRepository, sourceArtifacts, sourceRepoId, repoid );
+ sourceArtifacts.removeAll( getConflictSourceArtifacts() );
+
+ Filter artifactsWithOutConflicts = new IncludesFilter(
+ sourceArtifacts );
+ repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactsWithOutConflicts );
}
else
{
+ repositoryMerger.merge( metadataRepository, sourceRepoId, repoid );
+ }
- Filter artifactsWithOutConflicts =
- new IncludesFilter( sourceArtifacts );
- repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactsWithOutConflicts );
- for ( ArtifactMetadata metadata : sourceArtifacts )
- {
- triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES );
- }
+ // FIXME: this should happen in the merge itself
+ for ( ArtifactMetadata metadata : sourceArtifacts )
+ {
+ triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES );
}
+ // FIXME: this should happen in the merge itself, don't re-scan the whole thing. Make sure we test the
+ // results
scanRepository();
addActionMessage( "Repository '" + sourceRepoId + "' successfully merged to '" + repoid + "'." );
@@ -185,31 +154,6 @@ public class MergeAction
}
}
- public String mergeWithOutConlficts()
- {
- sourceRepoId = repoid + "-stage";
-
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- conflictSourceArtifacts =
- repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), sourceRepoId, repoid );
- }
- catch ( Exception e )
- {
- addActionError( "Error occurred while merging the repositories." );
- return ERROR;
- }
- finally
- {
- repositorySession.close();
- }
-
- addActionMessage( "Repository '" + sourceRepoId + "' successfully merged to '" + repoid + "'." );
-
- return SUCCESS;
- }
-
public ManagedRepository getRepository()
{
return repository;
@@ -223,30 +167,7 @@ public class MergeAction
public void prepare()
throws Exception
{
- sourceRepoId = repoid + "-stage";
- RepositorySession repositorySession = repositorySessionFactory.createSession();
- try
- {
- conflictSourceArtifacts =
- repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), sourceRepoId, repoid );
- }
- finally
- {
- repositorySession.close();
- }
-
this.repository = managedRepositoryAdmin.getManagedRepository( repoid );
- setConflictSourceArtifactsToBeDisplayed( conflictSourceArtifacts );
- }
-
- public String getSourceRepoId()
- {
- return sourceRepoId;
- }
-
- public void setSourceRepoId( String sourceRepoId )
- {
- this.sourceRepoId = sourceRepoId;
}
public String getRepoid()
@@ -260,56 +181,39 @@ public class MergeAction
}
public List getConflictSourceArtifacts()
+ throws Exception
{
- return conflictSourceArtifacts;
- }
-
- public void setConflictSourceArtifacts( List conflictSourceArtifacts )
- {
- this.conflictSourceArtifacts = conflictSourceArtifacts;
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ return repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(), repoid );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
}
- public List getConflictSourceArtifactsToBeDisplayed()
+ public Collection getConflictSourceArtifactsToBeDisplayed()
{
return conflictSourceArtifactsToBeDisplayed;
}
- public void setConflictSourceArtifactsToBeDisplayed( List conflictSourceArtifacts )
- throws Exception
- {
- this.conflictSourceArtifactsToBeDisplayed = new ArrayList();
- HashMap map = new HashMap();
- for ( ArtifactMetadata metadata : conflictSourceArtifacts )
- {
- String metadataId =
- metadata.getNamespace() + metadata.getProject() + metadata.getProjectVersion() + metadata.getVersion();
- map.put( metadataId, metadata );
- }
- conflictSourceArtifactsToBeDisplayed.addAll( map.values() );
- }
-
- private void mergeWithOutSnapshots( MetadataRepository metadataRepository, List sourceArtifacts,
- String sourceRepoId, String repoid )
- throws Exception
+ private Filter filterOutSnapshots( List sourceArtifacts, String repoid )
{
- List artifactsWithOutSnapshots = new ArrayList();
- for ( ArtifactMetadata metadata : sourceArtifacts )
+ for ( Iterator i = sourceArtifacts.iterator(); i.hasNext(); )
{
-
+ ArtifactMetadata metadata = i.next();
if ( metadata.getProjectVersion().contains( "SNAPSHOT" ) )
{
- artifactsWithOutSnapshots.add( metadata );
+ i.remove();
}
else
{
triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES );
}
-
}
- sourceArtifacts.removeAll( artifactsWithOutSnapshots );
-
- Filter artifactListWithOutSnapShots = new IncludesFilter( sourceArtifacts );
- repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactListWithOutSnapShots );
+ return new IncludesFilter( sourceArtifacts );
}
private void scanRepository()
@@ -346,4 +250,4 @@ public class MergeAction
{
this.managedRepositoryAdmin = managedRepositoryAdmin;
}
-}
\ No newline at end of file
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java
index ae2cdd5e1..327c402c7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java
@@ -292,6 +292,7 @@ public class UploadAction
{
try
{
+ // STAGE FIXME: handle staging, reduce external duplication - should be a wrapper like block redeployment
ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repositoryId );
ArtifactReference artifactReference = new ArtifactReference();
@@ -424,6 +425,7 @@ public class UploadAction
}
}
+ // STAGE FIXME: if it was staged, say "staged for"
String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version
+ "\' was successfully deployed to repository \'" + repositoryId + "\'";
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
index 488db6c68..f010332ff 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
@@ -44,8 +44,6 @@ public class AddManagedRepositoryAction
private ManagedRepository repository;
- private boolean stageNeeded;
-
private String action = "addRepository";
public void prepare()
@@ -54,6 +52,7 @@ public class AddManagedRepositoryAction
this.repository.setReleases( false );
this.repository.setScanned( false );
this.repository.setBlockRedeployments( false );
+ this.repository.setStagingRequired( false );
}
public String input()
@@ -88,7 +87,7 @@ public class AddManagedRepositoryAction
String result = SUCCESS;
try
{
- getManagedRepositoryAdmin().addManagedRepository( repository, stageNeeded, getAuditInformation() );
+ getManagedRepositoryAdmin().addManagedRepository( repository, getAuditInformation() );
}
catch ( RepositoryAdminException e )
{
@@ -147,12 +146,6 @@ public class AddManagedRepositoryAction
this.repository = repository;
}
-
- public void setStageNeeded( boolean stageNeeded )
- {
- this.stageNeeded = stageNeeded;
- }
-
public String getAction()
{
return action;
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
index b1bc69756..7f79f77ca 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
@@ -41,8 +41,6 @@ public class DeleteManagedRepositoryAction
private ManagedRepository repository;
- private ManagedRepository stagingRepository;
-
private String repoid;
public void prepare()
@@ -51,7 +49,6 @@ public class DeleteManagedRepositoryAction
if ( StringUtils.isNotBlank( repoid ) )
{
this.repository = getManagedRepositoryAdmin().getManagedRepository( repoid );
- this.stagingRepository = getManagedRepositoryAdmin().getManagedRepository( repoid + "-stage" );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
index f28047afe..691e40c41 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
@@ -44,15 +44,10 @@ public class EditManagedRepositoryAction
private ManagedRepository repository;
- private ManagedRepository stagingRepository;
-
private String repoid;
private final String action = "editRepository";
- private boolean stageNeeded;
-
-
// FIXME better error message
public void prepare()
throws RepositoryAdminException
@@ -60,12 +55,12 @@ public class EditManagedRepositoryAction
if ( StringUtils.isNotBlank( repoid ) )
{
repository = getManagedRepositoryAdmin().getManagedRepository( repoid );
- stagingRepository = getManagedRepositoryAdmin().getManagedRepository( repoid + "-stage" );
}
else if ( repository != null )
{
repository.setReleases( false );
repository.setScanned( false );
+ repository.setStagingRequired( false );
}
}
@@ -115,7 +110,7 @@ public class EditManagedRepositoryAction
String result = SUCCESS;
try
{
- getManagedRepositoryAdmin().updateManagedRepository( repository, stageNeeded, getAuditInformation(),
+ getManagedRepositoryAdmin().updateManagedRepository( repository, getAuditInformation(),
resetStats );
}
catch ( RepositoryAdminException e )
@@ -175,17 +170,6 @@ public class EditManagedRepositoryAction
}
- public boolean isStageNeeded()
- {
- return stageNeeded;
- }
-
- public void setStageNeeded( boolean stageNeeded )
- {
-
- this.stageNeeded = stageNeeded;
- }
-
public String getAction()
{
return action;
@@ -200,14 +184,4 @@ public class EditManagedRepositoryAction
{
this.repository = repository;
}
-
- public ManagedRepository getStagingRepository()
- {
- return stagingRepository;
- }
-
- public void setStagingRepository( ManagedRepository stagingRepository )
- {
- this.stagingRepository = stagingRepository;
- }
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/RepositoriesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/RepositoriesAction.java
index bbe13967b..cebfcf4d2 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/RepositoriesAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/admin/repositories/RepositoriesAction.java
@@ -43,13 +43,13 @@ import org.codehaus.redback.integration.interceptor.SecureActionException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
/**
* Shows the Repositories Tab for the administrator.
@@ -152,10 +152,7 @@ public class RepositoriesAction
List managedRepositoriesList = new ArrayList();
for ( ManagedRepository repoConfig : managedRepositories )
{
- if ( !repoConfig.getId().endsWith( "-stage" ) )
- {
- managedRepositoriesList.add( repoConfig );
- }
+ managedRepositoriesList.add( repoConfig );
}
return managedRepositoriesList;
}
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
index ef83869b0..c94ea1ced 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
@@ -415,8 +415,8 @@
-
- /WEB-INF/jsp/admin/mergeExcludeConflicts.jsp
+
+ /WEB-INF/jsp/admin/mergeExcludeConflicts.jsp
/WEB-INF/jsp/admin/mergeResults.jsp
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
index 406426de5..d084f4dd2 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp
@@ -49,7 +49,6 @@
<%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
-
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
index 8a2bfed8c..2d3e95646 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
@@ -52,15 +52,6 @@
<%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
-
-
-
-
-
-
-
-
-
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf
index 73b9b980f..69c54b224 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf
@@ -34,3 +34,4 @@
+
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/mergeExcludeConflicts.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/mergeExcludeConflicts.jsp
index 8ccbfda68..cadfd2197 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/mergeExcludeConflicts.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/mergeExcludeConflicts.jsp
@@ -36,79 +36,38 @@
-
+
+
+ No conflicting artifacts
-
-
- No conflicting artifacts
-
-
-
-
- WARNING: Repository "${repoid}" does not allow to merge snapshots
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WARNING: Repository "${repoid}" does not allow to merge snapshots
-
-
-
- WARNING: The following are the artifacts in conflict.
-
-
-
-
- Artifact Id : |
- <%--${artifact.id} | --%>
- ${artifact.namespace} ${" "} ${artifact.project} ${" "} ${artifact.version} |
-
-
+
+
+
+
+
+
+
+
+
+
WARNING! The following are the artifacts in conflict:
+
+
+
-
-
-
-
-
- |
+ Artifact Id : |
+ ${artifact.namespace} : ${artifact.project} : ${artifact.version} |
-
-
-
+
+
+
+
+
+
+
+
+
+
+