コード例 #1
0
        List <ServiceBusNode> Discover(string root, ServiceBusNode router)
        {
            root = VerifyNoEndSlash(root);

            Uri feedUri = new Uri(root);

            List <ServiceBusNode> nodes = new List <ServiceBusNode>();

            if (root.Contains("!") == false)
            {
                string relativeAddress = root.Replace(ServiceBusRootAddress, "");
                if (relativeAddress != "" && relativeAddress != "/")
                {
                    ServiceBusNode node = new ServiceBusNode(root);
                    nodes.Add(node);
                }
            }

            SyndicationFeed feed = GetFeed(feedUri, Token);

            if (feed != null)
            {
                foreach (SyndicationItem endpoint in feed.Items)
                {
                    foreach (SyndicationLink link in endpoint.Links)
                    {
                        Trace.WriteLine("Link: " + link.RelationshipType + " " + link.Uri.AbsoluteUri);

                        nodes.AddRange(Discover(link.Uri.AbsoluteUri, router));
                    }
                }
            }
            return(nodes);
        }
コード例 #2
0
ファイル: ExplorerForm.cs プロジェクト: ittray/LocalDemo
      void AddNodesToTree(TreeView tree,ServiceBusNode[] nodes)
      {
         string serviceNamespace = m_NamespaceTextBox.Text;

         if(tree.Nodes[0].Text == "Unspecified Namespace")
         {
            tree.Nodes.Clear();
         }
         else
         {
            foreach(TreeNode domianNode in tree.Nodes)
            {
               if(domianNode.Text == serviceNamespace)
               {
                  tree.Nodes.Remove(domianNode);
                  break;
               }
            }
         }
         TreeNode newNamespaceNode = new NamespaceTreeNode(this,serviceNamespace);
         tree.Nodes.Add(newNamespaceNode);

         tree.SelectedNode = newNamespaceNode;
         tree.Focus();

         foreach(ServiceBusNode node in nodes)
         {
            AddNode(newNamespaceNode,node);
         }
      }
コード例 #3
0
ファイル: BufferViewControl.cs プロジェクト: ittray/LocalDemo
      public override void Refresh(ServiceBusNode node,TransportClientEndpointBehavior credential)
      {
         MessageBufferPolicy policy = node.Policy as MessageBufferPolicy;

         int overflowIndex = 0;
         switch(policy.OverflowPolicy)
         {
            case OverflowPolicy.RejectIncomingMessage:
            {
               overflowIndex = 0;
               break;
            }
            default:
            {
               throw new InvalidOperationException("Unrecognized overflow value");
            }
         }
         m_OverflowComboBox.Text = m_OverflowComboBox.Items[overflowIndex] as string;

         m_ExpirationTime.Text = policy.ExpiresAfter.TotalMinutes.ToString();

         m_CountTextBox.Text = policy.MaxMessageCount.ToString();

         base.Refresh(node,credential);
      }
コード例 #4
0
 ServiceBusTreeNode MatchTreeNode(ServiceBusNode node)
 {
     if (node == null)
     {
         return(new NamespaceTreeNode(this, m_NamespaceTextBox.Text));
     }
     if (node.Policy != null)
     {
         if (node.Policy is RouterPolicy)
         {
             return(new RouterTreeNode(this, node, node.Name));
         }
         else
         {
             return(new BufferTreeNode(this, node, node.Name));
         }
     }
     else
     {
         if (node.SubscribedTo != null)
         {
             return(new RouterSubscriberTreeNode(this, node, node.Name));
         }
         else
         {
             return(new EndpointTreeNode(this, node, node.Name));
         }
     }
 }
コード例 #5
0
        public override void Refresh(ServiceBusNode node, TransportClientEndpointBehavior credential)
        {
            MessageBufferPolicy policy = node.Policy as MessageBufferPolicy;

            int overflowIndex = 0;

            switch (policy.OverflowPolicy)
            {
            case OverflowPolicy.RejectIncomingMessage:
            {
                overflowIndex = 0;
                break;
            }

            default:
            {
                throw new InvalidOperationException("Unrecognized overflow value");
            }
            }
            m_OverflowComboBox.Text = m_OverflowComboBox.Items[overflowIndex] as string;

            m_ExpirationTime.Text = policy.ExpiresAfter.TotalMinutes.ToString();

            m_CountTextBox.Text = policy.MaxMessageCount.ToString();

            base.Refresh(node, credential);
        }
