in Common/JobSettings/Settings.cs [24:179]
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));
}
UseADAL = dataMap.GetBooleanValue(SettingsConstants.UseADAL);
UseServiceAuthentication = dataMap.GetBooleanValue(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);
}
DelayBetweenFiles = dataMap.GetInt(SettingsConstants.DelayBetweenFiles);
RetryCount = dataMap.GetInt(SettingsConstants.RetryCount);
if (RetryCount == 0)
{
RetryCount = 1;
}
RetryDelay = dataMap.GetInt(SettingsConstants.RetryDelay);
if (RetryDelay == 0)
{
RetryDelay = 10; //seconds
}
PauseJobOnException = dataMap.GetBooleanValue(SettingsConstants.PauseJobOnException);
IndefinitePause = dataMap.GetBooleanValue(SettingsConstants.IndefinitePause);
ImportFromPackageActionPath = dataMap.GetString(SettingsConstants.ImportFromPackageActionPath);
if (string.IsNullOrEmpty(ImportFromPackageActionPath))
{
ImportFromPackageActionPath = PackageApiActions.ImportFromPackageActionPath;
}
GetAzureWriteUrlActionPath = dataMap.GetString(SettingsConstants.GetAzureWriteUrlActionPath);
if (string.IsNullOrEmpty(GetAzureWriteUrlActionPath))
{
GetAzureWriteUrlActionPath = PackageApiActions.GetAzureWriteUrlActionPath;
}
GetExecutionSummaryStatusActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryStatusActionPath);
if (string.IsNullOrEmpty(GetExecutionSummaryStatusActionPath))
{
GetExecutionSummaryStatusActionPath = PackageApiActions.GetExecutionSummaryStatusActionPath;
}
GetExportedPackageUrlActionPath = dataMap.GetString(SettingsConstants.GetExportedPackageUrlActionPath);
if (string.IsNullOrEmpty(GetExportedPackageUrlActionPath))
{
GetExportedPackageUrlActionPath = PackageApiActions.GetExportedPackageUrlActionPath;
}
GetExecutionSummaryPageUrlActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryPageUrlActionPath);
if (string.IsNullOrEmpty(GetExecutionSummaryPageUrlActionPath))
{
GetExecutionSummaryPageUrlActionPath = PackageApiActions.GetExecutionSummaryPageUrlActionPath;
}
DeleteExecutionHistoryJobActionPath = dataMap.GetString(SettingsConstants.DeleteExecutionHistoryJobActionPath);
if (string.IsNullOrEmpty(DeleteExecutionHistoryJobActionPath))
{
DeleteExecutionHistoryJobActionPath = PackageApiActions.DeleteExecutionHistoryJobActionPath;
}
ExportToPackageActionPath = dataMap.GetString(SettingsConstants.ExportToPackageActionPath);
if (string.IsNullOrEmpty(ExportToPackageActionPath))
{
ExportToPackageActionPath = PackageApiActions.ExportToPackageActionPath;
}
ExportFromPackageActionPath = dataMap.GetString(SettingsConstants.ExportFromPackageActionPath);
if (string.IsNullOrEmpty(ExportFromPackageActionPath))
{
ExportFromPackageActionPath = PackageApiActions.ExportFromPackageActionPath;
}
GetMessageStatusActionPath = dataMap.GetString(SettingsConstants.GetMessageStatusActionPath);
if (string.IsNullOrEmpty(GetMessageStatusActionPath))
{
GetMessageStatusActionPath = PackageApiActions.GetMessageStatusActionPath;
}
GetImportTargetErrorKeysFileUrlPath = dataMap.GetString(SettingsConstants.GetImportTargetErrorKeysFileUrlPath);
if (string.IsNullOrEmpty(GetImportTargetErrorKeysFileUrlPath))
{
GetImportTargetErrorKeysFileUrlPath = PackageApiActions.GetImportTargetErrorKeysFileUrlPath;
}
GenerateImportTargetErrorKeysFilePath = dataMap.GetString(SettingsConstants.GenerateImportTargetErrorKeysFilePath);
if (string.IsNullOrEmpty(GenerateImportTargetErrorKeysFilePath))
{
GenerateImportTargetErrorKeysFilePath = PackageApiActions.GenerateImportTargetErrorKeysFilePath;
}
GetExecutionErrorsPath = dataMap.GetString(SettingsConstants.GetExecutionErrorsPath);
if (string.IsNullOrEmpty(GetExecutionErrorsPath))
{
GetExecutionErrorsPath = PackageApiActions.GetExecutionErrorsPath;
}
GetExecutionErrors = dataMap.GetBooleanValue(SettingsConstants.GetExecutionErrors);
LogVerbose = dataMap.GetBooleanValue(SettingsConstants.LogVerbose);
JobKey = context.JobDetail.Key.ToString();
}