Package eu.planets_project.pp.plato.model

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


        rec2.setShortName("zwo");
        rec2.getData().setData(byteStream.getBytes());

        q.getSampleRecordsDefinition().addRecord(rec2);

        Alternative alt1 = Alternative.createAlternative();
        alt1.setName("PDF/A ToolA");
        alt1.setDescription("Convert to PDF/A using this new tool named 'A'");
        q.getAlternativesDefinition().addAlternative(alt1);

        Alternative alt2 = Alternative.createAlternative();
        alt2.setName("PDF/A ToolB");
        alt2.setDescription("Convert to PDF/A using the well-tested tool 'B'");
        q.getAlternativesDefinition().addAlternative(alt2);

        Decision d2 = new Decision();
        d2.setDecision(GoDecision.GO);
        d2.setActionNeeded("also no actions needed");
View Full Code Here


        p.getProjectBasis().setDocumentTypes("This is a test documentation string.");
        p.getPlanProperties().setOrganization("ICW - Icebears for Climate warming");
        p.getSampleRecordsDefinition().setSamplesDescription("yes yes i know");
        p.getState().setValue(PlanState.ANALYSED);
        p.setTree(t);
        Alternative alt = new Alternative();
        alt.setName("Alternative Name");
        p.getAlternativesDefinition().getAlternatives().add(alt);
        p.getAlternativesDefinition().getAlternatives().add(alt);

        em.persist(p);
View Full Code Here

        // are there experiments which can be run automated?
        hasAutomatedExperiments.setBool(false);
        Iterator<Alternative> iter = consideredAlternatives.iterator();
        while (iter.hasNext() && !hasAutomatedExperiments.isBool()) {
            Alternative a = iter.next();
            if (a.isExecutable()) {
                hasAutomatedExperiments.setBool(true);
            }
        }

        // add empty result files where missing (only for considered alternatives!)
View Full Code Here

     */
    public void startExperiments() {
        if (experimentStatus == null)  {
            experimentStatus = new ExperimentStatus();
           }
        Alternative alt = experimentStatus.getNextAlternative();
        while ((alt != null)&&(! experimentStatus.isCanceled())) {
            runSingle(alt);
            alt = experimentStatus.getNextAlternative();
        }
        System.gc();
View Full Code Here

        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);
                    // we cannot use SETTINGS here because settings are not PER SAMPLE OBJECT!
                    info.getMeasurements().put("sessionid", new Measurement("sessionID",sessionID));
                } catch (PlatoServiceException e) {
                    String errorMsg = "Could not start emulation service." + e.getMessage();
                    setUniformProgramOutput(a, errorMsg, false);
View Full Code Here

    /**
     * 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();
            a.getExperiment().getDetailedInfo().put(so, info);
        }
       
        this.selectedExperimentInfo = info;

        if (this.selectedExperimentInfo.getProgramOutput() == null) {
View Full Code Here

            if (action.isSelected()) {
                /*
                 * Create a new alternative for this service
                 */
                String uniqueName = selectedPlan.getAlternativesDefinition().createUniqueName(action.getShortname());
                Alternative a = Alternative.createAlternative(uniqueName, action);
               
                // and add it to the preservation planning project
                selectedPlan.getAlternativesDefinition().addAlternative(a);
            }
        }
View Full Code Here

                     * TODO what about adding planets and filtering
                     * services according to "sensible" target formats
                     * (e.g. images: png,tiff,jp2,jpg,dng) ?
                     */
                    for (PreservationActionDefinition definition : actions) {
                        Alternative a = Alternative.createAlternative(
                                selectedPlan.getAlternativesDefinition().createUniqueName(definition.getShortname()),
                                definition);
                        // and add it to the preservation planning project
                        selectedPlan.getAlternativesDefinition()
                                .addAlternative(a);
View Full Code Here

       
        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
        // we have to merge the sample object back into the session to be able to access the byte stream
        DigitalObject result = em.merge(a.getExperiment().getResults().get(record));
        a.getExperiment().getResults().put(o, result);
       
        jhoveTree2=characteriseJHove(result);    
    }
View Full Code Here

     *
     * @return
     */
    private boolean isExecutablePreservationPlanPossible() {
       
        Alternative recommendedAlternative = selectedPlan.getRecommendation().getAlternative();
       
        // does the recommended alternative exist and does it have an "action". if not we can't
        // create an executable preservation plan
        if (recommendedAlternative == null || recommendedAlternative.getAction() == null) {
            return false;
        }
       
        // if the recommended action is not a Planets action, we cannot create an executable
        // preservation plan
        if (!"Planets-local".equals(recommendedAlternative.getAction().getActionIdentifier())) {
            return false;
        }
    
        return true;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.Alternative

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.