summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-09-12 21:45:27 +0000
committerOlivier Lamy <olamy@apache.org>2012-09-12 21:45:27 +0000
commit8136dbe4d271854687b6c067333e3c821db79cec (patch)
treee4d65e1f6246c719accd6b693273cd1a6f19f070
parent838b6e957be7c24b54c493d48b8a5e30a05e93be (diff)
downloadarchiva-8136dbe4d271854687b6c067333e3c821db79cec.tar.gz
archiva-8136dbe4d271854687b6c067333e3c821db79cec.zip
[MRM-1263] creating an m2eclipse compatible index should be an optional component.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384138 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java20
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java14
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdminTest.java3
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java28
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java2
6 files changed, 58 insertions, 18 deletions
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 1c02c812b..8692e7c50 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
@@ -648,6 +648,15 @@
</description>
<defaultValue>false</defaultValue>
</field>
+ <field>
+ <name>skipPackedIndexCreation</name>
+ <version>1.0.0+</version>
+ <type>boolean</type>
+ <description>
+ True to not generate packed index (note you won't be able to export your index.
+ </description>
+ <defaultValue>false</defaultValue>
+ </field>
</fields>
</class>
<class>
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 a1bbbc1ab..a34469e52 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
@@ -70,6 +70,11 @@ public class ManagedRepository
private boolean resetStats;
+ /**
+ * @since 1.4-M3
+ */
+ private boolean skipPackedIndexCreation;
+
public ManagedRepository()
{
// no op
@@ -96,17 +101,17 @@ public class ManagedRepository
}
/**
- *
* @since 1.4-M3
*/
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, String description )
+ boolean stageRepoNeeded, String description, boolean skipPackedIndexCreation )
{
this( id, name, location, layout, snapshots, releases, blockRedeployments, cronExpression, indexDir, scanned,
daysOlder, retentionCount, deleteReleasedSnapshots, stageRepoNeeded );
setDescription( description );
+ setSkipPackedIndexCreation( skipPackedIndexCreation );
}
public String getCronExpression()
@@ -237,6 +242,16 @@ public class ManagedRepository
this.resetStats = resetStats;
}
+ public boolean isSkipPackedIndexCreation()
+ {
+ return skipPackedIndexCreation;
+ }
+
+ public void setSkipPackedIndexCreation( boolean skipPackedIndexCreation )
+ {
+ this.skipPackedIndexCreation = skipPackedIndexCreation;
+ }
+
@Override
public String toString()
{
@@ -255,6 +270,7 @@ public class ManagedRepository
sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
sb.append( ", stageRepoNeeded=" ).append( stageRepoNeeded );
sb.append( ", resetStats=" ).append( resetStats );
+ sb.append( ", skipPackedIndexCreation=" ).append( skipPackedIndexCreation );
sb.append( '}' );
return sb.toString();
}
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 30d74f704..144f86aa3 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
@@ -72,7 +72,7 @@ import java.util.Map;
*
* @author Olivier Lamy
*/
-@Service ( "managedRepositoryAdmin#default" )
+@Service ("managedRepositoryAdmin#default")
public class DefaultManagedRepositoryAdmin
extends AbstractRepositoryAdmin
implements ManagedRepositoryAdmin
@@ -83,7 +83,7 @@ public class DefaultManagedRepositoryAdmin
public static final String STAGE_REPO_ID_END = "-stage";
@Inject
- @Named ( value = "archivaTaskScheduler#repository" )
+ @Named (value = "archivaTaskScheduler#repository")
private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
@Inject
@@ -171,6 +171,7 @@ public class DefaultManagedRepositoryAdmin
repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(), false );
repo.setDescription( repoConfig.getDescription() );
+ repo.setSkipPackedIndexCreation( repoConfig.isSkipPackedIndexCreation() );
managedRepos.add( repo );
}
@@ -219,7 +220,8 @@ public class DefaultManagedRepositoryAdmin
managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
- auditInformation, getArchivaConfiguration().getConfiguration() ) != null;
+ managedRepository.isSkipPackedIndexCreation(), auditInformation,
+ getArchivaConfiguration().getConfiguration() ) != null;
createIndexContext( managedRepository );
return res;
@@ -232,6 +234,7 @@ public class DefaultManagedRepositoryAdmin
boolean stageRepoNeeded, String cronExpression,
String indexDir, int daysOlder, int retentionCount,
boolean deteleReleasedSnapshots, String description,
+ boolean skipPackedIndexCreation,
AuditInformation auditInformation,
Configuration config )
throws RepositoryAdminException
@@ -253,6 +256,7 @@ public class DefaultManagedRepositoryAdmin
repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
repository.setIndexDir( indexDir );
repository.setDescription( description );
+ repository.setSkipPackedIndexCreation( skipPackedIndexCreation );
try
{
@@ -482,7 +486,8 @@ public class DefaultManagedRepositoryAdmin
managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
- auditInformation, getArchivaConfiguration().getConfiguration() );
+ managedRepository.isSkipPackedIndexCreation(), auditInformation,
+ getArchivaConfiguration().getConfiguration() );
// Save the repository configuration.
RepositorySession repositorySession = getRepositorySessionFactory().createSession();
@@ -635,6 +640,7 @@ public class DefaultManagedRepositoryAdmin
stagingRepository.setRetentionCount( repository.getRetentionCount() );
stagingRepository.setScanned( repository.isScanned() );
stagingRepository.setSnapshots( repository.isSnapshots() );
+ stagingRepository.setSkipPackedIndexCreation( repository.isSkipPackedIndexCreation() );
// do not duplicate description
//stagingRepository.getDescription("")
return stagingRepository;
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 b1fa302ef..746a57f8b 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
@@ -157,6 +157,8 @@ public class ManagedRepositoryAdminTest
repo.setLocation( repoLocation );
repo.setCronExpression( "0 0 * * * ?" );
+ repo.setSkipPackedIndexCreation( true );
+
managedRepositoryAdmin.updateManagedRepository( repo, false, getFakeAuditInformation(), false );
repo = managedRepositoryAdmin.getManagedRepository( repoId );
@@ -165,6 +167,7 @@ public class ManagedRepositoryAdminTest
assertEquals( new File( repoLocation ).getCanonicalPath(), new File( repo.getLocation() ).getCanonicalPath() );
assertTrue( new File( repoLocation ).exists() );
assertEquals( description, repo.getDescription() );
+ assertTrue( repo.isSkipPackedIndexCreation() );
assertTemplateRoleExists( repoId );
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
index 89705e7e8..3e21b5b23 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
@@ -236,17 +236,23 @@ public class ArchivaIndexingTaskExecutor
context.optimize();
- File managedRepository = new File( repository.getLocation() );
- String indexDirectory = repository.getIndexDirectory();
- final File indexLocation = StringUtils.isBlank( indexDirectory )
- ? new File( managedRepository, ".indexer" )
- : new File( indexDirectory );
- IndexPackingRequest request = new IndexPackingRequest( context, indexLocation );
- indexPacker.packIndex( request );
- context.updateTimestamp( true );
-
- log.debug( "Index file packaged at '{}'.", indexLocation.getPath() );
-
+ if ( repository.isSkipPackedIndexCreation() )
+ {
+ File managedRepository = new File( repository.getLocation() );
+ String indexDirectory = repository.getIndexDirectory();
+ final File indexLocation = StringUtils.isBlank( indexDirectory )
+ ? new File( managedRepository, ".indexer" )
+ : new File( indexDirectory );
+ IndexPackingRequest request = new IndexPackingRequest( context, indexLocation );
+ indexPacker.packIndex( request );
+ context.updateTimestamp( true );
+
+ log.debug( "Index file packaged at '{}'.", indexLocation.getPath() );
+ }
+ else
+ {
+ log.debug( "skip packed index creation" );
+ }
}
catch ( IOException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index 38102a439..93059b1a9 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -295,7 +295,7 @@ public abstract class AbstractArchivaRestTest
{
String location = new File( FileUtil.getBasedir(), "target/test-repo" ).getAbsolutePath();
return new ManagedRepository( "TEST", "test", location, "default", true, true, false, "2 * * * * ?", null,
- false, 2, 3, true, false, "my nice repo" );
+ false, 2, 3, true, false, "my nice repo", false );
}