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

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


           
           
            // 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());
                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);

               
View Full Code Here


        /**
         * @return
         */
        public String getSummary() {
            try {
                Format f = ServiceBrowser.fr.getFormatForUri(new URI(format));
                if( f.getExtensions() != null && f.getExtensions().size() > 0 ) {
                    String fs = ""; // Use the (1st) longest extension:
                    for( String ext : f.getExtensions() ) {
                        if( ext.length() > fs.length() ) fs = ext;
                    }
                    fs = fs.toUpperCase();
                    if( f.getVersion() != null ) fs += " v."+f.getVersion();
                    if( f.getSummary() != null )
                        fs += " - "+f.getSummary();
                    fs += " ("+f.getUri()+")";
                    return fs;
                } else {
                    return f.getSummary() + " " + f.getVersion();
                }
            } catch ( Exception e) {
                log.error("Could not understand format URI: "+format);
                return "unknown";
            }
View Full Code Here

        Set<Format> formats = new HashSet<Format>();
        for( ServiceDescription sd : this.listAllMigrationServices() )  {
            for( MigrationPath path : sd.getPaths() ) {
                if( ( endpoint == null ) || endpoint.equals(sd.getEndpoint().toString()) ) {
                    if( ( outputFormat == null ) || outputFormat.equals(path.getOutputFormat().toString()) ) {
                        Format fmt = fr.getFormatForUri( path.getInputFormat() );
                        formats.add(fmt);
                    }
                }
            }
        }
View Full Code Here

        Set<Format> formats = new HashSet<Format>();
        for( ServiceDescription sd : this.listAllMigrationServices() )  {
            for( MigrationPath path : sd.getPaths() ) {
                if( ( endpoint == null ) || endpoint.equals(sd.getEndpoint().toString()) ) {
                    if( ( inputFormat == null ) || inputFormat.equals(path.getInputFormat().toString()) ) {
                        Format fmt = fr.getFormatForUri( path.getOutputFormat() );
                        formats.add(fmt);
                    }
                }
            }
        }
View Full Code Here

     */
    private List<FormatBean> urisToFormats( List<URI> uris ) {
        if( uris == null ) return null;
        List<FormatBean> fmts = new ArrayList<FormatBean>();
        for( URI fmturi: uris ) {
            Format fmt = ServiceBrowser.fr.getFormatForUri( fmturi );
            fmts.add(new FormatBean(fmt) );
        }
        return fmts;
    }
View Full Code Here

    /**
     * @param fmturi
     * @return
     */
    private String formatSummary( URI fmturi ) {
        Format fmt = ServiceBrowser.fr.getFormatForUri( fmturi );
        if( fmt.getSummary() != null ) {
            return fmt.getSummary() + " " + fmt.getVersion();
        } else {
            return fmt.getUri().toString();
        }
    }
View Full Code Here

   
   
    private List<URI> getPronomURIAliases(URI typeURI) {
        Set<URI> turis = new HashSet<URI>();
       
        Format fmt = format.getFormatForUri(typeURI);
        if( format.isUriOfType(typeURI,UriType.MIME) ) {
            Set<URI> furis = ServiceBrowser.fr.getUrisForMimeType(fmt.getMimeTypes().iterator().next());
            turis.addAll(furis);
        } else if( format.isUriOfType(typeURI, UriType.EXTENSION)) {
            Set<URI> furis = ServiceBrowser.fr.getUrisForExtension(fmt.getExtensions().iterator().next());
            turis.addAll(furis);
        } else {
            // Aliases:
            for( URI uri : fmt.getAliases() ) {
                turis.add(uri);
            }
        }
        return new ArrayList<URI>(turis);
    }
View Full Code Here

TOP

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

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.