/// <summary>
        /// Initialize and verify settings for job
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="JobExecutionException">
        /// </exception>
        public virtual void Initialize(IJobExecutionContext context)
        {
            var dataMap = context.JobDetail.JobDataMap;

            AosUri = dataMap.GetString(SettingsConstants.AosUri);
            if (string.IsNullOrEmpty(AosUri))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.AOS_URL_is_missing_in_job_configuration));
            }
            //remove trailing slash if any
            AosUri = AosUri.TrimEnd('/');

            AzureAuthEndpoint = dataMap.GetString(SettingsConstants.AzureAuthEndpoint);
            if (string.IsNullOrEmpty(AzureAuthEndpoint))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_authentication_endpoint_URL_is_missing_in_job_configuration));
            }

            AadTenant = dataMap.GetString(SettingsConstants.AadTenant);
            if (string.IsNullOrEmpty(AadTenant))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.AAD_tenant_id_is_missing_in_job_configuration));
            }

            UseServiceAuthentication = Convert.ToBoolean(dataMap.GetString(SettingsConstants.UseServiceAuthentication));

            var aadClientIdStr = dataMap.GetString(SettingsConstants.AadClientId);

            if (!Guid.TryParse(aadClientIdStr, out Guid aadClientGuid) || (Guid.Empty == aadClientGuid))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_application_client_id_is_missing_or_is_not_a_GUID_in_job_configuration));
            }
            AadClientId = aadClientGuid;

            if (UseServiceAuthentication)
            {
                AadClientSecret = dataMap.GetString(SettingsConstants.AadClientSecret);
                if (string.IsNullOrEmpty(AadClientSecret))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_web_application_secret_is_missing_in_job_configuration));
                }
                AadClientSecret = EncryptDecrypt.Decrypt(AadClientSecret);
            }
            else
            {
                UserName = dataMap.GetString(SettingsConstants.UserName);
                if (string.IsNullOrEmpty(UserName))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.User_principal_name_is_missing_in_job_configuration));
                }

                UserPassword = dataMap.GetString(SettingsConstants.UserPassword);
                if (string.IsNullOrEmpty(UserPassword))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.User_password_is_missing_in_job_configuration));
                }
                UserPassword = EncryptDecrypt.Decrypt(UserPassword);
            }

            Interval = dataMap.GetInt(SettingsConstants.Interval);
            if (Interval < 1) //Default execution interval is 1 second.
            {
                Interval = 1;
            }

            RetryCount = dataMap.GetInt(SettingsConstants.RetryCount);
            if (RetryCount == 0)
            {
                RetryCount = 1;
            }

            RetryDelay = dataMap.GetInt(SettingsConstants.RetryDelay);
            if (RetryDelay == 0)
            {
                RetryDelay = 60; //seconds
            }

            PauseJobOnException = Convert.ToBoolean(dataMap.GetString(SettingsConstants.PauseJobOnException));

            IndefinitePause = Convert.ToBoolean(dataMap.GetString(SettingsConstants.IndefinitePause));

            ImportFromPackageActionPath = dataMap.GetString(SettingsConstants.ImportFromPackageActionPath);
            if (string.IsNullOrEmpty(ImportFromPackageActionPath))
            {
                ImportFromPackageActionPath = OdataActionsConstants.ImportFromPackageActionPath;
            }

            GetAzureWriteUrlActionPath = dataMap.GetString(SettingsConstants.GetAzureWriteUrlActionPath);
            if (string.IsNullOrEmpty(GetAzureWriteUrlActionPath))
            {
                GetAzureWriteUrlActionPath = OdataActionsConstants.GetAzureWriteUrlActionPath;
            }

            GetExecutionSummaryStatusActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryStatusActionPath);
            if (string.IsNullOrEmpty(GetExecutionSummaryStatusActionPath))
            {
                GetExecutionSummaryStatusActionPath = OdataActionsConstants.GetExecutionSummaryStatusActionPath;
            }

            GetExportedPackageUrlActionPath = dataMap.GetString(SettingsConstants.GetExportedPackageUrlActionPath);
            if (string.IsNullOrEmpty(GetExportedPackageUrlActionPath))
            {
                GetExportedPackageUrlActionPath = OdataActionsConstants.GetExportedPackageUrlActionPath;
            }

            GetExecutionSummaryPageUrlActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryPageUrlActionPath);
            if (string.IsNullOrEmpty(GetExecutionSummaryPageUrlActionPath))
            {
                GetExecutionSummaryPageUrlActionPath = OdataActionsConstants.GetExecutionSummaryPageUrlActionPath;
            }

            DeleteExecutionHistoryJobActionPath = dataMap.GetString(SettingsConstants.DeleteExecutionHistoryJobActionPath);
            if (string.IsNullOrEmpty(DeleteExecutionHistoryJobActionPath))
            {
                DeleteExecutionHistoryJobActionPath = OdataActionsConstants.DeleteExecutionHistoryJobActionPath;
            }

            ExportToPackageActionPath = dataMap.GetString(SettingsConstants.ExportToPackageActionPath);
            if (string.IsNullOrEmpty(ExportToPackageActionPath))
            {
                ExportToPackageActionPath = OdataActionsConstants.ExportToPackageActionPath;
            }

            ExportFromPackageActionPath = dataMap.GetString(SettingsConstants.ExportFromPackageActionPath);
            if (string.IsNullOrEmpty(ExportFromPackageActionPath))
            {
                ExportFromPackageActionPath = OdataActionsConstants.ExportFromPackageActionPath;
            }

            GetMessageStatusActionPath = dataMap.GetString(SettingsConstants.GetMessageStatusActionPath);
            if (string.IsNullOrEmpty(GetMessageStatusActionPath))
            {
                GetMessageStatusActionPath = OdataActionsConstants.GetMessageStatusActionPath;
            }

            GetImportTargetErrorKeysFileUrlPath = dataMap.GetString(SettingsConstants.GetImportTargetErrorKeysFileUrlPath);
            if (string.IsNullOrEmpty(GetImportTargetErrorKeysFileUrlPath))
            {
                GetImportTargetErrorKeysFileUrlPath = OdataActionsConstants.GetImportTargetErrorKeysFileUrlPath;
            }

            GenerateImportTargetErrorKeysFilePath = dataMap.GetString(SettingsConstants.GenerateImportTargetErrorKeysFilePath);
            if (string.IsNullOrEmpty(GenerateImportTargetErrorKeysFilePath))
            {
                GenerateImportTargetErrorKeysFilePath = OdataActionsConstants.GenerateImportTargetErrorKeysFilePath;
            }
        }
        /// <summary>
        /// Initialize and verify settings for job
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="Quartz.JobExecutionException">
        /// </exception>
        public virtual void Initialize(IJobExecutionContext context)
        {
            var dataMap = context.JobDetail.JobDataMap;

            AosUri = dataMap.GetString(SettingsConstants.AosUri);
            if (string.IsNullOrEmpty(AosUri))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                              string.Format(Resources.AOS_URL_is_missing_in_job_configuration, context.JobDetail.Key)));
            }
            //remove trailing slash if any
            AosUri = AosUri.TrimEnd('/');

            AzureAuthEndpoint = dataMap.GetString(SettingsConstants.AzureAuthEndpoint);
            if (string.IsNullOrEmpty(AzureAuthEndpoint))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                              string.Format(Resources.Azure_authentication_endpoint_URL_is_missing_in_job_configuration,
                                                                            context.JobDetail.Key)));
            }

            AadTenant = dataMap.GetString(SettingsConstants.AadTenant);
            if (string.IsNullOrEmpty(AadTenant))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                              string.Format(Resources.AAD_tenant_id_is_missing_in_job_configuration, context.JobDetail.Key)));
            }

            UseServiceAuthentication = Convert.ToBoolean(dataMap.GetString(SettingsConstants.UseServiceAuthentication));

            var aadClientIdStr = dataMap.GetString(SettingsConstants.AadClientId);

            if (!Guid.TryParse(aadClientIdStr, out Guid aadClientGuid) || (Guid.Empty == aadClientGuid))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                              string.Format(
                                                                  Resources.Azure_application_client_id_is_missing_or_is_not_a_GUID_in_job_configuration,
                                                                  context.JobDetail.Key)));
            }
            AadClientId = aadClientGuid;

            if (UseServiceAuthentication)
            {
                AadClientSecret = dataMap.GetString(SettingsConstants.AadClientSecret);
                if (string.IsNullOrEmpty(AadClientSecret))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                                  string.Format(Resources.Azure_web_application_secret_is_missing_in_job_configuration,
                                                                                context.JobDetail.Key)));
                }
                AadClientSecret = EncryptDecrypt.Decrypt(AadClientSecret);
            }
            else
            {
                UserName = dataMap.GetString(SettingsConstants.UserName);
                if (string.IsNullOrEmpty(UserName))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                                  string.Format(Resources.User_principal_name_is_missing_in_job_configuration,
                                                                                context.JobDetail.Key)));
                }

                UserPassword = dataMap.GetString(SettingsConstants.UserPassword);
                if (string.IsNullOrEmpty(UserPassword))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture,
                                                                  string.Format(Resources.User_password_is_missing_in_job_configuration, context.JobDetail.Key)));
                }
                UserPassword = EncryptDecrypt.Decrypt(UserPassword);
            }

            Interval = dataMap.GetInt(SettingsConstants.Interval);
            if (Interval < 2000) //Default execution interval is 2 seconds.
            {
                Interval = 2000;
            }
        }