internal void DisposeClientPublications(DPE_Client client) { try { CustomList pubList = this.GetListOfClientPostedPublications(client); IEnumerator enumm = pubList.GetEnumerator(); string pubName = ""; DPE_Publication publication = default(DPE_Publication); while (enumm.MoveNext()) { pubName = System.Convert.ToString(enumm.Current); publication = this.GetPublication(pubName); try { publication.ShutDownPublication(); publication.Dispose(); } catch (Exception) { } } } catch (Exception) { } }
//the table contains the relacion of which publications has been made by which client private void AddSTXDSSClientPublicationReference(DPE_Publication publication) { string publisherClientID = ""; publisherClientID = publication.publisherSTXDSSClient.ClientID; if (!this._referenceTableOFPublicationsCreatedBySTXDSSClients.Contains(publisherClientID)) { Hashtable publicationsOFCLientTable = new Hashtable(); publicationsOFCLientTable.Add(publication.PublicationName, publication); this._referenceTableOFPublicationsCreatedBySTXDSSClients.Add(publisherClientID, publicationsOFCLientTable); //registers the client as publisher this.LogClientAsPublisher(publication.publisherSTXDSSClient); this.IncreasePublisherClientPublicationsCount(publication.publisherSTXDSSClient); } else { Hashtable publicationsOFCLientTable = default(Hashtable); publicationsOFCLientTable = (Hashtable)(this._referenceTableOFPublicationsCreatedBySTXDSSClients[publisherClientID]); this.IncreasePublisherClientPublicationsCount(publication.publisherSTXDSSClient); if (!publicationsOFCLientTable.Contains(publication.PublicationName)) { publicationsOFCLientTable.Add(publication.PublicationName, publication); } } }
private bool disposedValue = false; // To detect redundant calls // IDisposable protected virtual void Dispose(bool disposing) { if (!this.disposedValue) { if (disposing) { // TODO: free other state (managed objects). //destroys all the available publications publications IEnumerator pubEnumm = default(IEnumerator); pubEnumm = this._publicationsHashTable.GetEnumerator(); DPE_Publication publication = default(DPE_Publication); while (pubEnumm.MoveNext()) { publication = (DPE_Publication)(((DictionaryEntry)pubEnumm.Current).Value); try { publication.Dispose(); } catch (Exception) { } } } // // TODO: free your own state (unmanaged objects). // TODO: set large fields to null. } this.disposedValue = true; }
private void VariableRemovedFromPublication_EventHandlerFcn(DPE_Publication publication, string variableName) { try { this.SetPublishedVariablesCountOfPublication(publication); } catch (Exception) { } }
private void VariableAddedToPublication_EventHandlerFcn(DPE_Publication publication, string variableName, DPE_ServerDefs.PublicationVariableDataType variableType) { try { this.SetPublishedVariablesCountOfPublication(publication); } catch (Exception) { } }
private void SubscriptionDeattachment_EventHandlerFcn(DPE_Publication publication, DPE_Client client) { try { this.SetPublicationAttachmentsCounterOnDataTableRegistry(publication); this.RemoveClientConnectionToAPublicationRegister(client, publication); } catch (Exception) { } }
private void SetPublishedVariablesCountOfPublication(DPE_Publication publication) { if (this._publicationsHashTable.ContainsKey(publication.PublicationName)) { string selectionCriteria = ""; DataRow[] resultRows = null; selectionCriteria = "[Publication Name] = \'" + publication.PublicationName + "\'"; resultRows = this._publicationsDataTable.Select(selectionCriteria); if (resultRows.Length > 0) { DataRow publisherRow = resultRows[0]; publisherRow["Variables Published Count"] = publication.PublishedVariablesCount; this._publicationsDataTable.AcceptChanges(); } } }
private void SetPublicationAttachmentsCounterOnDataTableRegistry(DPE_Publication publication) { if (this._publicationsHashTable.ContainsKey(publication.PublicationName)) { string selectionCriteria = ""; DataRow[] resultRows = null; selectionCriteria = "[Publication Name] = \'" + publication.PublicationName + "\'"; resultRows = this._publicationsDataTable.Select(selectionCriteria); if (resultRows.Length > 0) { DataRow publisherRow = resultRows[0]; publisherRow["Subscriptors Count"] = publication.SubcriptorsAttachedCount; this._publicationsDataTable.AcceptChanges(); } } }
private void PublicationGroupChanged_EventHandlerFcn(DPE_Publication publication, string newGroup) { try { string selectionCriteria = "[Publication Name]=\'" + publication.PublicationName + "\'"; DataRow[] ResultRows = this._publicationsDataTable.Select(selectionCriteria); if (ResultRows.Length > 0) { DataRow row = ResultRows[0]; row["Publications Group"] = newGroup; row.AcceptChanges(); } } catch (Exception) { } }
private void RemovePublicationFromDataTableRegistry(DPE_Publication publication) { try { string selectionCriteria = ""; DataRow[] resultRows = null; selectionCriteria = "[Publication Name] = \'" + publication.PublicationName + "\'"; resultRows = this._publicationsDataTable.Select(selectionCriteria); if (resultRows.Length > 0) { DataRow publicationRow = resultRows[0]; this._publicationsDataTable.Rows.Remove(publicationRow); this._publicationsDataTable.AcceptChanges(); } } catch (Exception) { } }
private void PublicationShutDown_EventHandlerFcn(DPE_Publication publication) { try { this.RemovePublication(publication); try { if (PublicationShutDownEvent != null) { PublicationShutDownEvent(); } } catch (Exception) { } } catch (Exception) { } }
private void AddPublicationToDataTableRegistry(DPE_Publication publication) { try { DataRow pubrow = default(DataRow); pubrow = this._publicationsDataTable.NewRow(); pubrow["Publications Group"] = publication.PublicationsGroup; pubrow["Publication Name"] = publication.PublicationName; pubrow["Publication Creation DateTime"] = publication.CreationDateTime; pubrow["Publication Owner Name"] = publication.publisherSTXDSSClient.Name; pubrow["Publication Owner Hostname"] = publication.publisherSTXDSSClient.HostName; pubrow["Application Domain"] = publication.publisherSTXDSSClient.ApplicationDomainName; pubrow["Variables Published Count"] = System.Convert.ToString(publication.PublishedVariablesCount); pubrow["Publication Sockets Server Port"] = publication.PublicationSocketsServerPort; pubrow["Subscriptors Count"] = publication.SubcriptorsAttachedCount; this._publicationsDataTable.Rows.Add(pubrow); } catch (Exception) { } }
internal void RemovePublication(DPE_Publication publication) { if (this._publicationsHashTable.ContainsKey(publication.PublicationName)) { //removes the publication in the publications table and datatable this._publicationsHashTable.Remove(publication.PublicationName); this.RemovePublicationFromDataTableRegistry(publication); //updates the reference of the publications posted by a client this.RemoveSTXDSSClientPublicationReference(publication); publication.NewSubscriptionAttachement -= NewSubscriptionAttachement_EventHandlerFcn; publication.SubscriptionDeattachment -= SubscriptionDeattachment_EventHandlerFcn; publication.PublicationShutDown -= PublicationShutDown_EventHandlerFcn; publication.VariableAdded -= VariableAddedToPublication_EventHandlerFcn; publication.VariableRemoved -= VariableRemovedFromPublication_EventHandlerFcn; } else { throw (new Exception("The publication name \'" + publication.PublicationName + "\' not exists.")); } }
internal void AddPublication(DPE_Publication publication) { if (!this._publicationsHashTable.Contains(publication.PublicationName)) { //registers the publication in the publications table and datatable this._publicationsHashTable.Add(publication.PublicationName, publication); this.AddPublicationToDataTableRegistry(publication); //updates the reference of the publications posted by a client this.AddSTXDSSClientPublicationReference(publication); publication.NewSubscriptionAttachement += NewSubscriptionAttachement_EventHandlerFcn; publication.SubscriptionDeattachment += SubscriptionDeattachment_EventHandlerFcn; publication.PublicationShutDown += PublicationShutDown_EventHandlerFcn; publication.VariableAdded += VariableAddedToPublication_EventHandlerFcn; publication.VariableRemoved += VariableRemovedFromPublication_EventHandlerFcn; publication.PublicationGroupChanged += PublicationGroupChanged_EventHandlerFcn; } else { throw (new Exception("The publication named \'" + publication.PublicationName + "\' already exists.")); } }
internal DPE_PublicationClientConnectionsManager(DPE_Publication publicationOwner) { this._publicationOwner = publicationOwner; this._PendingSocketClientMatchWithSTXDSSClientTable = new Hashtable(); this._socketConnectionHandlerToClientREferenceTable = new Hashtable(); this._STXDSSClientTosocketConnectionHandlerReferenceTable = new Hashtable(); this._STXDSSClienstSubscribedRegistryTable = new DataTable(); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Client Name"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Client ID"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Client AppDomain"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Client HostName"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Connection Date Time"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Client Network ID"); this._STXDSSClienstSubscribedRegistryTable.Columns.Add("Connection Mode"); this._posponedMatchQueue = new Queue(); this._posponedMatchTimer = new System.Timers.Timer(100); this._posponedMatchTimer.Elapsed += this._posponedMatchTimer_Elapsed; this._posponedMatchTimer.AutoReset = false; this._posponedMatchTimer.Stop(); }
private void RemoveSTXDSSClientPublicationReference(DPE_Publication publication) { string publisherClientID = ""; publisherClientID = publication.publisherSTXDSSClient.ClientID; if (this._referenceTableOFPublicationsCreatedBySTXDSSClients.ContainsKey(publisherClientID)) { Hashtable publicationsOFCLientTable = default(Hashtable); publicationsOFCLientTable = (Hashtable)(this._referenceTableOFPublicationsCreatedBySTXDSSClients[publisherClientID]); if (publicationsOFCLientTable.Contains(publication.PublicationName)) { publicationsOFCLientTable.Remove(publication.PublicationName); this.DecreasePublisherClientPublicationsCount(publication.publisherSTXDSSClient); } //If the client doesn't have any remaining publications then removes from the table //that keeps the tracking of the publications posted by a client if (publicationsOFCLientTable.Count <= 0) { this._referenceTableOFPublicationsCreatedBySTXDSSClients.Remove(publisherClientID); this.UnlogClientAsPublisher(publication.publisherSTXDSSClient); } } }
internal void SetPublicationHolder(DPE_Publication Publication) { this._publicationName = Publication.PublicationName; }
internal dynamic ContainsPublication(DPE_Publication Publication) { return(this.ContainsPublication(Publication.PublicationName)); }
private void AddClientConnectionToaPublicationRegister(DPE_Client client, DPE_Publication publication) { if (!this._referenceTableOFConnectionsToPublicationsOfASTXDSSClient.ContainsKey(client.ClientID)) { CustomHashTable list = new CustomHashTable(); list.Add(publication.PublicationName, publication.PublicationName); this._referenceTableOFConnectionsToPublicationsOfASTXDSSClient.Add(client.ClientID, list); } else { CustomHashTable list = default(CustomHashTable); list = (CustomHashTable)this._referenceTableOFConnectionsToPublicationsOfASTXDSSClient[client.ClientID]; if (!list.ContainsKey(publication.PublicationName)) { list.Add(publication.PublicationName, publication.PublicationName); } } }
private void RemoveClientConnectionToAPublicationRegister(DPE_Client client, DPE_Publication publication) { if (this._referenceTableOFConnectionsToPublicationsOfASTXDSSClient.ContainsKey(client.ClientID)) { CustomHashTable list = default(CustomHashTable); list = (CustomHashTable)this._referenceTableOFConnectionsToPublicationsOfASTXDSSClient[client.ClientID]; if (list.ContainsKey(publication.PublicationName)) { list.Remove(publication.PublicationName); } } }