Package eu.planets_project.pp.plato.model

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


                String targetFormat = targetFormats[i];
                /*
                 * Then get all the possible migration paths for each target format
                 * - each migration path corresponds to one service  
                 */
                PreservationActionDefinition action;
               
                MigrationPath[] paths = serviceRegistryService.getMigrationPaths(cribID, targetFormat);
                for (int j = 0; j < paths.length; j++) {
                    MigrationPath path = paths[j];
                    action = new PreservationActionDefinition();
                   
                    action.setShortname(getShortnameFromPath(path, shortnames));
                    String urls[] = path.getAccessPoints();
                    LinkedList<Parameter> params = new LinkedList<Parameter>();
                    for (int k = 0; k < urls.length; k++) {
                        Parameter param = new Parameter();
                        param.setName(""+k);
                        param.setValue(urls[k]);
                        params.add(param);
                    }
                    action.setParams(params);
                    action.setTargetFormat(targetFormats[i]);
                    if (urls.length > 0)
                        action.setUrl(urls[0].substring(0, urls[0].lastIndexOf("/")));
                    /*
                     * extract information about the conversions from urls
                     */
                    StringBuilder b = new StringBuilder();
                    b.append(getSourceFormatFromPath(urls[0]));
                    for(int uIdx = 0; uIdx < urls.length; uIdx++) {
                        b.append(">");
                        b.append(getTargetFormatFromPath(urls[uIdx]));
                    }
                    action.setInfo(b.toString());
                    /*
                     * mark this as a CRiB action
                     */
                    action.setActionIdentifier("CRiB");
                    /*
                     * no gif, bmp, text - conversions: they are of minor interest for dp
                     */
/*                String info = action.getInfo().toUpperCase();
                    if (!(info.contains("GIF") ||
View Full Code Here


                }
               
                // get the output format the service is able to migrate to
                Format outputFormat = fr.getFormatForUri(path.getOutputFormat());

                PreservationActionDefinition pad = new PreservationActionDefinition();
               
                pad.setActionIdentifier("Planets-local");
                pad.setTargetFormat(outputFormat.getUri().toString());
                pad.setShortname(sd.getName() + " @ " + sd.getEndpoint().getHost());
                pad.setUrl(sd.getEndpoint().toString());
               
                String input;
               
                // if an extension is defined we take the first one from the list
                if (inputFormat.getExtensions().size() > 0) {
                    input = inputFormat.getExtensions().iterator().next();
                } else {
                    input = inputFormat.getUri().toString();
                }
               
                String output;
               
                // if an extension is defined we take the first one from the list               
                if (outputFormat.getExtensions().size() > 0) {
                    output = outputFormat.getExtensions().iterator().next();
                } else {
                    output = outputFormat.getUri().toString();
                }
               
                pad.setInfo(input+" > "+output);

               
               
                if (sd.getParameters() != null) {
                    String paramInfo = "";
                    // from the Planets registry we can have parameters and their possible values.
                    for (Parameter p : sd.getParameters()) {
                        paramInfo += (p.getName() + " = " + p.getValue() + "\n");
                    }
                   
                    pad.setParameterInfo(paramInfo);
                }
               
                services.add(pad);
            }
           
        }
       
        for (ServiceDescription sd : listViewers) {

            if (CreateView.class.getCanonicalName().equals(sd.getType())) {
                PreservationActionDefinition pad = new PreservationActionDefinition();
               
                pad.setActionIdentifier("Planets-Viewer-local");
                pad.setTargetFormat("");
                pad.setShortname(sd.getName() + " @ " + sd.getEndpoint().getHost());
                pad.setUrl(sd.getEndpoint().toString());
                pad.setEmulated(true);
               
                pad.setInfo(sd.getDescription());
               
                services.add(pad);
            }
        }
       
View Full Code Here

                String targetFormat = targetFormats[i];
                /*
                 * Then get all the possible migration paths for each target format
                 * - each migration path corresponds to one service  
                 */
                PreservationActionDefinition action;
               
                MigrationPath[] paths = serviceRegistryService.findall_migrationPaths(cribID, targetFormat);
                for (int j = 0; j < paths.length; j++) {
                    MigrationPath path = paths[j];
                    action = new PreservationActionDefinition();
                   
                    action.setShortname(getShortnameFromPath(path, shortnames));
                    String urls[] = path.getAccessPoints();
                    LinkedList<Parameter> params = new LinkedList<Parameter>();
                    for (int k = 0; k < urls.length; k++) {
                        Parameter param = new Parameter();
                        param.setName("crib::location"+k);
                        param.setValue(urls[k]);
                        params.add(param);
                    }
                    action.setParams(params);
                    action.setTargetFormat(targetFormats[i]);
                    if (urls.length > 0)
                        action.setUrl(urls[0].substring(0, urls[0].lastIndexOf("/")));
                    /*
                     * extract information about the conversions from urls
                     */
                    StringBuilder b = new StringBuilder();
                    b.append(getSourceFormatFromPath(urls[0]));
                    for(int uIdx = 0; uIdx < urls.length; uIdx++) {
                        b.append(">");
                        b.append(getTargetFormatFromPath(urls[uIdx]));
                    }
                    action.setInfo(b.toString());
                    /*
                     * mark this as a CRiB action
                     */
                    action.setActionIdentifier("CRiB-local");
                    /*
                     * no gif, bmp, text - conversions: they are of minor interest for dp
                     */
/*                String info = action.getInfo().toUpperCase();
                    if (!(info.contains("GIF") ||
View Full Code Here

            // this should not happen if MiniREEF is properly configured
            log.error("querying miniREEF/P2 knowledge base failed for statement: " + statement);
            return result;
        }
       
        PreservationActionDefinition def;
        for (int i = 0 ; i < resultSet.size(); i++) {
            def = new PreservationActionDefinition();
            def.setShortname("Convert using " + resultSet.getRow(i).get(0)+" "+resultSet.getRow(i).get(1));
            def.setTargetFormat(resultSet.getRow(i).get(2)+" "+resultSet.getRow(i).get(3));
            def.setInfo("by "+resultSet.getRow(i).get(4));
            def.setActionIdentifier("P2");
            def.setExecutable(false);
//            if (service.getTargetFormat() != null) {
//               def.setTargetFormat(service.getTargetFormat().getDefaultExtension());
//               def.setTargetFormatInfo(service.getTargetFormat());
//            }
//            def.setInfo(service.getDescription());
View Full Code Here

    public List<PreservationActionDefinition> getAvailableActions(
            FormatInfo sourceFormat) throws PlatoServiceException {
        List<PreservationActionService> services = registry.findServices(sourceFormat, null);
        ArrayList<PreservationActionDefinition> result = new ArrayList<PreservationActionDefinition>();
        PreservationActionDefinition def;
        for (PreservationActionService service : services) {
            def = new PreservationActionDefinition();
            def.setShortname(service.getName());
            if (service.getTargetFormat() != null) {
               def.setTargetFormat(service.getTargetFormat().getDefaultExtension());
               def.setTargetFormatInfo(service.getTargetFormat());
            }
            def.setInfo(service.getDescription());
            def.setUrl(service.getUrl());
            def.setDescriptor(service.getDescriptor());
            if (service.isMigration())
               def.setActionIdentifier("MiniMEE-migration");
            else {
               def.setEmulated(true);
               def.setActionIdentifier("MiniMEE-emulation" );
               // TODO: refine setting type according to sourceFormat
               if ("avi".equals(sourceFormat.getDefaultExtension()) ||
                   "mpg".equals(sourceFormat.getDefaultExtension()) ||
                   "mpeg".equals(sourceFormat.getDefaultExtension())) {
                   def.setParamByName("filetype", "1");
               }
               else if ("jpg".equals(sourceFormat.getDefaultExtension()) ||
                   "gif".equals(sourceFormat.getDefaultExtension())||
                   "tif".equals(sourceFormat.getDefaultExtension())) {
                  def.setParamByName("filetype", "2");
               }
               else if ("pdf".equals(sourceFormat.getDefaultExtension()) ||
                        "sam".equals(sourceFormat.getDefaultExtension())) {
                  def.setParamByName("filetype", "3");
               }
            }
            result.add(def);
        }
       
View Full Code Here

        }
        this.changed="T";
        // das sieht verd�chtig aus - pad wird auch geschrieben.
        // ABER die settings, die in pad eingetragen werden, brauchen wir nicht zum persistieren, sondern nur zum
        // ausf�hren der action - stehen ja in experiment.settings. daher ist es ok, dass wir die merged instance ver�ndern.
        PreservationActionDefinition pad = em.merge(a.getAction());
        pad.setExecute(a.getAction().isExecute());

        String settings = a.getExperiment().getSettings();
        pad.setParamByName("settings", settings);

        StringBuffer runDescription = new StringBuffer();

        if (action instanceof IMigrationAction) {
            DigitalObject migrationResultObject;
View Full Code Here

TOP

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

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.