Changeset 5902 for branches/cleanup


Ignore:
Timestamp:
02/11/10 13:39:12 (10 years ago)
Author:
melissa
Message:

Fixed compile errors introduced in r5898.

Location:
branches/cleanup/components
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/components/flow-cytometry/src/loci/apps/flow/FlowCytometry.java

    r5414 r5902  
    6565import javax.swing.JFrame; 
    6666import javax.swing.JPanel; 
    67  
     67import javax.xml.parsers.ParserConfigurationException; 
     68 
     69import loci.common.dependency.DependencyException; 
     70import loci.common.dependency.ServiceFactory; 
    6871import loci.formats.FormatException; 
    6972import loci.formats.ImageWriter; 
    7073import loci.formats.MetadataTools; 
    71 import loci.formats.meta.IMetadata; 
     74import loci.formats.ome.OMEXMLMetadata; 
     75import loci.formats.ome.OMEXMLService; 
     76 
     77import org.xml.sax.SAXException; 
     78 
    7279import visad.DataReferenceImpl; 
    7380import visad.Display; 
     
    434441  public static void saveDataWithXML() throws FormatException, IOException { 
    435442    ImageWriter iw = new ImageWriter(); 
    436     IMetadata omexmlMeta = MetadataTools.createOMEXMLMetadata(); 
     443 
     444    OMEXMLService service = null; 
     445    OMEXMLMetadata omexmlMeta = null; 
     446 
     447    Exception exc = null; 
     448    try { 
     449      ServiceFactory factory = new ServiceFactory(); 
     450      service = factory.getInstance(OMEXMLService.class); 
     451      omexmlMeta = service.createOMEXMLMetadata(); 
     452    } 
     453    catch (DependencyException e) { exc = e; } 
     454    catch (ParserConfigurationException e) { exc = e; } 
     455    catch (SAXException e) { exc = e; } 
     456 
     457    if (exc != null) { 
     458      IJ.log("Could not create OMEXMLMetadataStore: " + exc.getMessage()); 
     459      exc = null; 
     460    } 
     461 
    437462    omexmlMeta.createRoot(); 
    438463 
     
    448473 
    449474    iw.setMetadataRetrieve(omexmlMeta); 
    450     MetadataTools.populateOriginalMetadata(omexmlMeta, 
    451       "Experiment", s_Experiment); 
    452     MetadataTools.populateOriginalMetadata(omexmlMeta, "Parameters", s_Params); 
    453     MetadataTools.populateOriginalMetadata(omexmlMeta, "Date", s_Date); 
    454     MetadataTools.populateOriginalMetadata(omexmlMeta, 
     475    service.populateOriginalMetadata(omexmlMeta, "Experiment", s_Experiment); 
     476    service.populateOriginalMetadata(omexmlMeta, "Parameters", s_Params); 
     477    service.populateOriginalMetadata(omexmlMeta, "Date", s_Date); 
     478    service.populateOriginalMetadata(omexmlMeta, 
    455479      "AreaValues", flattenVector(areaValues)); 
    456     MetadataTools.populateOriginalMetadata(omexmlMeta, 
     480    service.populateOriginalMetadata(omexmlMeta, 
    457481      "IntensityValues", flattenVector(intensityValues)); 
    458482 
  • branches/cleanup/components/legacy/ome-editor/src/loci/ome/editor/MetadataPane.java

    r5605 r5902  
    7272 
    7373import loci.common.ReflectedUniverse; 
     74import loci.common.dependency.ServiceFactory; 
    7475import loci.formats.FormatException; 
    7576import loci.formats.ImageReader; 
     
    8283import loci.formats.ome.OMEXML2003FCMetadata; 
    8384import loci.formats.ome.OMEXMLMetadata; 
     85import loci.formats.ome.OMEXMLService; 
    8486import loci.formats.out.TiffWriter; 
    8587import loci.formats.tiff.IFD; 
     
    461463 
    462464      try { 
    463         IMetadata meta = MetadataTools.createOMEXMLMetadata(); 
     465        ServiceFactory factory = new ServiceFactory(); 
     466        OMEXMLService service = 
     467          (OMEXMLService) factory.getInstance(OMEXMLService.class); 
     468        IMetadata meta = service.createOMEXMLMetadata(); 
    464469        writer.setMetadataRetrieve(meta); 
    465470        meta.setPixelsBigEndian(new Boolean(!reader.isLittleEndian()), 0, 0); 
  • branches/cleanup/components/legacy/ome-notes/src/loci/ome/notes/Notes.java

    r5191 r5902  
    6262import javax.swing.border.LineBorder; 
    6363import javax.swing.filechooser.FileFilter; 
     64import javax.xml.parsers.ParserConfigurationException; 
    6465 
    6566import loci.common.RandomAccessInputStream; 
     67import loci.common.dependency.DependencyException; 
     68import loci.common.dependency.ServiceFactory; 
    6669import loci.formats.ImageReader; 
    67 import loci.formats.MetadataTools; 
    6870import loci.formats.gui.BufferedImageReader; 
    6971import loci.formats.gui.GUITools; 
     
    7173import loci.formats.meta.MetadataRetrieve; 
    7274import loci.formats.meta.MetadataStore; 
     75import loci.formats.ome.OMEXMLService; 
    7376 
    7477import com.jgoodies.forms.layout.CellConstraints; 
    7578import com.jgoodies.forms.layout.FormLayout; 
    7679import com.jgoodies.forms.layout.RowSpec; 
     80 
     81import org.xml.sax.SAXException; 
    7782 
    7883/** 
     
    128133 
    129134  private AggregateMetadata metadata; 
     135  private OMEXMLService service; 
    130136 
    131137  // -- Constructor -- 
     
    147153  public Notes(String template, AggregateMetadata store) { 
    148154    super("OME Notes"); 
     155    try { 
     156      ServiceFactory factory = new ServiceFactory(); 
     157      service = (OMEXMLService) factory.getInstance(OMEXMLService.class); 
     158    } 
     159    catch (DependencyException e) { e.printStackTrace(); } 
     160 
    149161    setupWindow(); 
    150162 
     
    446458        String xml = null; 
    447459        for (int i=0; i<delegates.size(); i++) { 
    448           if (MetadataTools.isOMEXMLMetadata(delegates.get(i))) { 
    449             xml = MetadataTools.getOMEXML((MetadataRetrieve) delegates.get(i)); 
     460          try { 
     461            if (service.isOMEXMLMetadata(delegates.get(i))) { 
     462              xml = service.getOMEXML((MetadataRetrieve) delegates.get(i)); 
     463            } 
    450464          } 
     465          catch (ParserConfigurationException exc) { } 
     466          catch (SAXException exc) { } 
     467          catch (IOException exc) { } 
    451468        } 
    452469        File f = new File(name); 
     
    610627      String xml = s.readString((int) s.length()); 
    611628      s.close(); 
    612       metadata.addDelegate(MetadataTools.createOMEXMLMetadata(xml)); 
     629      try { 
     630        metadata.addDelegate(service.createOMEXMLMetadata(xml)); 
     631      } 
     632      catch (ParserConfigurationException e) { } 
     633      catch (SAXException e) { } 
     634      catch (IOException e) { } 
    613635    } 
    614636    else { 
     
    621643        String xml = s.readString((int) s.length()); 
    622644        s.close(); 
    623         companionStore = MetadataTools.createOMEXMLMetadata(xml); 
    624       } 
    625  
    626       reader.setMetadataStore(MetadataTools.createOMEXMLMetadata()); 
     645        try { 
     646          companionStore = service.createOMEXMLMetadata(xml); 
     647        } 
     648        catch (ParserConfigurationException e) { } 
     649        catch (SAXException e) { } 
     650        catch (IOException e) { } 
     651      } 
     652 
     653      try { 
     654        reader.setMetadataStore(service.createOMEXMLMetadata()); 
     655      } 
     656      catch (ParserConfigurationException e) { } 
     657      catch (SAXException e) { } 
     658      catch (IOException e) { } 
    627659      reader.setId(currentFile); 
    628660      readerStore = reader.getMetadataStore(); 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/exporter/Exporter.java

    r5867 r5902  
    4949import javax.swing.JOptionPane; 
    5050import javax.swing.filechooser.FileFilter; 
     51import javax.xml.parsers.ParserConfigurationException; 
    5152 
    5253import loci.common.DataTools; 
     54import loci.common.dependency.DependencyException; 
     55import loci.common.dependency.ServiceFactory; 
    5356import loci.formats.FormatException; 
    5457import loci.formats.FormatTools; 
     
    6063import loci.formats.gui.GUITools; 
    6164import loci.formats.meta.IMetadata; 
     65import loci.formats.ome.OMEXMLService; 
    6266import loci.plugins.LociExporter; 
    6367import loci.plugins.util.RecordedImageProcessor; 
    6468import loci.plugins.util.WindowTools; 
     69 
     70import org.xml.sax.SAXException; 
    6571 
    6672/** 
     
    210216      String xml = fi == null ? null : fi.description == null ? null : 
    211217        fi.description.indexOf("xml") == -1 ? null : fi.description; 
    212       IMetadata store = MetadataTools.createOMEXMLMetadata(xml); 
    213       if (store == null) IJ.error("OME-XML Java library not found."); 
     218 
     219      OMEXMLService service = null; 
     220      IMetadata store = null; 
     221 
     222      try { 
     223        ServiceFactory factory = new ServiceFactory(); 
     224        service = factory.getInstance(OMEXMLService.class); 
     225        store = service.createOMEXMLMetadata(xml); 
     226      } 
     227      catch (DependencyException de) { } 
     228      catch (ParserConfigurationException pce) { } 
     229      catch (SAXException se) { } 
     230 
     231      if (store == null || service == null) { 
     232        IJ.error("OME-XML Java library not found."); 
     233      } 
    214234      if (xml == null) { 
    215235        store.createRoot(); 
     
    241261              newXML.append(xml.substring(end)); 
    242262 
    243               store = MetadataTools.createOMEXMLMetadata(newXML.toString()); 
     263              try { 
     264               store = service.createOMEXMLMetadata(newXML.toString()); 
     265              } 
     266              catch (ParserConfigurationException pce) { } 
     267              catch (SAXException se) { } 
    244268 
    245269              break; 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/importer/Importer.java

    r5867 r5902  
    4848import java.util.Vector; 
    4949 
     50import javax.xml.parsers.ParserConfigurationException; 
     51 
    5052import loci.common.Location; 
    5153import loci.common.ReflectException; 
    5254import loci.common.ReflectedUniverse; 
     55import loci.common.dependency.DependencyException; 
     56import loci.common.dependency.ServiceFactory; 
    5357import loci.formats.ChannelMerger; 
    5458import loci.formats.FilePattern; 
     
    5963import loci.formats.gui.XMLWindow; 
    6064import loci.formats.meta.MetadataRetrieve; 
     65import loci.formats.ome.OMEXMLService; 
    6166import loci.plugins.Colorizer; 
    6267import loci.plugins.LociImporter; 
     
    7378import loci.plugins.util.WindowTools; 
    7479 
     80import org.xml.sax.SAXException; 
     81 
    7582/** 
    7683 * Core logic for the Bio-Formats Importer ImageJ plugin. 
     
    221228          XMLWindow metaWindow = 
    222229            new XMLWindow("OME Metadata - " + options.getIdName()); 
     230          Exception exc = null; 
    223231          try { 
    224             metaWindow.setXML(MetadataTools.getOMEXML(options.getMetadata())); 
     232            ServiceFactory factory = new ServiceFactory(); 
     233            OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     234            metaWindow.setXML(service.getOMEXML(options.getMetadata())); 
    225235            WindowTools.placeWindow(metaWindow); 
    226236            metaWindow.setVisible(true); 
    227237          } 
    228           catch (javax.xml.parsers.ParserConfigurationException exc) { 
    229             WindowTools.reportException(exc, options.isQuiet(), 
    230               "Sorry, there was a problem displaying the OME metadata"); 
    231           } 
    232           catch (org.xml.sax.SAXException exc) { 
     238          catch (DependencyException e) { exc = e; } 
     239          catch (ParserConfigurationException e) { exc = e; } 
     240          catch (SAXException e) { exc = e; } 
     241 
     242          if (exc != null) { 
    233243            WindowTools.reportException(exc, options.isQuiet(), 
    234244              "Sorry, there was a problem displaying the OME metadata"); 
     
    318328 
    319329        // dump OME-XML to ImageJ's description field, if available 
    320         fi.description = MetadataTools.getOMEXML(options.getMetadata()); 
     330        try { 
     331          ServiceFactory factory = new ServiceFactory(); 
     332          OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     333          fi.description = service.getOMEXML(options.getMetadata()); 
     334        } 
     335        catch (DependencyException de) { } 
     336        catch (ParserConfigurationException pce) { } 
     337        catch (SAXException se) { } 
    321338 
    322339        if (options.isVirtual()) { 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/importer/ImporterOptions.java

    r5867 r5902  
    3333import java.util.StringTokenizer; 
    3434 
     35import javax.xml.parsers.ParserConfigurationException; 
     36 
    3537import loci.common.Location; 
    3638import loci.common.ReflectException; 
    3739import loci.common.ReflectedUniverse; 
     40import loci.common.dependency.DependencyException; 
     41import loci.common.dependency.ServiceFactory; 
    3842import loci.formats.ChannelSeparator; 
    3943import loci.formats.FilePattern; 
     
    4549import loci.formats.MetadataTools; 
    4650import loci.formats.meta.IMetadata; 
     51import loci.formats.ome.OMEXMLService; 
    4752import loci.plugins.prefs.OptionsDialog; 
    4853import loci.plugins.prefs.OptionsList; 
     
    5863import org.apache.log4j.Level; 
    5964import org.apache.log4j.Logger; 
     65 
     66import org.xml.sax.SAXException; 
    6067 
    6168/** 
     
    548555        "Sorry, there has been an internal error: unknown data source"); 
    549556    } 
    550     meta = MetadataTools.createOMEXMLMetadata(); 
     557 
     558    try { 
     559      ServiceFactory factory = new ServiceFactory(); 
     560      OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     561      meta = service.createOMEXMLMetadata(); 
     562    } 
     563    catch (DependencyException de) { } 
     564    catch (ParserConfigurationException pce) { } 
     565    catch (SAXException se) { } 
     566    catch (IOException ie) { } 
     567 
    551568    baseReader.setMetadataStore(meta); 
    552569 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/macro/LociFunctions.java

    r5867 r5902  
    3232import java.io.IOException; 
    3333 
     34import javax.xml.parsers.ParserConfigurationException; 
     35 
     36import loci.common.dependency.DependencyException; 
     37import loci.common.dependency.ServiceFactory; 
    3438import loci.formats.ChannelSeparator; 
    3539import loci.formats.FileStitcher; 
     
    4044import loci.formats.MetadataTools; 
    4145import loci.formats.meta.MetadataRetrieve; 
     46import loci.formats.ome.OMEXMLService; 
    4247import loci.plugins.util.ImagePlusReader; 
    4348import loci.plugins.util.ImagePlusTools; 
     49 
     50import org.xml.sax.SAXException; 
    4451 
    4552/** 
     
    6673    r = new ImagePlusReader(new ChannelSeparator( 
    6774      new FileStitcher(ImagePlusReader.makeImageReader(), true))); 
    68     r.setMetadataStore(MetadataTools.createOMEXMLMetadata()); 
     75 
     76    try { 
     77      ServiceFactory factory = new ServiceFactory(); 
     78      OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     79      r.setMetadataStore(service.createOMEXMLMetadata()); 
     80    } 
     81    catch (DependencyException de) { } 
     82    catch (ParserConfigurationException pce) { } 
     83    catch (SAXException se) { } 
     84    catch (IOException e) { } 
    6985  } 
    7086 
  • branches/cleanup/components/ome-io/src/loci/ome/io/OMEWriter.java

    r5852 r5902  
    3030import java.util.Hashtable; 
    3131 
     32import javax.xml.parsers.ParserConfigurationException; 
     33 
    3234import loci.common.DateTools; 
    3335import loci.common.ReflectException; 
    3436import loci.common.ReflectedUniverse; 
     37import loci.common.dependency.DependencyException; 
     38import loci.common.dependency.ServiceFactory; 
    3539import loci.common.xml.XMLTools; 
    3640import loci.formats.FileStitcher; 
     
    4145import loci.formats.MetadataTools; 
    4246import loci.formats.meta.MetadataRetrieve; 
     47import loci.formats.ome.OMEXMLService; 
    4348 
    4449import org.apache.log4j.ConsoleAppender; 
     
    4651import org.apache.log4j.Logger; 
    4752import org.apache.log4j.PatternLayout; 
     53 
     54import org.xml.sax.SAXException; 
    4855 
    4956/** 
     
    326333        // upload original metadata, if available 
    327334 
    328         if (MetadataTools.isOMEXMLMetadata(metadataRetrieve)) { 
     335        boolean isOMEXML = false; 
     336        try { 
     337          ServiceFactory factory = new ServiceFactory(); 
     338          OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     339          isOMEXML = service.isOMEXMLMetadata(metadataRetrieve); 
     340        } 
     341        catch (DependencyException e) { 
     342          LOGGER.warn("OMEXMLService not available", e); 
     343        } 
     344 
     345        if (isOMEXML) { 
    329346          r.setVar("metadata", metadataRetrieve); 
    330347          Hashtable meta = (Hashtable) r.exec("metadata.getOriginalMetadata()"); 
     
    512529    FileStitcher reader = new FileStitcher(); 
    513530    reader.setOriginalMetadataPopulated(true); 
    514     reader.setMetadataStore(MetadataTools.createOMEXMLMetadata()); 
     531 
     532    try { 
     533      ServiceFactory factory = new ServiceFactory(); 
     534      OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     535      reader.setMetadataStore(service.createOMEXMLMetadata()); 
     536    } 
     537    catch (DependencyException e) { 
     538      LOGGER.warn("OMEXMLService not available", e); 
     539    } 
     540    catch (ParserConfigurationException e) { 
     541      LOGGER.warn("Could not parse OME-XML", e); 
     542    } 
     543    catch (SAXException e) { 
     544      LOGGER.warn("Could not parse OME-XML", e); 
     545    } 
     546 
    515547    reader.setId(id); 
    516548 
  • branches/cleanup/components/ome-plugins/src/loci/plugins/ome/LociUploader.java

    r5300 r5902  
    3636 
    3737import java.awt.TextField; 
     38import java.io.IOException; 
    3839import java.util.HashSet; 
    3940 
     41import javax.xml.parsers.ParserConfigurationException; 
     42 
    4043import loci.common.DataTools; 
     44import loci.common.dependency.DependencyException; 
     45import loci.common.dependency.ServiceFactory; 
    4146import loci.formats.FormatTools; 
    4247import loci.formats.MetadataTools; 
    4348import loci.formats.meta.MetadataRetrieve; 
    4449import loci.formats.meta.MetadataStore; 
     50import loci.formats.ome.OMEXMLService; 
    4551import loci.ome.io.OMEWriter; 
    4652import loci.plugins.util.LibraryChecker; 
     53 
     54import org.xml.sax.SAXException; 
    4755 
    4856/** 
     
    124132      ImageStack is = imp.getImageStack(); 
    125133      FileInfo fi = imp.getOriginalFileInfo(); 
    126       MetadataStore store; 
     134      MetadataStore store = null; 
     135 
     136      OMEXMLService service = null; 
     137      try { 
     138        ServiceFactory factory = new ServiceFactory(); 
     139        service = (OMEXMLService) factory.getInstance(OMEXMLService.class); 
     140      } 
     141      catch (DependencyException e) { 
     142        IJ.error("OME-XML library not found."); 
     143      } 
    127144 
    128145      // if we opened this stack with the Bio-Formats importer, then the 
     
    131148        fi.description.endsWith("</OME>")) 
    132149      { 
    133         store = MetadataTools.createOMEXMLMetadata(fi.description); 
     150        Exception exc = null; 
     151        try { 
     152          store = service.createOMEXMLMetadata(fi.description); 
     153        } 
     154        catch (ParserConfigurationException e) { exc = e; } 
     155        catch (SAXException e) { exc = e; } 
     156        catch (IOException e) { exc = e; } 
     157 
     158        if (exc != null) { 
     159          IJ.error("Could not create OMEXMLMetadataStore"); 
     160        } 
    134161      } 
    135162      else { 
    136         store = MetadataTools.createOMEXMLMetadata(); 
     163        Exception exc = null; 
     164        try { 
     165          store = service.createOMEXMLMetadata(); 
     166        } 
     167        catch (ParserConfigurationException e) { exc = e; } 
     168        catch (SAXException e) { exc = e; } 
     169        catch (IOException e) { exc = e; } 
     170 
     171        if (exc != null) { 
     172          IJ.error("Could not create OMEXMLMetadataStore"); 
     173        } 
     174 
    137175        int pixelType = FormatTools.UINT8; 
    138176        switch (imp.getBitDepth()) { 
  • branches/cleanup/components/test-suite/src/loci/tests/EnumTest.java

    r5647 r5902  
    3333 
    3434import java.util.Vector; 
     35import loci.common.dependency.DependencyException; 
    3536import loci.formats.enums.*; 
    3637 
     
    6869  } 
    6970 
    70   public static void main(String[] args) { 
     71  public static void main(String[] args) throws DependencyException { 
    7172    IEnumerationProvider provider = new EnumerationProvider(); 
    7273    for (TestCase t : cases) { 
  • branches/cleanup/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r5852 r5902  
    4141import java.util.List; 
    4242 
     43import javax.xml.parsers.ParserConfigurationException; 
     44 
    4345import loci.common.DateTools; 
    4446import loci.common.Location; 
     47import loci.common.dependency.DependencyException; 
     48import loci.common.dependency.ServiceFactory; 
    4549import loci.formats.FileStitcher; 
    4650import loci.formats.FormatTools; 
    4751import loci.formats.IFormatReader; 
    4852import loci.formats.ImageReader; 
    49 import loci.formats.MetadataTools; 
    5053import loci.formats.ReaderWrapper; 
    5154import loci.formats.gui.AWTImageTools; 
     
    5659import loci.formats.meta.MetadataRetrieve; 
    5760import loci.formats.meta.MetadataStore; 
     61import loci.formats.ome.OMEXMLService; 
    5862 
    5963import org.slf4j.Logger; 
     
    6165 
    6266import org.testng.SkipException; 
     67 
     68import org.xml.sax.SAXException; 
    6369 
    6470/** 
     
    111117  private float timeMultiplier = 1; 
    112118 
     119  private OMEXMLService omexmlService = null; 
     120 
    113121  // -- Constructor -- 
    114122 
     
    116124    id = filename; 
    117125    timeMultiplier = multiplier; 
     126    try { 
     127      ServiceFactory factory = new ServiceFactory(); 
     128      omexmlService = factory.getInstance(OMEXMLService.class); 
     129    } 
     130    catch (DependencyException e) { 
     131      LOGGER.warn("OMEXMLService not available", e); 
     132    } 
    118133  } 
    119134 
     
    342357    try { 
    343358      MetadataRetrieve retrieve = (MetadataRetrieve) reader.getMetadataStore(); 
    344       boolean success = MetadataTools.isOMEXMLMetadata(retrieve); 
     359      boolean success = omexmlService.isOMEXMLMetadata(retrieve); 
    345360      if (!success) msg = TestTools.shortClassName(retrieve); 
    346361 
     
    396411    try { 
    397412      MetadataRetrieve retrieve = (MetadataRetrieve) reader.getMetadataStore(); 
    398       boolean success = MetadataTools.isOMEXMLMetadata(retrieve); 
     413      boolean success = omexmlService.isOMEXMLMetadata(retrieve); 
    399414      if (!success) msg = TestTools.shortClassName(retrieve); 
    400415 
     
    679694    try { 
    680695      MetadataStore store = reader.getMetadataStore(); 
    681       MetadataRetrieve retrieve = MetadataTools.asRetrieve(store); 
    682       String xml = MetadataTools.getOMEXML(retrieve); 
    683       success = xml != null && MetadataTools.validateOMEXML(xml, true); 
     696      MetadataRetrieve retrieve = omexmlService.asRetrieve(store); 
     697      String xml = omexmlService.getOMEXML(retrieve); 
     698      success = xml != null && omexmlService.validateOMEXML(xml, true); 
    684699    } 
    685700    catch (Throwable t) { 
     
    888903      reader.setOriginalMetadataPopulated(true); 
    889904      reader.setMetadataFiltered(true); 
    890       MetadataStore store = MetadataTools.createOMEXMLMetadata(); 
     905      MetadataStore store = null; 
     906      try { 
     907        store = omexmlService.createOMEXMLMetadata(); 
     908      } 
     909      catch (ParserConfigurationException e) { 
     910        LOGGER.warn("Could not parse OME-XML", e); 
     911      } 
     912      catch (SAXException e) { 
     913        LOGGER.warn("Could not parse OME-XML", e); 
     914      } 
     915      catch (IOException e) { 
     916        LOGGER.warn("Could not parse OME-XML", e); 
     917      } 
    891918      reader.setMetadataStore(store); 
    892919    } 
  • branches/cleanup/components/test-suite/src/loci/tests/testng/FormatWriterTest.java

    r5852 r5902  
    3939 
    4040import loci.common.DataTools; 
     41import loci.common.dependency.ServiceFactory; 
    4142import loci.formats.FormatException; 
    4243import loci.formats.IFormatWriter; 
    4344import loci.formats.ImageWriter; 
    44 import loci.formats.MetadataTools; 
    4545import loci.formats.gui.BufferedImageReader; 
    4646import loci.formats.meta.IMetadata; 
    4747import loci.formats.meta.MetadataRetrieve; 
     48import loci.formats.ome.OMEXMLService; 
    4849import loci.formats.out.JPEG2000Writer; 
    4950import loci.formats.out.JPEGWriter; 
     
    160161    try { 
    161162      reader.close(); 
    162       reader.setMetadataStore(MetadataTools.createOMEXMLMetadata()); 
     163 
     164      ServiceFactory factory = new ServiceFactory(); 
     165      OMEXMLService service = factory.getInstance(OMEXMLService.class); 
     166      reader.setMetadataStore(service.createOMEXMLMetadata()); 
    163167      reader.setId(id); 
    164168 
  • branches/cleanup/components/visbio/src/loci/visbio/data/Dataset.java

    r5852 r5902  
    3636import javax.swing.JOptionPane; 
    3737 
     38import javax.xml.parsers.ParserConfigurationException; 
     39 
    3840import loci.common.Location; 
     41import loci.common.dependency.DependencyException; 
     42import loci.common.dependency.ServiceFactory; 
    3943import loci.formats.ChannelSeparator; 
    4044import loci.formats.FilePattern; 
     
    4751import loci.formats.gui.GUITools; 
    4852import loci.formats.meta.MetadataStore; 
     53import loci.formats.ome.OMEXMLService; 
    4954import loci.visbio.StatusEvent; 
    5055import loci.visbio.StatusListener; 
     
    5863 
    5964import org.w3c.dom.Element; 
     65import org.xml.sax.SAXException; 
    6066 
    6167import visad.FunctionType; 
     
    379385    reader = new BufferedImageReader( 
    380386      new ChannelSeparator(new FileStitcher(true))); 
    381     reader.setMetadataStore(MetadataTools.createOMEXMLMetadata()); 
     387 
     388    Exception serviceException = null; 
     389    try { 
     390      ServiceFactory factory = new ServiceFactory(); 
     391      OMEXMLService service = 
     392        (OMEXMLService) factory.getInstance(OMEXMLService.class); 
     393      reader.setMetadataStore(service.createOMEXMLMetadata()); 
     394    } 
     395    catch (DependencyException e) { serviceException = e; } 
     396    catch (ParserConfigurationException e) { serviceException = e; } 
     397    catch (SAXException e) { serviceException = e; } 
     398    catch (IOException e) { serviceException = e; } 
     399 
     400    if (serviceException != null) { 
     401      System.err.println("Could not construct OMEXMLMetadataStore"); 
     402      if (VisBioFrame.DEBUG) serviceException.printStackTrace(); 
     403      return; 
     404    } 
    382405 
    383406    // determine number of images per source file 
  • branches/cleanup/components/visbio/src/loci/visbio/ome/ImageUploader.java

    r5852 r5902  
    2626import java.util.Vector; 
    2727 
     28import loci.common.dependency.ServiceFactory; 
    2829import loci.formats.FormatTools; 
    2930import loci.formats.MetadataTools; 
     
    3132import loci.formats.meta.MetadataRetrieve; 
    3233import loci.formats.meta.MetadataStore; 
     34import loci.formats.ome.OMEXMLService; 
    3335import loci.ome.io.OMEWriter; 
    3436import loci.visbio.StatusEvent; 
     
    6769      OMEWriter writer = new OMEWriter(); 
    6870      BufferedImageWriter biWriter = new BufferedImageWriter(writer); 
    69       MetadataStore store = MetadataTools.createOMEXMLMetadata(); 
     71 
     72      ServiceFactory factory = new ServiceFactory(); 
     73      OMEXMLService service = 
     74        (OMEXMLService) factory.getInstance(OMEXMLService.class); 
     75      MetadataStore store = service.createOMEXMLMetadata(); 
     76 
    7077      store.setRoot(data.getOMEXMLRoot()); 
    7178      MetadataRetrieve retrieve = (MetadataRetrieve) store; 
Note: See TracChangeset for help on using the changeset viewer.