Package eu.planets_project.ifr.core.techreg.formats

Examples of eu.planets_project.ifr.core.techreg.formats.FormatRegistry


     * @param sourceFormat source format from which we want to migrate
     */
    public List<PreservationActionDefinition> getAvailableActions(FormatInfo sourceFormat)
            throws PlatoServiceException {
       
        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
       
        // we only want migration services
        ServiceDescription sdQuery = new ServiceDescription.Builder(null, Migrate.class.getCanonicalName()).build();
       
        ServiceDescription sdQueryViewer = new ServiceDescription.Builder(null, CreateView.class.getCanonicalName()).build();
       
        // query all migration services
        List<ServiceDescription> list = registry.query(sdQuery);
       
        List<ServiceDescription> listViewers = registry.query(sdQueryViewer);
       
        list.addAll(listViewers);
       
        // the list of available preservation action services we want to offer the user
        List<PreservationActionDefinition> services = new ArrayList<PreservationActionDefinition>();
       
        // iterate through services list
        for (ServiceDescription sd : list) {
           
           
            // iterate through migration paths of found service
            for( MigrationPath path : sd.getPaths() ) {
               
                Format inputFormat = fr.getFormatForUri(path.getInputFormat());
               
                // check if this is the input format we are looking for
                if (false == inputFormat.getExtensions().contains(sourceFormat.getDefaultExtension())) {
                    continue;
                }
               
                // 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());
View Full Code Here


        registry
                .register(/* new Droid().describe() */new ServiceDescription.Builder(
                        "Droid", Identify.class.getName()).endpoint(endpoint1)
                        .build());
        /* We can register supported migration paths with the service description: */
        FormatRegistry formatRegistry = FormatRegistryFactory.getFormatRegistry();
        MigrationPath path = new MigrationPath(formatRegistry.createExtensionUri("jpg"),
                formatRegistry.createExtensionUri("bmp"), null);
        registry
                .register(/* new SanselanMigrate().describe() */new ServiceDescription.Builder(
                        "Sanselan", Migrate.class.getName())
                        .endpoint(endpoint2).paths(path).build());
        /* And can then query by example, e.g. for migration services supporting the path: */
 
View Full Code Here

    private static boolean mappable(final URI candidate, final URI sample, final MatchingMode mode) {
        /* No mapping required: */
        if (mode.matches(candidate.toString(), sample.toString())) {
            return true;
        }
        FormatRegistry registry = FormatRegistryFactory.getFormatRegistry();
        List<URI> candidateAliases = registry.getFormatUriAliases(candidate);
        List<URI> sampleAliases = registry.getFormatUriAliases(sample);
        /* If one of the aliases of the candidate and the sample match we're OK: */
        for (URI sampleAlias : sampleAliases) {
            for (URI candidateAlias : candidateAliases) {
                if (mode.matches(candidateAlias.toString(), sampleAlias.toString())) {
                    return true;
View Full Code Here

                        log.info("Extracted metadata: " + metadata);
                    }
                   
                    // Migrate
                    try {
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            dgo = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
                            dgo = new DigitalObject.Builder(dgo.getContent())
                                .title(tmpDo.getTitle().substring(0, tmpDo.getTitle().lastIndexOf(".")))
                                .build();
                            objects.add(dgo);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
View Full Code Here

                        log.info("Extracted metadata: " + metadata);
                    }
                   
                    // Migrate
                    try {
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            dgo = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
                            objects.add(dgo);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
                                    .getTitle())));
                        }
                    } catch (URISyntaxException e) {
View Full Code Here

        sd.classname(this.getClass().getCanonicalName());
        sd.version("0.1");

        List<URI> inputFormatsPUID = new ArrayList<URI>();
        List<URI> outputFormatsPUID = new ArrayList<URI>();
        FormatRegistry formatRegistry = FormatRegistryFactory
                .getFormatRegistry();

        inputFormatsPUID.add(formatRegistry.createPronomUri("fmt/96")); // HTML
        // versions
        // older than
        // 2.0
        inputFormatsPUID.add(formatRegistry.createPronomUri("fmt/97")); // HTML 2.0
        inputFormatsPUID.add(formatRegistry.createPronomUri("fmt/98")); // HTML 3.2
        inputFormatsPUID.add(formatRegistry.createPronomUri("fmt/99")); // HTML 4.0
        inputFormatsPUID.add(formatRegistry.createPronomUri("fmt/100")); // HTML 4.01

        outputFormatsPUID.add(formatRegistry.createPronomUri("fmt/102")); // XHTML 1.0

        List<Parameter> parameterList = new ArrayList<Parameter>();
        Parameter configFile = new Parameter.Builder("configFile",
                "The content of a config file read into a String.").description(
                "Allows configurating JTidy by passing it a config file consisting of name=value pairs.\n"
View Full Code Here

                    // Migrate
                    try {
                        String ext = dgo.getTitle().substring(dgo.getTitle().lastIndexOf('.')+1, dgo.getTitle().length());
                        log.info("detected extension: "+ext);
                       
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        //String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            DigitalObject dgoOut = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
                           
                            objects.add(dgoOut);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
                                    .getTitle())));
                        }
View Full Code Here

                    // Migrate
                    try {
                        String ext = dgo.getTitle().substring(dgo.getTitle().lastIndexOf('.')+1, dgo.getTitle().length());
                        log.info("detected extension: "+ext);
                       
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        //String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            DigitalObject dgoOut = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
                           
                            objects.add(dgoOut);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
                                    .getTitle())));
                        }
View Full Code Here

                        log.info("Extracted metadata: " + metadata);
                    }
                   
                    // Migrate
                    try {
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            dgo = runMigrationService(dgo, fr.createExtensionUri(ext), wfResult);
                            objects.add(dgo);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
                                    .getTitle())));
                        }
                    } catch (URISyntaxException e) {
View Full Code Here

                    dgo = runCropService(dgo, types[0], metadata, wfResult);
                    log.info(new Message("Cropping", new Parameter("Metadata", metadata)));

                    // Migrate to JPEG
                    try {
                        FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
                        String ext = fr.getFirstExtension(new URI(types[0]));
                        log.info("Getting extension: " + ext);
                        if (ext != null) {
                            dgo = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
                            objects.add(dgo);
                            log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
                                    .getTitle())));
                        }
                    } catch (URISyntaxException e) {
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.techreg.formats.FormatRegistry

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.