Class ZipChemCompProvider

  • All Implemented Interfaces:
    ChemCompProvider

    public class ZipChemCompProvider
    extends java.lang.Object
    implements ChemCompProvider
    This chemical component provider retrieves and caches chemical component definition files from a zip archive specified in its construction. If the archive does not contain the record, an attempt is made to download it using DownloadChemCompProvider. The downloaded file is then added to the archive. The class is thread-safe and the same ZipChemCompProvider should be used by all threads to prevent simultaneous read or write to the zip archive. A zip archive will be created if missing.
    Since:
    12/05/12 updated 3/5/2016 for Java 7 ZipFileSystem
    Author:
    edlunde, larsonm
    • Constructor Summary

      Constructors 
      Constructor Description
      ZipChemCompProvider​(java.lang.String chemicalComponentDictionaryFile, java.lang.String tempDir)
      ZipChemCompProvider is a Chemical Component provider that stores chemical components in a zip archive.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ChemComp getChemComp​(java.lang.String recordName)
      Returns a new instance of a chemical component definition.
      static void purgeTempFiles​(java.lang.String tempdir)
      Cleanup chemical component (.cif.gz) files downloaded to tmpdir.
      void setRemoveCif​(boolean doRemove)
      Remove downloaded .cif.gz after adding to zip archive? Default is true.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZipChemCompProvider

        public ZipChemCompProvider​(java.lang.String chemicalComponentDictionaryFile,
                                   java.lang.String tempDir)
                            throws java.io.IOException
        ZipChemCompProvider is a Chemical Component provider that stores chemical components in a zip archive. Missing chemical components are downloaded and appended to the archive. If non-existent a new zip archive will be created.
        Parameters:
        chemicalComponentDictionaryFile - : path to zip archive for chemical components.
        tempDir - : path for temporary directory, (null) defaults to path in property "java.io.tmpdir".
        Throws:
        java.io.IOException
    • Method Detail

      • setRemoveCif

        public void setRemoveCif​(boolean doRemove)
        Remove downloaded .cif.gz after adding to zip archive? Default is true.
        Parameters:
        doRemove -
      • purgeTempFiles

        public static void purgeTempFiles​(java.lang.String tempdir)
        Cleanup chemical component (.cif.gz) files downloaded to tmpdir.
        Parameters:
        tempdir - : path to temporary directory for chemical components