Esempio n. 1
0
            private void AddChannel()
            {
                PushChannelConfig c = new PushChannelConfig();

                c.ReceiverEntityID   = _entityConfig.EntityID;
                c.ReceiverEntityName = _entityConfig.Name;

                FormPushChannel frm = new FormPushChannel(c, FormPushChannel.ActionType.Add, _entityConfig.SubscribeConfig.Channels);

                if (frm.ShowDialog(_formMain) != DialogResult.OK)
                {
                    return;
                }

                PushChannelConfig t = frm.ChannelConfig;

                if (t == null)
                {
                    return;
                }

                _entityConfig.SubscribeConfig.Channels.Add(t);

                RefreshChannelList();
                SelectChannel(t);
            }
Esempio n. 2
0
        public LPCNotificationReceiver(PushChannelConfig config, ILog log)
            : base(config, log)
        {
            //StackTrace t = new StackTrace(true);
            //log.Write(t.ToString());

            log.Write("Registering LPC subscriber. Push route: " + config.ID.ToString());
            LPCReceiverDictionary.RegisterPushReceiver(config.ID, this);
        }
Esempio n. 3
0
        public static void RaiseMSMQException(IPushRoute route, string message)
        {
            PushChannelConfig cfg = route as PushChannelConfig;

            if (cfg != null && cfg.ProtocolType == ProtocolType.MSMQ)
            {
                throw new MSMQReceiveCancelException(message);
            }
        }
Esempio n. 4
0
        public static void RaiseLPCException(IPushRoute route, string message)
        {
            PushChannelConfig cfg = route as PushChannelConfig;

            if (cfg != null && cfg.ProtocolType == ProtocolType.LPC)
            {
                throw new LPCException(message);
            }
        }
Esempio n. 5
0
 private void SelectChannel(PushChannelConfig t)
 {
     foreach (ListViewItem i in _formMain.listViewSUBChannelList.Items)
     {
         if (i.Tag as PushChannelConfig == t)
         {
             i.Selected = true;
             i.EnsureVisible();
             break;
         }
     }
 }
Esempio n. 6
0
        public FormChannelURI(PushChannelConfig chn)
        {
            InitializeComponent();
            _pushChannel = chn;

            if (_pushChannel.ProtocolType == ProtocolType.MSMQ)
            {
                this.groupBoxURI.Text = "MSMQ Path";
            }

            this.textBoxURI.Text = _pushChannel.MSMQConfig.SenderParameter.MSMQ.Path;
        }
Esempio n. 7
0
            private void ViewChannel()
            {
                PushChannelConfig chn = GetSelectedChannel();

                if (chn == null)
                {
                    return;
                }

                FormPushChannel frm = new FormPushChannel(chn, FormPushChannel.ActionType.View);

                frm.ShowDialog(_formMain);
            }
Esempio n. 8
0
            private void DeleteChannel()
            {
                PushChannelConfig chn = GetSelectedChannel();

                if (chn == null)
                {
                    return;
                }

                _entityConfig.PublishConfig.Channels.Remove(chn);

                RefreshChannelList();
                RefreshChannelButton();
            }
Esempio n. 9
0
            private void DeleteChannel()
            {
                PushChannelConfig t = GetSelectedChannel();

                if (t == null)
                {
                    return;
                }

                _entityConfig.SubscribeConfig.Channels.Remove(t);

                RefreshChannelList();
                RefreshChannelButton();
            }
Esempio n. 10
0
            private void EditChannel()
            {
                PushChannelConfig t = GetSelectedChannel();

                if (t == null)
                {
                    return;
                }

                FormPushChannel frm = new FormPushChannel(t, FormPushChannel.ActionType.Edit, _entityConfig.SubscribeConfig.Channels);

                if (frm.ShowDialog(_formMain) != DialogResult.OK)
                {
                    return;
                }

                RefreshChannelList();
                SelectChannel(t);
            }
