Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs
===================================================================
diff -u -r2e2d39247c4204f6bb00ab53d8aa9ac5e84df9b8 -r0b4dccd26edac358235c579145b96b0b803c9f5d
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 2e2d39247c4204f6bb00ab53d8aa9ac5e84df9b8)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 0b4dccd26edac358235c579145b96b0b803c9f5d)
@@ -27,72 +27,27 @@
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 design water level.
///
- public class DesignWaterLevelCalculationService
+ public class DesignWaterLevelCalculationService : TargetProbabilityCalculationService
{
private static readonly ILog log = LogManager.GetLogger(typeof(DesignWaterLevelCalculationService));
private IDesignWaterLevelCalculator 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 the design water level.
///
/// The hydraulic boundary location calculation to perform.
@@ -172,7 +127,7 @@
log.Error(messageProvider.GetCalculationFailedWithErrorReportMessage(hydraulicBoundaryLocation.Name, lastErrorFileContent));
}
- log.InfoFormat(Resources.DesignWaterLevelCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
+ log.InfoFormat(RingtoetsCommonServiceResources.DesignWaterLevelCalculationService_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;
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj
===================================================================
diff -u -rd3b14a0f327184e0239e5239c826805c565fe8be -r0b4dccd26edac358235c579145b96b0b803c9f5d
--- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision d3b14a0f327184e0239e5239c826805c565fe8be)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 0b4dccd26edac358235c579145b96b0b803c9f5d)
@@ -36,6 +36,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Service/TargetProbabilityCalculationService.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Service/TargetProbabilityCalculationService.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/TargetProbabilityCalculationService.cs (revision 0b4dccd26edac358235c579145b96b0b803c9f5d)
@@ -0,0 +1,76 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.Common.IO.HydraRing;
+using Ringtoets.Common.Service.Properties;
+
+namespace Ringtoets.Common.Service
+{
+ ///
+ /// Abstract service that provides methods for performing Hydra-Ring calculations with a target probability.
+ ///
+ public abstract class TargetProbabilityCalculationService
+ {
+ ///
+ /// 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 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;
+ }
+ }
+}
\ No newline at end of file
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;
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs
===================================================================
diff -u -r7f7abb21ec08d415362eddc7ac0d64c83d95897f -r0b4dccd26edac358235c579145b96b0b803c9f5d
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision 7f7abb21ec08d415362eddc7ac0d64c83d95897f)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision 0b4dccd26edac358235c579145b96b0b803c9f5d)
@@ -25,71 +25,27 @@
using Core.Common.Util;
using log4net;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Common.IO.HydraRing;
using Ringtoets.Common.Service;
using Ringtoets.DuneErosion.Data;
using Ringtoets.DuneErosion.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 RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources;
namespace Ringtoets.DuneErosion.Service
{
///
/// Service that provides methods for performing Hydra-Ring calculations for dune locations.
///
- public class DuneLocationCalculationService
+ public class DuneLocationCalculationService : TargetProbabilityCalculationService
{
private static readonly ILog log = LogManager.GetLogger(typeof(DuneLocationCalculationService));
private bool canceled;
private IDunesBoundaryConditionsCalculator calculator;
///
- /// Performs validation on the given and .
- /// Error and status information is logged during the execution of the operation.
- ///
- /// The file path of the hydraulic boundary database file which to validate.
- /// The preprocessor directory to validate.
- /// true if there were no validation errors; false otherwise.
- public static bool Validate(string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory)
- {
- var isValid = true;
-
- CalculationServiceHelper.LogValidationBegin();
-
- string databaseFilePathValidationProblem = HydraulicBoundaryDatabaseHelper.ValidateFilesForCalculation(hydraulicBoundaryDatabaseFilePath,
- preprocessorDirectory);
- if (!string.IsNullOrEmpty(databaseFilePathValidationProblem))
- {
- CalculationServiceHelper.LogMessagesAsError(RingtoetsCommonServiceResources.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 the provided and sets its output if the calculation is successful.
/// Error and status information is logged during the execution of the operation.
///