some tools useful when working with COMBINE stuff
The CombineFormatizer maintains a list of recognizers which are able to recognize certain file types, see List<FormatRecognizer> recognizerList
in /src/main/java/de/unirostock/sems/cbext/Formatizer.java
Formatizer.addFormatRecognizer (FormatRecognizer recognizer)
FormatRecognizer
class, see /src/main/java/de/unirostock/sems/cbext/FormatRecognizer.java
/src/main/java/de/unirostock/sems/cbext/recognizer
SbmlRecognizer.priority = 200
Formatizer.resortRecognizers ()
Formatizer.removeRecognizers ()
Formatizer.addDefaultRecognizers ()
The abstract class has 4 functions that you need to implement:
int getPriority ()
must return a positive priority. Default recognizers have a priority of 100. Recognizers with a higher priority are asked first for a format. The first who knows a format wins this competition.URI getFormatByParsing (File file, String mimeType)
you’ll get a files and it’s mime type, try to identify it’s format by looking into the fileURI getFormatFromMime (String mime)
you’ll get the mime type of a file, try to identify it’s formatURI getFormatFromExtension (String extension)
you’ll get the extension of a file, try to identify it’s format
null
and the next recognizer will be askedAn example of an extension can be found at PharmMLRecognizer There the Formatizer was extended to also recognize PharmML files.