The purpose of this page is to discuss technical details relating to how a File Manager may obtain the mime type of a particular file that is about to be ingested when an automatic product detection Crawler is being used.
This article assumes that you have a working knowledge of the File Manager and the Crawler.
Components and Component Configuration
The components involved are the File Manager and the Crawler.
I'm ingesting hdf5 files (ext .h5) products into my archive.
The File Manager is setup and configured to ingest hdf5 files and knows about the expected metadata for the catalogue.
The Crawler is in "automatic product detection mode". This is setup by setting the
The Crawler policy/mimetypes.xml and policy/mime-extractor-map.xml files contains the information that is used by the Auto Detect Product Crawler to detect the file type by its regex name pattern so that it can run the correct metadata extractor. In my case I want to detect files that are named something like 1234567890.h5 and run an external extractor (actually some python code). The external extrator is configured in the katfile.config file. I've also set a precondition to make sure that the file size is greater than zero.
The Crawler extracts meta data from the product and produces a <name>.met file.
The Crawler then detects the mime type of the file is detected in the following line of code in org.apache.oodt.cas.filemgr.structs.Reference.java. The relevant code snippet is listed below. The mime-type is actually detected by the Tika library.
The Crawler then executes an XML-RPC ingestProduct method call on the File Manager XML-RPC interface. I've captured the methodCall and here is the mime-type member that is passed to the File Manager on a successful ingest:
For the auto detection product crawler, the product type is detected separately in two different places:
- For metadata extraction, which is defined in the policy files.
- By Tika to pass to the File Manager.
For my case the current version of Tika does not correctly identify *.h5 files, so it sets the mime-type to be application/octet-stream.
This issue will be resolved once JIRA https://issues.apache.org/jira/browse/OODT-385 has been completed.