dk.netarkivet.common.distribute.arcrepository
Class ARCLookup

java.lang.Object
  extended by dk.netarkivet.common.distribute.arcrepository.ARCLookup

public class ARCLookup
extends java.lang.Object

This class allows lookup of URLs in the ArcRepository, using full Lucene indexes to find offsets.


Constructor Summary
ARCLookup(ViewerArcRepositoryClient arcRepositoryClient, java.io.File indexDir)
          Create a new ARCLookup object.
 
Method Summary
 java.io.InputStream lookup(java.net.URI uri)
          Look up a given URI and return the contents as an InputStream.
 void setIndex(java.io.File gzippedIndexDir)
          This method resets the current Lucene index this object works on, and replaces them with this new, gzipped index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARCLookup

public ARCLookup(ViewerArcRepositoryClient arcRepositoryClient,
                 java.io.File indexDir)
Create a new ARCLookup object.

Parameters:
arcRepositoryClient - The interface to the ArcRepository
indexDir - Where the index will be placed. This directory should be unique to this instance.
Throws:
ArgumentNotValid - if arcRepositoryClient is null.
Method Detail

setIndex

public void setIndex(java.io.File gzippedIndexDir)
This method resets the current Lucene index this object works on, and replaces them with this new, gzipped index.

Parameters:
gzippedIndexDir - The new index, a directory containing gzipped Lucene files.
Throws:
ArgumentNotValid - If argument is null
IOFailure - if the files cannot be gunzipped.

lookup

public java.io.InputStream lookup(java.net.URI uri)
Look up a given URI and return the contents as an InputStream.

Parameters:
uri - The URI to find in the archive. If the URI does not match any entries in the archive, IOFailure is thrown.
Returns:
An InputStream Containing all the data in the entry, or null if the entry was not found
Throws:
IOFailure - If the ARC file was found in the Lucene index but not in the bit archive, or if some other failure happened while finding the file.