org.apache.solr.handler.extraction
Class RegexRulesPasswordProvider

java.lang.Object
  extended by org.apache.solr.handler.extraction.RegexRulesPasswordProvider
All Implemented Interfaces:
org.apache.tika.parser.PasswordProvider

public class RegexRulesPasswordProvider
extends Object
implements org.apache.tika.parser.PasswordProvider

Password provider for Extracting request handler which finds correct password based on file name matching against a list of regular expressions. The list of passwords is supplied in an optional Map. If an explicit password is set, it will be used.


Constructor Summary
RegexRulesPasswordProvider()
           
 
Method Summary
 String getExplicitPassword()
          Gets the explicit password, if set
 String getPassword(org.apache.tika.metadata.Metadata meta)
           
 LinkedHashMap<Pattern,String> getPasswordMap()
           
 void parse(InputStream is)
          Initialize rules through file input stream.
static LinkedHashMap<Pattern,String> parseRulesFile(InputStream is)
          Parses rule file from stream and returns a Map of all rules found
 void resetExplicitPassword()
          Resets explicit password, so that map will be used for lookups
 void setExplicitPassword(String explicitPassword)
          Sets an explicit password which will be used instead of password map
 void setPasswordMap(LinkedHashMap<Pattern,String> linkedHashMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexRulesPasswordProvider

public RegexRulesPasswordProvider()
Method Detail

getPassword

public String getPassword(org.apache.tika.metadata.Metadata meta)
Specified by:
getPassword in interface org.apache.tika.parser.PasswordProvider

parseRulesFile

public static LinkedHashMap<Pattern,String> parseRulesFile(InputStream is)
Parses rule file from stream and returns a Map of all rules found

Parameters:
is - input stream for the file

parse

public void parse(InputStream is)
Initialize rules through file input stream. This is a convenience for first calling setPasswordMap(parseRulesFile(is)).

Parameters:
is - the input stream with rules file, one line per rule on format regex=password

getPasswordMap

public LinkedHashMap<Pattern,String> getPasswordMap()

setPasswordMap

public void setPasswordMap(LinkedHashMap<Pattern,String> linkedHashMap)

getExplicitPassword

public String getExplicitPassword()
Gets the explicit password, if set

Returns:
the password, or null if not set

setExplicitPassword

public void setExplicitPassword(String explicitPassword)
Sets an explicit password which will be used instead of password map

Parameters:
explicitPassword - the password to use

resetExplicitPassword

public void resetExplicitPassword()
Resets explicit password, so that map will be used for lookups



Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.