Class RegexRulesPasswordProvider
- java.lang.Object
-
- 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
Constructors Constructor Description RegexRulesPasswordProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetExplicitPassword()Gets the explicit password, if setStringgetPassword(org.apache.tika.metadata.Metadata meta)LinkedHashMap<Pattern,String>getPasswordMap()voidparse(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 foundvoidresetExplicitPassword()Resets explicit password, so that map will be used for lookupsvoidsetExplicitPassword(String explicitPassword)Sets an explicit password which will be used instead of password mapvoidsetPasswordMap(LinkedHashMap<Pattern,String> linkedHashMap)
-
-
-
Method Detail
-
getPassword
public String getPassword(org.apache.tika.metadata.Metadata meta)
- Specified by:
getPasswordin interfaceorg.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
-
-