コード例 #6
0
 public void AddSubscribedTo(ServiceBusNode subscribedTo)
 {
     if (subscribedTo == null)
     {
         return;
     }
     AddSubscribedTo(new ServiceBusNode[] { subscribedTo });
 }
コード例 #7
0
 public void AddSubscribedTo(ServiceBusNode subscribedTo)
 {
    if(subscribedTo == null)
    {
       return;
    }
    AddSubscribedTo(new ServiceBusNode[] { subscribedTo });
 }
コード例 #8
0
        public ServiceBusTreeNode(ExplorerForm form, ServiceBusNode serviceBusNode, string text, int imageIndex) : base(text, imageIndex, imageIndex)
        {
            Form           = form;
            ServiceBusNode = serviceBusNode;

            if (serviceBusNode != null)
            {
                string serviceNamespace = ExtractNamespace(new Uri(serviceBusNode.Address));
                Credential = form.Graphs[serviceNamespace.ToLower()].Credential;
            }
        }
コード例 #9
0
      public ServiceBusTreeNode(ExplorerForm form,ServiceBusNode serviceBusNode,string text,int imageIndex) : base(text,imageIndex,imageIndex)
      {
         Form = form;
         ServiceBusNode = serviceBusNode;

         if(serviceBusNode != null)
         {
            string serviceNamespace = ExtractNamespace(new Uri(serviceBusNode.Address));
            Credential = form.Graphs[serviceNamespace.ToLower()].Credential;
         }
      }
コード例 #10
0
        public override void Refresh(ServiceBusNode node, TransportClientEndpointBehavior credential)
        {
            base.Refresh(node, credential);

            m_Address = Address;

            //The feed does not show correct transport - always http/https, so remove all transports
            m_Address = m_Address.Replace(@"sb://", @"[transport]://");

            m_AddressLabel.Text = m_Address;
            TrimLable(m_AddressLabel, 69);
        }
コード例 #11
0
      public override void Refresh(ServiceBusNode node,TransportClientEndpointBehavior credential)
      {
         base.Refresh(node,credential);

         m_Address = Address;

         //The feed does not show correct transport - always http/https, so remove all transports 
         m_Address = m_Address.Replace(@"sb://",@"[transport]://");

         m_AddressLabel.Text = m_Address;
         TrimLable(m_AddressLabel,69);
      }
コード例 #12
0
ファイル: NodeViewControl.cs プロジェクト: ittray/LocalDemo
      public virtual void Refresh(ServiceBusNode node,TransportClientEndpointBehavior credential)
      {
         Node = node;
         Credential = credential;
         Address = GetRealAddress(node.Address).AbsoluteUri;

         m_ItemNameLabel.Text = node.Name;
         m_AddressLabel.Text = GetRealAddress(node.Address).AbsoluteUri;

         TrimLable(m_ItemNameLabel,34);
         TrimLable(m_AddressLabel,69);
      }
コード例 #13
0
        public virtual void Refresh(ServiceBusNode node, TransportClientEndpointBehavior credential)
        {
            Node       = node;
            Credential = credential;
            Address    = GetRealAddress(node.Address).AbsoluteUri;

            m_ItemNameLabel.Text = node.Name;
            m_AddressLabel.Text  = GetRealAddress(node.Address).AbsoluteUri;

            TrimLable(m_ItemNameLabel, 34);
            TrimLable(m_AddressLabel, 69);
        }
コード例 #14
0
        ServiceBusNode FindMax(List <ServiceBusNode> nodes)
        {
            ServiceBusNode maxNode = new ServiceBusNode("");

            foreach (ServiceBusNode node in nodes)
            {
                if (StringComparer.Ordinal.Compare(node.Name, maxNode.Name) >= 0)
                {
                    maxNode = node;
                }
            }
            return(maxNode);
        }
