From 54894e8c0db937417015113e62b78d443c724cad Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Fri, 16 Feb 2018 00:14:51 +0100
Subject: [PATCH] Re-order optional settings, grouping notification / email
 stuff.

Refers to #18, #29
---
 ATxCommon/Serializables/ServiceConfig.cs  | 71 ++++++++++++-----------
 Resources/conf/config.common.xml          | 43 ++++++++------
 Resources/conf/host-specific.template.xml |  6 +-
 3 files changed, 65 insertions(+), 55 deletions(-)

diff --git a/ATxCommon/Serializables/ServiceConfig.cs b/ATxCommon/Serializables/ServiceConfig.cs
index 4f77eba..3c1de6a 100644
--- a/ATxCommon/Serializables/ServiceConfig.cs
+++ b/ATxCommon/Serializables/ServiceConfig.cs
@@ -89,6 +89,42 @@ namespace ATxCommon.Serializables
         /// </summary>
         public string MarkerFile { get; set; }
 
+        /// <summary>
+        /// Number of days after data in the "DONE" location expires. Default: 30.
+        /// </summary>
+        public int GracePeriod { get; set; } = 30;
+
+        /// <summary>
+        /// Whether to enforce ACL inheritance when moving files and directories, see 
+        /// https://support.microsoft.com/en-us/help/320246 for more details. Default: false.
+        /// </summary>
+        public bool EnforceInheritedACLs { get; set; } = false;
+
+        /// <summary>
+        /// Limit RoboCopy transfer bandwidth (mostly for testing purposes). Default: 0.
+        /// </summary>
+        /// See the RoboCopy documentation for more details.
+        public int InterPacketGap { get; set; } = 0;
+
+        /// <summary>
+        /// A list of process names causing transfers to be suspended if running.
+        /// </summary>
+        [XmlArray]
+        [XmlArrayItem(ElementName = "ProcessName")]
+        public List<string> BlacklistedProcesses { get; set; }
+
+        /// <summary>
+        /// A list of drives and thresholds to monitor free space.
+        /// </summary>
+        [XmlArray]
+        [XmlArrayItem(ElementName = "DriveToCheck")]
+        public List<DriveToCheck> SpaceMonitoring { get; set; }
+
+        #endregion
+
+
+        #region optional configuration parameters - notification settings
+
         /// <summary>
         /// SMTP server to send mails and Fatal/Error log messages. No mails if omitted.
         /// </summary>
@@ -123,7 +159,7 @@ namespace ATxCommon.Serializables
         /// The mail recipient address for admin notifications (including "Fatal" log messages).
         /// </summary>
         public string AdminEmailAdress { get; set; }
-        
+
         /// <summary>
         /// The mail recipient address for debug notifications (including "Error" log messages).
         /// </summary>
@@ -154,40 +190,9 @@ namespace ATxCommon.Serializables
         /// </summary>
         public int StorageNotificationDelta { get; set; } = 720;
 
-        /// <summary>
-        /// Number of days after data in the "DONE" location expires. Default: 30.
-        /// </summary>
-        public int GracePeriod { get; set; } = 30;
-
-        /// <summary>
-        /// A list of process names causing transfers to be suspended if running.
-        /// </summary>
-        [XmlArray]
-        [XmlArrayItem(ElementName = "ProcessName")]
-        public List<string> BlacklistedProcesses { get; set; }
-
-        /// <summary>
-        /// Whether to enforce ACL inheritance when moving files and directories, see 
-        /// https://support.microsoft.com/en-us/help/320246 for more details. Default: false.
-        /// </summary>
-        public bool EnforceInheritedACLs { get; set; } = false;
-
-        /// <summary>
-        /// A list of drives and thresholds to monitor free space.
-        /// </summary>
-        [XmlArray]
-        [XmlArrayItem(ElementName = "DriveToCheck")]
-        public List<DriveToCheck> SpaceMonitoring { get; set; }
-
-        /// <summary>
-        /// Limit RoboCopy transfer bandwidth (mostly for testing purposes). Default: 0.
-        /// </summary>
-        /// See the RoboCopy documentation for more details.
-        public int InterPacketGap { get; set; } = 0;
-
         #endregion
 
