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. The input takes the form of a directory containing a Lucene index.


Constructor Summary
ARCLookup(ViewerArcRepositoryClient arcRepositoryClient)
          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 indexDir)
          This method sets the current Lucene index this object works on, replacing and closing the current index if one is already set.
 
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)
Create a new ARCLookup object.

Parameters:
arcRepositoryClient - The interface to the ArcRepository
Throws:
ArgumentNotValid - if arcRepositoryClient is null.
Method Detail

setIndex

public void setIndex(java.io.File indexDir)
This method sets the current Lucene index this object works on, replacing and closing the current index if one is already set.

Parameters:
indexDir - The new index, a directory containing Lucene files.
Throws:
ArgumentNotValid - If argument is null

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.