Examples of Alternative


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

     */
    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

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

        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

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

    /**
     * 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

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

            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

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

                     * 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

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

       
        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

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

     *
     * @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

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

       
        if (registry == null) {
            return false;
        }
       
        Alternative recommendedAlternative = selectedPlan.getRecommendation().getAlternative();
       
        if (recommendedAlternative.getAction() == null) {
            return false;
        }
       
        if ("MiniMEE-migration".equals(recommendedAlternative.getAction().getActionIdentifier())) {

            String toolIdentifier = getToolIdentifier(registry);
           
            if (toolIdentifier != null && !"".equals(toolIdentifier)) {
                return true;
View Full Code Here

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

        return false;
    }
   
    private String getToolIdentifier(IPreservationActionRegistry registry) {
       
        Alternative recommendedAlternative = selectedPlan.getRecommendation().getAlternative();
               
        String toolIdentifier = registry.getToolIdentifier(recommendedAlternative.getAction().getUrl());
       
        return toolIdentifier;
    }
View Full Code Here

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

                minimee = par;
                break;
            }
        }
       
        Alternative recommendedAlternative = selectedPlan.getRecommendation().getAlternative();
       
        if (minimee != null) {
            registry = PreservationActionRegistryFactory.getInstance(minimee);
        }
       
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.