Esempio n. 11
0
        public FormPushChannel(PushChannelConfig cfg, ActionType actionType, XCollection <PushChannelConfig> cfgList)
        {
            InitializeComponent();

            _cfgList       = cfgList;
            _channelConfig = cfg;
            _actionType    = actionType;

            if (_channelConfig == null)
            {
                _channelConfig = new PushChannelConfig();
            }

            _routTypeCtrl           = new RoutingTypeControler(this.comboBoxRoutingType);
            _routTypeCtrl.Selected += new RoutingTypeSelectedHanlder(_routTypeCtrl_Selected);
            _routTypeCtrl.Initialize();

            _protocolTypeCtrl = new ProtocolTypeControler(this.comboBoxProtocolType);
            _protocolTypeCtrl.Initialize();
        }
Esempio n. 12
0
 public LPCNotifier(PushChannelConfig config, ILog log)
     : base(config, log)
 {
     _parameter = config.LPCConfig;
 }
Esempio n. 13
0
 public FormPushChannel(PushChannelConfig cfg, ActionType actionType)
     : this(cfg, actionType, null)
 {
 }
Esempio n. 14
0
 public MSMQReceiver(PushChannelConfig config, ILog log)
     : base(config, log)
 {
     _parameter = config.MSMQConfig.ReceiverParameter;
 }
Esempio n. 15
0
        static bool UpdateChannelInPublisher(PushChannelConfig cfg)
        {
            EntityAssemblyConfig acfg = null;

            foreach (EntityContractBase c in Program.SolutionMgt.Config.Entities)
            {
                if (c.EntityID == cfg.SenderEntityID)
                {
                    acfg = c.AssemblyConfig;
                    break;
                }
            }

            if (acfg == null)
            {
                Program.Log.Write(LogType.Error, "Cannot find publisher in the integration solution: "
                                  + cfg.SenderEntityName + " (" + cfg.SenderEntityID + ")");
                return(false);
            }

            bool ret = false;

            acfg = GetEntityAssemblyConfigForEntity(acfg);
            EntityConfigAgent agent = new EntityConfigAgent(acfg, Program.Log);

            if (agent.Initialize(acfg.InitializeArgument))
            {
                EntityConfigBase ecfg = agent.EntityConfig;
                if (ecfg == null)
                {
                    Program.Log.Write(LogType.Error, "Cannot get publisher configuration: "
                                      + cfg.SenderEntityName + " (" + cfg.SenderEntityID + ")");
                }
                else
                {
                    List <PushChannelConfig> deleteList = new List <PushChannelConfig>();
                    foreach (PushChannelConfig chn in ecfg.PublishConfig.Channels)
                    {
                        if (chn.ReceiverEntityID == cfg.ReceiverEntityID)
                        {
                            deleteList.Add(chn);
                            break;
                        }
                    }

                    foreach (PushChannelConfig chn in deleteList)
                    {
                        ecfg.PublishConfig.Channels.Remove(chn);
                    }

                    ecfg.PublishConfig.Channels.Add(cfg);

                    if (agent.EntityConfigInstance.SaveConfiguration())
                    {
                        ret = true;
                        Program.Log.Write("Save publisher configuration succeeded: "
                                          + cfg.SenderEntityName + " (" + cfg.SenderEntityID + ")");
                    }
                    else
                    {
                        Program.Log.Write(LogType.Error, "Save publisher configuration failed: "
                                          + cfg.SenderEntityName + " (" + cfg.SenderEntityID + ")");
                    }
                }

                agent.Uninitialize();
            }

            return(ret);
        }