コード例 #15
0
 public void AddSubscribedTo(ServiceBusNode[] subscribedTo)
 {
    if(SubscribedTo == null)
    {
       SubscribedTo = subscribedTo;
       return;
    }
    if(subscribedTo != null)
    {
       List<ServiceBusNode> list = new List<ServiceBusNode>(SubscribedTo);
       list.AddRange(subscribedTo);
       SubscribedTo = list.ToArray();
    }
 }
コード例 #16
0
 void AssertIntegrery(ServiceBusNode[] array)
 {
     foreach(ServiceBusNode node in array)
      {
     if(node.SubscribersCount > 0)
     {
        Debug.Assert(node.Subscribers != null);
        foreach(ServiceBusNode subscriber in node.Subscribers)
        {
           subscriber.SubscribedTo.Contains(node);
        }
     }
      }
 }
コード例 #17
0
        void AddNode(TreeNode root, ServiceBusNode nodeToAdd)
        {
            TreeNode newTreeNode = MatchTreeNode(nodeToAdd);

            root.Nodes.Add(newTreeNode);
            if (nodeToAdd.Subscribers == null)
            {
                return;
            }
            foreach (ServiceBusNode subscriber in nodeToAdd.Subscribers)
            {
                AddNode(newTreeNode, subscriber);
            }
        }
コード例 #18
0
        List <ServiceBusNode> Discover(string root, ServiceBusNode router)
        {
            root = VerifyNoEndSlash(root);

            Uri feedUri = new Uri(root);

            List <ServiceBusNode> nodes = new List <ServiceBusNode>();

            if (root.Contains("!") == false)
            {
                string relativeAddress = root.Replace(ServiceBusRootAddress, "");
                if (relativeAddress != "" && relativeAddress != "/")
                {
                    ServiceBusNode node = new ServiceBusNode(root);
                    node.AddSubscribedTo(router);
                    nodes.Add(node);
                }
            }

            SyndicationFeed feed = GetFeed(feedUri, Token);

            if (feed != null)
            {
                foreach (SyndicationItem endpoint in feed.Items)
                {
                    ServiceBusNode node = null;

                    foreach (SyndicationLink link in endpoint.Links)
                    {
                        Trace.WriteLine("Link: " + link.RelationshipType + " " + link.Uri.AbsoluteUri);
                        //Try to threat as buffer
                        try
                        {
                            MessageBufferPolicy policy = GetBufferPolicy(link.Uri.AbsoluteUri);
                            node        = new ServiceBusNode(link.Uri.AbsoluteUri);
                            node.Policy = policy;
                            nodes.Add(node);
                            break;
                        }
                        catch (FaultException exception)
                        {
                            Debug.Assert(exception.Message.StartsWith("Policy could not be retrieved"));
                        }
                        nodes.AddRange(Discover(link.Uri.AbsoluteUri, router));
                    }
                }
            }
            return(nodes);
        }
コード例 #19
0
      public void ReplaceSubscriber(ServiceBusNode service,ServiceBusNode junction)
      {
         if(Subscribers == null)
         {
            return;
         }
         Debug.Assert(service != null);
         Debug.Assert(junction != null);

         List<ServiceBusNode> list = new List<ServiceBusNode>(Subscribers);
         if(list.Contains(service))
         {
            list.Remove(service);
            list.Add(junction);
         }
         Subscribers = list.ToArray();
      }
