This is an automated email from the ASF dual-hosted git repository.

nick pushed a commit to branch multiple-parsers
in repository https://gitbox.apache.org/repos/asf/tika.git

commit dda50b6a82dcf45d38dc5a89cb60cc5ca82a01f6
Author: Nick Burch <n...@gagravarr.org>
AuthorDate: Sun Apr 8 13:00:23 2018 +0100

    MultipleParser constructor that accepts Params
---
 .../tika/parser/multiple/AbstractMultipleParser.java       | 14 ++++++++++++++
 .../org/apache/tika/parser/multiple/FallbackParser.java    |  6 ++++++
 .../apache/tika/parser/multiple/SupplementingParser.java   |  6 ++++++
 3 files changed, 26 insertions(+)

diff --git 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
index 6d168eb..793b3f4 100644
--- 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
+++ 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/AbstractMultipleParser.java
@@ -27,8 +27,10 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
+import org.apache.tika.config.Param;
 import org.apache.tika.exception.TikaException;
 import org.apache.tika.io.TemporaryResources;
 import org.apache.tika.metadata.Metadata;
@@ -88,6 +90,7 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
          */
         KEEP_ALL
     };
+    protected static final String METADATA_POLICY_CONFIG_KEY = 
"metadataPolicy";
     
     /**
      * Media type registry.
@@ -134,6 +137,17 @@ public abstract class AbstractMultipleParser extends 
AbstractParser {
     }
 
     
+    protected static MetadataPolicy getMetadataPolicy(Map<String, Param> 
params) {
+        if (params.containsKey(METADATA_POLICY_CONFIG_KEY)) {
+            return 
(MetadataPolicy)params.get(METADATA_POLICY_CONFIG_KEY).getValue();
+        }
+        throw new IllegalArgumentException("Required parameter 
'"+METADATA_POLICY_CONFIG_KEY+"' not supplied");
+    }
+    public AbstractMultipleParser(MediaTypeRegistry registry, 
+                                  Collection<? extends Parser> parsers,
+                                  Map<String, Param> params) {
+        
+    }
     public AbstractMultipleParser(MediaTypeRegistry registry, MetadataPolicy 
policy,
                                   Parser... parsers) {
         this(registry, policy, Arrays.asList(parsers));
diff --git 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/FallbackParser.java 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/FallbackParser.java
index 8dbc14e..983f792 100644
--- 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/FallbackParser.java
+++ 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/FallbackParser.java
@@ -19,7 +19,9 @@ package org.apache.tika.parser.multiple;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
+import org.apache.tika.config.Param;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.mime.MediaTypeRegistry;
 import org.apache.tika.parser.ParseContext;
@@ -48,6 +50,10 @@ public class FallbackParser extends AbstractMultipleParser {
             Arrays.asList(MetadataPolicy.values());
 
 
+    public FallbackParser(MediaTypeRegistry registry,
+                          Collection<? extends Parser> parsers, Map<String, 
Param> params) {
+        super(registry, parsers, params);
+    }
     public FallbackParser(MediaTypeRegistry registry, MetadataPolicy policy,
                           Collection<? extends Parser> parsers) {
         super(registry, policy, parsers);
diff --git 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/SupplementingParser.java
 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/SupplementingParser.java
index a24170d..3b9cb1d 100644
--- 
a/tika-core/src/main/java/org/apache/tika/parser/multiple/SupplementingParser.java
+++ 
b/tika-core/src/main/java/org/apache/tika/parser/multiple/SupplementingParser.java
@@ -19,7 +19,9 @@ package org.apache.tika.parser.multiple;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
+import org.apache.tika.config.Param;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.mime.MediaTypeRegistry;
 import org.apache.tika.parser.ParseContext;
@@ -53,6 +55,10 @@ public class SupplementingParser extends 
AbstractMultipleParser {
                           MetadataPolicy.KEEP_ALL);
 
 
+    public SupplementingParser(MediaTypeRegistry registry,
+                               Collection<? extends Parser> parsers, 
Map<String, Param> params) {
+        super(registry, parsers, params);
+    }
     public SupplementingParser(MediaTypeRegistry registry, MetadataPolicy 
policy,
                                Parser... parsers) {
         this(registry, policy, Arrays.asList(parsers));

-- 
To stop receiving notification emails like this one, please contact
n...@apache.org.

Reply via email to