Changeset 5915 for branches/cleanup


Ignore:
Timestamp:
02/15/10 12:54:32 (10 years ago)
Author:
callan
Message:

#464 Add ServiceException and switch OMEXMLService over to its use

Location:
branches/cleanup/components
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/components/autogen/src/ice/IMetadataI.vm

    r5901 r5915  
    3232package loci.ice.formats; 
    3333 
    34 import java.io.IOException; 
    35 import javax.xml.parsers.ParserConfigurationException; 
    3634import Ice.Current; 
    3735import loci.common.dependency.DependencyException; 
     36import loci.common.dependency.ServiceException; 
    3837import loci.common.dependency.ServiceFactory; 
    3938import loci.formats.MetadataTools; 
    4039import loci.formats.meta.IMetadata; 
    4140import loci.formats.ome.OMEXMLService; 
    42 import org.xml.sax.SAXException; 
    4341 
    4442/** 
     
    6967    } 
    7068    catch (DependencyException de) { } 
    71     catch (ParserConfigurationException pce) { } 
    72     catch (SAXException se) { } 
    73     catch (IOException e) { } 
     69    catch (ServiceException se) { } 
    7470  } 
    7571 
     
    9086      return service.getOMEXML(metadataObject); 
    9187    } 
    92     catch (ParserConfigurationException pce) { } 
    93     catch (SAXException se) { } 
    94     catch (IOException e) { } 
     88    catch (ServiceException se) { } 
    9589    return null; 
    9690  } 
  • branches/cleanup/components/bf-ice/src/bio-formats.ice

    r5901 r5915  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Feb 11, 2010 10:18:29 AM CST 
     27 * Created by callan via MetadataAutogen on Feb 15, 2010 5:18:33 PM GMT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
  • branches/cleanup/components/bf-ice/src/loci/ice/formats/IMetadataI.java

    r5901 r5915  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Feb 11, 2010 10:18:29 AM CST 
     27 * Created by callan via MetadataAutogen on Feb 15, 2010 5:18:33 PM GMT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    3232package loci.ice.formats; 
    3333 
    34 import java.io.IOException; 
    35 import javax.xml.parsers.ParserConfigurationException; 
    3634import Ice.Current; 
    3735import loci.common.dependency.DependencyException; 
     36import loci.common.dependency.ServiceException; 
    3837import loci.common.dependency.ServiceFactory; 
    3938import loci.formats.MetadataTools; 
    4039import loci.formats.meta.IMetadata; 
    4140import loci.formats.ome.OMEXMLService; 
    42 import org.xml.sax.SAXException; 
    4341 
    4442/** 
     
    6967    } 
    7068    catch (DependencyException de) { } 
    71     catch (ParserConfigurationException pce) { } 
    72     catch (SAXException se) { } 
    73     catch (IOException e) { } 
     69    catch (ServiceException se) { } 
    7470  } 
    7571 
     
    9086      return service.getOMEXML(metadataObject); 
    9187    } 
    92     catch (ParserConfigurationException pce) { } 
    93     catch (SAXException se) { } 
    94     catch (IOException e) { } 
     88    catch (ServiceException se) { } 
    9589    return null; 
    9690  } 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/OMETiffReader.java

    r5898 r5915  
    3232import java.util.Vector; 
    3333 
    34 import javax.xml.parsers.ParserConfigurationException; 
    35  
    36 import org.xml.sax.SAXException; 
    37  
    3834import loci.common.Location; 
    3935import loci.common.RandomAccessInputStream; 
    4036import loci.common.dependency.DependencyException; 
     37import loci.common.dependency.ServiceException; 
    4138import loci.common.dependency.ServiceFactory; 
    4239import loci.formats.CoreMetadata; 
     
    111108      throw new MissingLibraryException(MISSING_OME_XML_JAR, de); 
    112109    } 
    113     catch (ParserConfigurationException pce) { 
    114       throw new FormatException(pce); 
    115     } 
    116     catch (SAXException se) { 
     110    catch (ServiceException se) { 
    117111      throw new FormatException(se); 
    118112    } 
     
    244238      throw new MissingLibraryException(MISSING_OME_XML_JAR, de); 
    245239    } 
    246     catch (ParserConfigurationException pce) { 
    247       throw new FormatException(pce); 
    248     } 
    249     catch (SAXException se) { 
     240    catch (ServiceException se) { 
    250241      throw new FormatException(se); 
    251242    } 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/OMEXMLReader.java

    r5898 r5915  
    2929import java.util.Vector; 
    3030 
    31 import javax.xml.parsers.ParserConfigurationException; 
    32  
    3331import loci.common.CBZip2InputStream; 
    3432import loci.common.RandomAccessInputStream; 
    3533import loci.common.dependency.DependencyException; 
     34import loci.common.dependency.ServiceException; 
    3635import loci.common.dependency.ServiceFactory; 
    3736import loci.common.xml.XMLTools; 
     
    4039import loci.formats.FormatReader; 
    4140import loci.formats.FormatTools; 
    42 import loci.formats.MetadataTools; 
    4341import loci.formats.MissingLibraryException; 
    4442import loci.formats.codec.Base64Codec; 
     
    4745import loci.formats.codec.JPEGCodec; 
    4846import loci.formats.codec.ZlibCodec; 
    49 import loci.formats.meta.IMetadata; 
    5047import loci.formats.meta.MetadataStore; 
    5148import loci.formats.ome.OMEXMLMetadata; 
     
    5350 
    5451import org.xml.sax.Attributes; 
    55 import org.xml.sax.SAXException; 
    5652import org.xml.sax.helpers.DefaultHandler; 
    5753 
     
    289285      throw new MissingLibraryException(OMETiffReader.MISSING_OME_XML_JAR, de); 
    290286    } 
    291     catch (ParserConfigurationException pce) { 
    292       throw new FormatException(pce); 
    293     } 
    294     catch (SAXException se) { 
     287    catch (ServiceException se) { 
    295288      throw new FormatException(se); 
    296289    } 
  • branches/cleanup/components/bio-formats/src/loci/formats/ome/OMEXMLService.java

    r5913 r5915  
    2424package loci.formats.ome; 
    2525 
    26 import java.io.IOException; 
    27 import java.util.Hashtable; 
    28  
    29 import javax.xml.parsers.ParserConfigurationException; 
    30  
    31 import org.xml.sax.SAXException; 
    32  
     26import loci.common.dependency.ServiceException; 
    3327import loci.common.dependency.services.Service; 
    34 import loci.formats.FormatException; 
    35 import loci.formats.IFormatReader; 
    36 import loci.formats.meta.IMetadata; 
    3728import loci.formats.meta.MetadataRetrieve; 
    3829import loci.formats.meta.MetadataStore; 
     
    5748   * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    5849   *   or null if the class is not available. 
    59    * @throws IOException If there is an error reading from the string. 
    60    * @throws SAXException If there is an error parsing the XML. 
    61    * @throws ParserConfigurationException If there is an error preparing the 
    62    * parsing infrastructure. 
     50   * @throws ServiceException If there is an error creating the OME-XML 
     51   * metadata object. 
    6352   */ 
    64   public OMEXMLMetadata createOMEXMLMetadata() 
    65     throws ParserConfigurationException, SAXException, IOException; 
     53  public OMEXMLMetadata createOMEXMLMetadata() throws ServiceException; 
    6654 
    6755  /** 
     
    7159   * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    7260   *   or null if the class is not available. 
    73    * @throws IOException If there is an error reading from the string. 
    74    * @throws SAXException If there is an error parsing the XML. 
    75    * @throws ParserConfigurationException If there is an error preparing the 
    76    * parsing infrastructure. 
     61   * @throws ServiceException If there is an error creating the OME-XML 
     62   * metadata object. 
    7763   */ 
    7864  public OMEXMLMetadata createOMEXMLMetadata(String xml) 
    79     throws ParserConfigurationException, SAXException, IOException; 
     65    throws ServiceException; 
    8066 
    8167  /** 
     
    9177   * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    9278   *   or null if the class is not available. 
    93    * @throws IOException If there is an error reading from the string. 
    94    * @throws SAXException If there is an error parsing the XML. 
    95    * @throws ParserConfigurationException If there is an error preparing the 
    96    * parsing infrastructure. 
     79   * @throws ServiceException If there is an error creating the OME-XML 
     80   * metadata object. 
    9781   */ 
    9882  public OMEXMLMetadata createOMEXMLMetadata(String xml, String version) 
    99     throws ParserConfigurationException, SAXException, IOException; 
     83    throws ServiceException; 
    10084 
    10185  /** 
     
    10387   * @param xml String of XML to create the root node from. 
    10488   * @return An ome.xml.OMEXMLNode subclass root node. 
    105    * @throws IOException If there is an error reading from the string. 
    106    * @throws SAXException If there is an error parsing the XML. 
    107    * @throws ParserConfigurationException If there is an error preparing the 
    108    * parsing infrastructure. 
    109    * @throws IOException If there is an error reading from the string. 
    110    * @throws SAXException If there is an error parsing the XML. 
    111    * @throws ParserConfigurationException If there is an error preparing the 
    112    * parsing infrastructure. 
     89   * @throws ServiceException If there is an error creating the OME-XML 
     90   * metadata object. 
    11391   */ 
    114   public Object createOMEXMLRoot(String xml) 
    115     throws ParserConfigurationException, SAXException, IOException; 
     92  public Object createOMEXMLRoot(String xml) throws ServiceException; 
    11693 
    11794  /** 
     
    139116   * Returns a {@link loci.formats.ome.OMEXMLMetadata} object with the same 
    140117   * contents as the given MetadataRetrieve, converting it if necessary. 
    141    * @throws IOException If there is an error reading from the string. 
    142    * @throws SAXException If there is an error parsing the XML. 
    143    * @throws ParserConfigurationException If there is an error preparing the 
    144    * parsing infrastructure. 
     118   * @throws ServiceException If there is an error creating the OME-XML 
     119   * metadata object. 
    145120   */ 
    146121  public OMEXMLMetadata getOMEMetadata(MetadataRetrieve src) 
    147     throws ParserConfigurationException, SAXException, IOException; 
     122    throws ServiceException; 
    148123 
    149124  /** 
    150125   * Extracts an OME-XML metadata string from the given metadata object, 
    151126   * by converting to an OME-XML metadata object if necessary. 
    152    * @throws IOException If there is an error reading from the string. 
    153    * @throws SAXException If there is an error parsing the XML. 
    154    * @throws ParserConfigurationException If there is an error preparing the 
    155    * parsing infrastructure. 
     127   * @throws ServiceException If there is an error creating the OME-XML 
     128   * metadata object. 
    156129   */ 
    157130  public String getOMEXML(MetadataRetrieve src) 
    158     throws ParserConfigurationException, SAXException, IOException; 
     131    throws ServiceException; 
    159132 
    160133  /** 
     
    192165   * Converts information from an OME-XML string (source) 
    193166   * into a metadata store (destination). 
    194    * @throws IOException If there is an error reading from the string. 
    195    * @throws SAXException If there is an error parsing the XML. 
    196    * @throws ParserConfigurationException If there is an error preparing the 
    197    * parsing infrastructure. 
     167   * @throws ServiceException If there is an error creating the OME-XML 
     168   * metadata object. 
    198169   */ 
    199170  public void convertMetadata(String xml, MetadataStore dest) 
    200     throws ParserConfigurationException, SAXException, IOException; 
     171    throws ServiceException; 
    201172 
    202173  /** 
  • branches/cleanup/components/bio-formats/src/loci/formats/ome/OMEXMLServiceImpl.java

    r5913 r5915  
    2525 
    2626import java.io.IOException; 
    27 import java.util.Arrays; 
    28 import java.util.Hashtable; 
    2927 
    3028import javax.xml.parsers.ParserConfigurationException; 
     
    4341import org.xml.sax.SAXException; 
    4442 
    45 import loci.common.DateTools; 
    46 import loci.common.Location; 
     43import loci.common.dependency.ServiceException; 
    4744import loci.common.xml.XMLTools; 
    48 import loci.formats.FormatException; 
    49 import loci.formats.FormatTools; 
    50 import loci.formats.IFormatReader; 
    5145import loci.formats.meta.IMetadata; 
    5246import loci.formats.meta.MetadataConverter; 
     
    8074  } 
    8175 
    82   /** 
    83    * Creates an OME-XML metadata object using reflection, to avoid 
    84    * direct dependencies on the optional {@link loci.formats.ome} package. 
    85    * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    86    *   or null if the class is not available. 
    87    */ 
    88   public OMEXMLMetadata createOMEXMLMetadata() 
    89     throws ParserConfigurationException, SAXException, IOException { 
     76  /* (non-Javadoc) 
     77   * @see loci.formats.ome.OMEXMLService#createOMEXMLMetadata() 
     78   */ 
     79  public OMEXMLMetadata createOMEXMLMetadata() throws ServiceException { 
    9080    return createOMEXMLMetadata(null); 
    9181  } 
    9282 
    93   /** 
    94    * Creates an OME-XML metadata object using reflection, to avoid 
    95    * direct dependencies on the optional {@link loci.formats.ome} package, 
    96    * wrapping a DOM representation of the given OME-XML string. 
    97    * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    98    *   or null if the class is not available. 
     83  /* (non-Javadoc) 
     84   * @see loci.formats.ome.OMEXMLService#createOMEXMLMetadata(java.lang.String) 
    9985   */ 
    10086  public OMEXMLMetadata createOMEXMLMetadata(String xml) 
    101     throws ParserConfigurationException, SAXException, IOException { 
     87    throws ServiceException { 
    10288    return createOMEXMLMetadata(xml, null); 
    10389  } 
    10490 
    105   /** 
    106    * Creates an OME-XML metadata object using reflection, to avoid 
    107    * direct dependencies on the optional {@link loci.formats.ome} package, 
    108    * wrapping a DOM representation of the given OME-XML string. 
    109    * 
    110    * @param xml The OME-XML string to use for initial population of the 
    111    *   metadata object. 
    112    * @param version The OME-XML version to use (e.g., "2003-FC" or "2007-06"). 
    113    *   If the xml and version parameters are both null, the newest version is 
    114    *   used. 
    115    * @return A new instance of {@link loci.formats.ome.AbstractOMEXMLMetadata}, 
    116    *   or null if the class is not available. 
     91  /* (non-Javadoc) 
     92   * @see loci.formats.ome.OMEXMLService#createOMEXMLMetadata(java.lang.String, java.lang.String) 
    11793   */ 
    11894  public OMEXMLMetadata createOMEXMLMetadata(String xml, String version) 
    119     throws ParserConfigurationException, SAXException, IOException { 
     95    throws ServiceException { 
    12096    OMEXMLNode ome = createRoot(xml); 
    12197    if (version == null) { 
     
    147123  } 
    148124 
    149   /** 
    150    * Constructs an OME root node. 
    151    * @param xml String of XML to create the root node from. 
    152    * @return An ome.xml.OMEXMLNode subclass root node. 
    153    * @throws IOException If there is an error reading from the string. 
    154    * @throws SAXException If there is an error parsing the XML. 
    155    * @throws ParserConfigurationException If there is an error preparing the 
    156    * parsing infrastructure. 
    157    */ 
    158   public Object createOMEXMLRoot(String xml) 
    159     throws ParserConfigurationException, SAXException, IOException { 
     125  /* (non-Javadoc) 
     126   * @see loci.formats.ome.OMEXMLService#createOMEXMLRoot(java.lang.String) 
     127   */ 
     128  public Object createOMEXMLRoot(String xml) throws ServiceException { 
    160129    return createRoot(xml); 
    161130  } 
    162131 
    163   /** 
    164    * Checks whether the given object is an OME-XML metadata object. 
    165    * @return True if the object is an instance of 
    166    *   {@link loci.formats.ome.AbstractOMEXMLMetadata}. 
     132  /* (non-Javadoc) 
     133   * @see loci.formats.ome.OMEXMLService#isOMEXMLMetadata(java.lang.Object) 
    167134   */ 
    168135  public boolean isOMEXMLMetadata(Object o) { 
     
    170137  } 
    171138 
    172   /** 
    173    * Checks whether the given object is an OME-XML root object. 
    174    * @return True if the object is an instance of ome.xml.OMEXMLNode. 
     139  /* (non-Javadoc) 
     140   * @see loci.formats.ome.OMEXMLService#isOMEXMLRoot(java.lang.Object) 
    175141   */ 
    176142  public boolean isOMEXMLRoot(Object o) { 
     
    189155   * parsing infrastructure. 
    190156   */ 
    191   private OMEXMLNode createRoot(String xml) 
    192     throws ParserConfigurationException, SAXException, IOException { 
    193     return OMEXMLFactory.newOMENodeFromSource(xml); 
    194   } 
    195    
    196   /** 
    197    * Gets the schema version for the given OME-XML metadata or root object 
    198    * (e.g., "2007-06" or "2003-FC"). 
    199    * @return OME-XML schema version, or null if the object is not an instance 
    200    *   of {@link loci.formats.ome.AbstractOMEXMLMetadata} or ome.xml.OMEXMLNode. 
     157  private OMEXMLNode createRoot(String xml) throws ServiceException { 
     158    try { 
     159      return OMEXMLFactory.newOMENodeFromSource(xml); 
     160    } 
     161    catch (Exception e) { 
     162      throw new ServiceException(e); 
     163    } 
     164  } 
     165 
     166  /* (non-Javadoc) 
     167   * @see loci.formats.ome.OMEXMLService#getOMEXMLVersion(java.lang.Object) 
    201168   */ 
    202169  public String getOMEXMLVersion(Object o) { 
     
    220187    return null; 
    221188  } 
    222    
    223   /** 
    224    * Returns a {@link loci.formats.ome.AbstractOMEXMLMetadata} object with the same 
    225    * contents as the given MetadataRetrieve, converting it if necessary. 
    226    * @throws IOException If there is an error reading from the string. 
    227    * @throws SAXException If there is an error parsing the XML. 
    228    * @throws ParserConfigurationException If there is an error preparing the 
    229    * parsing infrastructure. 
     189 
     190  /* (non-Javadoc) 
     191   * @see loci.formats.ome.OMEXMLService#getOMEMetadata(loci.formats.meta.MetadataRetrieve) 
    230192   */ 
    231193  public OMEXMLMetadata getOMEMetadata(MetadataRetrieve src) 
    232     throws ParserConfigurationException, SAXException, IOException { 
     194    throws ServiceException { 
    233195    // check if the metadata is already an OME-XML metadata object 
    234196    if (src instanceof OMEXMLMetadata) return (OMEXMLMetadata) src; 
     
    241203  } 
    242204 
    243   /** 
    244    * Extracts an OME-XML metadata string from the given metadata object, 
    245    * by converting to an OME-XML metadata object if necessary. 
    246    * @throws IOException If there is an error reading from the string. 
    247    * @throws SAXException If there is an error parsing the XML. 
    248    * @throws ParserConfigurationException If there is an error preparing the 
    249    * parsing infrastructure. 
    250    */ 
    251   public String getOMEXML(MetadataRetrieve src) 
    252     throws ParserConfigurationException, SAXException, IOException { 
     205  /* (non-Javadoc) 
     206   * @see loci.formats.ome.OMEXMLService#getOMEXML(loci.formats.meta.MetadataRetrieve) 
     207   */ 
     208  public String getOMEXML(MetadataRetrieve src) throws ServiceException { 
    253209    OMEXMLMetadata omexmlMeta = getOMEMetadata(src); 
    254210    String xml = omexmlMeta.dumpXML(); 
     
    263219  } 
    264220 
    265   /** 
    266    * Attempts to validate the given OME-XML string using 
    267    * Java's XML validation facility. Requires Java 1.5+. 
    268    * 
    269    * @param xml XML string to validate. 
    270    * @return true if the XML successfully validates. 
     221  /* (non-Javadoc) 
     222   * @see loci.formats.ome.OMEXMLService#validateOMEXML(java.lang.String) 
    271223   */ 
    272224  public boolean validateOMEXML(String xml) { 
    273225    return validateOMEXML(xml, false); 
    274226  } 
    275    
    276   /** 
    277    * Attempts to validate the given OME-XML string using 
    278    * Java's XML validation facility. Requires Java 1.5+. 
    279    * 
    280    * @param xml XML string to validate. 
    281    * @param pixelsHack Whether to ignore validation errors 
    282    *   due to childless Pixels elements 
    283    * @return true if the XML successfully validates. 
     227 
     228  /* (non-Javadoc) 
     229   * @see loci.formats.ome.OMEXMLService#validateOMEXML(java.lang.String, boolean) 
    284230   */ 
    285231  public boolean validateOMEXML(String xml, boolean pixelsHack) { 
     
    335281  } 
    336282 
    337   /** 
    338    * Adds the specified key/value pair as a new OriginalMetadata node 
    339    * to the given OME-XML metadata object. 
    340    * Does nothing unless the given object is an OME-XML metadata object. 
    341    * @param omexmlMeta An object of type 
    342    *   {@link loci.formats.ome.AbstractOMEXMLMetadata}. 
    343    * @param key Metadata key to populate. 
    344    * @param value Metadata value corresponding to the specified key. 
     283  /* (non-Javadoc) 
     284   * @see loci.formats.ome.OMEXMLService#populateOriginalMetadata(loci.formats.ome.OMEXMLMetadata, java.lang.String, java.lang.String) 
    345285   */ 
    346286  public void populateOriginalMetadata(OMEXMLMetadata omexmlMeta, 
     
    350290  } 
    351291 
    352   /** 
    353    * Converts information from an OME-XML string (source) 
    354    * into a metadata store (destination). 
    355    * @throws IOException If there is an error reading from the string. 
    356    * @throws SAXException If there is an error parsing the XML. 
    357    * @throws ParserConfigurationException If there is an error preparing the 
    358    * parsing infrastructure. 
     292  /* (non-Javadoc) 
     293   * @see loci.formats.ome.OMEXMLService#convertMetadata(java.lang.String, loci.formats.meta.MetadataStore) 
    359294   */ 
    360295  public void convertMetadata(String xml, MetadataStore dest) 
    361     throws ParserConfigurationException, SAXException, IOException { 
     296    throws ServiceException { 
    362297    OMEXMLNode ome = createRoot(xml); 
    363298    String rootVersion = getOMEXMLVersion(ome); 
     
    382317  } 
    383318 
    384   /** 
    385    * Copies information from a metadata retrieval object 
    386    * (source) into a metadata store (destination). 
     319  /* (non-Javadoc) 
     320   * @see loci.formats.ome.OMEXMLService#convertMetadata(loci.formats.meta.MetadataRetrieve, loci.formats.meta.MetadataStore) 
    387321   */ 
    388322  public void convertMetadata(MetadataRetrieve src, MetadataStore dest) { 
     
    392326  // -- Utility methods - casting -- 
    393327 
    394   /** 
    395    * Gets the given {@link MetadataRetrieve} object as a {@link MetadataStore}. 
    396    * Returns null if the object is incompatible and cannot be casted. 
     328  /* (non-Javadoc) 
     329   * @see loci.formats.ome.OMEXMLService#asStore(loci.formats.meta.MetadataRetrieve) 
    397330   */ 
    398331  public MetadataStore asStore(MetadataRetrieve meta) { 
     
    400333  } 
    401334 
    402   /** 
    403    * Gets the given {@link MetadataStore} object as a {@link MetadataRetrieve}. 
    404    * Returns null if the object is incompatible and cannot be casted. 
     335  /* (non-Javadoc) 
     336   * @see loci.formats.ome.OMEXMLService#asRetrieve(loci.formats.meta.MetadataStore) 
    405337   */ 
    406338  public MetadataRetrieve asRetrieve(MetadataStore meta) { 
  • branches/cleanup/components/bio-formats/src/loci/formats/out/OMETiffWriter.java

    r5898 r5915  
    2929import java.util.UUID; 
    3030 
    31 import javax.xml.parsers.ParserConfigurationException; 
    32  
    33 import org.xml.sax.SAXException; 
    34  
    3531import loci.common.Location; 
    3632import loci.common.dependency.DependencyException; 
     33import loci.common.dependency.ServiceException; 
    3734import loci.common.dependency.ServiceFactory; 
    3835import loci.formats.FormatException; 
     
    10097      } 
    10198      catch (DependencyException de) { 
    102         throw new IOException(de.getMessage()); 
    10399        // FIXME: Modify close() interface to include FormatException? 
    104100        //throw new MissingLibraryException( 
    105101        //    OMETiffReader.MISSING_OME_XML_JAR, de); 
    106       } 
    107       catch (ParserConfigurationException pce) { 
    108         throw new IOException(pce.getMessage()); 
    109         // FIXME: Modify close() interface to include FormatException? 
    110         //throw new FormatException(pce); 
    111       } 
    112       catch (SAXException se) { 
    113         throw new IOException(se.getMessage()); 
     102        throw new RuntimeException(de); 
     103      } 
     104      catch (ServiceException se) { 
    114105        // FIXME: Modify close() interface to include FormatException? 
    115106        //throw new FormatException(se); 
     107        throw new RuntimeException(se); 
    116108      } 
    117109 
     
    192184        xml = service.getOMEXML(omexmlMeta); 
    193185      } 
    194       catch (ParserConfigurationException pce) { 
    195         throw new IOException(pce.getMessage()); 
    196         // FIXME: Modify close() interface to include FormatException? 
    197         //throw new FormatException(pce); 
    198       } 
    199       catch (SAXException se) { 
    200         throw new IOException(se.getMessage()); 
     186      catch (ServiceException se) { 
    201187        // FIXME: Modify close() interface to include FormatException? 
    202188        //throw new FormatException(se); 
     189        throw new RuntimeException(se); 
    203190      } 
    204191 
  • branches/cleanup/components/bio-formats/src/loci/formats/out/OMEXMLWriter.java

    r5898 r5915  
    2727import java.util.Vector; 
    2828 
    29 import javax.xml.parsers.ParserConfigurationException; 
    30  
    3129import loci.common.RandomAccessOutputStream; 
    3230import loci.common.dependency.DependencyException; 
     31import loci.common.dependency.ServiceException; 
    3332import loci.common.dependency.ServiceFactory; 
    3433import loci.common.xml.XMLTools; 
     
    4645import loci.formats.in.OMETiffReader; 
    4746import loci.formats.meta.MetadataRetrieve; 
    48 import loci.formats.ome.OMEXMLMetadata; 
    4947import loci.formats.ome.OMEXMLService; 
    5048 
    5149import org.xml.sax.Attributes; 
    52 import org.xml.sax.SAXException; 
    5350import org.xml.sax.helpers.DefaultHandler; 
    5451 
     
    108105            OMETiffReader.MISSING_OME_XML_JAR, de); 
    109106      } 
    110       catch (ParserConfigurationException pce) { 
    111         throw new FormatException(pce); 
    112       } 
    113       catch (SAXException se) { 
     107      catch (ServiceException se) { 
    114108        throw new FormatException(se); 
    115109      } 
  • branches/cleanup/components/bio-formats/src/loci/formats/tools/ImageConverter.java

    r5898 r5915  
    2727import java.io.IOException; 
    2828 
    29 import javax.xml.parsers.ParserConfigurationException; 
    30  
    3129import loci.common.Location; 
    3230import loci.common.dependency.DependencyException; 
     31import loci.common.dependency.ServiceException; 
    3332import loci.common.dependency.ServiceFactory; 
    3433import loci.formats.ChannelFiller; 
     
    4241import loci.formats.ImageReader; 
    4342import loci.formats.ImageWriter; 
    44 import loci.formats.MetadataTools; 
    4543import loci.formats.MissingLibraryException; 
    4644import loci.formats.in.OMETiffReader; 
    4745import loci.formats.meta.MetadataRetrieve; 
    4846import loci.formats.meta.MetadataStore; 
    49 import loci.formats.ome.OMEXMLMetadata; 
    5047import loci.formats.ome.OMEXMLService; 
    5148import loci.formats.out.TiffWriter; 
     
    5754import org.slf4j.Logger; 
    5855import org.slf4j.LoggerFactory; 
    59 import org.xml.sax.SAXException; 
    6056 
    6157/** 
     
    193189      throw new MissingLibraryException(OMETiffReader.MISSING_OME_XML_JAR, de); 
    194190    } 
    195     catch (ParserConfigurationException pce) { 
    196       throw new FormatException(pce); 
    197     } 
    198     catch (SAXException se) { 
     191    catch (ServiceException se) { 
    199192      throw new FormatException(se); 
    200193    } 
  • branches/cleanup/components/bio-formats/src/loci/formats/tools/ImageInfo.java

    r5898 r5915  
    3636import loci.common.RandomAccessInputStream; 
    3737import loci.common.dependency.DependencyException; 
     38import loci.common.dependency.ServiceException; 
    3839import loci.common.dependency.ServiceFactory; 
    3940import loci.common.xml.XMLTools; 
     
    5859import loci.formats.meta.MetadataRetrieve; 
    5960import loci.formats.meta.MetadataStore; 
    60 import loci.formats.ome.OMEXMLMetadata; 
    6161import loci.formats.ome.OMEXMLService; 
    6262 
     
    332332        throw new MissingLibraryException(OMETiffReader.MISSING_OME_XML_JAR, de); 
    333333      } 
    334       catch (ParserConfigurationException pce) { 
    335         throw new FormatException(pce); 
    336       } 
    337       catch (SAXException se) { 
     334      catch (ServiceException se) { 
    338335        throw new FormatException(se); 
    339336      } 
     
    800797  } 
    801798 
    802   public void printOMEXML()  
    803     throws FormatException, ParserConfigurationException, SAXException, 
    804            IOException { 
     799  public void printOMEXML() throws MissingLibraryException, ServiceException { 
    805800    LOGGER.info(""); 
    806801    MetadataStore ms = reader.getMetadataStore(); 
     
    840835   */ 
    841836  public boolean testRead(String[] args) 
    842     throws FormatException, ParserConfigurationException, SAXException, 
    843            IOException { 
     837    throws FormatException, ServiceException, IOException { 
    844838    parseArgs(args); 
    845839    if (printVersion) { 
  • branches/cleanup/components/flow-cytometry/src/loci/apps/flow/FlowCytometry.java

    r5902 r5915  
    6565import javax.swing.JFrame; 
    6666import javax.swing.JPanel; 
    67 import javax.xml.parsers.ParserConfigurationException; 
    6867 
    6968import loci.common.dependency.DependencyException; 
     69import loci.common.dependency.ServiceException; 
    7070import loci.common.dependency.ServiceFactory; 
    7171import loci.formats.FormatException; 
     
    7474import loci.formats.ome.OMEXMLMetadata; 
    7575import loci.formats.ome.OMEXMLService; 
    76  
    77 import org.xml.sax.SAXException; 
    7876 
    7977import visad.DataReferenceImpl; 
     
    452450    } 
    453451    catch (DependencyException e) { exc = e; } 
    454     catch (ParserConfigurationException e) { exc = e; } 
    455     catch (SAXException e) { exc = e; } 
     452    catch (ServiceException e) { exc = e; } 
    456453 
    457454    if (exc != null) { 
  • branches/cleanup/components/legacy/ome-notes/src/loci/ome/notes/Notes.java

    r5902 r5915  
    6262import javax.swing.border.LineBorder; 
    6363import javax.swing.filechooser.FileFilter; 
    64 import javax.xml.parsers.ParserConfigurationException; 
    6564 
    6665import loci.common.RandomAccessInputStream; 
    6766import loci.common.dependency.DependencyException; 
     67import loci.common.dependency.ServiceException; 
    6868import loci.common.dependency.ServiceFactory; 
    6969import loci.formats.ImageReader; 
     
    7878import com.jgoodies.forms.layout.FormLayout; 
    7979import com.jgoodies.forms.layout.RowSpec; 
    80  
    81 import org.xml.sax.SAXException; 
    8280 
    8381/** 
     
    463461            } 
    464462          } 
    465           catch (ParserConfigurationException exc) { } 
    466           catch (SAXException exc) { } 
    467           catch (IOException exc) { } 
     463          catch (ServiceException exc) { } 
    468464        } 
    469465        File f = new File(name); 
     
    630626        metadata.addDelegate(service.createOMEXMLMetadata(xml)); 
    631627      } 
    632       catch (ParserConfigurationException e) { } 
    633       catch (SAXException e) { } 
    634       catch (IOException e) { } 
     628      catch (ServiceException e) { } 
    635629    } 
    636630    else { 
     
    646640          companionStore = service.createOMEXMLMetadata(xml); 
    647641        } 
    648         catch (ParserConfigurationException e) { } 
    649         catch (SAXException e) { } 
    650         catch (IOException e) { } 
     642        catch (ServiceException e) { } 
    651643      } 
    652644 
     
    654646        reader.setMetadataStore(service.createOMEXMLMetadata()); 
    655647      } 
    656       catch (ParserConfigurationException e) { } 
    657       catch (SAXException e) { } 
    658       catch (IOException e) { } 
     648      catch (ServiceException e) { } 
    659649      reader.setId(currentFile); 
    660650      readerStore = reader.getMetadataStore(); 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/exporter/Exporter.java

    r5902 r5915  
    4949import javax.swing.JOptionPane; 
    5050import javax.swing.filechooser.FileFilter; 
    51 import javax.xml.parsers.ParserConfigurationException; 
    5251 
    5352import loci.common.DataTools; 
    5453import loci.common.dependency.DependencyException; 
     54import loci.common.dependency.ServiceException; 
    5555import loci.common.dependency.ServiceFactory; 
    5656import loci.formats.FormatException; 
     
    6767import loci.plugins.util.RecordedImageProcessor; 
    6868import loci.plugins.util.WindowTools; 
    69  
    70 import org.xml.sax.SAXException; 
    7169 
    7270/** 
     
    226224      } 
    227225      catch (DependencyException de) { } 
    228       catch (ParserConfigurationException pce) { } 
    229       catch (SAXException se) { } 
     226      catch (ServiceException se) { } 
    230227 
    231228      if (store == null || service == null) { 
     
    264261               store = service.createOMEXMLMetadata(newXML.toString()); 
    265262              } 
    266               catch (ParserConfigurationException pce) { } 
    267               catch (SAXException se) { } 
     263              catch (ServiceException se) { } 
    268264 
    269265              break; 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/importer/Importer.java

    r5902 r5915  
    5454import loci.common.ReflectedUniverse; 
    5555import loci.common.dependency.DependencyException; 
     56import loci.common.dependency.ServiceException; 
    5657import loci.common.dependency.ServiceFactory; 
    5758import loci.formats.ChannelMerger; 
     
    237238          } 
    238239          catch (DependencyException e) { exc = e; } 
     240          catch (ServiceException e) { exc = e; } 
    239241          catch (ParserConfigurationException e) { exc = e; } 
    240242          catch (SAXException e) { exc = e; } 
     
    334336        } 
    335337        catch (DependencyException de) { } 
    336         catch (ParserConfigurationException pce) { } 
    337         catch (SAXException se) { } 
     338        catch (ServiceException se) { } 
    338339 
    339340        if (options.isVirtual()) { 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/importer/ImporterOptions.java

    r5902 r5915  
    3333import java.util.StringTokenizer; 
    3434 
    35 import javax.xml.parsers.ParserConfigurationException; 
    36  
    3735import loci.common.Location; 
    3836import loci.common.ReflectException; 
    3937import loci.common.ReflectedUniverse; 
    4038import loci.common.dependency.DependencyException; 
     39import loci.common.dependency.ServiceException; 
    4140import loci.common.dependency.ServiceFactory; 
    4241import loci.formats.ChannelSeparator; 
     
    6362import org.apache.log4j.Level; 
    6463import org.apache.log4j.Logger; 
    65  
    66 import org.xml.sax.SAXException; 
    6764 
    6865/** 
     
    562559    } 
    563560    catch (DependencyException de) { } 
    564     catch (ParserConfigurationException pce) { } 
    565     catch (SAXException se) { } 
    566     catch (IOException ie) { } 
     561    catch (ServiceException se) { } 
    567562 
    568563    baseReader.setMetadataStore(meta); 
  • branches/cleanup/components/loci-plugins/src/loci/plugins/macro/LociFunctions.java

    r5902 r5915  
    3232import java.io.IOException; 
    3333 
    34 import javax.xml.parsers.ParserConfigurationException; 
    35  
    3634import loci.common.dependency.DependencyException; 
     35import loci.common.dependency.ServiceException; 
    3736import loci.common.dependency.ServiceFactory; 
    3837import loci.formats.ChannelSeparator; 
     
    4746import loci.plugins.util.ImagePlusReader; 
    4847import loci.plugins.util.ImagePlusTools; 
    49  
    50 import org.xml.sax.SAXException; 
    5148 
    5249/** 
     
    8077    } 
    8178    catch (DependencyException de) { } 
    82     catch (ParserConfigurationException pce) { } 
    83     catch (SAXException se) { } 
    84     catch (IOException e) { } 
     79    catch (ServiceException se) { } 
    8580  } 
    8681 
  • branches/cleanup/components/ome-io/src/loci/ome/io/OMEWriter.java

    r5902 r5915  
    3030import java.util.Hashtable; 
    3131 
    32 import javax.xml.parsers.ParserConfigurationException; 
    33  
    3432import loci.common.DateTools; 
    3533import loci.common.ReflectException; 
    3634import loci.common.ReflectedUniverse; 
    3735import loci.common.dependency.DependencyException; 
     36import loci.common.dependency.ServiceException; 
    3837import loci.common.dependency.ServiceFactory; 
    3938import loci.common.xml.XMLTools; 
     
    5150import org.apache.log4j.Logger; 
    5251import org.apache.log4j.PatternLayout; 
    53  
    54 import org.xml.sax.SAXException; 
    5552 
    5653/** 
     
    538535      LOGGER.warn("OMEXMLService not available", e); 
    539536    } 
    540     catch (ParserConfigurationException e) { 
    541       LOGGER.warn("Could not parse OME-XML", e); 
    542     } 
    543     catch (SAXException e) { 
     537    catch (ServiceException e) { 
    544538      LOGGER.warn("Could not parse OME-XML", e); 
    545539    } 
  • branches/cleanup/components/ome-plugins/src/loci/plugins/ome/LociUploader.java

    r5902 r5915  
    66OME Plugins for ImageJ: a collection of ImageJ plugins 
    77including the Download from OME and Upload to OME plugins. 
    8 Copyright (C) 2005-@year@ Melissa Linkert, Philip Huettl and Curtis Rueden. 
     8Copyright (C) 2005-2010 Melissa Linkert, Philip Huettl and Curtis Rueden. 
    99 
    1010This program is free software; you can redistribute it and/or modify 
     
    3939import java.util.HashSet; 
    4040 
    41 import javax.xml.parsers.ParserConfigurationException; 
    42  
    4341import loci.common.DataTools; 
    4442import loci.common.dependency.DependencyException; 
     43import loci.common.dependency.ServiceException; 
    4544import loci.common.dependency.ServiceFactory; 
    4645import loci.formats.FormatTools; 
     
    5150import loci.ome.io.OMEWriter; 
    5251import loci.plugins.util.LibraryChecker; 
    53  
    54 import org.xml.sax.SAXException; 
    5552 
    5653/** 
     
    152149          store = service.createOMEXMLMetadata(fi.description); 
    153150        } 
    154         catch (ParserConfigurationException e) { exc = e; } 
    155         catch (SAXException e) { exc = e; } 
    156         catch (IOException e) { exc = e; } 
     151        catch (ServiceException e) { exc = e; } 
    157152 
    158153        if (exc != null) { 
     
    165160          store = service.createOMEXMLMetadata(); 
    166161        } 
    167         catch (ParserConfigurationException e) { exc = e; } 
    168         catch (SAXException e) { exc = e; } 
    169         catch (IOException e) { exc = e; } 
     162        catch (ServiceException e) { exc = e; } 
    170163 
    171164        if (exc != null) { 
  • branches/cleanup/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r5902 r5915  
    4141import java.util.List; 
    4242 
    43 import javax.xml.parsers.ParserConfigurationException; 
    44  
    4543import loci.common.DateTools; 
    4644import loci.common.Location; 
    4745import loci.common.dependency.DependencyException; 
     46import loci.common.dependency.ServiceException; 
    4847import loci.common.dependency.ServiceFactory; 
    4948import loci.formats.FileStitcher; 
     
    6564 
    6665import org.testng.SkipException; 
    67  
    68 import org.xml.sax.SAXException; 
    6966 
    7067/** 
     
    907904        store = omexmlService.createOMEXMLMetadata(); 
    908905      } 
    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) { 
     906      catch (ServiceException e) { 
    916907        LOGGER.warn("Could not parse OME-XML", e); 
    917908      } 
  • branches/cleanup/components/visbio/src/loci/visbio/data/Dataset.java

    r5902 r5915  
    55/* 
    66VisBio application for visualization of multidimensional biological 
    7 image data. Copyright (C) 2002-@year@ Curtis Rueden and Abraham Sorber. 
     7image data. Copyright (C) 2002-2010 Curtis Rueden and Abraham Sorber. 
    88 
    99This program is free software; you can redistribute it and/or modify 
     
    3636import javax.swing.JOptionPane; 
    3737 
    38 import javax.xml.parsers.ParserConfigurationException; 
    39  
    4038import loci.common.Location; 
    4139import loci.common.dependency.DependencyException; 
     40import loci.common.dependency.ServiceException; 
    4241import loci.common.dependency.ServiceFactory; 
    4342import loci.formats.ChannelSeparator; 
     
    6362 
    6463import org.w3c.dom.Element; 
    65 import org.xml.sax.SAXException; 
    6664 
    6765import visad.FunctionType; 
     
    394392    } 
    395393    catch (DependencyException e) { serviceException = e; } 
    396     catch (ParserConfigurationException e) { serviceException = e; } 
    397     catch (SAXException e) { serviceException = e; } 
    398     catch (IOException e) { serviceException = e; } 
     394    catch (ServiceException e) { serviceException = e; } 
    399395 
    400396    if (serviceException != null) { 
Note: See TracChangeset for help on using the changeset viewer.