コード例 #20
0
        //TODO Restore on next release
        public override void Refresh(ServiceBusNode node, TransportClientEndpointBehavior credential)
        {
            RouterPolicy policy = node.Policy as RouterPolicy;

            m_AllRadioButton.Checked = policy.MessageDistribution == MessageDistributionPolicy.AllSubscribers;
            m_OneRadioButton.Checked = policy.MessageDistribution == MessageDistributionPolicy.OneSubscriber;

            m_MaxSubscribersTextBox.Text = policy.MaxSubscribers.ToString();

            m_PushRetriesTextBox.Text = policy.PushDeliveryRetries.ToString();

            m_Expiration = policy.ExpirationInstant;
            m_ExpirationTimePicker.Value = m_Expiration;

            m_BufferLengthTextBox.Text = policy.MaxBufferLength.ToString();

            int overflowIndex = 0;

            switch (policy.OverflowPolicy)
            {
            case OverflowPolicy.RejectIncomingMessage:
            {
                overflowIndex = 0;
                break;
            }

                /* TODO Restore on next release
                 * case OverflowPolicy.DiscardIncomingMessage:
                 * {
                 * overflowIndex = 1;
                 * break;
                 * }
                 * case OverflowPolicy.DiscardExistingMessage:
                 * {
                 * overflowIndex = 2;
                 * break;
                 * }
                 */
            }
            m_OverflowComboBox.Text = m_OverflowComboBox.Items[overflowIndex] as string;

            m_PurgeButton.Enabled = node.SubscribersCount > 0;

            base.Refresh(node, credential);
        }
コード例 #21
0
        public void AddSubscriber(ServiceBusNode junction)
        {
            Debug.Assert(junction != null);

            if (Subscribers == null)
            {
                Subscribers = new ServiceBusNode[] { junction };
                return;
            }

            List <ServiceBusNode> list = new List <ServiceBusNode>(Subscribers);

            Debug.Assert(list.Contains(junction) == false);

            list.Add(junction);

            Subscribers = list.ToArray();
        }
コード例 #22
0
      public void AddSubscriber(ServiceBusNode junction)
      {
         Debug.Assert(junction != null);

         if(Subscribers == null)
         {
            Subscribers = new ServiceBusNode[] { junction };
            return;
         }

         List<ServiceBusNode> list = new List<ServiceBusNode>(Subscribers);

         Debug.Assert(list.Contains(junction) == false);

         list.Add(junction);

         Subscribers = list.ToArray();
      }  
コード例 #23
0
        public void ReplaceSubscriber(ServiceBusNode service, ServiceBusNode junction)
        {
            if (Subscribers == null)
            {
                return;
            }
            Debug.Assert(service != null);
            Debug.Assert(junction != null);

            List <ServiceBusNode> list = new List <ServiceBusNode>(Subscribers);

            if (list.Contains(service))
            {
                list.Remove(service);
                list.Add(junction);
            }
            Subscribers = list.ToArray();
        }
コード例 #24
0
ファイル: RouterViewControl.cs プロジェクト: ittray/LocalDemo
      //TODO Restore on next release
      public override void Refresh(ServiceBusNode node,TransportClientEndpointBehavior credential)
      {
         RouterPolicy policy = node.Policy as RouterPolicy;

         m_AllRadioButton.Checked = policy.MessageDistribution == MessageDistributionPolicy.AllSubscribers;
         m_OneRadioButton.Checked = policy.MessageDistribution == MessageDistributionPolicy.OneSubscriber;

         m_MaxSubscribersTextBox.Text = policy.MaxSubscribers.ToString();

         m_PushRetriesTextBox.Text = policy.PushDeliveryRetries.ToString();

         m_Expiration = policy.ExpirationInstant;
         m_ExpirationTimePicker.Value = m_Expiration;

         m_BufferLengthTextBox.Text = policy.MaxBufferLength.ToString();

         int overflowIndex = 0;
         switch(policy.OverflowPolicy)
         {
            case OverflowPolicy.RejectIncomingMessage:
            {
               overflowIndex = 0;
               break;
            }
            /* TODO Restore on next release
            case OverflowPolicy.DiscardIncomingMessage:
            {
               overflowIndex = 1;
               break;
            }
            case OverflowPolicy.DiscardExistingMessage:
            {
               overflowIndex = 2;
               break;
            }
            */
         }
         m_OverflowComboBox.Text = m_OverflowComboBox.Items[overflowIndex] as string;

         m_PurgeButton.Enabled = node.SubscribersCount > 0;

         base.Refresh(node,credential);
      }
