Class Upgrader

  • All Implemented Interfaces:
    Runnable, nzilbb.util.MonitorableTask

    public class Upgrader
    extends Task
    Task that upgrades LaBB-CAT by selectively unpacking a given .war file.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Upgrader

        public Upgrader()
        Subclass constructor.
      • Upgrader

        public Upgrader​(File war,
                        File dir,
                        String driverName,
                        String connectionURL,
                        String connectionName,
                        String connectionPassword)
        Constructor.
        Parameters:
        war - The .war package file to upgrade from.
        dir - The directory into which files should be unpacked.
    • Method Detail

      • getUpgrader

        public static Upgrader getUpgrader()
        Provides the currently-running upgrader task, if any.
        Returns:
        The currently-running upgrader task, if any.
      • getWar

        public File getWar()
        Getter for war: The .war package to upgrade from.
        Returns:
        The .war package to upgrade from.
      • setWar

        public Upgrader setWar​(File newWar)
        Setter for war: The .war package to upgrade from.
        Parameters:
        newWar - The .war package to upgrade from.
      • getDir

        public File getDir()
        Getter for dir: LaBB-CAT root directory, to where the contents of the uploader should be unpacked.
        Returns:
        LaBB-CAT root directory, to where the contents of the uploader should be unpacked.
      • setDir

        public Upgrader setDir​(File newDir)
        Setter for dir: LaBB-CAT root directory, to where the contents of the uploader should be unpacked.
        Parameters:
        newDir - LaBB-CAT root directory, to where the contents of the uploader should be unpacked.
      • getMessages

        public Vector<String> getMessages()
        Getter for messages: Messages logged by the upgrader.
        Returns:
        Messages logged by the upgrader.
      • setStatus

        public void setStatus​(String message)
        Sets the thread status.
        Overrides:
        setStatus in class Task
        Parameters:
        message - a status message to display to anyone who's watching the thread.
      • run

        public void run()
        Runs the upgrade.
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • executeSql

        public void executeSql​(File sqlFile)
                        throws SQLException,
                               Exception
        Executes all SQL statements in the given file.
        Parameters:
        sqlFile - The file to execute.
        Throws:
        SQLException - If there was an SQL error.
        Exception - If there was a general error.
      • release

        public void release()
        Release resources.
        Overrides:
        release in class Task