Changeset 3860


Ignore:
Timestamp:
03/30/08 00:51:54 (12 years ago)
Author:
curtis
Message:

Move list of libraries into external configuration file.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.properties

    r3857 r3860  
    140140### LOCI Plugins for ImageJ ### 
    141141 
    142 plugins.jar    = loci_plugins.jar 
    143 plugins.main   = loci.plugins.About 
    144 plugins.source = loci/plugins/**/*.java \ 
    145                  loci/ome/util/**/*.java 
    146 plugins.files  = loci/plugins/** \ 
    147                  loci/ome/util/** 
     142plugins.jar       = loci_plugins.jar 
     143plugins.main      = loci.plugins.About 
     144plugins.source    = loci/plugins/**/*.java \ 
     145                    loci/ome/util/**/*.java 
     146plugins.files     = loci/plugins/** \ 
     147                    loci/ome/util/** 
     148plugins.resources = loci/plugins/config/*.txt 
    148149 
    149150### OME Notes ### 
  • trunk/build.xml

    r3802 r3860  
    568568  </target> 
    569569 
     570  <target name="copy-resources-plugins"> 
     571    <copy todir="${classes.dir}" preservelastmodified="true"> 
     572      <fileset dir="${src.dir}" includes="${plugins.resources}"/> 
     573    </copy> 
     574  </target> 
     575 
    570576  <target name="copy-resources-notes"> 
    571577    <copy todir="${classes.dir}" preservelastmodified="true"> 
     
    587593 
    588594  <target name="copy-source" depends="init, copy-resources-formats, 
    589     copy-resources-visbio, copy-resources-notes, copy-resources-editor, 
    590     copy-resources-checks"> 
     595    copy-resources-visbio, copy-resources-plugins, copy-resources-notes, 
     596                copy-resources-editor, copy-resources-checks"> 
    591597    <!-- copy binary files without filtering --> 
    592598    <copy todir="${dest.dir}" preservelastmodified="true"> 
  • trunk/loci/plugins/config/ConfigWindow.java

    r3859 r3860  
    3131import java.lang.reflect.Field; 
    3232import java.lang.reflect.Method; 
    33 import java.util.Arrays; 
     33import java.io.*; 
     34import java.util.*; 
    3435import javax.swing.*; 
    3536import javax.swing.border.EmptyBorder; 
     
    118119    catch (Throwable t) { } 
    119120 
    120     LibraryEntry[] libraries = { 
    121       // core libraries 
    122       new LibraryEntry("Java", libCore, // classes.jar, rt.jar 
    123         "java.lang.System", javaVersion, 
    124         "http://java.sun.com/", "Varies", "Core Java library"), 
    125       new LibraryEntry("ImageJ", libCore, // ij.jar 
    126         "ij.ImageJ", null, 
    127         "http://rsb.info.nih.gov/ij/", "Public domain", 
    128         "Core ImageJ library"), 
    129       new LibraryEntry("Java3D", libCore, 
    130         "javax.vecmath.Point3d", null, 
    131         "https://java3d.dev.java.net/", "GPL", 
    132         "Not used; listed for informational purposes only."), 
    133       new LibraryEntry("Jython", libCore, 
    134         "org.python.util.PythonInterpreter", null, 
    135         "http://www.jython.org/", "BSD", 
    136         "Not used; listed for informational purposes only."), 
    137       new LibraryEntry("MATLAB", libCore, 
    138         "com.mathworks.jmi.Matlab", matlabVersion, 
    139         "http://www.mathworks.com/products/matlab/", "Commercial", 
    140         "Not used; listed for informational purposes only. " + 
    141         "Note that for MATLAB to be successfully detected here, " + 
    142         "ImageJ must be launched from within the MATLAB environment."), 
    143  
    144       // native libraries 
    145       new LibraryEntry("QuickTime for Java", libNative, 
    146         "quicktime.QTSession", qtVersion, // QTJava.zip 
    147         "http://www.apple.com/quicktime/", "Commercial", 
    148         "Bio-Formats has two modes of operation for QuickTime movies:\n" + 
    149         "1) QTJava mode requires the QuickTime for Java library to be " + 
    150         "installed.\n" + 
    151         "2) Native mode works on systems with no QuickTime (e.g., Linux).\n" + 
    152         "\n" + 
    153         "Using QTJava mode adds or improves support for the following " + 
    154         "codecs:\n" + 
    155         "1) [iraw] Intel YUV Uncompressed: enables write\n" + 
    156         "2) [rle] Animation (run length encoded RGB): " + 
    157         "improves read, enables write\n" + 
    158         "3) [rpza] Apple Video 16 bit \"road pizza\": improves read\n" + 
    159         "4) [cvid] Cinepak: enables read and write\n" + 
    160         "5) [svq1] Sorenson Video: enables read and write\n" + 
    161         "6) [svq3] Sorenson Video 3: enables read and write\n" + 
    162         "7) [mp4v] MPEG-4: enables read and write\n" + 
    163         "8) [h263] H.263: enables read and write\n" + 
    164         "\n" + 
    165         "You can toggle which mode is used " + 
    166         "in the Formats tab's \"QuickTime\" entry."), 
    167       new LibraryEntry("JAI Image I/O Tools - native codecs", libNative, 
    168         "TODO", null, 
    169         "https://jai-imageio.dev.java.net/", "BSD", 
    170         "Used by Bio-Formats for lossless JPEG support in DICOM."), 
    171       new LibraryEntry("Nikon ND2 plugin", libNative, 
    172         "TODO", null, 
    173         "http://rsb.info.nih.gov/ij/plugins/nd2-reader.html", "Commercial", 
    174         "Optional plugin. If you have Nikon's ND2 plugin installed, you can " + 
    175         "configure Bio-Formats to use it instead of its native ND2 support " + 
    176         "in the Formats tab's \"Nikon ND2\" entry."), 
    177  
    178       // ImageJ plugins 
    179       new LibraryEntry("LOCI plugins", libPlugin, 
    180         "loci.plugins.About", bfVersion, // loci_plugins.jar 
    181         "http://www.loci.wisc.edu/ome/formats.html", "LGPL", 
    182         "LOCI Plugins for ImageJ: a collection of ImageJ plugins including " + 
    183         "the Bio-Formats Importer, Bio-Formats Exporter, Data Browser, " + 
    184         "Stack Colorizer, Stack Slicer, and OME plugins."), 
    185       new LibraryEntry("Image5D", libPlugin, 
    186         "i5d.Image5D", null, // Image_5D.jar 
    187         "http://rsb.info.nih.gov/ij/plugins/image5d.html", "Public domain", 
    188         "Optional plugin. If you have Image5D installed, the Bio-Formats " + 
    189         "Importer plugin can use Image5D to display your image stacks."), 
    190       new LibraryEntry("View5D", libPlugin, 
    191         "View5D_", null, // View5D_.jar 
    192         "http://www.nanoimaging.de/View5D/", "GPL", 
    193         "Optional plugin. If you have View5D installed, the Bio-Formats " + 
    194         "Importer plugin can use View5D to display your image stacks."), 
    195  
    196       // Java libraries 
    197       new LibraryEntry("Bio-Formats", libJava, 
    198         "loci.formats.IFormatReader", bfVersion, // bio-formats.jar 
    199         "http://www.loci.wisc.edu/ome/formats.html", "LGPL", 
    200         "LOCI Bio-Formats package for reading and converting " + 
    201         "biological file formats."), 
    202       new LibraryEntry("BUFR Java Decoder", libJava, 
    203         "ucar.bufr.BufrDump", null, // bufr-1.1.00.jar 
    204         "http://www.unidata.ucar.edu/software/decoders/", "LGPL", 
    205         "Used by the NetCDF Java library."), 
    206       new LibraryEntry("JAI Image I/O Tools - Java wrapper", libJava, 
    207         "com.sun.medialib.codec.jiio.Constants", null, // clibwrapper_jiio.jar 
    208         "https://jai-imageio.dev.java.net/", "BSD", 
    209         "Java wrapper for JAI Image I/O Tools native codecs."), 
    210       new LibraryEntry("GRIB Java Decoder", libJava, 
    211         "ucar.grib.GribChecker", null, // grib-5.1.03.jar 
    212         "http://www.unidata.ucar.edu/software/decoders/", "LGPL", 
    213         "Used by the NetCDF Java library."), 
    214       new LibraryEntry("JAI Image I/O Tools - Java codecs", libJava, 
    215         "com.sun.media.imageio.plugins.jpeg2000.J2KImageReadParam", 
    216         null, // jai_imageio.jar 
    217         "https://jai-imageio.dev.java.net/", "BSD", 
    218         "Used by Bio-Formats for JPEG2000 support (ND2, JP2)."), 
    219       new LibraryEntry("MDB Tools (Java port)", libJava, 
    220         "mdbtools.libmdb.MdbFile", null, // mdbtools-java.jar 
    221         "http://sourceforge.net/forum/message.php?msg_id=2550619", "LGPL", 
    222         "Used by Bio-Formats for Zeiss LSM metadata in MDB database files."), 
    223       new LibraryEntry("NetCDF Java", libJava, 
    224         "ucar.nc2.NetcdfFile", null, // netcdf-4.0.jar 
    225         "http://www.unidata.ucar.edu/software/netcdf-java/", "LGPL", 
    226         "Used by Bio-Formats for HDF support (Imaris 5.5)."), 
    227       new LibraryEntry("Apache Jakarta POI (LOCI version)", libJava, 
    228         "org.apache.poi.poifs.filesystem.POIFSDocument", null, // poi-loci.jar 
    229         "http://jakarta.apache.org/poi/", "Apache", 
    230         "Used by Bio-Formats for OLE support in CXD, IPW, OIB and ZVI " + 
    231         "formats. Based on poi-2.5.1-final-20040804.jar, with bugfixes for " + 
    232         "OLE v2 and memory efficiency improvements."), 
    233       new LibraryEntry("Simple Logging Facade for Java", libJava, 
    234         "org.slf4j.Logger", null, // slf4j-jdk14.jar 
    235         "http://www.slf4j.org/", "MIT", 
    236         "Used by the NetCDF Java library."), 
    237       new LibraryEntry("OME Java", libJava, 
    238         "ome.xml.OMEXMLNode", null, // ome-java.jar 
    239         "http://openmicroscopy.org/api/java/", "LGPL", 
    240         "Used by the \"Download from OME\" and \"Upload to OME\" plugins " + 
    241         "to connect to OME. Used by Bio-Formats to work with OME-XML."), 
    242       new LibraryEntry("Apache Jakarta Commons HttpClient", libJava, 
    243         "org.apache.commons.httpclient.HttpConnection", 
    244         null, // commons-httpclient-2.0-rc2.jar 
    245         "http://jakarta.apache.org/commons/httpclient/", "Apache", 
    246         "Required for OME Java to communicate with OME servers."), 
    247       new LibraryEntry("Apache Jakarta Commons Logging", libJava, 
    248         "org.apache.commons.logging.Log", null, // commons-logging.jar 
    249         "http://jakarta.apache.org/commons/logging/", "Apache", 
    250         "Used by OME Java."), 
    251       new LibraryEntry("Apache XML-RPC", libJava, 
    252         "org.apache.xmlrpc.XmlRpc", null, // xmlrpc-1.2-b1.jar 
    253         "http://ws.apache.org/xmlrpc/", "Apache", 
    254         "Required for OME Java to communicate with OME servers"), 
    255       new LibraryEntry("OMERO Common", libJava, 
    256         "ome.model.core.Image", null, // omero-common.jar 
    257         "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads", 
    258         "LGPL", "Used by Bio-Formats to connect to OMERO."), 
    259       new LibraryEntry("OMERO Client", libJava, 
    260         "ome.client.Session", null, // omero-client.jar 
    261         "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads", 
    262         "LGPL", "Used by Bio-Formats to connect to OMERO."), 
    263       new LibraryEntry("Spring", libJava, 
    264         "org.springframework.core.SpringVersion", null, // spring.jar 
    265         "http://springframework.org/", "Apache", 
    266         "Used by Bio-Formats to connect to OMERO."), 
    267       new LibraryEntry("JBoss Client", libJava, 
    268         "org.jboss.system.Service", null, // jbossall-client.jar 
    269         "http://jboss.org/", "LGPL", 
    270         "Used by Bio-Formats to connect to OMERO."), 
    271       new LibraryEntry("JGoodies Forms", libJava, 
    272         "com.jgoodies.forms.layout.FormLayout", null, // forms-1.0.4.jar 
    273         "http://www.jgoodies.com/freeware/forms/index.html", "BSD", 
    274         "Used for layout by the Data Browser plugin."), 
    275       new LibraryEntry("OME Notes", libJava, 
    276         "loci.ome.notes.Notes", null, // ome-notes.jar 
    277         "http://www.loci.wisc.edu/ome/notes.html", "LGPL", 
    278         "OME Notes library for flexible organization and presentation " + 
    279         "of OME-XML metadata."), 
    280       new LibraryEntry("LuraWave decoder SDK", libJava, 
    281         "com.luratech.lwf.lwfDecoder", null, // lwf_jsdk2.6.jar 
    282         "http://www.luratech.com/", "Commercial", 
    283         "Used by Bio-Formats to decode Flex files " + 
    284         "compressed with the LuraWave JPEG2000 codec.") 
    285     }; 
     121    Hashtable versions = new Hashtable(); 
     122    if (javaVersion != null) versions.put("javaVersion", javaVersion); 
     123    if (bfVersion != null) versions.put("bfVersion", bfVersion); 
     124    if (qtVersion != null) versions.put("qtVersion", qtVersion); 
     125    if (matlabVersion != null) versions.put("matlabVersion", matlabVersion); 
     126 
     127    LibraryEntry[] libraries = parseLibraries("libraries.txt", versions); 
    286128    Arrays.sort(libraries); 
    287129 
     
    405247  // -- Helper methods -- 
    406248 
     249  private static LibraryEntry[] parseLibraries(String resource, 
     250    Hashtable versions) 
     251  { 
     252    Vector list = new Vector(); 
     253    Hashtable props = null; 
     254    String propKey = null; 
     255    StringBuffer propValue = new StringBuffer(); 
     256    BufferedReader in = new BufferedReader(new InputStreamReader( 
     257      ConfigWindow.class.getResourceAsStream(resource))); 
     258    while (true) { 
     259      String line = null; 
     260      try { 
     261        line = in.readLine(); 
     262      } 
     263      catch (IOException exc) { 
     264        break; 
     265      } 
     266      if (line == null) break; 
     267 
     268      // ignore characters following # sign (comments) 
     269      int ndx = line.indexOf("#"); 
     270      if (ndx >= 0) line = line.substring(0, ndx); 
     271      boolean space = line.startsWith(" "); 
     272      line = line.trim(); 
     273      if (line.equals("")) continue; 
     274 
     275      // parse key/value pairs 
     276      int equals = line.indexOf("="); 
     277      if (line.startsWith("[")) { 
     278        // new entry 
     279        if (props == null) props = new Hashtable(); 
     280        else { 
     281          addProp(props, propKey, propValue.toString(), versions); 
     282          list.add(new LibraryEntry(props)); 
     283        } 
     284        props.clear(); 
     285        props.put("name", line.substring(1, line.length() - 1)); 
     286        propKey = null; 
     287      } 
     288      else if (space) { 
     289        // append to previous property value 
     290        propValue.append(" "); 
     291        propValue.append(line); 
     292      } 
     293      else if (equals >= 0) { 
     294        addProp(props, propKey, propValue.toString(), versions); 
     295        propKey = line.substring(0, equals - 1).trim(); 
     296        propValue.setLength(0); 
     297        propValue.append(line.substring(equals + 1).trim()); 
     298      } 
     299    } 
     300    try { 
     301      in.close(); 
     302    } 
     303    catch (IOException exc) { } 
     304    LibraryEntry[] entries = new LibraryEntry[list.size()]; 
     305    list.copyInto(entries); 
     306    return entries; 
     307  } 
     308 
     309  private static void addProp(Hashtable props, 
     310    String key, String value, Hashtable versions) 
     311  { 
     312    if (key == null) return; 
     313 
     314    // replace \n sequence with newlines 
     315    value = value.replaceAll("\\\\n *", "\n"); 
     316 
     317    if (key.equals("version")) { 
     318      // get actual value from versions hashtable 
     319      value = (String) versions.get(value); 
     320    } 
     321    if (value != null) props.put(key, value); 
     322  } 
     323 
    407324  private JLabel makeLabel(String text, boolean top) { 
    408325    JLabel label = new JLabel(text); 
  • trunk/loci/plugins/config/LibraryEntry.java

    r3856 r3860  
    2525 
    2626package loci.plugins.config; 
     27 
     28import java.io.File; 
     29import java.net.URLDecoder; 
     30import java.util.Hashtable; 
    2731 
    2832/** 
     
    6064 
    6165  // -- Constructor -- 
     66 
     67  public LibraryEntry(Hashtable props) { 
     68    this((String) props.get("name"), 
     69      (String) props.get("type"), 
     70      (String) props.get("class"), 
     71      (String) props.get("version"), 
     72      (String) props.get("url"), 
     73      (String) props.get("license"), 
     74      (String) props.get("notes")); 
     75  } 
    6276 
    6377  public LibraryEntry(String name, String type, String libClass, 
     
    98112      path = path.replaceAll("^file:", ""); 
    99113      path = path.replaceAll("^/*/", "/"); 
     114      path = path.replaceAll("^/([A-Z]:)", "$1"); 
    100115      path = path.replaceAll("!.*", ""); 
     116      path = URLDecoder.decode(path, "UTF-8"); 
     117                        String slash = File.separator; 
     118                        if (slash.equals("\\")) slash = "\\\\"; 
     119      path = path.replaceAll("/", slash); 
    101120    } 
    102121    catch (Throwable t) { } 
Note: See TracChangeset for help on using the changeset viewer.