コード例 #25
0
        ServiceBusNode[] SortList(List <ServiceBusNode> nodes)
        {
            ServiceBusNode[] array = new ServiceBusNode[nodes.Count];

            for (int i = 0; i < array.Length; i++)
            {
                ServiceBusNode maxNode = FindMax(nodes);
                array[i] = maxNode;
                nodes.Remove(maxNode);
            }
            //Transpose array
            ServiceBusNode[] returned = new ServiceBusNode[array.Length];

            int index = 0;

            for (int j = array.Length - 1; j >= 0; j--)
            {
                returned[index++] = array[j];
            }
            return(returned);
        }
コード例 #26
0
ファイル: EndpointTreeNode.cs プロジェクト: ittray/LocalDemo
 public EndpointTreeNode(ExplorerForm form,ServiceBusNode serviceBusNode,string name) : base(form,serviceBusNode,name,ExplorerForm.EndpointIndex)
 {}
コード例 #27
0
 public RouterSubscriberTreeNode(ExplorerForm form, ServiceBusNode serviceBusNode, string name) : base(form, serviceBusNode, name, ExplorerForm.EventEndpointIndex)
 {
 }
コード例 #28
0
 public RouterSubscriberTreeNode(ExplorerForm form,ServiceBusNode serviceBusNode,string name) : base(form,serviceBusNode,name,ExplorerForm.EventEndpointIndex)
 {}
コード例 #29
0
 public EndpointTreeNode(ExplorerForm form, ServiceBusNode serviceBusNode, string name) : base(form, serviceBusNode, name, ExplorerForm.EndpointIndex)
 {
 }
コード例 #30
0
 internal void DisplayRouterControl(ServiceBusNode node, TransportClientEndpointBehavior credential)
 {
     m_RouterViewControl.Refresh(node, credential);
     DisplayControl(m_RouterViewControl);
 }
コード例 #31
0
ファイル: ServiceBusGraph.cs プロジェクト: ittray/LocalDemo
      List<ServiceBusNode> Discover(string root,ServiceBusNode router)
      {
         root = VerifyNoEndSlash(root);

         Uri feedUri = new Uri(root);

         List<ServiceBusNode> nodes = new List<ServiceBusNode>();

         if(root.Contains("!") == false)
         {
            string relativeAddress = root.Replace(ServiceBusRootAddress,"");
            if(relativeAddress != "" && relativeAddress != "/")
            {
               ServiceBusNode node = new ServiceBusNode(root);
               nodes.Add(node);
            }
         }

         SyndicationFeed feed = GetFeed(feedUri,Token);

         if(feed != null)
         {
            foreach(SyndicationItem endpoint in feed.Items)
            {
               ServiceBusNode node = null;

               foreach(SyndicationLink link in endpoint.Links)
               {
                  Trace.WriteLine("Link: " + link.RelationshipType + " " + link.Uri.AbsoluteUri);
                  //Try to threat as buffer
                  try
                  {
                     MessageBufferPolicy policy = GetBufferPolicy(link.Uri.AbsoluteUri);
                     node = new ServiceBusNode(link.Uri.AbsoluteUri);
                     node.Policy = policy;
                     nodes.Add(node);
                     break;
                  }
                  catch(FaultException exception)
                  {
                     Debug.Assert(exception.Message.StartsWith("Policy could not be retrieved"));
                  }
                  nodes.AddRange(Discover(link.Uri.AbsoluteUri,router));
               }
            }
         }
         return nodes;
      }
