From fec2e0eb6e6287fd49d25bdda53db10f373fdec7 Mon Sep 17 00:00:00 2001 From: sgay Date: Thu, 26 Jul 2012 12:56:41 -0200 Subject: [PATCH] rename routing 'resolvers' to 'lookups' --- src/Umbraco.Web/PluginResolverExtensions.cs | 10 +++---- src/Umbraco.Web/Routing/DocumentRequest.cs | 30 ++++++++++----------- src/Umbraco.Web/Routing/RoutingContext.cs | 6 ++--- src/Umbraco.Web/Umbraco.Web.csproj | 18 ++++++------- src/Umbraco.Web/UmbracoApplication.cs | 2 +- src/Umbraco.Web/UmbracoModule.cs | 6 ++--- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Umbraco.Web/PluginResolverExtensions.cs b/src/Umbraco.Web/PluginResolverExtensions.cs index 3d4eaff11a..d480e3ec91 100644 --- a/src/Umbraco.Web/PluginResolverExtensions.cs +++ b/src/Umbraco.Web/PluginResolverExtensions.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web public static class PluginResolverExtensions { - private static volatile IEnumerable _lookups; + private static volatile IEnumerable _lookups; private static readonly object Locker = new object(); /// @@ -21,7 +21,7 @@ namespace Umbraco.Web /// /// /// - internal static IEnumerable ResolveLookups(this PluginResolver plugins) + internal static IEnumerable ResolveLookups(this PluginResolver plugins) { if (_lookups == null) { @@ -29,13 +29,13 @@ namespace Umbraco.Web { if (_lookups == null) { - var lookupTypes = TypeFinder.FindClassesOfType(); - var lookups = new List(); + var lookupTypes = TypeFinder.FindClassesOfType(); + var lookups = new List(); foreach (var l in lookupTypes) { try { - var typeInstance = Activator.CreateInstance(l) as IRequestDocumentResolver; + var typeInstance = Activator.CreateInstance(l) as IDocumentLookup; lookups.Add(typeInstance); } catch (Exception ex) diff --git a/src/Umbraco.Web/Routing/DocumentRequest.cs b/src/Umbraco.Web/Routing/DocumentRequest.cs index d02d95c793..d9b450b2a5 100644 --- a/src/Umbraco.Web/Routing/DocumentRequest.cs +++ b/src/Umbraco.Web/Routing/DocumentRequest.cs @@ -140,15 +140,15 @@ namespace Umbraco.Web.Routing #endregion - #region Resolve + #region Lookup /// /// Determines the site root (if any) matching the http request. /// /// A value indicating whether a domain was found. - public bool ResolveDomain() + public bool LookupDomain() { - const string tracePrefix = "ResolveDomain: "; + const string tracePrefix = "LookupDomain: "; // note - we are not handling schemes nor ports here. @@ -193,17 +193,17 @@ namespace Umbraco.Web.Routing /// Determines the Umbraco document (if any) matching the http request. /// /// A value indicating whether a document and template nave been found. - public bool ResolveDocument() + public bool LookupDocument() { - const string tracePrefix = "ResolveDocument: "; + const string tracePrefix = "LookupDocument: "; Trace.TraceInformation("{0}Path=\"{1}\"", tracePrefix, this.Uri.AbsolutePath); // look for the document // the first successful resolver, if any, will set this.Node, and may also set this.Template // some lookups may implement caching Trace.TraceInformation("{0}Begin resolvers", tracePrefix); - var resolvers = RoutingContext.RequestDocumentResolversResolver.RequestDocumentResolvers; - resolvers.Any(resolver => resolver.TrySetDocument(this)); + var lookups = RoutingContext.DocumentLookupsResolver.DocumentLookups; + lookups.Any(lookup => lookup.TrySetDocument(this)); Trace.TraceInformation("{0}End resolvers, {1}", tracePrefix, (this.HasNode ? "a document was found" : "no document was found")); // fixme - not handling umbracoRedirect @@ -211,7 +211,7 @@ namespace Umbraco.Web.Routing // so after ResolveDocument2() => docreq.IsRedirect => handled by the module! // handle not-found, redirects, access, template - ResolveDocument2(); + LookupDocument2(); // handle umbracoRedirect (moved from umbraco.page) FollowRedirect(); @@ -224,9 +224,9 @@ namespace Umbraco.Web.Routing /// Performs the document resolution second pass. /// /// The second pass consists in handling "not found", internal redirects, access validation, and template. - void ResolveDocument2() + void LookupDocument2() { - const string tracePrefix = "ResolveDocument2: "; + const string tracePrefix = "LookupDocument2: "; // handle "not found", follow internal redirects, validate access, template // because these might loop, we have to have some sort of infinite loop detection @@ -240,10 +240,10 @@ namespace Umbraco.Web.Routing if (!this.HasNode) { this.Is404 = true; - Trace.TraceInformation("{0}No document, try notFound lookup", tracePrefix); + Trace.TraceInformation("{0}No document, try last chance lookup", tracePrefix); // if it fails then give up, there isn't much more that we can do - var lastChance = RoutingContext.RequestDocumentResolversResolver.RequestDocumentLastChanceResolver; + var lastChance = RoutingContext.DocumentLookupsResolver.DocumentLastChanceLookup; if (lastChance == null || !lastChance.TrySetDocument(this)) { Trace.TraceInformation("{0}Failed to find a document, give up", tracePrefix); @@ -267,7 +267,7 @@ namespace Umbraco.Web.Routing // resolve template if (this.HasNode) - ResolveTemplate(); + LookupTemplate(); // loop while we don't have page, ie the redirect or access // got us to nowhere and now we need to run the notFoundLookup again @@ -384,9 +384,9 @@ namespace Umbraco.Web.Routing /// /// Resolves a template for the current node. /// - void ResolveTemplate() + void LookupTemplate() { - const string tracePrefix = "ResolveTemplate: "; + const string tracePrefix = "LookupTemplate: "; if (this.Node == null) throw new InvalidOperationException("There is no node."); diff --git a/src/Umbraco.Web/Routing/RoutingContext.cs b/src/Umbraco.Web/Routing/RoutingContext.cs index 33ecdbcd42..19aa35fea8 100644 --- a/src/Umbraco.Web/Routing/RoutingContext.cs +++ b/src/Umbraco.Web/Routing/RoutingContext.cs @@ -12,18 +12,18 @@ namespace Umbraco.Web.Routing { public RoutingContext( UmbracoContext umbracoContext, - RequestDocumentResolversResolver requestDocumentResolversResolver, + DocumentLookupsResolver documentLookupsResolver, ContentStore contentStore, NiceUrlProvider niceUrlResolver) { this.UmbracoContext = umbracoContext; - this.RequestDocumentResolversResolver = requestDocumentResolversResolver; + this.DocumentLookupsResolver = documentLookupsResolver; this.ContentStore = contentStore; this.NiceUrlProvider = niceUrlResolver; } public UmbracoContext UmbracoContext { get; private set; } - public RequestDocumentResolversResolver RequestDocumentResolversResolver { get; private set; } + public DocumentLookupsResolver DocumentLookupsResolver { get; private set; } public ContentStore ContentStore { get; private set; } public NiceUrlProvider NiceUrlProvider { get; private set; } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 73874de594..1488af6b52 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -243,17 +243,17 @@ - + - - + + - - - - - - + + + + + + diff --git a/src/Umbraco.Web/UmbracoApplication.cs b/src/Umbraco.Web/UmbracoApplication.cs index 53447f4698..dfa0f90248 100644 --- a/src/Umbraco.Web/UmbracoApplication.cs +++ b/src/Umbraco.Web/UmbracoApplication.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web }; // create the resolvers - RequestDocumentResolversResolver.Current = new RequestDocumentResolversResolver(ApplicationContext.Current.Plugins.ResolveLookups(), new ResolveLastChance()); + DocumentLookupsResolver.Current = new DocumentLookupsResolver(ApplicationContext.Current.Plugins.ResolveLookups(), new DefaultLastChanceLookup()); RoutesCacheResolver.Current = new RoutesCacheResolver(new DefaultRoutesCache()); Umbraco.Core.Resolving.Resolution.Freeze(); diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 49a8f2cc67..3505f497bb 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web //create the RoutingContext (one per http request) var routingContext = new RoutingContext( umbracoContext, - RequestDocumentResolversResolver.Current, + DocumentLookupsResolver.Current, contentStore, niceUrls); // NOT HERE BUT SEE **THERE** BELOW @@ -106,11 +106,11 @@ namespace Umbraco.Web //**THERE** we should create the doc request // before, we're not sure we handling a doc request - docreq.ResolveDomain(); + docreq.LookupDomain(); if (docreq.IsRedirect) httpContext.Response.Redirect(docreq.RedirectUrl, true); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = docreq.Culture; - docreq.ResolveDocument(); + docreq.LookupDocument(); if (docreq.IsRedirect) httpContext.Response.Redirect(docreq.RedirectUrl, true);