Package at.tuwien.minimee.migration.runners

Examples of at.tuwien.minimee.migration.runners.RunInfo


        try {
            String command = prepareCommand(config, params, inputFile, outputFile, time);
           
            IRunner runner = makeRunner(command, config);
            RunInfo r = runner.run();   
           
            result.setSuccessful(r.isSuccess());
            result.setReport(r.getReport());
           
            byte[] migratedFile = new byte[]{};
            try {
                migratedFile = FileUtils.getBytesFromFile(new File(outputFile));
                DigitalObject u = new DigitalObject();
                u.getData().setData(migratedFile);
                FormatInfo tFormat = new FormatInfo();
                tFormat.setDefaultExtension(config.getOutEnding());
                result.setTargetFormat(tFormat);
                result.setMigratedObject(u);
            } catch (Exception e) {
                log.error("Could not get outputfile "+outputFile);
                result.setSuccessful(false);
                log.error(e);
            }
            collectData(config, time, result);
           
          

            double length = migratedFile.length;
            double elapsed = r.getElapsedTimeMS();
            double elapsedPerMB = ((double)elapsed)/(getMByte(data));

            Measurement me = new Measurement(MigrationResult.MIGRES_ELAPSED_TIME,elapsed);
            result.getMeasurements().put(MigrationResult.MIGRES_ELAPSED_TIME, me);

            for (MeasurableProperty property: getMeasurableProperties()) {
                if (!property.getName().startsWith("machine:")) {
                    Measurement m = new Measurement();
                    m.setProperty(property);
                    PositiveFloatValue v = (PositiveFloatValue) property.getScale().createValue();
                    if (property.getName().equals(MigrationResult.MIGRES_ELAPSED_TIME)) {
                        v.setValue(elapsed);
                        m.setValue(v);
                        result.getMeasurements().put(property.getName(), m);
                    } else if (property.getName().equals(MigrationResult.MIGRES_ELAPSED_TIME_PER_MB)) {
                        v.setValue(elapsedPerMB);
                        m.setValue(v);
                        result.getMeasurements().put(property.getName(), m);
                    } else if (property.getName().equals(MigrationResult.MIGRES_RELATIVE_FILESIZE)) {
                        v.setValue(((double)length)/data.length * 100);
                        m.setValue(v);
                        result.getMeasurements().put(property.getName(), m);
                    } else if (property.getName().equals(MigrationResult.MIGRES_RESULT_FILESIZE)) {
                        v.setValue((double)length);
                        m.setValue(v);
                        result.getMeasurements().put(property.getName(), m);
                    }
                }               
            }
           
            success =  r.isSuccess();
        } catch (Exception e) {
            log.error(e.getMessage(),e);
            return false;
        } finally {
            cleanup(time,inputFile,outputFile);
View Full Code Here


        try {
            String command = prepareCommand(config, params, inputFile, outputFile, time);
           
            IRunner runner = makeRunner(command, config);
            RunInfo r = runner.run();   
           
            result.setSuccessful(r.isSuccess());
            result.setReport(r.getReport());
           
            byte[] migratedFile = new byte[]{};
            try {
                migratedFile = FileUtils.getBytesFromFile(new File(outputFile));
                DigitalObject u = new DigitalObject();
                u.getData().setData(migratedFile);
                FormatInfo tFormat = new FormatInfo();
                tFormat.setDefaultExtension(config.getOutEnding());
                result.setTargetFormat(tFormat);
                result.setMigratedObject(u);
            } catch (Exception e) {
                log.error("Could not get outputfile "+outputFile, e);
                result.setReport(result.getReport() + "\r\n error: could not retrieve outputfile.");
                result.setSuccessful(false);
            }
            collectData(config, time, result);
           
          

            double length = migratedFile.length;
            double elapsed = r.getElapsedTimeMS();
            double elapsedPerMB = ((double)elapsed)/(getMByte(data));

            Measurement me = new Measurement(MeasureConstants.ELAPSED_TIME_PER_OBJECT,elapsed);
            result.getMeasurements().put(MeasureConstants.ELAPSED_TIME_PER_OBJECT, me);

            for (Measure measure: getMeasures()) {
                if (!measure.getUri().startsWith("machine:")) {
                    Measurement m = new Measurement();
                    m.setMeasureId(measure.getUri());
                    PositiveFloatValue v = new PositiveFloatValue();
                    if (measure.getUri().equals(MeasureConstants.ELAPSED_TIME_PER_OBJECT)) {
                        v.setValue(elapsed);
                        m.setValue(v);
                        result.getMeasurements().put(measure.getUri(), m);
                    } else if (measure.getUri().equals(MeasureConstants.ELAPSED_TIME_PER_MB)) {
                        v.setValue(elapsedPerMB);
                        m.setValue(v);
                        result.getMeasurements().put(measure.getUri(), m);
                    } else if (measure.getUri().equals(MeasureConstants.COMPARATIVE_FILE_SIZE)) {
                        v.setValue(((double)length)/data.length * 100);
                        m.setValue(v);
                        result.getMeasurements().put(measure.getUri(), m);
                    } else if (measure.getUri().equals(MigrationResult.MIGRES_RESULT_FILESIZE)) {
                        v.setValue((double)length);
                        m.setValue(v);
                        result.getMeasurements().put(measure.getUri(), m);
                    }
                }               
            }
           
            success =  r.isSuccess();
        } catch (Exception e) {
            log.error(e.getMessage(),e);
            return false;
        } finally {
            cleanup(time,inputFile,outputFile);
View Full Code Here

TOP

Related Classes of at.tuwien.minimee.migration.runners.RunInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.