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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 5dba438  CAMEL-14833 camel-tika: enhance TikaProducer to use different 
tika parser instead of AutodetectParse (#3705)
5dba438 is described below

commit 5dba43891e0bdf805c4e065d68bddb0803a83830
Author: JiriOndrusek <ondrusek.j...@gmail.com>
AuthorDate: Fri Apr 3 08:24:17 2020 +0200

    CAMEL-14833 camel-tika: enhance TikaProducer to use different tika parser 
instead of AutodetectParse (#3705)
---
 .../java/org/apache/camel/component/tika/TikaComponent.java    |  8 +++++++-
 .../java/org/apache/camel/component/tika/TikaProducer.java     | 10 +++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaComponent.java
 
b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaComponent.java
index 249c770..d4492d6 100644
--- 
a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaComponent.java
+++ 
b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaComponent.java
@@ -32,12 +32,18 @@ public class TikaComponent extends DefaultComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
         TikaConfiguration tikaConfiguration = new TikaConfiguration();
-        setProperties(tikaConfiguration, parameters);
+
         TikaConfig config = resolveAndRemoveReferenceParameter(parameters, 
TIKA_CONFIG, TikaConfig.class);
         if (config != null) {
             tikaConfiguration.setTikaConfig(config);
         }
         tikaConfiguration.setOperation(new URI(uri).getHost());
+        TikaEndpoint endpoint = createEndpoint(uri, tikaConfiguration);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+    protected TikaEndpoint createEndpoint(String uri, TikaConfiguration 
tikaConfiguration) {
         return new TikaEndpoint(uri, this, tikaConfiguration);
     }
 }
diff --git 
a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java
 
b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java
index 9d37053..09177de 100644
--- 
a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java
+++ 
b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java
@@ -59,12 +59,20 @@ public class TikaProducer extends DefaultProducer {
     private final String encoding;
 
     public TikaProducer(TikaEndpoint endpoint) {
+        this(endpoint,  null);
+    }
+
+    public TikaProducer(TikaEndpoint endpoint, Parser parser) {
         super(endpoint);
         this.tikaConfiguration = endpoint.getTikaConfiguration();
         this.encoding = this.tikaConfiguration.getTikaParseOutputEncoding();
         TikaConfig config = this.tikaConfiguration.getTikaConfig();
-        this.parser = new AutoDetectParser(config);
         this.detector = config.getDetector();
+        if (parser == null) {
+            this.parser = new 
AutoDetectParser(this.tikaConfiguration.getTikaConfig());
+        } else {
+            this.parser = parser;
+        }
     }
 
     @Override

Reply via email to