import com.google.common.io.Files;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.beans.RepositoryGroup;
+import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.StopWatch;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
private Logger log = LoggerFactory.getLogger( getClass() );
- @Inject
- private ManagedRepositoryAdmin managedRepositoryAdmin;
-
private MavenIndexerUtils mavenIndexerUtils;
private NexusIndexer indexer;
IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation );
indexPacker.packIndex( request );
}
- temporaryGroupIndexes.add( new TemporaryGroupIndex( mergedIndexDirectory, tempRepoId, groupId,
- indexMergerRequest.getMergedIndexTtl() ) );
+
+ if ( indexMergerRequest.isTemporary() )
+ {
+ temporaryGroupIndexes.add( new TemporaryGroupIndex( mergedIndexDirectory, tempRepoId, groupId,
+ indexMergerRequest.getMergedIndexTtl() ) );
+ }
stopWatch.stop();
log.info( "merged index for repos {} in {} s", indexMergerRequest.getRepositoriesIds(),
stopWatch.getTime() );
private File mergedIndexDirectory;
+ private boolean temporary;
+
public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
{
this.repositoriesIds = repositoriesIds;
return this;
}
+ public boolean isTemporary()
+ {
+ return temporary;
+ }
+
+ public void setTemporary( boolean temporary )
+ {
+ this.temporary = temporary;
+ }
+
+
+ public IndexMergerRequest temporary( boolean temporary )
+ {
+ this.temporary = temporary;
+ return this;
+ }
@Override
public String toString()
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
- sb.append( ", mergedIndexDirectory='" ).append( mergedIndexDirectory ).append( '\'' );
+ sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory );
+ sb.append( ", temporary=" ).append( temporary );
sb.append( '}' );
return sb.toString();
}
IndexMergerRequest indexMergerRequest = new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
repositoryGroupConfiguration.getMergedIndexPath(),
- repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory( tempRepoFile );
+ repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory( tempRepoFile )
+ .temporary( true );
MergedRemoteIndexesTaskRequest taskRequest =
new MergedRemoteIndexesTaskRequest(indexMergerRequest, indexMerger);