git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384138 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M3
@@ -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> |
@@ -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(); | |||
} |
@@ -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; |
@@ -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 ); | |||
@@ -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 ) | |||
{ |
@@ -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 ); | |||
} | |||