コード例 #1
0
        private void Init(SPWeb spWeb)
        {
            IMapManager mapManager = null;
            if (spWeb != null && spWeb.Site != null)
            {
                var binding = new BasicHttpBinding();
                binding.ReaderQuotas.MaxStringContentLength = 2147483647;
                binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
                binding.MaxReceivedMessageSize = 2147483647;

                //Note in the future it may be necessary to handle in a configuration file what zone to use if the Default zone doesn't support Windows NTLM authentication.
                Uri siteUri = new Uri(spWeb.Site.Url + "/");
                Uri combinedUri = new Uri(siteUri, "_vti_bin/sevensigma/transactionalmappingtoolservice.svc");
                var address = new EndpointAddress(combinedUri);

                CallingUrl.Url = spWeb.Url;

                var client = new TransactionalMappingToolServiceClient(binding, address);
                NetworkCredential credentials = CredentialCache.DefaultNetworkCredentials;
                client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
                client.ClientCredentials.Windows.ClientCredential = credentials;

                mapManager = new SoapMapManager(client, true);
                mapManager.InitialiseMapManagerCompleted += mapManager_InitialiseMapManagerCompleted;
                mapManager.InitialiseMapManagerAsync();
                Completed.WaitOne(_mapManagerTimeout);
            }
        }
コード例 #2
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        public SoapMapManager(TransactionalMappingToolServiceClient serviceProxy, bool forceWindowsLogin)
        {
            ServiceProxy = serviceProxy;
            ServiceProxy.QueryMapCompleted += OnQueryMapCompleted;
            ServiceProxy.QueryMapPagedCompleted += OnQueryMapPagedCompleted;
            ServiceProxy.CreateDomainCompleted += OnCreateDomainCompleted;
            ServiceProxy.CreateRootMapCompleted += OnCreateRootMapCompleted;
            ServiceProxy.DeleteDomainCompleted += OnDeleteDomainCompleted;
            ServiceProxy.DeleteRootMapCompleted += OnDeleteRootMapCompleted;
            IsMapTypesLoaded = false;

            if (forceWindowsLogin)
            {
                ForceWindowsAuthHeaderBehaviour forceWindowsAuthBehaviour = new ForceWindowsAuthHeaderBehaviour();
                ServiceProxy.Endpoint.Behaviors.Add(forceWindowsAuthBehaviour);
            }
        }
コード例 #3
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BRD relationshipBulkOperation = new Service.BRD();
            relationshipBulkOperation.I = TransactionLinkId;
            relationshipBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            relationshipBulkOperation.R = RelationshipParameter.GetParameterValue(SessionId);
            relationshipBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(relationshipBulkOperation);

            ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor;

            if (executor == null)
            {
                DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            if (bulkOperations.O.Count < 200)
            {
                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                DebugLogger.Instance.LogMsg("Executing delete relationship transaction. ClientId - '{0}';", Relationship.ClientId);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += new EventHandler<BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted);
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
コード例 #4
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ServiceProxy.RDCompleted += OnDeleteRelationshipCompleted;
            ServiceProxy.RDAsync(CallingUrl.Url, SessionId, DomainParameter.GetParameterValue(SessionId), RelationshipParameter.GetParameterValue(SessionId), this);
        }
コード例 #5
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Node.NodeType = NodeType;

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BNU nodeBulkOperation = new Service.BNU();
            nodeBulkOperation.I = TransactionLinkId;
            nodeBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            nodeBulkOperation.N = NodeParameter.GetParameterValue(SessionId);
            nodeBulkOperation.T = MapManager.NodeTypes.ConvertProxyToService(NodeType);
            nodeBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(nodeBulkOperation);

            ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor;

            if (executor == null)
            {
                DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            if (bulkOperations.O.Count < 200)
            {
                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                DebugLogger.Instance.LogMsg("Executing update node transaction. NodeId - '{0}'; NodeTypeName - '{1}'", Node.Id, NodeType.Name);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += OnSubmitBulkOperationCompleted;
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
コード例 #6
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Node.NodeType = NodeType;

            ServiceProxy.NUCompleted += OnUpdateNodeCompleted;
            ServiceProxy.NUAsync(CallingUrl.Url, sessionId, DomainParameter.GetParameterValue(SessionId), NodeParameter.GetParameterValue(SessionId), MapManager.NodeTypes.ConvertProxyToService(NodeType), this);
        }
コード例 #7
0
        private void InitMapManager()
        {
            ProgressRecord progressRecord = new ProgressRecord(0, "Exporting Glyma Map", "Initialising web service client");
            progressRecord.SecondsRemaining = -1;
            progressRecord.PercentComplete = 0;
            progressRecord.RecordType = ProgressRecordType.Processing;

            lock (pr_lock)
            {
                this.ProgressRecord = progressRecord;
                ProgressEvent.Set(); //notify of change to progress
            }

            var binding = new BasicHttpBinding();
            binding.ReaderQuotas.MaxStringContentLength = 2147483647;
            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
            binding.MaxReceivedMessageSize = 2147483647;

            var address = new EndpointAddress(new Uri(ServiceUrl));
            CallingUrl.Url = Identity;

            var client = new TransactionalMappingToolServiceClient(binding, address);
            System.Net.NetworkCredential credential = new System.Net.NetworkCredential(SharePointUsername, SharePointPassword);
            client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            client.ClientCredentials.Windows.ClientCredential = credential;

            MapManager = new SoapMapManager(client, true);

            MapManager.InitialiseMapManagerCompleted += OnInitialiseMapManagerCompleted;
            MapManager.InitialiseMapManagerAsync();
        }
コード例 #8
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            IsBulkExecution = true;

            ISoapTransactionLinkExecutor executor = this;
            executor.ExecuteTransaction(sessionId, serviceProxy);
        }
