Examples of TikaConfig


Examples of org.apache.tika.config.TikaConfig

  public String getSource() {
    return "$URL:$";
  }
 
  private TikaConfig getDefaultConfig(ClassLoader classLoader) throws MimeTypeException, IOException {
    return new TikaConfig(classLoader);
  }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

    public TikaMIMETypeDetector(Purifier purifier) {
        this.purifier = purifier;
        InputStream is = getResourceAsStream();
        if (config == null) {
            try {
                config = new TikaConfig(is);
            } catch (Exception e) {
                throw new RuntimeException("Error while loading Tika configuration.", e);
            }
        }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

  protected void firstInit(Context context) {
    try {
      String tikaConfigFile = context.getResolvedEntityAttribute("tikaConfig");
      if (tikaConfigFile == null) {
        ClassLoader classLoader = context.getSolrCore().getResourceLoader().getClassLoader();
        tikaConfig = new TikaConfig(classLoader);
      } else {
        File configFile = new File(tikaConfigFile);
        if (!configFile.isAbsolute()) {
          configFile = new File(context.getSolrCore().getResourceLoader().getConfigDir(), tikaConfigFile);
        }
        tikaConfig = new TikaConfig(configFile);
      }
    } catch (Exception e) {
      wrapAndThrow (SEVERE, e,"Unable to load Tika Config");
    }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

public class OOXMLParserTest extends TestCase {
    private Parser parser;
  
    @Override
    protected void setUp() throws Exception {
       TikaConfig config = TikaConfig.getDefaultConfig();
       ContainerAwareDetector detector = new ContainerAwareDetector(
             config.getMimeRepository()
       );
       parser = new AutoDetectParser(detector);
    }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

    private boolean pipeMode = true;

    public TikaCLI() throws TransformerConfigurationException, IOException, TikaException, SAXException {
        context = new ParseContext();
        detector = (new TikaConfig()).getMimeRepository();
        initParser();
    }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

        File configFile = new File(tikaConfigLoc);
        if (configFile.isAbsolute() == false) {
          configFile = new File(core.getResourceLoader().getConfigDir(), configFile.getPath());
        }
        try {
          config = new TikaConfig(configFile);
        } catch (Exception e) {
          throw new SolrException(ErrorCode.SERVER_ERROR, e);
        }
      } else {
        try {
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

    private URL u;

    private static final File f = new File("/a/b/c/x.pdf");

    protected void setUp() throws Exception{
        TikaConfig config = TikaConfig.getDefaultConfig();
        repo = config.getMimeRepository();
        tika = new Tika(config);
        u = new URL("http://mydomain.com/x.pdf?x=y");
    }
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

        }
        if (url == null) {
            url = SearchIndex.class.getResource("tika-config.xml");
        }

        TikaConfig config = null;
        if (url != null) {
            try {
                config = new TikaConfig(url);
            } catch (Exception e) {
                log.warn("Tika configuration not available: " + url, e);
            }
        }
        if (config == null) {
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

        }
        if (url == null) {
            url = SearchIndex.class.getResource("tika-config.xml");
        }

        TikaConfig config = null;
        if (url != null) {
            try {
                config = new TikaConfig(url);
            } catch (Exception e) {
                log.warn("Tika configuration not available: " + url, e);
            }
        }
        if (config == null) {
View Full Code Here

Examples of org.apache.tika.config.TikaConfig

        CompositeParser parser = null;
        InputStream stream = null;
        try {
            stream = config.getInputStream();
            if (autoDetectType) {
                parser = new AutoDetectParser(new TikaConfig(stream));
            } else {
                TikaConfig cfg = new TikaConfig(stream);
                parser = (CompositeParser) cfg.getParser();
            }
        } catch (Exception e) {
            logger.error("Error initializing text extraction service. Service will be disabled. Cause: "
                    + e.getMessage(), e);
        } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.