Class AbstractOnmsUpgrade

    • Field Detail

      • ZIP_EXT

        public static final java.lang.String ZIP_EXT
        The Constant ZIP_EXT.
        See Also:
        Constant Field Values
    • Method Detail

      • setVersion

        protected void setVersion​(java.lang.String version)
        Sets the version.

        This method is intended for JUnit tests.

        Parameters:
        version - the new version
      • setProductName

        protected void setProductName​(java.lang.String productName)
        Sets the product name.

        This method is intended for JUnit tests.

        Parameters:
        productName - the new product name
      • setProductDescription

        protected void setProductDescription​(java.lang.String productDescription)
        Sets the product description.

        This method is intended for JUnit tests.

        Parameters:
        productDescription - the new product description
      • getId

        public java.lang.String getId()
        Description copied from interface: OnmsUpgrade
        Gets the id.

        This is for informational purposes, and will be used to store the execution status.

        It is recommended to use the class-name, but any other text can be used.

        Specified by:
        getId in interface OnmsUpgrade
        Returns:
        the id
      • getHomeDirectory

        protected java.lang.String getHomeDirectory()
        Gets the home directory.
        Returns:
        the home directory
      • getFiles

        protected java.io.File[] getFiles​(java.io.File resourceDir,
                                          java.lang.String ext)
        Gets the files.
        Parameters:
        resourceDir - the resource directory
        ext - the file extension
        Returns:
        the files
      • registerProperties

        protected void registerProperties​(java.util.Properties properties)
        Register properties.
        Parameters:
        properties - the properties
      • loadProperties

        protected void loadProperties​(java.util.Properties properties,
                                      java.lang.String fileName)
                               throws OnmsUpgradeException
        Load properties.
        Parameters:
        properties - the properties
        fileName - the file name
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getMainProperties

        protected java.util.Properties getMainProperties()
                                                  throws OnmsUpgradeException
        Gets the main properties.
        Returns:
        the main properties
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getRrdProperties

        protected java.util.Properties getRrdProperties()
                                                 throws OnmsUpgradeException
        Gets the RRD properties.
        Returns:
        the RRD properties
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • isStoreByGroupEnabled

        protected boolean isStoreByGroupEnabled()
        Checks if storeByGroup is enabled.
        Returns:
        true, if storeByGroup is enabled
      • isStoreByForeignSourceEnabled

        protected boolean isStoreByForeignSourceEnabled()
        Checks if storeByForeignSource is enabled.
        Returns:
        true, if storeByForeignSource is enabled
      • getRrdStrategy

        protected java.lang.String getRrdStrategy()
                                           throws OnmsUpgradeException
        Gets the RRD strategy.
        Returns:
        the RRD strategy
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • isRrdToolEnabled

        protected boolean isRrdToolEnabled()
                                    throws OnmsUpgradeException
        Checks if is RRDtool enabled.
        Returns:
        true, if is RRDtool enabled
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getRrdExtension

        protected java.lang.String getRrdExtension()
                                            throws OnmsUpgradeException
        Gets the RRD extension.
        Returns:
        the RRD extension
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getDbConnection

        protected java.sql.Connection getDbConnection()
                                               throws OnmsUpgradeException
        Gets the DB connection.
        Returns:
        the DB connection
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • zipDir

        protected void zipDir​(java.io.File zipFile,
                              java.io.File sourceFolder)
                       throws OnmsUpgradeException
        ZIP a directory.
        Parameters:
        zipFile - the output ZIP file
        sourceFolder - the source folder
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • zipFile

        protected java.io.File zipFile​(java.io.File sourceFile)
                                throws OnmsUpgradeException
        ZIP a file.

        The name of the ZIP file will be the name of the source file plus ".zip"

        Parameters:
        sourceFile - the source file
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • unzipFile

        protected void unzipFile​(java.io.File zipFile,
                                 java.io.File outputFolder)
                          throws OnmsUpgradeException
        UNZIP a file.
        Parameters:
        zipFile - the input ZIP file
        outputFolder - the output folder
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getOpennmsVersion

        protected java.lang.String getOpennmsVersion()
                                              throws OnmsUpgradeException
        Gets the currently installed OpenNMS version.
        Returns:
        the OpenNMS version
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getOpennmsProductName

        public java.lang.String getOpennmsProductName()
        Gets the OpenNMS product name.
        Returns:
        the OpenNMS product name
      • getOpennmsProductDescription

        public java.lang.String getOpennmsProductDescription()
        Gets the OpenNMS product description.
        Returns:
        the OpenNMS product description
      • isMeridian

        public boolean isMeridian()
        Checks if is meridian.
        Returns:
        true, if is meridian
      • isInstalledVersionGreaterOrEqual

        protected boolean isInstalledVersionGreaterOrEqual​(int mayor,
                                                           int minor,
                                                           int release)
                                                    throws OnmsUpgradeException
        Checks if the installed version of OpenNMS is greater or equals than the supplied version.
        Parameters:
        mayor - the mayor
        minor - the minor
        release - the release
        Returns:
        true, if the current installed version is greater or equals than $major.$minor.$release

        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • log

        protected void log​(java.lang.String msgFormat,
                           java.lang.Object... args)
        Log.
        Parameters:
        msgFormat - the message format
        args - the message's arguments