コード例 #9
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            TransactionStatus = ServerStatus.SendingTransaction;
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            Dictionary<Service.DT, Service.MP> nodeConnections = new Dictionary<Service.DT, Service.MP>();

            foreach (KeyValuePair<Service.DT, SoapTransactionLinkParameter> keyValuePair in TransactionLinkConnections)
            {
                Service.DT descriptorType = keyValuePair.Key;
                Service.MP parameter = keyValuePair.Value.GetParameterValue(sessionId);

                nodeConnections[descriptorType] = parameter;
            }

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Relationship.RelationshipType = RelationshipType;

            foreach (KeyValuePair<ConnectionType, INode> connectionPairs in ProxyNodeConnections)
            {
                Relationship.Nodes.UpdateConnection(connectionPairs.Key, connectionPairs.Value);
            }

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BRU relationshipBulkOperation = new Service.BRU();
            relationshipBulkOperation.I = TransactionLinkId;
            relationshipBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            relationshipBulkOperation.R = RelationshipParameter.GetParameterValue(SessionId);
            relationshipBulkOperation.N = nodeConnections;
            relationshipBulkOperation.T = MapManager.RelationshipTypes.ConvertProxyToService(RelationshipType);
            relationshipBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(relationshipBulkOperation);

            ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor;

            if (executor == null)
            {
                DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            if (bulkOperations.O.Count < 200)
            {
                TransactionStatus = ServerStatus.TransactionReceived;

                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                TransactionStatus = ServerStatus.TransactionExecuting;

                DebugLogger.Instance.LogMsg("Executing update relationship transaction. ClientId - '{0}';", Relationship.ClientId);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += new EventHandler<BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted);
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
コード例 #10
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            TransactionStatus = ServerStatus.SendingTransaction;
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            Dictionary<Service.DT, Service.MP> nodeConnections = new Dictionary<Service.DT, Service.MP>();

            foreach (KeyValuePair<Service.DT, SoapTransactionLinkParameter> keyValuePair in TransactionLinkConnections)
            {
                Service.DT descriptorType = keyValuePair.Key;
                Service.MP parameter = keyValuePair.Value.GetParameterValue(sessionId);

                nodeConnections[descriptorType] = parameter;
            }

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Relationship.RelationshipType = RelationshipType;

            foreach (KeyValuePair<ConnectionType, INode> connectionPairs in ProxyNodeConnections)
            {
                Relationship.Nodes.UpdateConnection(connectionPairs.Key, connectionPairs.Value);
            }

            ServiceProxy.RUCompleted += OnUpdateRelationshipCompleted;
            ServiceProxy.RUAsync(CallingUrl.Url, sessionId, DomainParameter.GetParameterValue(SessionId), RelationshipParameter.GetParameterValue(SessionId), nodeConnections, MapManager.RelationshipTypes.ConvertProxyToService(RelationshipType), this);
        }
