Beispiel #1
0
            public bool TransferTransportManagers(Microsoft.ServiceBus.Channels.TransportManagerContainer transportManagerContainer)
            {
                bool flag;

                lock (base.ThisLock)
                {
                    if (base.State == CommunicationState.Opened)
                    {
                        this.transportManagerContainer = transportManagerContainer;
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                    }
                }
                return(flag);
            }
Beispiel #2
0
        protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context, System.ServiceModel.Channels.MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode) : base(context.Binding)
        {
            Microsoft.ServiceBus.Channels.HostNameComparisonModeHelper.Validate(hostNameComparisonMode);
            this.hostNameComparisonMode = hostNameComparisonMode;
            this.manualAddressing       = bindingElement.ManualAddressing;
            this.maxBufferPoolSize      = bindingElement.MaxBufferPoolSize;
            this.maxReceivedMessageSize = bindingElement.MaxReceivedMessageSize;
            Collection <MessageEncodingBindingElement> messageEncodingBindingElements = context.BindingParameters.FindAll <MessageEncodingBindingElement>();

            if (messageEncodingBindingElements.Count > 1)
            {
                throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(Microsoft.ServiceBus.SR.GetString(Resources.MultipleMebesInParameters, new object[0])));
            }
            if (messageEncodingBindingElements.Count != 1)
            {
                this.messageEncoderFactory = defaultMessageEncoderFactory;
            }
            else
            {
                this.messageEncoderFactory = messageEncodingBindingElements[0].CreateMessageEncoderFactory();
                context.BindingParameters.Remove <MessageEncodingBindingElement>();
            }
            if (this.messageEncoderFactory == null)
            {
                this.messageVersion = System.ServiceModel.Channels.MessageVersion.None;
            }
            else
            {
                this.messageVersion = this.messageEncoderFactory.MessageVersion;
            }
            ServiceSecurityAuditBehavior serviceSecurityAuditBehavior = context.BindingParameters.Find <ServiceSecurityAuditBehavior>();

            if (serviceSecurityAuditBehavior == null)
            {
                this.auditBehavior = new ServiceSecurityAuditBehavior();
            }
            else
            {
                this.auditBehavior = (ServiceSecurityAuditBehavior)InvokeHelper.InvokeInstanceMethod(typeof(ServiceSecurityAuditBehavior), serviceSecurityAuditBehavior, "Clone", new object[0]);
            }
            if (context.ListenUriMode == ListenUriMode.Unique && context.ListenUriBaseAddress == null)
            {
                UriBuilder uriBuilder = new UriBuilder(this.Scheme, Microsoft.ServiceBus.Channels.DnsCache.MachineName)
                {
                    Path = this.GeneratedAddressPrefix
                };
                context.ListenUriBaseAddress = uriBuilder.Uri;
            }
            Microsoft.ServiceBus.Channels.UriSchemeKeyedCollection.ValidateBaseAddress(context.ListenUriBaseAddress, "baseAddress");
            if (context.ListenUriBaseAddress.Scheme != this.Scheme && !context.ListenUriBaseAddress.Scheme.Equals("sbwss") && string.Compare(context.ListenUriBaseAddress.Scheme, this.Scheme, StringComparison.OrdinalIgnoreCase) != 0)
            {
                ExceptionUtility exceptionUtility = Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility;
                string           invalidUriScheme = Resources.InvalidUriScheme;
                object[]         scheme           = new object[] { context.ListenUriBaseAddress.Scheme, this.Scheme };
                throw exceptionUtility.ThrowHelperArgument("context.ListenUriBaseAddress", Microsoft.ServiceBus.SR.GetString(invalidUriScheme, scheme));
            }
            Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.DebugAssert(context.ListenUriRelativeAddress != null, "");
            if (context.ListenUriMode != ListenUriMode.Explicit)
            {
                string listenUriRelativeAddress = context.ListenUriRelativeAddress;
                if (listenUriRelativeAddress.Length > 0 && !listenUriRelativeAddress.EndsWith("/", StringComparison.Ordinal))
                {
                    listenUriRelativeAddress = string.Concat(listenUriRelativeAddress, "/");
                }
                System.Uri listenUriBaseAddress = context.ListenUriBaseAddress;
                Guid       guid = Guid.NewGuid();
                this.SetUri(listenUriBaseAddress, string.Concat(listenUriRelativeAddress, guid.ToString()));
            }
            else
            {
                this.SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
            }
            this.transportManagerContainer = new Microsoft.ServiceBus.Channels.TransportManagerContainer(this);
        }
Beispiel #3
0
 protected override void OnOpening()
 {
     base.OnOpening();
     this.transportManagerContainer = this.listener.GetTransportManagers();
     this.listener = null;
 }