class UpgradeUtil {

    public static boolean initiateUpgrade( final String upgradeId, final String upgradeBinaryFileName )
    {

        String upgradeScript = HmsConfigHolder.getHMSConfigProperty( UPGRADE_SCRIPT );
        final String upgradeDir = UpgradeUtil.getUpgradeDir( upgradeId );

        if ( upgradeId != null && upgradeBinaryFileName != null && upgradeScript != null )
        {

            // upgrade script abs path
            String upgradeScriptAbsPath = FilenameUtils.concat( upgradeDir, upgradeScript );

            try
            {

                List<String> cmdWithArgs = new ArrayList<String>();
                cmdWithArgs.add( 0, upgradeScriptAbsPath );

                // HMS_TOKEN
                cmdWithArgs.add( 1, upgradeId );

                // HMS_SCRIPT_DIR
                cmdWithArgs.add( 2, upgradeDir );

                // HMS_OOB_BINARY_LOCATION
                cmdWithArgs.add( 3, upgradeDir );

                // HMS_OOB_BINARY_FILENAME
                cmdWithArgs.add( 4, upgradeBinaryFileName );

                // HMS_OOB_BINARY_CHECKSUM_FILENAME
                cmdWithArgs.add( 5, upgradeBinaryFileName + ".md5" );

                int exitValue = ProcessUtil.getCommandExitValue( cmdWithArgs );
                if ( exitValue == 0 )
                {
                    return true;
                }
            }
            catch ( Exception e )
            {
                logger.error( "Error while initiating upgrade using script '{}'.", upgradeScriptAbsPath, e );
            }
        }
        return false;
    }

    private  UpgradeUtil();

}