コード例 #11
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BMA metadataBulkOperation = new Service.BMA();
            metadataBulkOperation.I = TransactionLinkId;
            metadataBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            metadataBulkOperation.RM = RootMapParameter.GetParameterValue(sessionId);
            metadataBulkOperation.N = NodeParameter.GetParameterValue(sessionId);
            metadataBulkOperation.R = RelationshipParameter.GetParameterValue(sessionId);
            metadataBulkOperation.DT = MapManager.ConnectionTypes.ConvertProxyToService(ConnectionType);
            metadataBulkOperation.T = MapManager.MetadataTypes.ConvertProxyToService(MetadataType);
            metadataBulkOperation.MN = Name;
            metadataBulkOperation.MV = Value;
            metadataBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(metadataBulkOperation);

            ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor;

            if (executor == null)
            {
                DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            if (bulkOperations.O.Count < 200)
            {
                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                DebugLogger.Instance.LogMsg("Executing add metadata transaction. Name - '{0}'; Value - '{1}';", Name, Value);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += new EventHandler<BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted);
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
コード例 #12
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ServiceProxy.MACompleted += OnAddMetadataCompleted;
            ServiceProxy.MAAsync(CallingUrl.Url, SessionId, DomainParameter.GetParameterValue(sessionId), RootMapParameter.GetParameterValue(sessionId), NodeParameter.GetParameterValue(sessionId), RelationshipParameter.GetParameterValue(sessionId), MapManager.ConnectionTypes.ConvertProxyToService(ConnectionType), MapManager.MetadataTypes.ConvertProxyToService(MetadataType), Name, Value, this);
        }
コード例 #13
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            TransactionStatus = ServerStatus.TransactionExecuting;

            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ServiceProxy.CompleteTransactionCompleted += OnCompleteTransactionCompleted;
            ServiceProxy.CompleteTransactionAsync(CallingUrl.Url, SessionId, this);
        }
コード例 #14
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            if (bulkOperations.O.Count > 0)
            {
                TransactionStatus = ServerStatus.SendingTransaction;

                ServiceProxy.BOCCompleted += OnSubmitBulkOperationCompleted;
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
            else
            {
                ISoapTransactionLinkExecutor executor = this;
                executor.ExecuteTransaction(sessionId, serviceProxy);
            }
        }
コード例 #15
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            TransactionStatus = ServerStatus.SendingTransaction;
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            Dictionary<Service.DT, Service.MP> nodeConnections = new Dictionary<Service.DT, Service.MP>();

            foreach (KeyValuePair<Service.DT, SoapTransactionLinkParameter> keyValuePair in TransactionLinkConnections)
            {
                Service.DT descriptorType = keyValuePair.Key;
                Service.MP parameter = keyValuePair.Value.GetParameterValue(sessionId);

                nodeConnections[descriptorType] = parameter;
            }

            ServiceProxy.RACompleted += OnAddRelationshipCompleted;
            ServiceProxy.RAAsync(CallingUrl.Url, SessionId, DomainParameter.GetParameterValue(sessionId), RootMapParameter.GetParameterValue(sessionId), nodeConnections, MapManager.RelationshipTypes.ConvertProxyToService(RelationshipType), OriginalId, this);
        }
コード例 #16
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            ServiceProxy.MUCompleted += OnUpdateMetadataCompleted;
            ServiceProxy.MUAsync(CallingUrl.Url, SessionId, DomainParameter.GetParameterValue(sessionId), MetadataParameter.GetParameterValue(sessionId), Name, Value, this);
        }
コード例 #17
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            TransactionStatus = ServerStatus.SendingTransaction;
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            Dictionary<Service.DT, Service.MP> nodeConnections = new Dictionary<Service.DT, Service.MP>();

            foreach (KeyValuePair<Service.DT, SoapTransactionLinkParameter> keyValuePair in TransactionLinkConnections)
            {
                Service.DT descriptorType = keyValuePair.Key;
                Service.MP parameter = keyValuePair.Value.GetParameterValue(sessionId);

                nodeConnections[descriptorType] = parameter;
            }

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BRA relationshipBulkOperation = new Service.BRA();
            relationshipBulkOperation.I = TransactionLinkId;
            relationshipBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            relationshipBulkOperation.RM = RootMapParameter.GetParameterValue(sessionId);
            relationshipBulkOperation.N = nodeConnections;
            relationshipBulkOperation.T = MapManager.RelationshipTypes.ConvertProxyToService(RelationshipType);
            relationshipBulkOperation.O = OriginalId;
            relationshipBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(relationshipBulkOperation);

            ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor;

            if (executor == null)
            {
                DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
                throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor.");
            }

            if (bulkOperations.O.Count < 200)
            {
                TransactionStatus = ServerStatus.TransactionReceived;

                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                TransactionStatus = ServerStatus.TransactionExecuting;

                DebugLogger.Instance.LogMsg("Executing add relationship transaction. ClientId - '{0}';", CreateInProcessObjects().ClientId);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += new EventHandler<BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted);
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
コード例 #18
0
        void ISoapTransactionLinkExecutor.ExecuteTransaction(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy)
        {
            ServiceProxy = serviceProxy;

            serviceProxy.BeginTransactionCompleted += OnBeginTransactionCompleted;
            serviceProxy.BeginTransactionAsync(CallingUrl.Url, this);
        }