Class ZipUpgrader


  • public class ZipUpgrader
    extends FileUpgrader
    An upgrader for zip and file input locations.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ZipUpgrader

        public ZipUpgrader​(java.net.URI source,
                           java.lang.String dest,
                           java.util.Map<java.lang.String,​java.lang.String> files,
                           java.lang.String marker,
                           ProgressObserver observer)
        Creates an upgrader instance.
        Parameters:
        source - the source containing the files to upgrade
        dest - the destination bundle location
        files - the file mapping describing the upgrade
        marker - an optional marker file within dest (may be null)
        observer - a progress observer, use ProgressObserver.NO_OBSERVER if no observer shall be informed
    • Method Detail

      • doUpgrade

        protected boolean doUpgrade​(ReasoningResult result)
        Performs the upgrade operations.
        Overrides:
        doUpgrade in class FileUpgrader
        Parameters:
        result - the reasoning result to be modified as a side effect
        Returns:
        true if performed, false if node
      • unpackZip

        private void unpackZip​(java.util.zip.ZipInputStream zis)
                        throws java.io.IOException
        Unpacks a JESS installation zip.
        Parameters:
        zis - the ZIP input stream
        Throws:
        java.io.IOException - any occuring I/O exception
      • unpackEntryToInstallPath

        private void unpackEntryToInstallPath​(java.util.zip.ZipInputStream zis,
                                              java.util.zip.ZipEntry entry,
                                              java.lang.String targetName)
                                       throws java.io.IOException
        Unpacks a ZIP entry to the bundle installation path.
        Parameters:
        zis - the ZIP input stream
        entry - the ZIP entry to unpack
        targetName - the relative name of the target file
        Throws:
        java.io.IOException - any occuring I/O exception