org.archive.wayback.liveweb
Class ARCCacheDirectory

java.lang.Object
  extended by org.archive.wayback.liveweb.ARCCacheDirectory

public class ARCCacheDirectory
extends Object

Class uses an ARCWriterPool to provide access to a set of ARCWriters, exposing getting and setters which simplify Spring configuration. This class also provides one method, getResource() which transforms a String path and an long offset into a Resource.

Version:
$Date: 2010-09-29 05:28:38 +0700 (Wed, 29 Sep 2010) $, $Revision: 3262 $
Author:
brad

Field Summary
static String LIVE_WAYBACK_TEMPLATE
          template string used to configure the ARC writer pool
 
Constructor Summary
ARCCacheDirectory()
           
 
Method Summary
 String getArcDir()
           
 String getArcPrefix()
           
 long getMaxARCSize()
           
 int getMaxPoolWait()
           
 int getPoolWriters()
           
 Resource getResource(String path, long offset)
          transform an ARCLocation into a Resource.
 org.archive.io.arc.ARCWriter getWriter()
          get an ARCWriter.
 void init()
           
 void returnWriter(org.archive.io.arc.ARCWriter w)
           
 void setArcDir(String arcPath)
           
 void setArcPrefix(String arcPrefix)
           
 void setMaxARCSize(long maxARCSize)
           
 void setMaxPoolWait(int maxPoolWait)
           
 void setPoolWriters(int poolWriters)
           
 void shutdown()
          shut down the ARC Writer pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIVE_WAYBACK_TEMPLATE

public static String LIVE_WAYBACK_TEMPLATE
template string used to configure the ARC writer pool

Constructor Detail

ARCCacheDirectory

public ARCCacheDirectory()
Method Detail

init

public void init()
          throws IOException
Throws:
IOException - for usual reasons

shutdown

public void shutdown()
shut down the ARC Writer pool.


getWriter

public org.archive.io.arc.ARCWriter getWriter()
                                       throws IOException
get an ARCWriter. be sure to return it to the pool with returnWriter.

Returns:
an ARCWriter prepared to store an ARCRecord
Throws:
IOException - for usual reasons

returnWriter

public void returnWriter(org.archive.io.arc.ARCWriter w)
                  throws IOException
Parameters:
w - previously borrowed ARCWriter
Throws:
IOException - for usual reasons

getResource

public Resource getResource(String path,
                            long offset)
                     throws IOException
transform an ARCLocation into a Resource. Be sure to call close() on it when processing is finished.

Parameters:
path - to ARC file
offset - within file where record begins
Returns:
the Resource for the location
Throws:
IOException - for usual reasons

getArcPrefix

public String getArcPrefix()
Returns:
the arcPrefix

setArcPrefix

public void setArcPrefix(String arcPrefix)
Parameters:
arcPrefix - the arcPrefix to set

getArcDir

public String getArcDir()
Returns:
the arcDir

setArcDir

public void setArcDir(String arcPath)
Parameters:
arcPath - the arcPath to set

getPoolWriters

public int getPoolWriters()
Returns:
the poolWriters

setPoolWriters

public void setPoolWriters(int poolWriters)
Parameters:
poolWriters - the poolWriters to set

getMaxPoolWait

public int getMaxPoolWait()
Returns:
the maxPoolWait

setMaxPoolWait

public void setMaxPoolWait(int maxPoolWait)
Parameters:
maxPoolWait - the maxPoolWait to set

getMaxARCSize

public long getMaxARCSize()
Returns:
the maxARCSize

setMaxARCSize

public void setMaxARCSize(long maxARCSize)
Parameters:
maxARCSize - the maxARCSize to set


Copyright © 2005-2011 Internet Archive. All Rights Reserved.