diff --git a/src/DataStreamSuite/PubSub/Config/PubSub3Config.cs b/src/DataStreamSuite/PubSub/Config/PubSub3Config.cs deleted file mode 100644 index 5c7f3075e..000000000 --- a/src/DataStreamSuite/PubSub/Config/PubSub3Config.cs +++ /dev/null @@ -1,382 +0,0 @@ -using bts; - -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -//using BCG.Utilities.BlueConfiguration; -//using BCG.Utilities; - -namespace BCG { - public class PubSub3Config //: ConfigurationRequest - { - bool IsGlobalConfigSet = false; - - private static PubSub3Config myInstance; - public static PubSub3Config instance => - myInstance ?? throw new InvalidOperationException( - "SetGlobalConfig must be called to initialize config static singleton"); - - public static void SetGlobalConfig(PubSub3Config cfg) { - // This should only be called once - Log.isnull(myInstance); - myInstance = cfg; - } - - private int myPS3_millisecondsBetweenSubInfoUpdates = 1000; - private int myPS3_millisecondsBetweenTimeSliceUpdates = 5000; - private int myPS3_retriesOnNoBufferSpace = 1; - private int myPS3_millisecondsBetweenNoBufferSpaceRetries = 100; - - private int myPS3_DoItAllSecondsBetweenLogs = 0; - private int myPS3_HeartBeatInterval = 15000; - private int myPS3_MissingHeartBeatsBeforeGC = 50; - private bool myPS3_UseManagedSockets = true; - private int myPS3_StateUpdatePeriod = 5000; - private int myPS3_StatisticsUpdatePeriod = 5000; - private int myPS3_DisposedConnectionCheckPeriod = 1000; - private int myPS3_MessageProcessingWarningThreshold = 1000; - private int myPS3_ServerPort = 12345; - private int myPS3_MaxPacketSize = 500000000; - private bool myBlueComm_mustDie = true; - - private string[] myPS3_CrushableTags = new string[] { }; - - //moved from PS2 - private TagTypeToAssembly myTagTypeToAssemblyMap = new TagTypeToAssembly(); - private string myPS3_ServerQueue; - - //substation stuff - //private PubSubComponentSettings myPS3_Components = null; - private PubSubPortRange myPS3_PortRange = new PubSubPortRange(30400, 31700); - private bool myPS3_BindToRandomPort = false; - - //for debugging stuff on a tag by tag basis - private string myPS3_DebugTags = "^NOTAGS$"; - private Regex myDebugTagsRegex; - - //for reporting the latency of a tag from publisher to reciever - private double myPS3_LatencyReportThresholdMS = 1500f; - - //used to determine what parts to build the pubsub and its clients out of - private bool myPS3_UseSubstations = false; - private bool myPS3_UseDynamicClients = false; - private bool myPS3_IsSubstation = false; - private bool myPS3_InternallyPublishSubInfo = true; - private bool myPS3_UseManagedClientsInNativeCode = false; - - //compression stuff - private string myPS3_CompressedTagsRegex = "^NOTAGS$"; - private string myPS3_TagsToReportCompressionRatio = "^NOTAGS$"; - private Regex myTagsToReportCompressionRatioRegex; - private Regex myCompressedTagsRegex; - - private bool myPS3_DisableMSMQ = false; - private bool myPS3_UsePrepublishedServerState = false; - private string myPS3_IPTranslation; - private long myGCActivationThreshold = 0; - private int myWaitPeriodAfterGC = 1000; - - // recovery - //private ConfigKeys.Recovery_PubSubImports myRecovery_PubSubImports = new ConfigKeys.Recovery_PubSubImports(); - //private ConfigKeys.Recovery_PubSubCopies myRecovery_PubSubCopies = new ConfigKeys.Recovery_PubSubCopies(); - - // bluecomm transition - //public ConfigKeys.BlueComm_PSTransition BlueComm_PSTransition { get; set; } - public PubSub3Config() { - //BlueComm_PSTransition = new BCG.ConfigKeys.BlueComm_PSTransition(true); - } - - public bool isValid() { - return true; - } - - public int PS3_retriesOnNoBufferSpace { - get { return myPS3_retriesOnNoBufferSpace; } - set { myPS3_retriesOnNoBufferSpace = value; } - } - - public int PS3_millisecondsBetweenNoBufferSpaceRetries { - get { return myPS3_millisecondsBetweenNoBufferSpaceRetries; } - set { myPS3_millisecondsBetweenNoBufferSpaceRetries = value; } - } - - public int PS3_millisecondsBetweenTimeSliceUpdates { - get { return myPS3_millisecondsBetweenTimeSliceUpdates; } - set { myPS3_millisecondsBetweenTimeSliceUpdates = value; } - } - - - public bool BlueComm_mustDie { - get { return myBlueComm_mustDie; } - set { myBlueComm_mustDie = value; } - } - - public int PS3_HeartBeatInterval { - get { return myPS3_HeartBeatInterval; } - set { myPS3_HeartBeatInterval = value; } - } - - public int PS3_DoItAllSecondsBetweenLogs { - get { return myPS3_DoItAllSecondsBetweenLogs; } - set { myPS3_DoItAllSecondsBetweenLogs = value; } - } - - public int PS3_MissingHeartBeatsForGC { - get { return myPS3_MissingHeartBeatsBeforeGC; } - set { myPS3_MissingHeartBeatsBeforeGC = value; } - } - - public bool PS3_UseManagedSockets { - get { return myPS3_UseManagedSockets; } - set { myPS3_UseManagedSockets = value; } - } - - public int PS3_StateUpdatePeriod { - get { return myPS3_StateUpdatePeriod; } - set { myPS3_StateUpdatePeriod = value; } - } - - public int PS3_StatisticsUpdatePeriod { - get { return myPS3_StatisticsUpdatePeriod; } - set { myPS3_StatisticsUpdatePeriod = value; } - } - - public int PS3_DisposedConnectionCheckPeriod { - get { return myPS3_DisposedConnectionCheckPeriod; } - set { myPS3_DisposedConnectionCheckPeriod = value; } - } - - public int PS3_MessageProcessingWarningThreshold { - get { return myPS3_MessageProcessingWarningThreshold; } - set { myPS3_MessageProcessingWarningThreshold = value; } - } - - public int PS3_millisecondsBetweenSubInfoUpdates { - get { return myPS3_millisecondsBetweenSubInfoUpdates; } - set { myPS3_millisecondsBetweenSubInfoUpdates = value; } - } - - public double PS3_LatencyReportThresholdMS { - get { return myPS3_LatencyReportThresholdMS; } - set { myPS3_LatencyReportThresholdMS = value; } - } - - public int PS3_ServerPort { - get { return myPS3_ServerPort; } - set { myPS3_ServerPort = value; } - } - - public PubSubRoute[] getSubRouting() { return getRouting(); } - - public PubSubRoute[] getPubRouting() { return getRouting(); } - - public PubSubRoute[] getRouting() { - // TODO - return new PubSubRoute[] { PubSubRoute.get_default_route() }; - // return getRouting(SitesCore.getMySiteName()); - } - - public PubSubRoute[] getRouting(string forSite) { - // TODO - return getRouting(); - - } - - public List getAllPubSubs() { - return new List(); - //return getAllPubSubs(SitesCore.getMySiteName()); - } - - public List getAllPubSubs(string forSite) { - List result = new List(); - foreach (PubSubRoute r in getRouting(forSite)) - result.AddRange(r.getAllPubSubs()); - return result; - } - - // private ConfigKeys.sites_layout _layout = new ConfigKeys.sites_layout(); - // public ConfigKeys.sites_layout sites_layout { get { return _layout; } } - - // public ConfigKeys.sites_siteName sites_siteName { get; set; } - - public TagTypeToAssembly PS3_TagTypeToAssemblyMap { - get { return myTagTypeToAssemblyMap; } - set { myTagTypeToAssemblyMap = value; } - } - - //[Description("PUBSUB: The Message queue to look for pub sub messages")] - public string PS3_ServerQueue { - get { - if (myPS3_ServerQueue == null || myPS3_ServerQueue == "") - return "PubSubQueue"; - else - return myPS3_ServerQueue; - } - set { myPS3_ServerQueue = value; } - } - - public bool PS3_InternallyPublishSubInfo { - get { return myPS3_InternallyPublishSubInfo; } - set { myPS3_InternallyPublishSubInfo = value; } - } - - public string[] PS3_CrushableTags { - get { return myPS3_CrushableTags; } - set { myPS3_CrushableTags = value; } - } - - //lots of logic in this key because it's designed to be transitional, - //to enable mixed use of substations and non-substations. - // public PubSubComponentSettings PS3_Components - // { - // get { - - - // if (myPS3_Components == null) - // { - - // if(myPS3_IsSubstation) - // myPS3_Components = new PubSubComponentSettings(PubSubComponentSettings.ComponentGroup.substationServer); - // else if (ClientInfo.thisClient.app.ToUpper().Contains("PUBSUB2MAIN") && myPS3_InternallyPublishSubInfo) - // myPS3_Components = new PubSubComponentSettings(PubSubComponentSettings.ComponentGroup.interallyPublishingPubSub); - - // else if(myPS3_UseDynamicClients) - // { - // if(myPS3_UseSubstations) - // myPS3_Components = new PubSubComponentSettings(PubSubComponentSettings.ComponentGroup.substationClient); - // else - // myPS3_Components = new PubSubComponentSettings(PubSubComponentSettings.ComponentGroup.dynamicRoutingTableClient); - // } - // else - // myPS3_Components = new PubSubComponentSettings(PubSubComponentSettings.ComponentGroup.staticRoutingTableClient); - - // } - - // return myPS3_Components; - // } - - // //this key cannot be set in config (it would be too messy and only read by the C# clients - // //therefore it's best to use this logic here. - - // } - - public bool PS3_UseSubstations { - get { return myPS3_UseSubstations; } - set { myPS3_UseSubstations = value; } - } - - public PubSubPortRange PS3_PortRange { - get { return myPS3_PortRange; } - set { myPS3_PortRange = value; } - } - - public bool PS3_BindToRandomPort { - get { return myPS3_BindToRandomPort; } - set { myPS3_BindToRandomPort = value; } - - } - - public bool PS3_IsSubstation { - get { return myPS3_IsSubstation; } - set { myPS3_IsSubstation = value; } - - } - - public bool PS3_UseDynamicClients { - get { return myPS3_UseDynamicClients; } - set { myPS3_UseDynamicClients = value; } - } - - public bool PS3_UseManagedClientsInNativeCode { - get { return myPS3_UseManagedClientsInNativeCode; } - set { myPS3_UseManagedClientsInNativeCode = value; } - } - - public string PS3_CompressedTagsRegex { - get { return myPS3_CompressedTagsRegex; } - - set { myPS3_CompressedTagsRegex = value; } - } - - public string PS3_DebugTags { - get { return myPS3_DebugTags; } - set { - myPS3_DebugTags = value; - myDebugTagsRegex = null; - } - } - - public string PS3_TagsToReportCompressionRatio { - get { return myPS3_TagsToReportCompressionRatio; } - set { myPS3_TagsToReportCompressionRatio = value; } - } - - public bool PS3_DisableMSMQ { - get { return myPS3_DisableMSMQ; } - set { myPS3_DisableMSMQ = true; } - } - - public string PS3_IPTranslation { - get { return myPS3_IPTranslation; } - set { myPS3_IPTranslation = value; } - } - - public long PS3_GCActivationThreshold { - get { return myGCActivationThreshold; } - set { myGCActivationThreshold = value; } - } - - public int PS3_WaitPeriodAfterGC { - get { return myWaitPeriodAfterGC; } - set { myWaitPeriodAfterGC = value; } - } - - public bool PS3_UsePrepublishedServerState { - get { return myPS3_UsePrepublishedServerState; } - set { myPS3_UsePrepublishedServerState = value; } - } - - public int PS3_MaxPacketSize { - get { return myPS3_MaxPacketSize; } - set { myPS3_MaxPacketSize = value; } - } - - // public ConfigKeys.Recovery_PubSubImports Recovery_PubSubImports - // { - // get { return (myRecovery_PubSubImports); } - // set { myRecovery_PubSubImports = value; } - // } - - // public ConfigKeys.Recovery_PubSubCopies Recovery_PubSubCopies - // { - // get { return (myRecovery_PubSubCopies); } - // set { myRecovery_PubSubCopies = value; } - // } - - public bool isTagDebugTag(string tag) { - if (myDebugTagsRegex == null) { - myDebugTagsRegex = new Regex(myPS3_DebugTags, RegexOptions.IgnoreCase); - } - return myDebugTagsRegex.IsMatch(tag); - - } - - public bool isTagCompressed(string tag) { - - if (myCompressedTagsRegex == null) { - myCompressedTagsRegex = new Regex(myPS3_CompressedTagsRegex, RegexOptions.IgnoreCase); - - } - - return (myCompressedTagsRegex.IsMatch(tag)); - } - - public bool shouldReportTagsCompressionRatio(string tag) { - if (myTagsToReportCompressionRatioRegex == null) { - myTagsToReportCompressionRatioRegex = new Regex(myPS3_TagsToReportCompressionRatio, RegexOptions.IgnoreCase); - } - return (myTagsToReportCompressionRatioRegex.IsMatch(tag)); - } - } -}