- private static Chain parseXmlFile(File xmlFile) {
- Serializer serializer = new Persister();
- logger.debug(String.format("Reading %s...", xmlFile.getPath()));
- return serializer.read(Chain.class, xmlFile);
+ private static Chain parseConfigurationFile(File configurationFile) {
+ try {
+ return objectMapper.readValue(configurationFile, Chain.class);
+ } catch (JsonParseException jpe1) {
+ logger.warn(String.format("Could not parse %s.", configurationFile), jpe1);
+ } catch (JsonMappingException jme1) {
+ logger.warn(String.format("Could not parse %s.", configurationFile), jme1);
+ } catch (IOException ioe1) {
+ logger.info(String.format("Could not read %s.", configurationFile));
+ }
+ return null;
+ }
+
+ /**
+ * Extracts the name of the reaction from the given filename.
+ *
+ * @param filename
+ * The filename to extract the reaction name from
+ * @return The name of the reaction
+ */
+ private static String getReactionName(String filename) {
+ return (filename.lastIndexOf(".") > -1) ? filename.substring(0, filename.lastIndexOf(".")) : filename;