/** * Singleton constructor. */ private ConnectionManager() { getPasswordProvider(); requests = new Dictionary <string, Sendable>(); expiryHandlers = new Dictionary <string, IExpiredMessageHandler>(); handlers = new Dictionary <string, ISpineHandler>(); synchronousHandlers = new Dictionary <string, ISynchronousResponseHandler>(); itkTrunkHandler = new ITKTrunkHandler(); handlers.Add("urn:nhs:names:services:itk/COPC_IN000001GB01", itkTrunkHandler); handlers.Add("\"urn:nhs:names:services:itk/COPC_IN000001GB01\"", itkTrunkHandler); loadCertificate(); messageDirectory = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, MESSAGE_DIRECTORY_REGVAL, ""); if (messageDirectory.Length == 0) { EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No message directory provided - only in-memory persistence available", EventLogEntryType.Warning); } // Make sure messageDirectory is terminated with a path delimiter, because we're going // to need to add message ids to it when we call depersist() to delete persisted messages // on expiry or explicit transmission result. // if (!messageDirectory.EndsWith("\\")) { messageDirectory = messageDirectory + "\\"; } myIp = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, MY_IP_REGVAL, ""); if (myIp.Length == 0) { myIp = null; EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No local IP address provided - will use first non-localhost interface", EventLogEntryType.Warning); } expiredDirectory = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, EXPIRED_DIRECTORY_REGVAL, ""); if (expiredDirectory.Length == 0) { EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No expired message directory provided - administrative handling of unsent messages NOT available", EventLogEntryType.Warning); } sdsConnection = new SDSconnection(); try { retryCheckPeriod = Int64.Parse((string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, RETRY_TIMER_PERIOD_REGVAL, "")); } catch { } string nulldefault = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, USE_NULL_DEFAULT_SYNCHRONOUS_HANDLER_REGVAL, ""); if (nulldefault.ToLower().StartsWith("y")) { defaultSynchronousResponseHandler = new NullSynchronousResponseHandler(); } else { defaultSynchronousResponseHandler = new DefaultFileSaveSynchronousResponseHandler(); } defaultSpineHandler = new DefaultFileSaveSpineHandler(); persistDurations = loadReceivedPersistDurations(); if (retryCheckPeriod != 0) { retryProcessorTimer = new Timer(processRetries, null, retryCheckPeriod, retryCheckPeriod); } }
/** * Singleton constructor. */ private ConnectionManager() { getPasswordProvider(); requests = new Dictionary<string, Sendable>(); expiryHandlers = new Dictionary<string, IExpiredMessageHandler>(); handlers = new Dictionary<string, ISpineHandler>(); synchronousHandlers = new Dictionary<string, ISynchronousResponseHandler>(); itkTrunkHandler = new ITKTrunkHandler(); handlers.Add("urn:nhs:names:services:itk/COPC_IN000001GB01", itkTrunkHandler); handlers.Add("\"urn:nhs:names:services:itk/COPC_IN000001GB01\"", itkTrunkHandler); loadCertificate(); messageDirectory = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, MESSAGE_DIRECTORY_REGVAL, ""); if (messageDirectory.Length == 0) { EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No message directory provided - only in-memory persistence available", EventLogEntryType.Warning); } // Make sure messageDirectory is terminated with a path delimiter, because we're going // to need to add message ids to it when we call depersist() to delete persisted messages // on expiry or explicit transmission result. // if (!messageDirectory.EndsWith("\\")) messageDirectory = messageDirectory + "\\"; myIp = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, MY_IP_REGVAL, ""); if (myIp.Length == 0) { myIp = null; EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No local IP address provided - will use first non-localhost interface", EventLogEntryType.Warning); } expiredDirectory = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, EXPIRED_DIRECTORY_REGVAL, ""); if (expiredDirectory.Length == 0) { EventLog logger = new EventLog("Application"); logger.Source = LOGSOURCE; logger.WriteEntry("No expired message directory provided - administrative handling of unsent messages NOT available", EventLogEntryType.Warning); } sdsConnection = new SDSconnection(); try { retryCheckPeriod = Int64.Parse((string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, RETRY_TIMER_PERIOD_REGVAL, "")); } catch { } string nulldefault = (string)Registry.GetValue(CONNECTION_MANAGER_REGSITRY_KEY, USE_NULL_DEFAULT_SYNCHRONOUS_HANDLER_REGVAL, ""); if (nulldefault.ToLower().StartsWith("y")) defaultSynchronousResponseHandler = new NullSynchronousResponseHandler(); else defaultSynchronousResponseHandler = new DefaultFileSaveSynchronousResponseHandler(); defaultSpineHandler = new DefaultFileSaveSpineHandler(); persistDurations = loadReceivedPersistDurations(); if (retryCheckPeriod != 0) retryProcessorTimer = new Timer(processRetries, null, retryCheckPeriod, retryCheckPeriod); }