/** Loads the different output converter implementations into ImplementationBundles. */ private void initImplementations() { PropertiesEx props = new PropertiesEx("/tvla/io/tvla.io.properties"); List implementations = props.getStringListProperty("implementations", Collections.EMPTY_LIST); for (Iterator i = implementations.iterator(); i.hasNext(); ) { String implementation = (String) i.next(); this.implementations.put(implementation, new ImplementationsBundle(implementation)); } }
public ImplementationsBundle(String implementation) { PropertiesEx props = new PropertiesEx("/tvla/io/tvla.io.properties"); this.implementation = implementation; try { Class analysisStateClass = props.getClassProperty(implementation + ".analysisStateConverter", null); Class commentConverterClass = props.getClassProperty(implementation + ".commentConverter", null); Class locationConverterClass = props.getClassProperty(implementation + ".locationConverter", null); Class programConverterClass = props.getClassProperty(implementation + ".programConverter", null); Class structureConverterClass = props.getClassProperty(implementation + ".structureConverter", null); Class bannerConverterClass = props.getClassProperty(implementation + ".bannerConverter", null); Class vocabularyConverterClass = props.getClassProperty(implementation + ".vocabularyConverter", null); // Class coerceConverterClass = props.getClassProperty(implementation + // ".coerceConverter", null); Class transitionRelationConverterClass = props.getClassProperty(implementation + ".transitionRelationConverter", null); if (analysisStateClass != null) analysisStateConverter = (StringConverter) analysisStateClass.newInstance(); if (commentConverterClass != null) commentConverter = (StringConverter) commentConverterClass.newInstance(); if (locationConverterClass != null) locationConverter = (LocationConverter) locationConverterClass.newInstance(); if (programConverterClass != null) programConverter = (StringConverter) programConverterClass.newInstance(); if (structureConverterClass != null) structureConverter = (StringConverter) structureConverterClass.newInstance(); if (bannerConverterClass != null) bannerConverter = (StringConverter) bannerConverterClass.newInstance(); if (vocabularyConverterClass != null) vocabularyConverter = (StringConverter) vocabularyConverterClass.newInstance(); // if (coerceConverterClass != null) // coerceConverter = (StringConverter) coerceConverterClass.newInstance(); if (transitionRelationConverterClass != null) transitionRelationConverter = (StringConverter) transitionRelationConverterClass.newInstance(); } catch (ClassNotFoundException e) { throw new RuntimeException("Unable to find class " + e.getMessage()); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage()); } catch (InstantiationError e) { throw new RuntimeException(e.getMessage()); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage()); } bundleEnabled = ProgramProperties.getBooleanProperty("tvla." + implementation + ".enabled", false); if (!bundleEnabled) return; fileSuffix = ProgramProperties.getProperty("tvla." + implementation + ".fileSuffix", implementation); subDirectory = ProgramProperties.getProperty("tvla." + implementation + ".subDirectory", null); baseOutputFile = ProgramProperties.getProperty("tvla." + implementation + ".outputFile", null); baseMessagesFile = ProgramProperties.getProperty("tvla." + implementation + ".messagesFile", null); // baseBreachesFile = ProgramProperties.getProperty("tvla." + implementation + // ".breachesFile", null); baseTransitionFile = ProgramProperties.getProperty("tvla.tr." + implementation + ".outputFile", null); outputEnabled = baseOutputFile != null && !baseOutputFile.equals("null"); messagesEnabled = baseMessagesFile != null && !baseMessagesFile.equals("null"); // breachesEnabled = baseBreachesFile != null && !baseBreachesFile.equals("null"); transitionEnabled = ProgramProperties.getBooleanProperty("tvla.tr.enabled", false) && ProgramProperties.getBooleanProperty( "tvla.tr." + implementation + ".enabled", false); redirectOutputToDir = ProgramProperties.getBooleanProperty("tvla.output.redirectToDirectory", false); if (redirectOutputToDir) { outputDirectory = ProgramProperties.getProperty("tvla.output.outputDirectory", "null"); assert (outputDirectory != null && !outputDirectory.equals("null")); String bundleSubDirectory = ProgramProperties.getProperty("tvla." + implementation + ".subDirectory", "null"); if (bundleSubDirectory != null && !bundleSubDirectory.equals("null")) outputDirectory = outputDirectory + IOFacade.fileSeperator + bundleSubDirectory; if (outputEnabled) baseOutputFile = outputDirectory + IOFacade.fileSeperator + baseOutputFile; if (messagesEnabled) baseMessagesFile = outputDirectory + IOFacade.fileSeperator + baseMessagesFile; // if (breachesEnabled) // baseBreachesFile = outputDirectory + IOFacade.fileSeperator+ baseBreachesFile; if (transitionEnabled) baseTransitionFile = outputDirectory + IOFacade.fileSeperator + baseTransitionFile; } multipleOutputFiles = ProgramProperties.getBooleanProperty("tvla.output.multipleOutputFiles", false); root = ProgramProperties.getProperty("tvla.output.root", null); if (root != null && root.equals("null")) root = null; assert (!multipleOutputFiles || root != null); redirectOutput(root); }