Esempio n. 16
0
        static void AddAndApplyChannel(string[] args)
        {
            int count = 6;

            if (args.Length < count)
            {
                Program.Log.Write("Arguement is not enough.");
                return;
            }

            try
            {
                string type         = args[1];
                string entityID     = args[2];
                string entityName   = args[3];
                string messageType  = args[4];
                string protocolType = args[5];

                switch (type.ToLowerInvariant())
                {
                case "publisher":
                {
                    MessageType mt = MessageType.Parse(messageType);
                    if (mt == null)
                    {
                        Program.Log.Write("Message Type can not be parse from: " + messageType);
                        return;
                    }

                    PushChannelConfig c = new PushChannelConfig();
                    c.ReceiverEntityID   = Program.ConfigMgt.Config.EntityAssembly.EntityInfo.EntityID;
                    c.ReceiverEntityName = Program.ConfigMgt.Config.EntityAssembly.EntityInfo.Name;
                    c.ProtocolType       = (ProtocolType)Enum.Parse(typeof(ProtocolType), protocolType);
                    c.Subscription.Type  = RoutingRuleType.MessageType;
                    c.Subscription.MessageTypeList.Add(mt);
                    c.SenderEntityID   = new Guid(entityID);
                    c.SenderEntityName = entityName;

                    switch (c.ProtocolType)
                    {
                    case ProtocolType.LPC: ChannelHelper.GenerateLPCChannel(c); break;

                    case ProtocolType.MSMQ: ChannelHelper.GenerateMSMQChannel(c); break;

                    default: Program.Log.Write("Following protocol type is not supported by now: " + c.ProtocolType.ToString()); return;
                    }

                    EntityConfigAgent agent = new EntityConfigAgent(Program.ConfigMgt.Config.EntityAssembly, Program.Log);
                    if (agent.Initialize(Program.ConfigMgt.Config.EntityAssembly.InitializeArgument))
                    {
                        EntityConfigBase cfg = agent.EntityConfig;
                        if (cfg == null)
                        {
                            Program.Log.Write("Cannot read configuration file.");
                        }
                        else
                        {
                            if (cfg.SubscribeConfig == null)
                            {
                                cfg.SubscribeConfig = new SubscribeConfig();
                            }
                            cfg.SubscribeConfig.Channels.Add(c);

                            if (agent.EntityConfigInstance.SaveConfiguration())
                            {
                                Program.Log.Write("Write configuration file successfully.");
                            }
                            else
                            {
                                Program.Log.Write("Cannot write configuration file.");
                            }
                        }
                        agent.Uninitialize();
                    }
                    break;
                }

                case "responser":
                {
                    PullChannelConfig c = new PullChannelConfig();
                    c.ReceiverEntityID   = Program.ConfigMgt.Config.EntityAssembly.EntityInfo.EntityID;
                    c.ReceiverEntityName = Program.ConfigMgt.Config.EntityAssembly.EntityInfo.Name;
                    c.ProtocolType       = (ProtocolType)Enum.Parse(typeof(ProtocolType), protocolType);
                    c.SenderEntityID     = new Guid(entityID);
                    c.SenderEntityName   = entityName;

                    switch (c.ProtocolType)
                    {
                    case ProtocolType.LPC: ChannelHelper.GenerateLPCChannel(c); break;

                    default: Program.Log.Write("Following protocol type is not supported by now: " + c.ProtocolType.ToString()); return;
                    }

                    EntityConfigAgent agent = new EntityConfigAgent(Program.ConfigMgt.Config.EntityAssembly, Program.Log);
                    if (agent.Initialize(Program.ConfigMgt.Config.EntityAssembly.InitializeArgument))
                    {
                        EntityConfigBase cfg = agent.EntityConfig;
                        if (cfg == null)
                        {
                            Program.Log.Write("Cannot read configuration file.");
                        }
                        else
                        {
                            if (cfg.RequestConfig == null)
                            {
                                cfg.RequestConfig = new RequestConfig();
                            }
                            cfg.RequestConfig.Channels.Add(c);

                            if (agent.EntityConfigInstance.SaveConfiguration())
                            {
                                Program.Log.Write("Write configuration file successfully.");
                            }
                            else
                            {
                                Program.Log.Write("Cannot write configuration file.");
                            }
                        }
                        agent.Uninitialize();
                    }
                    break;
                }
                }
            }
            catch (Exception err)
            {
                Program.Log.Write(err);
            }

            ApplyChannelConfigurations(false);
        }