-        
+
         #region wrappers for derived parameters
 
         /// <summary>
diff --git a/Resources/conf/config.common.xml b/Resources/conf/config.common.xml
index 54436ef..8109493 100644
--- a/Resources/conf/config.common.xml
+++ b/Resources/conf/config.common.xml
@@ -40,6 +40,29 @@
          file itself will be ignored for the transfers -->
     <MarkerFile>_DO_NOT_ACQUIRE_HERE_.txt</MarkerFile>
 
+    <!-- GracePeriod: number of days after data in the "DONE" location expires,
+         which will trigger a summary email to the admin address. -->
+    <GracePeriod>30</GracePeriod>
+
+    <!-- EnforceInheritedACLs: whether to enforce ACL inheritance when moving
+         files and directories, see this page for details (DEFAULT: true)
+         https://support.microsoft.com/en-us/help/320246 -->
+    <EnforceInheritedACLs>false</EnforceInheritedACLs>
+
+    <!-- BlacklistedProcesses: a list of "ProcessName" entries denoting
+         programs that will cause a transfer to be suspended immediately if the
+         name is found in the list of running processes -->
+    <BlacklistedProcesses>
+        <ProcessName>calc</ProcessName>
+        <ProcessName>notepad</ProcessName>
+        <ProcessName>wordpad</ProcessName>
+    </BlacklistedProcesses>
+
+    <!--  OPTIONAL CONFIGURATION SETTINGS  -->
+
+
+    <!--  OPTIONAL NOTIFICATION / EMAIL SETTINGS  -->
+
     <!-- SmtpHost: SMTP server hostname -->
     <SmtpHost />
     <!-- SmtpPort: SMTP server port, defaults to 25 if omitted -->
@@ -81,24 +104,6 @@
          in case one of the drives is below the threshold (in minutes) -->
     <StorageNotificationDelta>720</StorageNotificationDelta>
 
-    <!-- GracePeriod: number of days after data in the "DONE" location expires,
-         which will trigger a summary email to the admin address. -->
-    <GracePeriod>30</GracePeriod>
-
-    <!-- BlacklistedProcesses: a list of "ProcessName" entries denoting
-         programs that will cause a transfer to be suspended immediately if the
-         name is found in the list of running processes -->
-    <BlacklistedProcesses>
-        <ProcessName>calc</ProcessName>
-        <ProcessName>notepad</ProcessName>
-        <ProcessName>wordpad</ProcessName>
-    </BlacklistedProcesses>
-
-    <!-- EnforceInheritedACLs: whether to enforce ACL inheritance when moving
-         files and directories, see this page for details (DEFAULT: true)
-         https://support.microsoft.com/en-us/help/320246 -->
-    <EnforceInheritedACLs>false</EnforceInheritedACLs>
-
-    <!--  OPTIONAL CONFIGURATION SETTINGS  -->
+    <!--  OPTIONAL NOTIFICATION / EMAIL SETTINGS  -->
 
 </ServiceConfig>
\ No newline at end of file
diff --git a/Resources/conf/host-specific.template.xml b/Resources/conf/host-specific.template.xml
index f9a39e1..0feb144 100644
--- a/Resources/conf/host-specific.template.xml
+++ b/Resources/conf/host-specific.template.xml
@@ -11,6 +11,9 @@
 
     <!--  OPTIONAL CONFIGURATION SETTINGS  -->
 
+    <!-- InterPacketGap: RoboCopy parameter to limit the bandwidth -->
+    <InterPacketGap>0</InterPacketGap>
+
     <!-- A list of drive names and space thresholds to be used for monitoring
          the free space and send notifications if below. -->
     <SpaceMonitoring>
@@ -26,9 +29,6 @@
         </DriveToCheck><-->
     </SpaceMonitoring>
 
-    <!-- InterPacketGap: RoboCopy parameter to limit the bandwidth -->
-    <InterPacketGap>0</InterPacketGap>
-
     <!--  OPTIONAL CONFIGURATION SETTINGS  -->
 
   </ServiceConfig>
\ No newline at end of file
-- 
GitLab