aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduler/archiva-scheduler-indexing
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-15 12:12:08 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-15 12:12:08 +0000
commitb0b8c3c08ae10997ed0b473035aa7115d8519250 (patch)
tree316abefa25f52c9ce0a5810dcfb752acd95340b3 /archiva-modules/archiva-scheduler/archiva-scheduler-indexing
parentac5d5d5f47f20e484b614a76493c92d8cc7aea71 (diff)
downloadarchiva-b0b8c3c08ae10997ed0b473035aa7115d8519250.tar.gz
archiva-b0b8c3c08ae10997ed0b473035aa7115d8519250.zip
[MRM-1693] exposing index downloaded from remote repositories
pack index. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1398259 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-scheduler/archiva-scheduler-indexing')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java12
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java12
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java14
3 files changed, 35 insertions, 3 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
index c9184fbc5..9fe52c12a 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
@@ -36,6 +36,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
+import org.apache.maven.index.packer.IndexPacker;
import org.apache.maven.index.updater.IndexUpdater;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,7 +57,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
* @author Olivier Lamy
* @since 1.4-M1
*/
-@Service( "downloadRemoteIndexScheduler#default" )
+@Service ("downloadRemoteIndexScheduler#default")
public class DefaultDownloadRemoteIndexScheduler
implements ConfigurationListener, DownloadRemoteIndexScheduler
{
@@ -64,7 +65,7 @@ public class DefaultDownloadRemoteIndexScheduler
private Logger log = LoggerFactory.getLogger( getClass() );
@Inject
- @Named( value = "taskScheduler#indexDownloadRemote" )
+ @Named (value = "taskScheduler#indexDownloadRemote")
private TaskScheduler taskScheduler;
@Inject
@@ -92,6 +93,8 @@ public class DefaultDownloadRemoteIndexScheduler
private IndexUpdater indexUpdater;
+ private IndexPacker indexPacker;
+
// store ids about currently running remote download : updated in DownloadRemoteIndexTask
private List<String> runningRemoteDownloadIds = new CopyOnWriteArrayList<String>();
@@ -107,6 +110,8 @@ public class DefaultDownloadRemoteIndexScheduler
indexUpdater = plexusSisuBridge.lookup( IndexUpdater.class );
+ this.indexPacker = plexusSisuBridge.lookup( IndexPacker.class );
+
for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
{
String contextKey = "remote-" + remoteRepository.getId();
@@ -176,7 +181,8 @@ public class DefaultDownloadRemoteIndexScheduler
DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest =
new DownloadRemoteIndexTaskRequest().setRemoteRepository( remoteRepository ).setNetworkProxy(
networkProxy ).setFullDownload( fullDownload ).setWagonFactory(
- wagonFactory ).setRemoteRepositoryAdmin( remoteRepositoryAdmin ).setIndexUpdater( indexUpdater );
+ wagonFactory ).setRemoteRepositoryAdmin( remoteRepositoryAdmin ).setIndexUpdater(
+ indexUpdater ).setIndexPacker( this.indexPacker );
if ( now )
{
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
index 485ac42b7..8777fe9e2 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
@@ -27,6 +27,8 @@ import org.apache.archiva.proxy.common.WagonFactoryException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.StopWatch;
import org.apache.maven.index.context.IndexingContext;
+import org.apache.maven.index.packer.IndexPacker;
+import org.apache.maven.index.packer.IndexPackingRequest;
import org.apache.maven.index.updater.IndexUpdateRequest;
import org.apache.maven.index.updater.IndexUpdater;
import org.apache.maven.index.updater.ResourceFetcher;
@@ -78,6 +80,8 @@ public class DownloadRemoteIndexTask
private IndexUpdater indexUpdater;
+ private IndexPacker indexPacker;
+
public DownloadRemoteIndexTask( DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest,
List<String> runningRemoteDownloadIds )
{
@@ -88,6 +92,7 @@ public class DownloadRemoteIndexTask
this.runningRemoteDownloadIds = runningRemoteDownloadIds;
this.indexUpdater = downloadRemoteIndexTaskRequest.getIndexUpdater();
this.remoteRepositoryAdmin = downloadRemoteIndexTaskRequest.getRemoteRepositoryAdmin();
+ this.indexPacker = downloadRemoteIndexTaskRequest.getIndexPacker();
}
public void run()
@@ -170,6 +175,13 @@ public class DownloadRemoteIndexTask
stopWatch.stop();
log.info( "time to download remote repository index for repository {}: {} s", this.remoteRepository.getId(),
( stopWatch.getTime() / 1000 ) );
+
+ // index packing optionnal ??
+ IndexPackingRequest indexPackingRequest =
+ new IndexPackingRequest( indexingContext, indexingContext.getIndexDirectoryFile() );
+ indexPacker.packIndex( indexPackingRequest );
+ indexingContext.updateTimestamp( true );
+
}
catch ( MalformedURLException e )
{
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
index 91efc1477..03889773b 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
@@ -23,6 +23,7 @@ import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.packer.IndexPacker;
import org.apache.maven.index.updater.IndexUpdater;
/**
@@ -43,6 +44,8 @@ public class DownloadRemoteIndexTaskRequest
private IndexUpdater indexUpdater;
+ private IndexPacker indexPacker;
+
public DownloadRemoteIndexTaskRequest()
{
// no op
@@ -114,4 +117,15 @@ public class DownloadRemoteIndexTaskRequest
this.remoteRepositoryAdmin = remoteRepositoryAdmin;
return this;
}
+
+ public IndexPacker getIndexPacker()
+ {
+ return indexPacker;
+ }
+
+ public DownloadRemoteIndexTaskRequest setIndexPacker( IndexPacker indexPacker )
+ {
+ this.indexPacker = indexPacker;
+ return this;
+ }
}