コード例 #32
0
ファイル: ServiceBusGraph.cs プロジェクト: JMnITup/SMEX
        List<ServiceBusNode> Discover(string root,ServiceBusNode router)
        {
            root = VerifyNoEndSlash(root);

             Uri feedUri = new Uri(root);

             List<ServiceBusNode> nodes = new List<ServiceBusNode>();

             if(root.Contains("!") == false)
             {
            string relativeAddress = root.Replace(ServiceBusRootAddress,"");
            if(relativeAddress != "" && relativeAddress != "/")
            {
               ServiceBusNode node = new ServiceBusNode(root);
               nodes.Add(node);
            }
             }

             SyndicationFeed feed = GetFeed(feedUri,Token);

             if(feed != null)
             {
            foreach(SyndicationItem endpoint in feed.Items)
            {
               foreach(SyndicationLink link in endpoint.Links)
               {
                  Trace.WriteLine("Link: " + link.RelationshipType + " " + link.Uri.AbsoluteUri);

                  nodes.AddRange(Discover(link.Uri.AbsoluteUri,router));
               }
            }
             }
             return nodes;
        }
コード例 #33
0
ファイル: ExplorerForm.cs プロジェクト: ittray/LocalDemo
 internal void DisplayRouterControl(ServiceBusNode node,TransportClientEndpointBehavior credential)
 {
    m_RouterViewControl.Refresh(node,credential);
    DisplayControl(m_RouterViewControl);
 }
コード例 #34
0
ファイル: ExplorerForm.cs プロジェクト: ittray/LocalDemo
      void AddNode(TreeNode root,ServiceBusNode nodeToAdd)
      {
         TreeNode newTreeNode = MatchTreeNode(nodeToAdd);

         root.Nodes.Add(newTreeNode);
         if(nodeToAdd.Subscribers == null)
         {
            return;
         }
         foreach(ServiceBusNode subscriber in nodeToAdd.Subscribers)
         {
            AddNode(newTreeNode,subscriber);
         }
      }
コード例 #35
0
 public BufferTreeNode(ExplorerForm form, ServiceBusNode serviceBusNode, string name) : base(form, serviceBusNode, name, ExplorerForm.BufferIndex)
 {
 }
コード例 #36
0
ファイル: RouterTreeNode.cs プロジェクト: ittray/LocalDemo
 public RouterTreeNode(ExplorerForm form,ServiceBusNode serviceBusNode,string name) : base(form,serviceBusNode,name,ExplorerForm.RouterIndex)
 {}
コード例 #37
0
ファイル: ServiceBusGraph.cs プロジェクト: ittray/LocalDemo
 ServiceBusNode FindMax(List<ServiceBusNode> nodes)
 {
    ServiceBusNode maxNode = new ServiceBusNode("");
    foreach(ServiceBusNode node in nodes)
    {
       if(StringComparer.Ordinal.Compare(node.Name,maxNode.Name) >= 0)
       {
          maxNode = node;
       }
    }
    return maxNode;
 }
コード例 #38
0
ファイル: ServiceBusGraph.cs プロジェクト: ittray/LocalDemo
      ServiceBusNode[] SortList(List<ServiceBusNode> nodes)
      {
         ServiceBusNode[] array = new ServiceBusNode[nodes.Count];

         for(int i = 0;i<array.Length;i++)
         {
            ServiceBusNode maxNode = FindMax(nodes);
            array[i] = maxNode;
            nodes.Remove(maxNode);
         }
         //Transpose array
         ServiceBusNode[] returned = new ServiceBusNode[array.Length];

         int index = 0;
         for(int j = array.Length-1;j>=0;j--)
         {
            returned[index++] = array[j];
         }
         return returned;
      }
コード例 #39
0
ファイル: ExplorerForm.cs プロジェクト: ittray/LocalDemo
 ServiceBusTreeNode MatchTreeNode(ServiceBusNode node)
 {
    if(node == null)
    {
       return new NamespaceTreeNode(this,m_NamespaceTextBox.Text);
    }
    if(node.Policy != null)
    {
       if(node.Policy is RouterPolicy)
       {
          return new RouterTreeNode(this,node,node.Name);
       }
       else
       {
          return new BufferTreeNode(this,node,node.Name);
       }
    }
    else
    {
       if(node.SubscribedTo != null)
       {
          return new RouterSubscriberTreeNode(this,node,node.Name);
       }
       else
       {
          return new EndpointTreeNode(this,node,node.Name);
       }
    }
 }