Changeset 5913 for branches/cleanup


Ignore:
Timestamp:
02/15/10 10:56:27 (10 years ago)
Author:
melissa
Message:

Added LOCI POI service and fixed several bugs in service-related resource loading. See #464.

Location:
branches/cleanup/components
Files:
2 added
1 deleted
11 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/cleanup/components/bio-formats/build.properties

    r5904 r5913  
    1212component.classpath      = ${artifact.dir}/loci-common.jar:\ 
    1313                           ${artifact.dir}/ome-xml.jar:\ 
     14                           ${artifact.dir}/poi-loci.jar:\ 
    1415                           ${lib.dir}/forms-1.3.0.jar:\ 
    1516                           ${lib.dir}/log4j-1.2.15.jar:\ 
     
    2829                           ${artifact.dir}/ome-io.jar:\ 
    2930                           ${artifact.dir}/ome-notes.jar:\ 
    30                            ${artifact.dir}/poi-loci.jar:\ 
    3131                           ${artifact.dir}/mdbtools-java.jar:\ 
    3232                           ${artifact.dir}/jai_imageio.jar:\ 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/FV1000Reader.java

    r5852 r5913  
    3636import loci.common.Location; 
    3737import loci.common.RandomAccessInputStream; 
     38import loci.common.dependency.DependencyException; 
     39import loci.common.dependency.ServiceFactory; 
    3840import loci.formats.CoreMetadata; 
    3941import loci.formats.FormatException; 
     
    4143import loci.formats.FormatTools; 
    4244import loci.formats.MetadataTools; 
    43 import loci.formats.POITools; 
     45import loci.formats.POIService; 
    4446import loci.formats.meta.FilterMetadata; 
    4547import loci.formats.meta.MetadataStore; 
     
    121123  private Vector<ChannelData> channels; 
    122124 
    123   private POITools poi; 
     125  private POIService poi; 
    124126 
    125127  private short[][][] lut; 
     
    298300    isOIB = checkSuffix(id, OIB_SUFFIX); 
    299301 
    300     if (isOIB) poi = new POITools(Location.getMappedId(id)); 
     302    if (isOIB) { 
     303      try { 
     304        ServiceFactory factory = new ServiceFactory(); 
     305        poi = factory.getInstance(POIService.class); 
     306      } 
     307      catch (DependencyException de) { 
     308        throw new FormatException("POI library not found", de); 
     309      } 
     310 
     311      poi.initialize(Location.getMappedId(id)); 
     312    } 
    301313 
    302314    // mappedOIF is used to distinguish between datasets that are being read 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/IPWReader.java

    r5852 r5913  
    3232import loci.common.DataTools; 
    3333import loci.common.DateTools; 
     34import loci.common.dependency.DependencyException; 
     35import loci.common.dependency.ServiceFactory; 
    3436import loci.common.Location; 
    3537import loci.common.RandomAccessInputStream; 
     
    3840import loci.formats.FormatTools; 
    3941import loci.formats.MetadataTools; 
    40 import loci.formats.POITools; 
     42import loci.formats.MissingLibraryException; 
     43import loci.formats.POIService; 
    4144import loci.formats.meta.FilterMetadata; 
    4245import loci.formats.meta.MetadataStore; 
     
    6770 
    6871  /** Helper reader - parses embedded files from the OLE document. */ 
    69   private POITools poi; 
     72  private POIService poi; 
    7073 
    7174  /** Image description. */ 
     
    154157 
    155158    in = new RandomAccessInputStream(id); 
    156     poi = new POITools(Location.getMappedId(currentId)); 
     159 
     160    try { 
     161      ServiceFactory factory = new ServiceFactory(); 
     162      poi = factory.getInstance(POIService.class); 
     163    } 
     164    catch (DependencyException de) { 
     165      throw new MissingLibraryException("POI library not found", de); 
     166    } 
     167 
     168    poi.initialize(Location.getMappedId(currentId)); 
    157169 
    158170    imageFiles = new Hashtable<Integer, String>(); 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/PCIReader.java

    r5848 r5913  
    3333import loci.common.Location; 
    3434import loci.common.RandomAccessInputStream; 
     35import loci.common.dependency.DependencyException; 
     36import loci.common.dependency.ServiceFactory; 
    3537import loci.formats.FormatException; 
    3638import loci.formats.FormatReader; 
    3739import loci.formats.FormatTools; 
    3840import loci.formats.MetadataTools; 
    39 import loci.formats.POITools; 
     41import loci.formats.POIService; 
    4042import loci.formats.meta.FilterMetadata; 
    4143import loci.formats.meta.MetadataStore; 
     
    6163 
    6264  private HashMap<Integer, String> imageFiles; 
    63   private POITools poi; 
     65  private POIService poi; 
    6466  private HashMap<Integer, Double> timestamps; 
    6567  private String creationDate; 
     
    134136    timestamps = new HashMap<Integer, Double>(); 
    135137 
    136     poi = new POITools(Location.getMappedId(currentId)); 
     138    try { 
     139      ServiceFactory factory = new ServiceFactory(); 
     140      poi = factory.getInstance(POIService.class); 
     141    } 
     142    catch (DependencyException de) { 
     143      throw new FormatException("POI library not found", de); 
     144    } 
     145 
     146    poi.initialize(Location.getMappedId(currentId)); 
    137147 
    138148    double scaleFactor = 1; 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/TillVisionReader.java

    r5852 r5913  
    3535import loci.common.Location; 
    3636import loci.common.RandomAccessInputStream; 
     37import loci.common.dependency.DependencyException; 
     38import loci.common.dependency.ServiceFactory; 
    3739import loci.formats.CoreMetadata; 
    3840import loci.formats.FormatException; 
     
    4042import loci.formats.FormatTools; 
    4143import loci.formats.MetadataTools; 
    42 import loci.formats.POITools; 
     44import loci.formats.POIService; 
    4345import loci.formats.meta.FilterMetadata; 
    4446import loci.formats.meta.MetadataStore; 
     
    124126    exposureTimes = new Hashtable<Integer, Double>(); 
    125127 
    126     POITools poi = new POITools(id); 
     128    POIService poi = null; 
     129    try { 
     130      ServiceFactory factory = new ServiceFactory(); 
     131      poi = factory.getInstance(POIService.class); 
     132    } 
     133    catch (DependencyException de) { 
     134      throw new FormatException("POI library not found", de); 
     135    } 
     136 
     137    poi.initialize(id); 
    127138    Vector<String> documents = poi.getDocumentList(); 
    128139 
  • branches/cleanup/components/bio-formats/src/loci/formats/in/ZeissZVIReader.java

    r5852 r5913  
    3737import loci.common.Location; 
    3838import loci.common.RandomAccessInputStream; 
     39import loci.common.dependency.DependencyException; 
     40import loci.common.dependency.ServiceFactory; 
    3941import loci.formats.FormatException; 
    4042import loci.formats.FormatReader; 
    4143import loci.formats.FormatTools; 
    4244import loci.formats.MetadataTools; 
    43 import loci.formats.POITools; 
     45import loci.formats.POIService; 
    4446import loci.formats.codec.Codec; 
    4547import loci.formats.codec.CodecOptions; 
     
    9698  private int realWidth, realHeight; 
    9799 
    98   private POITools poi; 
     100  private POIService poi; 
    99101 
    100102  private Vector<RandomAccessInputStream> tagsToParse; 
     
    124126    if (magic != ZVI_MAGIC_BYTES) return false; 
    125127    try { 
    126       POITools p = new POITools(stream); 
     128      ServiceFactory factory = new ServiceFactory(); 
     129      POIService p = factory.getInstance(POIService.class); 
     130      p.initialize(stream); 
    127131      Vector<String> files = p.getDocumentList(); 
    128132      String filename = "Tags"; 
     
    131135      } 
    132136    } 
    133     catch (FormatException e) { 
    134       LOGGER.debug("", e); 
     137    catch (DependencyException de) { 
     138      LOGGER.debug("", de); 
    135139    } 
    136140    return false; 
     
    412416    super.initFile(id); 
    413417 
     418    try { 
     419      ServiceFactory factory = new ServiceFactory(); 
     420      poi = factory.getInstance(POIService.class); 
     421    } 
     422    catch (DependencyException de) { 
     423      throw new FormatException("POI library not found", de); 
     424    } 
     425 
     426    poi.initialize(Location.getMappedId(id)); 
     427 
    414428    timestamps = new Hashtable<Integer, String>(); 
    415429    exposureTime = new Hashtable<Integer, String>(); 
    416     poi = new POITools(Location.getMappedId(id)); 
    417430    tagsToParse = new Vector<RandomAccessInputStream>(); 
    418431 
  • branches/cleanup/components/bio-formats/src/loci/formats/ome/OMEXMLService.java

    r5898 r5913  
    4242 *  
    4343 * <dl><dt><b>Source code:</b></dt> 
    44  * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/bio-formats/src/loci/formats/in/OMEXMLService.java">Trac</a>, 
    45  * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/bio-formats/src/loci/formats/in/OMEXMLService.java">SVN</a></dd></dl> 
     44 * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/bio-formats/src/loci/formats/ome/OMEXMLService.java">Trac</a>, 
     45 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/bio-formats/src/loci/formats/ome/OMEXMLService.java">SVN</a></dd></dl> 
    4646 */ 
    4747public interface OMEXMLService extends Service { 
  • branches/cleanup/components/bio-formats/src/loci/formats/ome/OMEXMLServiceImpl.java

    r5898 r5913  
    7070  /** Reorderingstylesheet. */ 
    7171  private static Templates reorderXSLT = 
    72     XMLTools.getStylesheet("meta/reorder-2008-09.xsl", 
     72    XMLTools.getStylesheet("../meta/reorder-2008-09.xsl", 
    7373                           OMEXMLServiceImpl.class); 
    7474   
  • branches/cleanup/components/common/build.properties

    r5905 r5913  
    1818 
    1919component.resources-bin  = 
    20 component.resources-text = 
     20component.resources-text = loci/common/dependency/services.properties 
    2121 
    2222component.main-class     = 
  • branches/cleanup/components/common/src/loci/common/dependency/ServiceFactory.java

    r5898 r5913  
    8888   */ 
    8989  public ServiceFactory(String path) throws DependencyException { 
    90     ClassLoader classLoader = this.getClass().getClassLoader(); 
    91     InputStream stream = classLoader.getResourceAsStream(path); 
     90    InputStream stream = this.getClass().getResourceAsStream(path); 
    9291    Properties properties = new Properties(); 
    9392    try { 
  • branches/cleanup/components/common/src/loci/common/dependency/services.properties

    r5898 r5913  
    77# OME-XML service (interface and implementation in bio-formats component) 
    88loci.formats.ome.OMEXMLService=loci.formats.ome.OMEXMLServiceImpl 
     9# POI service (interface and implementation in bio-formats component) 
     10loci.formats.POIService=loci.formats.POIServiceImpl 
  • branches/cleanup/components/common/src/loci/common/xml/XMLTools.java

    r5852 r5913  
    324324    finally { 
    325325      try { 
    326         xsltStream.close(); 
     326        if (xsltStream != null) xsltStream.close(); 
    327327      } 
    328328      catch (IOException e) { 
Note: See TracChangeset for help on using the changeset viewer.