/** * Read in a file collection file with the specified file name. * @param theFileName Name of the file collection to read in */ public void readFileCollection(string theFileName) { try { /* checkFile(theFileName); //prepare for XML read MessageDisplay.resetXMLRead(); //prepare to read in the XML file SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); SAXParser saxParser = factory.newSAXParser(); XMLReader parser = saxParser.getXMLReader(); SAXModelBuilder mb = new SAXModelBuilder(); mb.setObjectPackage("FFIT"); mb.setupNamespace(FILE_COLLECTION_NS, true); parser.setContentHandler( mb ); //read in the XML file //specify the UTF8 encoding - otherwise will not interpret files with UTF8 characters correctly //java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(theFileName),"UTF8")); System.IO.StreamReader inReader = new System.IO.StreamReader(theFileName, Encoding.UTF8); parser.parse(new InputSource(inReader)); myFileCollection = (FileCollection)mb.getModel(); if (myFileCollection==null) { throw new Exception("The file "+theFileName+" doesn't specify any files."); } myFileCollection.setFileName(theFileName); //let the user know the outcome String successMessage = "The XML file "+theFileName; int numXMLWarnings = messageDisplay.getNumXMLWarnings(); if(numXMLWarnings == 0) { successMessage += " was successfully loaded"; } else if (numXMLWarnings == 1) { successMessage += " was loaded with 1 warning"; } else { successMessage += " was loaded with "+numXMLWarnings+" warnings"; } int numLoadedFiles = myFileCollection.getNumFiles(); if(numLoadedFiles == 0) { successMessage += "\nNo files were read in"; } else if (numLoadedFiles == 1) { successMessage += "\n1 file was read in"; } else { successMessage += "\n"+numLoadedFiles+" files were read in"; } messageDisplay.generalInformation(successMessage); int theFileSigFileVersion = myFileCollection.getLoadedFileSigFileVersion(); int theCurrentSigFileVersion = getSigFileVersion(); if( (theFileSigFileVersion > 0) && (theCurrentSigFileVersion != theFileSigFileVersion)) { messageDisplay.generalWarning("The file was generated with signature file V"+theFileSigFileVersion+". The current signature file is V"+theCurrentSigFileVersion); } */ } catch (Exception e) { MessageDisplay.GeneralWarning(e.ToString()); myFileCollection = null; } }
/** Creates a new instance of AnalysisThread */ public AnalysisThread(FileCollection theFileCollection, FFSignatureFile theSigFile, AnalysisController theAnalysisController) { myFileCollection = theFileCollection; mySigFile = theSigFile; myAnalysisController = theAnalysisController; }
public AnalysisController() { myFileCollection = new FileCollection() ; }