Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs
===================================================================
diff -u -r2e2d39247c4204f6bb00ab53d8aa9ac5e84df9b8 -r0b4dccd26edac358235c579145b96b0b803c9f5d
--- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 2e2d39247c4204f6bb00ab53d8aa9ac5e84df9b8)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 0b4dccd26edac358235c579145b96b0b803c9f5d)
@@ -27,73 +27,28 @@
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.IllustrationPoints;
-using Ringtoets.Common.IO.HydraRing;
using Ringtoets.Common.Service.IllustrationPoints;
using Ringtoets.Common.Service.MessageProviders;
-using Ringtoets.Common.Service.Properties;
using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Calculator.Factory;
using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
using Ringtoets.HydraRing.Calculation.Exceptions;
using HydraRingGeneralResult = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.GeneralResult;
+using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources;
namespace Ringtoets.Common.Service
{
///
/// Service that provides methods for performing Hydra-Ring calculations for marginal wave statistics.
///
- public class WaveHeightCalculationService
+ public class WaveHeightCalculationService : TargetProbabilityCalculationService
{
private static readonly ILog log = LogManager.GetLogger(typeof(WaveHeightCalculationService));
private IWaveHeightCalculator calculator;
private bool canceled;
///
- /// Performs validation on the given input parameters. Error and status information is logged during the execution of the operation.
- ///
- /// The file path of the hydraulic boundary database to validate.
- /// The preprocessor directory to validate.
- /// The norm to validate.
- /// true if there were no validation errors; false otherwise.
- public static bool Validate(string hydraulicBoundaryDatabaseFilePath,
- string preprocessorDirectory,
- double norm)
- {
- var isValid = true;
-
- CalculationServiceHelper.LogValidationBegin();
-
- string databaseFilePathValidationProblem = HydraulicBoundaryDatabaseHelper.ValidateFilesForCalculation(hydraulicBoundaryDatabaseFilePath,
- preprocessorDirectory);
- if (!string.IsNullOrEmpty(databaseFilePathValidationProblem))
- {
- CalculationServiceHelper.LogMessagesAsError(Resources.Hydraulic_boundary_database_connection_failed_0_,
- new[]
- {
- databaseFilePathValidationProblem
- });
-
- isValid = false;
- }
-
- string preprocessorDirectoryValidationProblem = HydraulicBoundaryDatabaseHelper.ValidatePreprocessorDirectory(preprocessorDirectory);
- if (!string.IsNullOrEmpty(preprocessorDirectoryValidationProblem))
- {
- CalculationServiceHelper.LogMessagesAsError(new[]
- {
- preprocessorDirectoryValidationProblem
- });
-
- isValid = false;
- }
-
- CalculationServiceHelper.LogValidationEnd();
-
- return isValid;
- }
-
- ///
/// Performs a calculation for wave height.
///
/// The hydraulic boundary location calculation to perform.
@@ -172,7 +127,7 @@
log.Error(messageProvider.GetCalculationFailedWithErrorReportMessage(hydraulicBoundaryLocation.Name, lastErrorFileContent));
}
- log.InfoFormat(Resources.WaveHeightCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
+ log.InfoFormat(RingtoetsCommonServiceResources.WaveHeightCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
CalculationServiceHelper.LogCalculationEnd();
if (errorOccurred)
@@ -233,7 +188,7 @@
}
catch (ArgumentException e)
{
- log.Warn(string.Format(Resources.CalculationService_Error_in_reading_illustrationPoints_for_CalculationName_0_with_ErrorMessage_1,
+ log.Warn(string.Format(RingtoetsCommonServiceResources.CalculationService_Error_in_reading_illustrationPoints_for_CalculationName_0_with_ErrorMessage_1,
hydraulicBoundaryLocation.Name,
e.Message));
}
@@ -264,7 +219,7 @@
}
catch (IllustrationPointConversionException e)
{
- log.Warn(Resources.SetGeneralResult_Converting_IllustrationPointResult_Failed, e);
+ log.Warn(RingtoetsCommonServiceResources.SetGeneralResult_Converting_IllustrationPointResult_Failed, e);
}
return null;