org.apache.maven.index.updater
Class DefaultIndexUpdater

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.index.updater.DefaultIndexUpdater
All Implemented Interfaces:
IndexUpdater, org.codehaus.plexus.logging.LogEnabled

@Component(role=IndexUpdater.class)
public class DefaultIndexUpdater
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements IndexUpdater

A default index updater implementation

Author:
Jason van Zyl, Eugene Kuleshov

Nested Class Summary
static class DefaultIndexUpdater.FileFetcher
          Filesystem-based ResourceFetcher implementation
 
Constructor Summary
DefaultIndexUpdater()
           
DefaultIndexUpdater(IncrementalHandler handler, List<IndexUpdateSideEffect> mySideeffects)
           
 
Method Summary
protected  void cleanCacheDirectory(File dir)
          Cleans specified cache directory.
 IndexUpdateResult fetchAndUpdateIndex(IndexUpdateRequest updateRequest)
           
 Date getTimestamp(Properties properties, String key)
           
static Date unpackIndexArchive(InputStream is, org.apache.lucene.store.Directory directory, IndexingContext context)
          Unpack legacy index archive into a specified Lucene Directory
static Date unpackIndexData(InputStream is, org.apache.lucene.store.Directory d, IndexingContext context)
          Unpack index data using specified Lucene Index writer
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIndexUpdater

public DefaultIndexUpdater(IncrementalHandler handler,
                           List<IndexUpdateSideEffect> mySideeffects)

DefaultIndexUpdater

public DefaultIndexUpdater()
Method Detail

fetchAndUpdateIndex

public IndexUpdateResult fetchAndUpdateIndex(IndexUpdateRequest updateRequest)
                                      throws IOException
Specified by:
fetchAndUpdateIndex in interface IndexUpdater
Returns:
IndexUpdateResult
Throws:
IOException

unpackIndexArchive

public static Date unpackIndexArchive(InputStream is,
                                      org.apache.lucene.store.Directory directory,
                                      IndexingContext context)
                               throws IOException
Unpack legacy index archive into a specified Lucene Directory

Parameters:
is - a ZipInputStream with index data
directory - Lucene Directory to unpack index data to
Returns:
Date of the index update or null if it can't be read
Throws:
IOException

getTimestamp

public Date getTimestamp(Properties properties,
                         String key)

unpackIndexData

public static Date unpackIndexData(InputStream is,
                                   org.apache.lucene.store.Directory d,
                                   IndexingContext context)
                            throws IOException
Unpack index data using specified Lucene Index writer

Parameters:
is - an input stream to unpack index data from
w - a writer to save index data
ics - a collection of index creators for updating unpacked documents.
Throws:
IOException

cleanCacheDirectory

protected void cleanCacheDirectory(File dir)
                            throws IOException
Cleans specified cache directory. If present, Locker.LOCK_FILE will not be deleted.

Throws:
IOException


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.