Esempio n. 1
0
        protected override void ProcessFinal(IEnumerable <ComplianceMessage> input)
        {
            ITargetResolver resolver                 = null;
            IRoutingManager routingManager           = null;
            IEnumerable <ComplianceMessage> messages = input;
            IMessageSender  sender;
            FaultDefinition faultDefinition;

            if (Registry.Instance.TryGetInstance <IRoutingManager>(RegistryComponent.TaskDistribution, TaskDistributionComponent.RoutingManager, out routingManager, out faultDefinition, "ProcessFinal", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Routing\\Cache\\DispatchBlock.cs", 42) && Registry.Instance.TryGetInstance <ITargetResolver>(RegistryComponent.TaskDistribution, TaskDistributionComponent.TargetResolver, out resolver, out faultDefinition, "ProcessFinal", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Routing\\Cache\\DispatchBlock.cs", 44) && Registry.Instance.TryGetInstance <IMessageSender>(RegistryComponent.Client, MessageHelper.GetClientType(input), out sender, out faultDefinition, "ProcessFinal", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Routing\\Cache\\DispatchBlock.cs", 46))
            {
                ExceptionHandler.Proxy.TryRun(delegate
                {
                    sender.SendMessageAsync(this.SetDispatchingStatus(resolver.Resolve(messages))).ContinueWith(delegate(Task <bool[]> task)
                    {
                        this.SetDispatchedStatus(messages, task.Result, routingManager);
                    });
                }, TaskDistributionSettings.RemoteExecutionTime, out faultDefinition, null, null, default(CancellationToken), null, "ProcessFinal", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Routing\\Cache\\DispatchBlock.cs", 48);
            }
            if (faultDefinition != null)
            {
                foreach (ComplianceMessage message in messages)
                {
                    ExceptionHandler.FaultMessage(message, faultDefinition, true);
                }
            }
        }
Esempio n. 2
0
 public override void Load(IRoutingManager manager)
 {
     foreach (string setting in ConfigurationManager.AppSettings.AllKeys)
     {
         WebRoute route = new WebRoute(setting, ConfigurationManager.AppSettings[setting]);
         manager.SettingsRoutes.Add(route);
     }
 }
Esempio n. 3
0
 public override void Load(IRoutingManager manager)
 {
     foreach (string setting in ConfigurationManager.AppSettings.AllKeys)
     {
         WebRoute route = new WebRoute(setting, ConfigurationManager.AppSettings[setting]);
         manager.SettingsRoutes.Add(route);
     }
 }
Esempio n. 4
0
 public DataManager(IDataStorage dataStorage, string dataFilePath, IRoutingManager routingManager, IEncryptionManager encryptionManager)
 {
     this.dataStorage       = dataStorage;
     this.dataFilePath      = dataFilePath;
     this.routingManager    = routingManager;
     this.encryptionManager = encryptionManager;
     random          = new Random();
     pendingMessages = new List <QueueEntry>();
 }
Esempio n. 5
0
        public override void Load(IRoutingManager manager)
        {
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }
            if (null == this.Agent)
            {
                throw new ApplicationException("Storage agent not set");
            }
            string routes_config = manager.SettingsRoutes["ROUTES_CONFIG"].Path;

            if (String.IsNullOrEmpty(routes_config))
            {
                throw new ApplicationException("ROUTES_CONFIG not set");
            }

            Cache cache = HttpContext.Current.Cache;

            lock (SyncRoot)
            {
                XDocument doc = cache[routes_config] as XDocument;
                if (null == doc)
                {
                    if (!this.Agent.HasKey(routes_config))
                    {
                        CreateEmptyConfigFile(routes_config);
                    }

                    doc = XDocument.Parse(this.Agent.Read(routes_config));
                    cache.Insert(routes_config, doc, new CacheDependency(routes_config));
                }

                XElement routesElement = doc.Element("routes");
                if (null != routesElement)
                {
                    XAttribute appRouteAttribute = routesElement.Attribute("name");
                    if (null != appRouteAttribute && !String.IsNullOrEmpty(appRouteAttribute.Value))
                    {
                        string name = appRouteAttribute.Value;
                        manager.ApplicationsRoutes.Add(new ApplicationRoute(name));
                    }
                }

                IEnumerable <XElement> leaves = doc.Descendants()
                                                .Where(e => !e.HasElements && e.Name != "routes");
                foreach (XElement element in leaves)
                {
                    string name = element.Attribute("name").Value;
                    string path = GetPath(element);
                    manager.ScreensRoutes.Add(new ScreenRoute(name, path));
                }
            }
        }
Esempio n. 6
0
        public override void Load(IRoutingManager manager)
        {
            if (null == manager) throw new ArgumentNullException("manager");
            if (null == this.Agent) throw new ApplicationException("Storage agent not set");
            string routes_config = manager.SettingsRoutes["ROUTES_CONFIG"].Path;
            if (String.IsNullOrEmpty(routes_config)) throw new ApplicationException("ROUTES_CONFIG not set");

            Cache cache = HttpContext.Current.Cache;
            lock (SyncRoot)
            {
                XDocument doc = cache[routes_config] as XDocument;
                if (null == doc)
                {
                    if (!this.Agent.HasKey(routes_config))
                        CreateEmptyConfigFile(routes_config);

                    doc = XDocument.Parse(this.Agent.Read(routes_config));
                    cache.Insert(routes_config, doc, new CacheDependency(routes_config));
                }

                XElement routesElement = doc.Element("routes");
                if (null != routesElement)
                {
                    XAttribute appRouteAttribute = routesElement.Attribute("name");
                    if (null != appRouteAttribute && !String.IsNullOrEmpty(appRouteAttribute.Value))
                    {
                        string name = appRouteAttribute.Value;
                        manager.ApplicationsRoutes.Add(new ApplicationRoute(name));
                    }
                }

                IEnumerable<XElement> leaves = doc.Descendants()
                                                  .Where(e => !e.HasElements && e.Name != "routes");
                foreach (XElement element in leaves)
                {
                    string name = element.Attribute("name").Value;
                    string path = GetPath(element);
                    manager.ScreensRoutes.Add(new ScreenRoute(name, path));
                }
            }
        }
Esempio n. 7
0
 public RestServiceFactory(IRoutingManager routingManager, IMapper mapper, IHeaderManager headerManager)
 {
     this.routingManager = routingManager;
     this.headerManager  = headerManager;
     this.mapper         = mapper;
 }
Esempio n. 8
0
 public abstract void Load(IRoutingManager manager);
Esempio n. 9
0
 private void SetDispatchedStatus(IEnumerable <ComplianceMessage> messages, bool[] messageStatuses, IRoutingManager routingManager)
 {
     foreach (Tuple <ComplianceMessage, bool> tuple in messages.Zip(messageStatuses, (ComplianceMessage message, bool status) => new Tuple <ComplianceMessage, bool>(message, status)))
     {
         if (tuple.Item2)
         {
             routingManager.DispatchedMessage(tuple.Item1);
         }
     }
 }
Esempio n. 10
0
 public abstract void Load(IRoutingManager manager);