On further thought, a static method returning the default configuration might
be better than a no-arg constructor.  That way, the single instance could be
shared.  So, assuming the tika-config.xml file were moved to
org/apache/tika, the following few lines could be added to tika-config.xml. 
Then the methods that use this shared instance could be added to ParseUtils.

Index: src/main/java/org/apache/tika/config/TikaConfig.java
===================================================================
--- src/main/java/org/apache/tika/config/TikaConfig.java        (revision
578987)
+++ src/main/java/org/apache/tika/config/TikaConfig.java        (working
copy)
@@ -45,6 +45,22 @@
     
     private static MimeUtils mimeTypeRepo;
 
+    private static final String DEFAULT_CONFIG_URL
+            = "/org/apache/tika/tika-config.xml";
+
+    private static TikaConfig defaultConfig;
+
+
+    public static final TikaConfig getDefaultConfig()
+            throws IOException, JDOMException {
+
+        if (defaultConfig == null) {
+            URL url = new URL(DEFAULT_CONFIG_URL);
+            defaultConfig = new TikaConfig(url);
+        }
+        return defaultConfig;
+    }
+
     public TikaConfig(String file) throws JDOMException, IOException {
         this(new File(file));
     }


- Keith

-- 
View this message in context: 
http://www.nabble.com/Providing-a-Default-Tika-Configuration-tf4510478.html#a12869890
Sent from the Apache Tika - Development mailing list archive at Nabble.com.

Reply via email to