dk.netarkivet.wayback.accesscontrol
Class RegExpExclusionFilterFactory

java.lang.Object
  extended by dk.netarkivet.wayback.accesscontrol.RegExpExclusionFilterFactory
All Implemented Interfaces:
org.archive.wayback.accesscontrol.ExclusionFilterFactory

public class RegExpExclusionFilterFactory
extends java.lang.Object
implements org.archive.wayback.accesscontrol.ExclusionFilterFactory

This class allows one to specify a file containing a list of regular expressions specifying url's to be blocked from access via wayback. The class is intended to be instantiated as a Spring bean in a wayback access point, for example by adding something like

 <property name="exclusionFactory">
       <bean class="dk.netarkivet.wayback.accesscontrol.RegExpExclusionFilterFactory" init-method="init">
           <property name="file" value="/home/test/wayback_regexps.txt" />
       </bean>
   </property>
 
 
to an access-point definition in wayback.xml.


Field Summary
(package private)  java.util.Collection<java.util.regex.Pattern> patterns
          The collection of regular expressions to be checked
 
Constructor Summary
RegExpExclusionFilterFactory()
           
 
Method Summary
 org.archive.wayback.resourceindex.filters.ExclusionFilter get()
           
 java.io.File getFile()
          Get the file from which regexps are read.
 void init()
          Initialiser to be called from Spring framework.
 void setFile(java.io.File file)
          Set the file from which regexps are read.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patterns

java.util.Collection<java.util.regex.Pattern> patterns
The collection of regular expressions to be checked

Constructor Detail

RegExpExclusionFilterFactory

public RegExpExclusionFilterFactory()
Method Detail

init

public void init()
          throws java.io.IOException,
                 java.util.regex.PatternSyntaxException
Initialiser to be called from Spring framework.

Throws:
java.io.IOException - if the file specifying the exclusions cannot be read.
java.util.regex.PatternSyntaxException - if one or more of the patterns in the configuration file is an invalid java regular expression.

getFile

public java.io.File getFile()
Get the file from which regexps are read.

Returns:
the file.

setFile

public void setFile(java.io.File file)
Set the file from which regexps are read.

Parameters:
file - thefile.

get

public org.archive.wayback.resourceindex.filters.ExclusionFilter get()
Specified by:
get in interface org.archive.wayback.accesscontrol.ExclusionFilterFactory

shutdown

public void shutdown()
Specified by:
shutdown in interface org.archive.wayback.accesscontrol.ExclusionFilterFactory