|
|
@@ -4,6 +4,7 @@ using System.Xml;
|
|
|
using System.Reflection;
|
|
|
using System.Diagnostics;
|
|
|
using winsw.Util;
|
|
|
+using log4net;
|
|
|
|
|
|
namespace winsw.Extensions
|
|
|
{
|
|
|
@@ -12,6 +13,8 @@ namespace winsw.Extensions
|
|
|
public Dictionary<string, IWinSWExtension> Extensions { private set; get; }
|
|
|
public ServiceDescriptor ServiceDescriptor { private set; get; }
|
|
|
|
|
|
+ private static readonly ILog Log = LogManager.GetLogger(typeof(WinSWExtensionManager));
|
|
|
+
|
|
|
public WinSWExtensionManager(ServiceDescriptor serviceDescriptor)
|
|
|
{
|
|
|
ServiceDescriptor = serviceDescriptor;
|
|
|
@@ -42,6 +45,44 @@ namespace winsw.Extensions
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Handler, which is being invoked once the child process is started.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="process">Process</param>
|
|
|
+ public void FireOnProcessStarted(System.Diagnostics.Process process)
|
|
|
+ {
|
|
|
+ foreach (var ext in Extensions)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ext.Value.OnProcessStarted(process);
|
|
|
+ }
|
|
|
+ catch (ExtensionException ex)
|
|
|
+ {
|
|
|
+ Log.Error("onProcessStarted() handler failed for " + ext.Value.DisplayName, ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Handler, which is being invoked once the child process is terminated.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="process">Process</param>
|
|
|
+ public void FireOnProcessTerminated(System.Diagnostics.Process process)
|
|
|
+ {
|
|
|
+ foreach (var ext in Extensions)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ext.Value.OnProcessTerminated(process);
|
|
|
+ }
|
|
|
+ catch (ExtensionException ex)
|
|
|
+ {
|
|
|
+ Log.Error("onProcessTerminated() handler failed for " + ext.Value.DisplayName, ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//TODO: Implement loading of external extensions. Current version supports internal hack
|
|
|
#region Extension load management
|
|
|
|