use of com.github.jaiimageio.impl.plugins.tiff.TIFFImageReaderSpi in project ddf by codice.
the class TikaInputTransformer method classLoaderAndBundleContextSetup.
private void classLoaderAndBundleContextSetup(BundleContext bundleContext) {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try (InputStream stream = TikaMetadataExtractor.class.getResourceAsStream("/metadata.xslt")) {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
templates = TransformerFactory.newInstance(net.sf.saxon.TransformerFactoryImpl.class.getName(), net.sf.saxon.TransformerFactoryImpl.class.getClassLoader()).newTemplates(new StreamSource(stream));
} catch (TransformerConfigurationException e) {
LOGGER.debug("Couldn't create XML transformer", e);
} catch (IOException e) {
LOGGER.debug("Could not get Tiki metadata XSLT", e);
} finally {
Thread.currentThread().setContextClassLoader(tccl);
}
if (bundleContext == null) {
LOGGER.info("Bundle context is null. Unable to register {} as an osgi service.", TikaInputTransformer.class.getSimpleName());
return;
}
registerService(bundleContext);
IIORegistry.getDefaultInstance().registerServiceProvider(new J2KImageReaderSpi());
IIORegistry.getDefaultInstance().registerServiceProvider(new TIFFImageReaderSpi());
}
Aggregations