Package eu.planets_project.pp.plato.model

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


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

            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

    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

     * 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

     * 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

                .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

        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

TOP

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

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.