//- ~CheckForExclusionAndForcePassThrough -//
 internal static void CheckForExclusionAndForcePassThrough(WebDomainData data)
 {
     foreach (EndpointData endpointData in data.EndpointDataList.Where(p => p.Type.Equals("{exclusion}", StringComparison.InvariantCultureIgnoreCase)))
     {
         if (PathMatcher.Match(endpointData.Selector, endpointData.Text))
         {
             FlowControl.IsHalted = true;
             return;
         }
     }
     foreach (EndpointData endpointData in data.EndpointDataList.Where(p => p.Type.Equals("{forcepassthrough}", StringComparison.InvariantCultureIgnoreCase)))
     {
         if (PathMatcher.Match(endpointData.Selector, endpointData.Text))
         {
             PassThroughHttpHandler.ForceUse = true;
             return;
         }
     }
 }
Exemple #2
0
 //- @Clone -//
 public WebDomainData Clone()
 {
     var data = new WebDomainData();
     //data.Default = this.Default;
     data.DefaultType = DefaultType;
     data.ParameterDataList = ParameterDataList;
     data.DefaultParameter = DefaultParameter;
     data.AcceptMissingTrailingSlash = AcceptMissingTrailingSlash;
     data.Subdomain = Subdomain;
     data.IsSealed = IsSealed;
     data.CatchAllMode = CatchAllMode;
     data.CatchAllInitParameter = CatchAllInitParameter;
     data.InitProcessorDataList = InitProcessorDataList.Clone();
     data.PostRenderProcessorDataList = PostRenderProcessorDataList.Clone();
     data.SecurityData = SecurityData.Clone();
     data.ComponentDataList = ComponentDataList.Clone();
     data.CatchAllEndpoint = CatchAllEndpoint.Clone();
     data.EndpointDataList = EndpointDataList.Clone();
     data.HandlerFactoryDataList = HandlerFactoryDataList.Clone();
     data.SelectionProcessorDataList = SelectionProcessorDataList.Clone();
     data.OverrideProcessorDataList = OverrideProcessorDataList.Clone();
     data.StateProcessorDataList = StateProcessorDataList.Clone();
     //data.AccessRuleDataList = this.AccessRuleDataList.Clone();
     data.ProcessorFactoryDataList = ProcessorFactoryDataList.Clone();
     //+
     return data;
 }
 //- ~RunSorting -//
 internal static void RunSorting(WebDomainData data)
 {
     ProcessorReaderWriterLockSlim.EnterWriteLock();
     try
     {
         if (data.EndpointDataList == null)
         {
             return;
         }
         EndpointDataList handlerList = data.EndpointDataList.Clone();
         data.EndpointDataList = new EndpointDataList();
         handlerList.Where(p => p.Selector == SelectorType.PathEquals).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.EndsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.WebDomainPathStartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.WebDomainPathEquals).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.PathStartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.StartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.PathContains).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
         handlerList.Where(p => p.Selector == SelectorType.Contains).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     }
     finally
     {
         ProcessorReaderWriterLockSlim.ExitWriteLock();
     }
 }
 //- $HasAccess -//
 private bool HasAccess(String key, WebDomainData data)
 {
     if (data.SecurityData.DefaultAccessMode == DefaultAccessMode.Allow)
     {
         if (data.SecurityData.SecurityExceptionDataList.Any(p => key.Equals(p.Key, StringComparison.InvariantCultureIgnoreCase)))
         {
             if (!SecurityData.SecurityValidator.IsValid())
             {
                 return false;
             }
         }
     }
     else
     {
         if (!data.SecurityData.SecurityExceptionDataList.Any(p => key.Equals(p.Key, StringComparison.InvariantCultureIgnoreCase)))
         {
             if (!SecurityData.SecurityValidator.IsValid())
             {
                 return false;
             }
         }
     }
     //+
     return true;
 }
 //- $SetCatchAllProcessorByMode -//
 private void SetCatchAllProcessorByMode(CatchAllMode catchAllMode, String catchAllInitParameter, WebDomainData webDomainData)
 {
     WebDomain webDomain = NalariumContext.Current.WebDomain;
     switch (webDomain.Configuration.CatchAllMode)
     {
         case CatchAllMode.PassThrough:
             webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "{passthrough}");
             break;
         case CatchAllMode.PassToDefault:
             if (String.IsNullOrEmpty(webDomainData.DefaultParameter))
             {
                 throw new InvalidOperationException(ResourceAccessor.GetString("WebDomain_DefaultPageCatchAllModeRequiresDefaultPage"));
             }
             if (!webDomainData.OverrideProcessorDataList.Any(p => p.ProcessorType.Equals("__$defaultpageoverrideprocessor", StringComparison.InvariantCulture)))
             {
                 webDomainData.OverrideProcessorDataList.Add(ProcessorData.Create<ProcessorData>("__$defaultpageoverrideprocessor"));
             }
             break;
         case CatchAllMode.Forbidden:
             webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "{httpforbidden}");
             break;
         case CatchAllMode.Blocked:
             webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "{blocked}", catchAllInitParameter);
             break;
         case CatchAllMode.Redirect:
             if (String.IsNullOrEmpty(catchAllInitParameter))
             {
                 SetCatchAllProcessorByMode(CatchAllMode.NotFound, String.Empty, webDomainData);
             }
             else
             {
                 webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "redirect", catchAllInitParameter);
             }
             break;
         case CatchAllMode.RedirectToRoot:
             webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "redirect", "/");
             break;
         case CatchAllMode.Page:
             if (String.IsNullOrEmpty(catchAllInitParameter))
             {
                 SetCatchAllProcessorByMode(CatchAllMode.NotFound, String.Empty, webDomainData);
             }
             else
             {
                 webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "page", catchAllInitParameter);
             }
             break;
         case CatchAllMode.NotFound:
             webDomainData.CatchAllEndpoint = EndpointData.Create(SelectorType.CatchAll, "*", "{notfound}");
             break;
     }
 }
 private static void LoadSingleProcessorData(WebDomainData data, String processorType, Object[] parameterArray, String source)
 {
     ProcessEachSettingToken(parameterArray);
     //+
     var readerWriterLockSlim = new ReaderWriterLockSlim();
     try
     {
         readerWriterLockSlim.EnterUpgradeableReadLock();
         try
         {
             IProcessor processor = null;
             //+
             if (RouteCache.ProcessorCache.ContainsKey(processorType))
             {
                 processor = RouteCache.ProcessorCache[processorType];
             }
             else
             {
                 readerWriterLockSlim.EnterWriteLock();
                 //+
                 try
                 {
                     if (!RouteCache.ProcessorCache.ContainsKey(processorType))
                     {
                         processor = ProcessorActivator.Create<IProcessor>(processorType, RouteCache.ProcessorFactoryCache);
                         if (processor == null)
                         {
                             throw new InvalidProcessorException(String.Format(Resource.Processor_Invalid, processorType));
                         }
                         //+
                         RouteCache.ProcessorCache.Add(processorType, processor);
                     }
                 }
                 finally
                 {
                     readerWriterLockSlim.ExitWriteLock();
                 }
             }
             if (processor == null)
             {
                 return;
             }
             ProcessorData processorData;
             if (processor is InitProcessor)
             {
                 processorData = new ProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 data.InitProcessorDataList.Add(processorData);
             }
             else if (processor is SelectionProcessor)
             {
                 processorData = new ProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 data.SelectionProcessorDataList.Add(processorData);
             }
             else if (processor is OverrideProcessor)
             {
                 processorData = new ProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 data.OverrideProcessorDataList.Add(processorData);
             }
             else if (processor is StateProcessor)
             {
                 processorData = new ProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 data.StateProcessorDataList.Add(processorData);
             }
             else if (processor is PostRenderProcessor)
             {
                 processorData = new ProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 data.PostRenderProcessorDataList.Add(processorData);
             }
             else if (processor is ErrorProcessor)
             {
                 processorData = new ErrorProcessorData
                                 {
                                     ProcessorType = processorType, ParameterArray = parameterArray
                                 };
                 processorData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                 var epd = ((ErrorProcessorData)processorData);
                 epd.Init();
                 data.ErrorProcessorDataList.Add(epd);
             }
         }
         finally
         {
             readerWriterLockSlim.ExitUpgradeableReadLock();
         }
     }
     catch (Exception ex)
     {
         if (WebProcessingReportController.Reporter.Initialized)
         {
             var map = new Map();
             map.Add("Section", "Processor");
             map.Add("Type", processorType);
             map.Add("Message", ex.Message);
             map.Add("Exception Type", ex.GetType().FullName);
             //+
             WebProcessingReportController.Reporter.AddMap(map);
         }
     }
 }
 //- $RemoveEachPartInstalledByComponent -//
 private static void RemoveEachPartInstalledByComponent(WebDomainData data, String componentKey)
 {
     data.HandlerFactoryDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     data.ProcessorFactoryDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     //+
     data.InitProcessorDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     data.SelectionProcessorDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     data.OverrideProcessorDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     data.StateProcessorDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     data.ErrorProcessorDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
     //+
     data.EndpointDataList.RemoveAll(f => !String.IsNullOrEmpty(f.Source) && f.Source.Equals(componentKey));
 }
 //- ~LoadSecurityData -//
 internal static void LoadSecurityData(WebDomainData data, SecurityElement securityElement)
 {
     if (securityElement.Disabled || securityElement.DefaultAccessMode == null)
     {
         data.SecurityData = new SecurityData
                             {
                                 Disabled = true
                             };
         //+
         return;
     }
     data.SecurityData.Disabled = false;
     data.SecurityData.DefaultAccessMode = securityElement.DefaultAccessMode ?? DefaultAccessMode.Block;
     data.SecurityData.ValidatorType = securityElement.ValidatorType;
     data.SecurityData.LoginText = securityElement.LoginText;
     data.SecurityData.LogoutText = securityElement.LogoutText;
     data.SecurityData.DefaultLoggedInTarget = securityElement.DefaultLoggedInTarget;
     SecurityExceptionCollection collection = securityElement.Exceptions;
     if (String.IsNullOrEmpty(securityElement.LoginPage))
     {
         throw new ArgumentException(ResourceAccessor.GetString("Security_LoginTargetRequired"));
     }
     data.SecurityData.LoginPage = securityElement.LoginPage;
     data.SecurityData.LogoutPage = securityElement.LogoutPage;
     List<SecurityExceptionElement> elementList = collection.ToList();
     foreach (SecurityExceptionElement element in elementList)
     {
         if (data.SecurityData.SecurityExceptionDataList.Any(p => p.Key == element.Key))
         {
             continue;
         }
         data.SecurityData.SecurityExceptionDataList.Add(new SecurityExceptionData
                                                         {
                                                             Key = element.Key
                                                         });
     }
     String type;
     if (data.SecurityData.LoginText.StartsWith("{"))
     {
         type = "sequence";
     }
     else
     {
         type = "page";
     }
     data.EndpointDataList.Insert(0, new EndpointData
                                     {
                                         Type = type,
                                         Text = UrlCleaner.CleanWebPathTail(data.SecurityData.LoginText) + "/",
                                         TextWithoutSlash = UrlCleaner.CleanWebPathTail(data.SecurityData.LoginText),
                                         Selector = SelectorType.EndsWith,
                                         ParameterValue = data.SecurityData.LoginPage
                                     });
     if (!String.IsNullOrEmpty(data.SecurityData.LogoutPage))
     {
         data.EndpointDataList.Insert(0, new EndpointData
                                         {
                                             Type = type,
                                             Text = UrlCleaner.CleanWebPathTail(data.SecurityData.LogoutText) + "/",
                                             TextWithoutSlash = UrlCleaner.CleanWebPathTail(data.SecurityData.LogoutText),
                                             Selector = SelectorType.EndsWith,
                                             ParameterValue = data.SecurityData.LogoutPage
                                         });
     }
 }
 //- $LoadSingleFactoryData -//
 private static void LoadSingleFactoryData(WebDomainData data, String factoryType, Object[] parameterArray, Map parameterMap, String source)
 {
     var readerWriterLockSlim = new ReaderWriterLockSlim();
     try
     {
         IFactory factory = null;
         //+
         readerWriterLockSlim.EnterUpgradeableReadLock();
         if (!RouteCache.HandlerFactoryCache.ContainsKey(factoryType) && !RouteCache.ProcessorFactoryCache.ContainsKey(factoryType))
         {
             readerWriterLockSlim.EnterWriteLock();
             //+
             try
             {
                 if (!RouteCache.HandlerFactoryCache.ContainsKey(factoryType) && !RouteCache.ProcessorFactoryCache.ContainsKey(factoryType))
                 {
                     factory = ObjectCreator.CreateAs<IFactory>(factoryType);
                     if (factory == null)
                     {
                         throw new InvalidFactoryException(String.Format(Resource.Factory_Invalid, factoryType));
                     }
                     //+
                     FactoryData factoryData = FactoryData.Create(factoryType, parameterArray, parameterMap);
                     factoryData.Source = String.IsNullOrEmpty(source) ? Info.System : source;
                     if (factory is HandlerFactory)
                     {
                         data.HandlerFactoryDataList.Add(factoryData);
                         RouteCache.HandlerFactoryCache.Add(factoryType, factory);
                     }
                     else if (factory is ProcessorFactory)
                     {
                         data.ProcessorFactoryDataList.Add(factoryData);
                         RouteCache.ProcessorFactoryCache.Add(factoryType, factory);
                     }
                 }
             }
             finally
             {
                 readerWriterLockSlim.ExitWriteLock();
             }
         }
     }
     catch (Exception ex)
     {
         if (WebProcessingReportController.Reporter.Initialized)
         {
             var map = new Map();
             map.Add("Section", "Factory");
             map.Add("Type", factoryType);
             map.Add("Message", ex.Message);
             map.Add("Exception Type", ex.GetType().FullName);
             //+
             WebProcessingReportController.Reporter.AddMap(map);
         }
     }
     finally
     {
         readerWriterLockSlim.ExitUpgradeableReadLock();
     }
 }
 //- ~LoadProcessorData -//
 internal static void LoadProcessorData(WebDomainData data, ProcessorCollection collection)
 {
     var readerWriterLockSlim = new ReaderWriterLockSlim();
     List<ProcessorElement> elementList = collection.ToList();
     foreach (ProcessorElement processor in elementList)
     {
         if (!processor.Enabled)
         {
             continue;
         }
         LoadSingleProcessorData(data, processor.ProcessorType, processor.GetParameterArray(), String.Empty);
     }
     foreach (ProcessorData processor in data.ProcessorDataList)
     {
         LoadSingleProcessorData(data, processor.ProcessorType, processor.ParameterArray, processor.Source);
     }
     //+
     data.InitProcessorDataList.OriginalCount = data.InitProcessorDataList.Count;
     data.SelectionProcessorDataList.OriginalCount = data.SelectionProcessorDataList.Count;
     data.OverrideProcessorDataList.OriginalCount = data.OverrideProcessorDataList.Count;
     data.StateProcessorDataList.OriginalCount = data.StateProcessorDataList.Count;
     data.ErrorProcessorDataList.OriginalCount = data.ErrorProcessorDataList.Count;
 }
 //- ~LoadFactoryData -//
 internal static void LoadFactoryData(WebDomainData data, Nalarium.Configuration.AppConfig.Factory.FactoryCollection collection)
 {
     List<Nalarium.Configuration.AppConfig.Factory.FactoryElement> elementList = collection.ToList();
     foreach (Nalarium.Configuration.AppConfig.Factory.FactoryElement factory in elementList)
     {
         if (!factory.Enabled)
         {
             continue;
         }
         LoadSingleFactoryData(data, factory.FactoryType, factory.GetParameterArray(), factory.GetParameterMap(), String.Empty);
     }
     foreach (FactoryData factory in data.FactoryDataList)
     {
         LoadSingleFactoryData(data, factory.FactoryType, factory.ParameterArray, factory.ParameterMap, factory.Source);
     }
     //+
     data.HandlerFactoryDataList.OriginalCount = data.HandlerFactoryDataList.Count;
     data.ProcessorFactoryDataList.OriginalCount = data.ProcessorFactoryDataList.Count;
 }
 //- ~LoadEndpointData -//
 internal static void LoadEndpointData(WebDomainData data, EndpointCollection collection)
 {
     List<EndpointElement> elementList = collection.ToList();
     var matchTextList = new List<String>();
     var referenceKeyList = new List<String>();
     if (collection.Count(p => p.Text == "*") > 1)
     {
         throw new ConfigurationErrorsException(ResourceAccessor.GetString("WebDomain_DuplicateCatchAll"));
     }
     foreach (EndpointElement element in elementList)
     {
         if (element.Disabled)
         {
             continue;
         }
         String matchText = element.Text;
         Boolean requireSlash = element.RequireSlash;
         String withoutSlash = EndpointData.GetTextWithoutSlash(matchText);
         SelectorType matchType = element.Selector;
         String originalMatchText = matchText;
         EndpointData newElement = AdjustMatchType(element.Text);
         if (newElement != null)
         {
             matchText = newElement.Text;
             matchType = newElement.Selector;
         }
         matchTextList.Add(matchText);
         if (element.Text == "*")
         {
             data.CatchAllEndpoint = new EndpointData
                                     {
                                         AccessRuleGroup = element.AccessRuleGroup,
                                         OriginalMatchText = originalMatchText,
                                         Text = matchText,
                                         TextWithoutSlash = withoutSlash,
                                         Selector = matchType,
                                         Type = element.Type,
                                         ParameterValue = element.Parameter,
                                         ParameterMap = element.GetParameterMap(),
                                         Source = Info.System
                                     };
         }
         else
         {
             var endpointData = new EndpointData
                                {
                                    AccessRuleGroup = element.AccessRuleGroup,
                                    OriginalMatchText = originalMatchText,
                                    Text = matchText,
                                    TextWithoutSlash = withoutSlash,
                                    Selector = matchType,
                                    Type = element.Type,
                                    RequireSlash = element.RequireSlash,
                                    ParameterValue = element.Parameter,
                                    ParameterMap = element.GetParameterMap(),
                                    Source = Info.System
                                };
             endpointData.SubEndpointDataList = new EndpointDataList();
             foreach (EndpointElement subElement in element.SubEndpoints)
             {
                 String subWithoutSlash = EndpointData.GetTextWithoutSlash(matchText);
                 endpointData.SubEndpointDataList.Add(new EndpointData
                                                      {
                                                          Text = subElement.Text,
                                                          TextWithoutSlash = subWithoutSlash,
                                                          Selector = subElement.Selector,
                                                          Type = subElement.Type,
                                                          ParameterValue = subElement.Parameter,
                                                          ParameterMap = subElement.GetParameterMap(),
                                                          Source = Info.System
                                                      });
             }
             data.EndpointDataList.Add(endpointData);
         }
     }
     EndpointDataList handlerList = data.EndpointDataList.Clone();
     data.EndpointDataList = new EndpointDataList();
     handlerList.Where(p => p.Selector == SelectorType.PathEquals).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.EndsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.WebDomainPathStartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.WebDomainPathEquals).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.PathStartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.StartsWith).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.PathContains).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     handlerList.Where(p => p.Selector == SelectorType.Contains).OrderByDescending(p => p.Text.Length).ToList().ForEach(p => data.EndpointDataList.Add(p));
     //+
     data.EndpointDataList.OriginalCount = data.EndpointDataList.Count;
 }
 internal static void LoadComponentData(WebDomainData data, ComponentCollection componentCollection, String webDomainBasedOn)
 {
     List<ComponentElement> componentList = componentCollection.OrderBy(p => p.Priority).ToList();
     foreach (ComponentElement element in componentList)
     {
         ComponentData activeComponent = null;
         String componentType = element.ComponentType;
         String key = element.Key;
         ParameterDataList parameterDataList;
         //+ load
         if (String.IsNullOrEmpty(webDomainBasedOn))
         {
             parameterDataList = GetComponentParameterData(element.Parameters);
             //+
             activeComponent = new ComponentData
                               {
                                   ComponentType = componentType,
                                   Key = key,
                                   ParameterDataList = parameterDataList
                               };
             //+ No base
             data.ComponentDataList.Add(activeComponent);
         }
         else
         {
             //+ Has base
             ComponentElement newElement = element;
             //+ find new
             ComponentData existingData = data.ComponentDataList.FirstOrDefault(p => p.Key == key);
             componentType = existingData.ComponentType;
             activeComponent = existingData;
             if (existingData == null)
             {
                 continue;
             }
             if (String.IsNullOrEmpty(existingData.ComponentType))
             {
                 throw new InvalidOperationException(Resource.General_NotFound);
             }
             //+ copy new
             parameterDataList = existingData.ParameterDataList;
             if (newElement.Parameters.ResetCollection)
             {
                 parameterDataList = GetComponentParameterData(newElement.Parameters);
             }
             Boolean hasDifferentParameter = false;
             ComponentParameterCollection parameterCollection = newElement.Parameters;
             foreach (ParameterElement parameterElement in parameterCollection)
             {
                 ParameterData existingParameterData = parameterDataList.FirstOrDefault(p => p.Name == parameterElement.Name);
                 if (existingParameterData != null)
                 {
                     if (!parameterElement.Value.Equals(existingParameterData.Value))
                     {
                         hasDifferentParameter = true;
                     }
                     existingParameterData.Value = parameterElement.Value;
                 }
             }
             if (hasDifferentParameter)
             {
                 RemoveEachPartInstalledByComponent(data, key);
             }
         }
         //+
         try
         {
             var component = ObjectCreator.CreateAs<Component>(componentType);
             if (component == null)
             {
                 throw new EntityNotFoundException(String.Format(Resource.General_NotFound, componentType));
             }
             component.Key = key;
             //+
             if (component != null)
             {
                 if (!activeComponent.IsInstalled)
                 {
                     component.Connect(data.FactoryDataList, data.ProcessorDataList, data.EndpointDataList);
                     component.ParameterMap = parameterDataList.GetMap();
                     component.Register();
                     activeComponent.IsInstalled = true;
                 }
             }
         }
         catch (Exception ex)
         {
             if (WebProcessingReportController.Reporter.Initialized)
             {
                 var map = new Map();
                 map.Add("Section", "Component");
                 map.Add("Type", componentType);
                 map.Add("Message", ex.Message);
                 map.Add("Exception Type", ex.GetType().FullName);
                 //+
                 WebProcessingReportController.Reporter.AddMap(map);
             }
         }
     }
 }
 //+
 //- ~InitWebDomain -//
 internal static void InitWebDomain(String webDomainName, WebDomainElement webDomainElement, WebDomainDataList webDomainDataList)
 {
     //+ based on
     WebDomainData data = null;
     if (!webDomainElement.IsAbstract && webDomainName != Info.Root)
     {
         if (String.IsNullOrEmpty(webDomainElement.Path) && String.IsNullOrEmpty(webDomainElement.Subdomain))
         {
             throw new ConfigurationErrorsException(Resource.WebDomain_PathAndSubdomainNotFound);
         }
     }
     if (!String.IsNullOrEmpty(webDomainElement.BasedOn))
     {
         data = CopyWebDomain(webDomainElement.BasedOn.ToLower(CultureInfo.CurrentCulture), webDomainDataList);
         if (data == null)
         {
             throw new InvalidOperationException(String.Format(Resource.WebDomain_Invalid, webDomainElement.BasedOn));
         }
         data.BasedOn = webDomainElement.BasedOn;
         //++ non-subdomain web domain based on subdomain web domain?
         if (String.IsNullOrEmpty(webDomainElement.Subdomain) && !String.IsNullOrEmpty(data.Subdomain))
         {
             data.Subdomain = String.Empty;
         }
     }
     if (data == null)
     {
         data = new WebDomainData();
     }
     //++ important note:
     //++  there is no way to know if the person wants to set false or just didn't set it.
     //++  therefore, you cannot disable this setting in web domain inheritance.  You must
     //++  create the web domain fresh.
     data.CatchAllMode = webDomainElement.CatchAllMode;
     data.CatchAllInitParameter = webDomainElement.CatchAllInitParameter;
     data.Name = webDomainName;
     if (!String.IsNullOrEmpty(webDomainElement.AccessRuleGroup))
     {
         data.AccessRuleGroup = webDomainElement.AccessRuleGroup;
     }
     if (!String.IsNullOrEmpty(webDomainElement.Default))
     {
         DefaultType type;
         String parameter;
         String customParameter;
         ParseDefault(webDomainElement.Default, webDomainElement.DefaultParameter, out parameter, out type, out customParameter);
         //+
         if (String.IsNullOrEmpty(parameter))
         {
             parameter = webDomainElement.DefaultParameter;
         }
         if (!String.IsNullOrEmpty(customParameter))
         {
             data.CustomParameter = customParameter;
         }
         data.DefaultParameter = UrlCleaner.CleanWebPathHead(parameter);
         data.DefaultType = type;
     }
     if (webDomainName == Info.Root)
     {
         data.Path = String.Empty;
         data.Subdomain = String.Empty;
     }
     else
     {
         data.Path = UrlCleaner.CleanWebPath(webDomainElement.Path.ToLower(CultureInfo.CurrentCulture));
         data.Subdomain = webDomainElement.Subdomain;
     }
     data.IsSealed = webDomainElement.IsSealed;
     data.ProcessorDataList = new ProcessorDataList();
     data.FactoryDataList = new FactoryDataList();
     //+ parameter
     data.ParameterDataList = GetWebDomainParameterData(webDomainElement.Parameters);
     //+ reset
     ResetFlags flags = ResetFlagReader.Read(webDomainElement.ResetSeries);
     if (data.ComponentDataList == null || (flags & ResetFlags.Component) == ResetFlags.Component)
     {
         data.ComponentDataList = new ComponentDataList();
     }
     if (data.InitProcessorDataList == null || (flags & ResetFlags.Init) == ResetFlags.Init)
     {
         data.InitProcessorDataList = new InitProcessorDataList();
     }
     if (data.ErrorProcessorDataList == null || (flags & ResetFlags.Error) == ResetFlags.Error)
     {
         data.ErrorProcessorDataList = new ErrorProcessorDataList();
     }
     if (data.SelectionProcessorDataList == null || (flags & ResetFlags.Selection) == ResetFlags.Selection)
     {
         data.SelectionProcessorDataList = new SelectionProcessorDataList();
     }
     if (data.OverrideProcessorDataList == null || (flags & ResetFlags.Override) == ResetFlags.Override)
     {
         data.OverrideProcessorDataList = new OverrideProcessorDataList();
     }
     if (data.StateProcessorDataList == null || (flags & ResetFlags.State) == ResetFlags.State)
     {
         data.StateProcessorDataList = new StateProcessorDataList();
     }
     if (data.PostRenderProcessorDataList == null || (flags & ResetFlags.PostRender) == ResetFlags.PostRender)
     {
         data.PostRenderProcessorDataList = new PostRenderProcessorDataList();
     }
     if (data.HandlerFactoryDataList == null || (flags & ResetFlags.HandlerFactory) == ResetFlags.HandlerFactory)
     {
         data.HandlerFactoryDataList = new EndpointFactoryDataList();
     }
     if (data.ProcessorFactoryDataList == null || (flags & ResetFlags.ProcessorFactory) == ResetFlags.ProcessorFactory)
     {
         data.ProcessorFactoryDataList = new ProcessorFactoryDataList();
     }
     if (data.EndpointDataList == null || (flags & ResetFlags.Endpoint) == ResetFlags.Endpoint)
     {
         data.EndpointDataList = new EndpointDataList();
     }
     if (data.ObjectFactoryDataList == null || (flags & ResetFlags.ObjectFactory) == ResetFlags.ObjectFactory)
     {
         data.ObjectFactoryDataList = new ObjectFactoryDataList();
     }
     if (data.SecurityData == null || (flags & ResetFlags.Security) == ResetFlags.Security)
     {
         data.SecurityData = new SecurityData();
     }
     if (data.SecurityData.SecurityExceptionDataList == null)
     {
         data.SecurityData.SecurityExceptionDataList = new SecurityExceptionDataList();
     }
     if (data.CatchAllEndpoint == null)
     {
         data.CatchAllEndpoint = new EndpointData();
     }
     //+ rule
     //LoadAccessRuleData(data, webDomainElement.AccessRules);
     //+ component
     LoadComponentData(data, webDomainElement.Components, webDomainElement.BasedOn);
     //+ factory
     LoadFactoryData(data, webDomainElement.Factories);
     //+ processor
     LoadProcessorData(data, webDomainElement.Processors);
     //+ handler
     LoadEndpointData(data, webDomainElement.Endpoints);
     //+ favicon
     FaviconMode faviconMode = ProcessingSection.GetConfigSection().WebDomain.FaviconMode;
     switch (faviconMode)
     {
         case FaviconMode.PassThrough:
             data.EndpointDataList.Add(EndpointData.Create(SelectorType.EndsWith, "/Favicon.ico", "{ForcePassThrough}"));
             PassThroughHttpHandler.ForceUse = true;
             break;
         case FaviconMode.Exclusion:
             data.EndpointDataList.Add(EndpointData.Create(SelectorType.EndsWith, "/Favicon.ico", "{Exclusion}"));
             break;
     }
     data.EndpointDataList.Add(EndpointData.Create(SelectorType.Contains, "/WebResource.axd?d=", "{Exclusion}"));
     //+ security
     LoadSecurityData(data, webDomainElement.Security);
     //+
     webDomainDataList.Add(data);
 }