/// <summary> /// TODO: I don't like how this is public. /// </summary> public void ProcessDelayedActions() { if (InProcessNode != null) { TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain(); InProcessNode.DelayedActions.CreateTransactions(ref chain); foreach (IMetadataSet metadataSet in Metadata) { FacadeMetadataSet facadeMetadataSet = metadataSet as FacadeMetadataSet; if (facadeMetadataSet != null) { SoapMetadataSet soapMetadataSet = facadeMetadataSet.BaseMetadata as SoapMetadataSet; if (soapMetadataSet != null) { soapMetadataSet.ProcessDelayedActions(ref chain); } } } MapManager.ExecuteTransaction(chain); } }
public void ProcessDelayedActions(ref TransactionFramework.TransactionChain chain) { if (InProcessMetadata != null) { InProcessMetadata.DelayedActions.CreateTransactions(ref chain); } }
public void ExecuteTransaction(TransactionFramework.TransactionChain transactionChain) { /// TODO: Need to figure why this is happening for the re-alignment code. /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions. if (transactionChain.NumOfTransactions <= 0) { return; } TransactionFramework.ISoapTransactionLinkExecutor executor = transactionChain; if (executor == null) { throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } lock (_executionThreadsLock) { ExecutionThreads.AddTransactionChain(transactionChain); if (_isInProcess) { executor = null; } else { ExecutionThreads.MoveToNextChain(); _isInProcess = true; } } if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = ExecutionThreads.Count + 1; status.Status = ActivityStatusEnum.Busy; MapManagerActivityStatusUpdated.Invoke(this, status); } if (executor != null) { /// TODO: Remove the following TransactionFramework.TransactionChain chain = executor as TransactionFramework.TransactionChain; if (chain != null) { System.Diagnostics.Debug.WriteLine(chain.ChainId); } /// executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; executor.ExecuteTransaction(Guid.Empty, ServiceProxy); } }
/// <summary> /// TODO: I don't like how this is public. /// </summary> public void ProcessDelayedActions() { if (InProcessRelationship != null) { TransactionFramework.TransactionChain chain = new TransactionFramework.TransactionChain(); InProcessRelationship.DelayedActions.CreateTransactions(ref chain); MapManager.ExecuteTransaction(chain); } }
public override void Delete(ref TransactionFramework.TransactionChain chain) { MapManager.RelationshipFactory.DeleteRelationship(this); TransactionFramework.DeleteRelationshipTransactionLink deleteRelationship = new TransactionFramework.DeleteRelationshipTransactionLink(); deleteRelationship.DomainId = DomainId; deleteRelationship.MapManager = MapManager; deleteRelationship.Relationship = this; chain.AddTransaction(deleteRelationship); }
public override void Delete(ref TransactionFramework.TransactionChain chain) { MapManager.NodeFactory.DeleteNode(this); TransactionFramework.DeleteNodeTransactionLink deleteNode = new TransactionFramework.DeleteNodeTransactionLink(); deleteNode.DomainId = DomainId; deleteNode.MapManager = MapManager; deleteNode.Node = this; chain.AddTransaction(deleteNode); }
public override void Update(NodeType nodeType, ref TransactionFramework.TransactionChain chain) { NodeType = nodeType; if (LastUpdateNode != null && LastUpdateNode.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient) { LastUpdateNode.NodeType = nodeType; } else { LastUpdateNode = CreateNewUpdateNode(nodeType); chain.AddTransaction(LastUpdateNode); } chain.TransactionExecuting += OnTransactionExecuting; }
public void ExecuteTransactions(Queue <TransactionFramework.TransactionChain> chains) { TransactionFramework.TransactionChain firstChain = null; lock (_executionThreadsLock) { while (chains.Count > 0) { TransactionFramework.TransactionChain chain = chains.Dequeue(); /// TODO: Need to figure why this is happening for the re-alignment code. /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions. if (chain.NumOfTransactions <= 0) { continue; } if (firstChain == null) { firstChain = chain; ExecutionThreads.AddTransactionChain(firstChain); if (_isInProcess) { firstChain = null; } else { ExecutionThreads.MoveToNextChain(); _isInProcess = true; } } else { ExecutionThreads.AddTransactionChain(chain); } } } if (firstChain != null) { firstChain.TransactionFailed += OnTransactionFailed; firstChain.TransactionCompleted += OnTransactionCompleted; firstChain.ExecuteTransaction(Guid.Empty, ServiceProxy); } }
public override void ConnectNode(ConnectionType connectionType, INode node, ref TransactionFramework.TransactionChain chain) { base.ConnectNode(connectionType, node, ref chain); if (LastUpdateRelationship != null && LastUpdateRelationship.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient) { LastUpdateRelationship.AddNode(connectionType, node); } else { LastUpdateRelationship = CreateNewUpdateRelationship(); LastUpdateRelationship.AddNode(connectionType, node); chain.AddTransaction(LastUpdateRelationship); } chain.TransactionExecuting += OnTransactionExecuting; }
public override void Update(RelationshipType relationshipType, ref TransactionFramework.TransactionChain chain) { RelationshipType = relationshipType; if (LastUpdateRelationship != null && LastUpdateRelationship.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient) { LastUpdateRelationship.RelationshipType = relationshipType; } else { LastUpdateRelationship = CreateNewUpdateRelationship(); LastUpdateRelationship.RelationshipType = relationshipType; chain.AddTransaction(LastUpdateRelationship); } chain.TransactionExecuting += OnTransactionExecuting; }
private void OnTransactionChainFacadesCompleted(object sender, System.EventArgs e) { TransactionFramework.DependencyCollection dependencies = sender as TransactionFramework.DependencyCollection; if (dependencies == null) { return; } TransactionFramework.TransactionChain chain = dependencies.State as TransactionFramework.TransactionChain; if (chain == null) { return; } IncompleteExecutionThreads.Remove(chain); ExecuteTransaction(chain); }
public void ForceTransactionReExecution() { TransactionFramework.ISoapTransactionLinkExecutor executor = null; if (_executionThreadsLock == null || ExecutionThreads == null || ExecutionThreads.CurrentChain == null || ExecutionThreads.CurrentChain.End == null) { return; } TransactionFramework.TransactionChain transactionChain = ExecutionThreads.CurrentChain; transactionChain.Reset(); /// If the last transaction is in one of the post execution states and the user has requested to force the commit, /// then it means we should attempt to do the current transaction again as something appears to have happened to /// cause the previous attempt to hang. if (transactionChain.End.TransactionStatus == TransactionFramework.ServerStatus.TransactionCompleted || transactionChain.End.TransactionStatus == TransactionFramework.ServerStatus.TransactionReceived || transactionChain.End.TransactionStatus == TransactionFramework.ServerStatus.TransactionFailed) { executor = ExecutionThreads.CurrentChain; /// Debug lines /// TODO: Remove the following if (transactionChain != null) { System.Diagnostics.Debug.WriteLine(transactionChain.ChainId); } /// if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = ExecutionThreads.Count + 1; status.Status = ActivityStatusEnum.Busy; MapManagerActivityStatusUpdated.Invoke(this, status); } executor.ExecuteTransaction(Guid.Empty, ServiceProxy); } }
public virtual void ConnectNode(ConnectionType connectionType, INode node, ref Soap.TransactionFramework.TransactionChain chain) { InProcess.InProcessRelationship inProcessRelationship = this as InProcess.InProcessRelationship; ConnectionSet connectionSet; if (inProcessRelationship != null) { connectionSet = ConnectionSetFactory.Instance.GetConnection(node, inProcessRelationship.Facade, connectionType); } else { connectionSet = ConnectionSetFactory.Instance.GetConnection(node, this, connectionType); } INodeManager nodes = Nodes; nodes.Load(connectionSet); IRelationshipManager relationships = node.Relationships; relationships.Load(connectionSet); }
public override void Delete(ref TransactionFramework.TransactionChain chain) { base.Delete(ref chain); TransactionFramework.DeleteMetadataTransactionLink deleteMetadataTransction = new TransactionFramework.DeleteMetadataTransactionLink(); if (Node != null) { deleteMetadataTransction.DomainId = Node.DomainId; } else if (Relationship != null) { deleteMetadataTransction.DomainId = Relationship.DomainId; } deleteMetadataTransction.MapManager = MapManager; deleteMetadataTransction.Metadata = this; chain.AddTransaction(deleteMetadataTransction); /// TODO: Need to consider whether the following should be done here. It was originally done in the base but this really shouldn't happen for an InProcessMetadata as when add transaction /// returns (for the InProcessMetadata transaction link) the delete transaction still needs to occur. MetadataSetFactory.GetInstance(MapManager).Remove(this); }
public override void Update(string name, string value, INode node, IRelationship relationship, ConnectionType connectionType, ref TransactionFramework.TransactionChain chain) { base.Update(name, value, node, relationship, connectionType, ref chain); TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = new TransactionFramework.UpdateMetadataTransactionLink(); if (Node != null) { updateMetadataTransaction.DomainId = Node.DomainId; } else if (Relationship != null) { updateMetadataTransaction.DomainId = Relationship.DomainId; } updateMetadataTransaction.MapManager = MapManager; updateMetadataTransaction.Metadata = this; updateMetadataTransaction.Name = name; updateMetadataTransaction.Value = value; chain.AddTransaction(updateMetadataTransaction); }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { TransactionFramework.ISoapTransactionLinkExecutor executor = null; lock (_executionThreadsLock) { if (e.Error != null) { /// An error occurred so let's retry the transaction. executor = ExecutionThreads.CurrentChain; } while (executor == null && ExecutionThreads.Count > 0) { _isInProcess = true; executor = ExecutionThreads.MoveToNextChain(); executor.UpdateDependencies(); if (executor.Dependencies.IsCompleted) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; } else { IncompleteExecutionThreads.Add(executor); executor.Dependencies.FacadesCompleted += OnTransactionChainFacadesCompleted; executor = null; } } } if (executor != null) { /// TODO: Remove the following TransactionFramework.TransactionChain chain = executor as TransactionFramework.TransactionChain; if (chain != null) { System.Diagnostics.Debug.WriteLine(chain.ChainId); } /// if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = ExecutionThreads.Count + 1; status.Status = ActivityStatusEnum.Busy; MapManagerActivityStatusUpdated.Invoke(this, status); } executor.ExecuteTransaction(Guid.Empty, ServiceProxy); } else { _isInProcess = false; if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = 0; status.Status = ActivityStatusEnum.Idle; MapManagerActivityStatusUpdated.Invoke(this, status); } } }
public abstract void Delete(ref Soap.TransactionFramework.TransactionChain chain);
public INode CreateNode(Guid domainId, Guid rootMapId, NodeType nodeType, string originalId, ref TransactionFramework.TransactionChain chain) { TransactionFramework.AddNodeTransactionLink createNodeTransaction = new TransactionFramework.AddNodeTransactionLink(); createNodeTransaction.MapManager = this; createNodeTransaction.DomainId = domainId; createNodeTransaction.RootMapId = rootMapId; createNodeTransaction.NodeType = nodeType; createNodeTransaction.OriginalId = originalId; chain.AddTransaction(createNodeTransaction); INode node = createNodeTransaction.CreateInProcessObjects(); return(node); }
public abstract void Update(NodeType nodeType, ref Soap.TransactionFramework.TransactionChain chain);
public void ConnectNode(ConnectionType connectionType, INode node, ref TransactionFramework.TransactionChain chain) { BaseRelationship.ConnectNode(connectionType, node, ref chain); }
public IRelationship CreateRelationship(Guid domainId, Guid rootMapId, RelationshipType relationshipType, string originalId, ref TransactionFramework.TransactionChain chain) { TransactionFramework.AddRelationshipTransactionLink createRelationshipTransaction = new TransactionFramework.AddRelationshipTransactionLink(); createRelationshipTransaction.MapManager = this; createRelationshipTransaction.DomainId = domainId; createRelationshipTransaction.RootMapId = rootMapId; createRelationshipTransaction.RelationshipType = relationshipType; createRelationshipTransaction.OriginalId = originalId; chain.AddTransaction(createRelationshipTransaction); IRelationship relationship = createRelationshipTransaction.CreateInProcessObjects(); return(relationship); }
public void Update(RelationshipType relationshipType, ref TransactionFramework.TransactionChain chain) { BaseRelationship.Update(relationshipType, ref chain); }
public void Delete(ref TransactionFramework.TransactionChain chain) { BaseNode.Delete(ref chain); }
public void Update(NodeType nodeType, ref TransactionFramework.TransactionChain chain) { BaseNode.Update(nodeType, ref chain); }
public abstract void Update(RelationshipType relationshipType, ref Soap.TransactionFramework.TransactionChain chain);
public void Delete(ref TransactionFramework.TransactionChain chain) { BaseRelationship.Delete(ref chain); }