Examples of SampleObject


Examples of eu.planets_project.pp.plato.model.SampleObject

     * @param object {@link eu.planets_project.pp.plato.model.SampleObject}
     */
    public void removeUpload(Object object) {
        log.debug("Object: " + object);
        if (object instanceof SampleObject) {
            SampleObject sample = (SampleObject) object;
            selectedAlternative.getExperiment().getResults().put(sample, new DigitalObject());
            log.debug("File in RunExperiment removed");
            showUpload.setBool(false);
        } else {
            failure("Couldn't remove upload");
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

     */
    public void setUpload(Object object) {
        log.debug("Number: " + object);
        //log.debug("File in RunExperiment uploaded");
        if (object instanceof SampleObject) {
            SampleObject sample = (SampleObject) object;
            up = em.merge(selectedAlternative.getExperiment().getResults().get(sample));
            selectedAlternative.getExperiment().getResults().put(sample,up);
            if(up == null){
                failure("Couldn't start upload process");
            } else {
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

            DigitalObject migrationResultObject;
            DigitalObject experimentResultObject;
            MigrationResult migrationResult = null;
            IMigrationAction migrationAction = (IMigrationAction) action;
            //                int nextIndex = experimentStatus.getNextSampleIndex();
            SampleObject record = experimentStatus.getNextSample(); //null;
            //                if (nextIndex >= 0 && nextIndex < selectedPlan.getSampleRecordsDefinition().getRecords().size()) {
            //                    record = selectedPlan.getSampleRecordsDefinition().getRecords().get(nextIndex);
            //                }
            //experimentStatus.getNextSample();
            while (record != null) {
                if (record.isDataExistent()) {

                    // objectTomigrate is only being read, needs to be merged to lazily get the data out
                    SampleObject objectToMigrate = em.merge(record);

                    try {
                        // ACTION HAPPENS HERE:
                        migrationResult =  migrationAction.migrate(pad, objectToMigrate);
                    } catch (NullPointerException npe) {
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

    public void selectEmulationAlternative(Object alt){
        emulationAlternative = (Alternative)alt;
    }
    public void runEmulation(Object rec){
        if (rec instanceof SampleObject) {
            SampleObject sample = (SampleObject)rec;
            Alternative a = emulationAlternative;
            if (!a.isExecutable()) {
                // this alternative has to be evaluated manually, nothing to do here
                return;
            }
            IPreservationAction action =
                PreservationActionServiceFactory.getPreservationAction(a.getAction());
            /*
             * clear old run description
             */
            if (action == null) {
               
                String msg = String.format("Preservation action %s - %s is not registered or accessible and cant be executed. (Please check the registry.)",
                        a.getAction().getShortname(), a.getAction().getInfo());
               
                setUniformProgramOutput(a, msg, false);
            }
           
            if (action instanceof IEmulationAction) {
//              GRATE does only work on files up to 2.88 MB in size
//                if (sample.getData().getSize() > (1024 * 1024 * 2.8)) {
//                    FacesMessages.instance().add(FacesMessage.SEVERITY_WARN,
//                            "Emulation actions are currently only supported on samples up to a size of 2,88 MB.");
//                    return;
//                }
                try {
                   
                    DetailedExperimentInfo info = a.getExperiment().getDetailedInfo().get(sample);
                    String sessionID = null;
                    if (info == null) {
                        info = new DetailedExperimentInfo();                           
                        a.getExperiment().getDetailedInfo().put(sample, info);
                    } else {
                        Value sid = info.getMeasurements().get("sessionid").getValue();
                        if (sid != null && (sid instanceof FreeStringValue)) {
                       //     sessionID = ((FreeStringValue)sid).getValue();
                        }
                    }
                   
                    // objectTomigrate is only being read, needs to be merged to lazily get the data out
                    SampleObject objectToView = em.merge(sample);
                   
                    byte[] b = objectToView.getData().getData();
                   
                    if (sessionID == null) {
                        sessionID = ((IEmulationAction)action).startSession(a.getAction(), objectToView);
                    }
                    a.getExperiment().getDetailedInfo().get(sample).setSuccessful(true);
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

     * ensures that there is a detaild experiment info per sample object
     */
    public void updateSelectedExperimentInfo(Object alternative, Object sampleObject) {
       
        Alternative a = (Alternative)alternative;
        SampleObject so = (SampleObject)sampleObject;
       
        DetailedExperimentInfo info = a.getExperiment().getDetailedInfo().get(sampleObject);
       
        if (info == null) {
            info = new DetailedExperimentInfo();
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

     * Looks up the <code>registry</code> for preservation services
     * that can handle objects which are of the same type as the first sample record.
     */
    public String showPreservationServices(Object registry) {
        // get first sample with data
        SampleObject sample = selectedPlan.getSampleRecordsDefinition().getFirstSampleWithFormat();
        if (sample == null) {
            return null;
        }
        FormatInfo formatInfo = sample.getFormatInfo();

        PreservationActionRegistryDefinition reg = (PreservationActionRegistryDefinition) registry;
        try {
            availableActions.clear();
            List<PreservationActionDefinition> actions = queryRegistry(formatInfo, reg);
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

                .getAvailableRegistries();

        //List<PreservationActionRegistryDefinition> registries = new ArrayList<PreservationActionRegistryDefinition>();

        // get first sample with data
        SampleObject sample = selectedPlan.getSampleRecordsDefinition()
                .getFirstSampleWithFormat();
        if (sample == null) {
            return;
        }
        FormatInfo formatInfo = sample.getFormatInfo();

        for (PreservationActionRegistryDefinition reg : allRegistries) {
            if (reg.getShortname().contains("MiniMEE")
            ) {
                try {
View Full Code Here

Examples of eu.planets_project.pp.plato.model.SampleObject

        if (!(record instanceof SampleObject) || !(alternative instanceof Alternative)) {
            return;
        }
       
        Alternative a = (Alternative)alternative;
        SampleObject o = (SampleObject)record;
       
        o = em.merge(o);
        jhoveTree1=characteriseJHove(o);
       
        // get the result
View Full Code Here

Examples of eu.scape_project.planning.model.SampleObject

    /**
     * Adds a new sample to the list of sample samples in the project. This is a
     * sample sample without data.
     */
    public String newSample() {
        SampleObject newSample = new SampleObject("<add name>");

        plan.getSampleRecordsDefinition().addRecord(newSample);
        // this SampleRecordsDefinition has been changed
        plan.getSampleRecordsDefinition().touch();

View Full Code Here

Examples of eu.scape_project.planning.model.SampleObject

                    // evaluator with the highest priority
                    measurementsToEval.clear();
                    measurementsToEval.addAll(allMeasurementsToEval);

                    // prepare sample object with data
                    SampleObject sample = samples.get(i);
                    String samplePid = sample.getPid();
                    if (samplePid != null) {
                        sample.getData().setData(bytestreamManager.load(samplePid));
                    }

                    DigitalObject r = alternative.getExperiment().getResults().get(sample);
                    if ((r != null) && (r.getPid() != null)) {
                        r = digitalObjectManager.getCopyOfDataFilledDigitalObject(r);
                    }

                    try {
                        for (IObjectEvaluator evaluator : objEvaluators) {
                            // DigitalObject r2 = (r == null ? null :
                            // em.merge(r));
                            try {
                                Map<String, Value> results = evaluator.evaluate(alternative, sample, r,
                                    measurementsToEval, statusListener);
                                // apply all results
                                for (String m : results.keySet()) {
                                    Value value = results.get(m);
                                    if (value != null) {
                                        Leaf l = measurementOfLeaf.get(m);
                                        value.setScale(l.getScale());
                                        // add evaluation result for the current
                                        // result-object!
                                        l.getValues(alternative.getName()).setValue(i, value);
                                    }
                                }
                                // exclude evaluated leaves from further
                                // evaluation
                                measurementsToEval.removeAll(results.keySet());
                            } catch (Exception e) {
                                log.error("evaluator failed: " + e.getMessage(), e);
                                continue;
                            }
                        }
                    } finally {
                        // free the bytestream data
                        sample.getData().releaseData();
                    }
                }
            }
        } catch (Exception e) {
            throw new PlanningException("Automated evaluation failed", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.