Search in sources :

Example 1 with ProfileException

use of com.att.aro.ui.view.menu.profiles.ProfileException in project VideoOptimzer by attdevsupport.

the class DataDump method startDataDump.

/**
 * Starts dumping data in CSV file for the provided trace files.
 *
 * @param traceFolders
 *            - List of trace folder names.
 * @return A FileWriter object.
 * @throws IOException
 */
private FileWriter startDataDump(List<File> traceFolders) throws IOException, ProfileException {
    FileWriter writer = new FileWriter(fileToSave);
    try {
        List<File> validFolderList = new ArrayList<File>();
        Set<AROTraceData> analysis = new LinkedHashSet<AROTraceData>();
        getValidFolderList(traceFolders, validFolderList);
        for (File traceDirectory : validFolderList) {
            try {
                analysis.add(controller.runAnalyzer(traceDirectory.getAbsolutePath(), controller.getTheModel().getAnalyzerResult().getProfile(), null));
            } catch (Exception e) {
                LOG.warn("Unable to run analysis on folder: " + traceDirectory, e);
            }
        }
        try {
            new ObjectMapper().writeValue(fileToSave, analysis);
        } catch (JsonGenerationException e) {
            LOG.error(e.getMessage());
            new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
        } catch (JsonMappingException e) {
            LOG.error(e.getMessage());
            new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
        } catch (IOException e) {
            LOG.error(e.getMessage());
            new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
        }
        userPreferences.setLastTraceDirectory(traceDir);
    } finally {
        writer.close();
    }
    return writer;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FileWriter(java.io.FileWriter) ArrayList(java.util.ArrayList) IOException(java.io.IOException) AROTraceData(com.att.aro.core.pojo.AROTraceData) JsonGenerationException(com.fasterxml.jackson.core.JsonGenerationException) ProfileException(com.att.aro.ui.view.menu.profiles.ProfileException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) JsonGenerationException(com.fasterxml.jackson.core.JsonGenerationException) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

AROTraceData (com.att.aro.core.pojo.AROTraceData)1 MessageDialogFactory (com.att.aro.ui.commonui.MessageDialogFactory)1 ProfileException (com.att.aro.ui.view.menu.profiles.ProfileException)1 JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 ExecutionException (java.util.concurrent.ExecutionException)1