Changeset 1211


Ignore:
Timestamp:
08/02/06 15:22:43 (14 years ago)
Author:
curtis
Message:

Reference OMEXMLMetadataStore only by reflection (it is an optional class).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FormatReader.java

    r1200 r1211  
    2727import java.awt.image.BufferedImage; 
    2828import java.io.*; 
     29import java.lang.reflect.Method; 
    2930import java.util.Arrays; 
    3031import java.util.Hashtable; 
     
    275276    } 
    276277    if (omexml) { 
    277       setMetadataStore(new OMEXMLMetadataStore()); 
    278       getMetadataStore(id).createRoot(); 
     278      try { 
     279        Class c = Class.forName("loci.formats.OMEXMLMetadataStore"); 
     280        MetadataStore ms = (MetadataStore) c.newInstance(); 
     281        setMetadataStore(ms); 
     282      } 
     283      catch (Exception exc) { } 
    279284    } 
    280285 
     
    367372    // output OME-XML 
    368373    MetadataStore ms = cm.getMetadataStore(id); 
    369     if (ms instanceof OMEXMLMetadataStore) { 
     374    try { 
     375      Method m = ms.getClass().getMethod("dumpXML", null); 
    370376      System.out.println("OME-XML:"); 
    371       OMEXMLMetadataStore xmlStore = (OMEXMLMetadataStore) ms; 
    372       System.out.println(xmlStore.dumpXML()); 
     377      System.out.println(m.invoke(ms, null)); 
    373378      System.out.println(); 
     379    } 
     380    catch (Exception exc) { 
     381      System.err.println("OME-XML functionality not available:"); 
     382      exc.printStackTrace(); 
    374383    } 
    375384 
Note: See TracChangeset for help on using the changeset viewer.