Class AbstractOnmsUpgrade

    • Method Detail

      • setVersion

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

        This method is intended for JUnit tests.

        Parameters:
        version - the new version
      • setProductName

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

        This method is intended for JUnit tests.

        Parameters:
        productName - the new product name
      • setProductDescription

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

        This method is intended for JUnit tests.

        Parameters:
        productDescription - the new product description
      • getId

        public 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 String getHomeDirectory()
        Gets the home directory.
        Returns:
        the home directory
      • getFiles

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

        protected void registerProperties​(Properties properties)
        Register properties.
        Parameters:
        properties - the properties
      • 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
      • isRrdToolEnabled

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

        protected void zipDir​(File zipFile,
                              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 File zipFile​(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​(File zipFile,
                                 File outputFolder)
                          throws OnmsUpgradeException
        UNZIP a file.
        Parameters:
        zipFile - the input ZIP file
        outputFolder - the output folder
        Throws:
        OnmsUpgradeException - the OpenNMS upgrade exception
      • getOpennmsProductName

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

        public 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​(String msgFormat,
                           Object... args)
        Log.
        Parameters:
        msgFormat - the message format
        args - the message's arguments