An object containing all of the meta data for all components/plugins registered
        public static Lazy<AbstractEditorController, EditorMetadata> GetEditorDashboardAction(
            this DashboardItemModel dashboard,
            ComponentRegistrations components,
            out MethodInfo action)
        {
            //we need to get the controller by name
            var parts = dashboard.ViewName.Split('.');
            if (parts.Length != 2)
                throw new FormatException("The string format for dashboard.ViewName for child actions must be: ControllerName.ActionName");
            var controllerName = parts[0];
            var controllerAction = parts[1];
            var editorController = components.EditorControllers
                .Where(x => x.Metadata.ControllerName == controllerName).SingleOrDefault();
            if (editorController == null)
                throw new ApplicationException("Could not find the Editor controller '" + controllerName);
            if (!editorController.Metadata.HasChildActionDashboards)
                throw new ApplicationException("The Editor controller '" + controllerName + "' is not advertising that it HasChildActionDashboards");
            //now we need to get the controller's referenced child action
            var childAction = editorController.Metadata.ComponentType.GetMethods()
                .Where(x => x.Name == controllerAction && x.GetCustomAttributes(typeof(ChildActionOnlyAttribute), false).Any())
                .SingleOrDefault();
            if (childAction == null)
                throw new ApplicationException("The Editor controller '" + controllerName + "' with Action: '" + controllerAction + "' could not be found or was not attributed with a ChildActionOnlyAttribute");

            action = childAction;
            return editorController;
        }
        /// <summary>
        /// Gets the surface controller meta data and a reference to the MethodInfo object for the ChildAction to render based on the 
        /// macro definition
        /// </summary>
        /// <param name="macro"></param>
        /// <param name="components"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static Lazy<SurfaceController, SurfaceMetadata> GetSurfaceMacroChildAction(
            this MacroDefinition macro, 
            ComponentRegistrations components,
            out MethodInfo action)
        {

            var parsedMacroName = MacroNameParser.ParseChildActionMacroName(macro.SelectedItem);            
            
            //get the surface controller for the area/controller name
            var surfaceController = components.SurfaceControllers
                .Where(x => x.Metadata.ControllerName == parsedMacroName.ControllerName
                    && (parsedMacroName.AreaName == "" || (x.Metadata.PluginDefinition != null && x.Metadata.PluginDefinition.PackageName == parsedMacroName.AreaName)))
                .SingleOrDefault();
            
            if (surfaceController == null)
                throw new ApplicationException("Could not find the Surface controller '" + parsedMacroName.ControllerName);
            if (!surfaceController.Metadata.HasChildActionMacros)
                throw new ApplicationException("The Surface controller '" + parsedMacroName.ControllerName + "' is not advertising that it HasChildActionMacros");
            //now we need to get the controller's referenced child action
            var childAction = surfaceController.Metadata.ComponentType.GetMethods()
                .Where(x => x.Name == parsedMacroName.ActionName && x.GetCustomAttributes(typeof(ChildActionOnlyAttribute), false).Any())
                .SingleOrDefault();
            if (childAction == null)
                throw new ApplicationException("The Surface controller '" + parsedMacroName.ControllerName + "' with Action: '" + parsedMacroName.ActionName + "' could not be found or was not attributed with a ChildActionOnlyAttribute");

            action = childAction;
            return surfaceController;
        }
        public RoutableRequestContext(IRebelApplicationContext applicationContext, ComponentRegistrations components, IRoutingEngine routingEngine)
        {
            Mandate.ParameterNotNull(applicationContext, "applicationContext");
            Mandate.ParameterNotNull(components, "components");
            Mandate.ParameterNotNull(routingEngine, "routingEngine");

            Application = applicationContext;
            RegisteredComponents = components;
            RoutingEngine = routingEngine;
        }
 /// <summary>
 /// Constructor using a specific RebelSettings object
 /// </summary>
 /// <param name="applicationContext"></param>
 /// <param name="componentRegistrar"></param>
 public RebelAreaRegistration(
     IRebelApplicationContext applicationContext,
     ComponentRegistrations componentRegistrar)
 {
     _applicationContext = applicationContext;
     _rebelSettings = _applicationContext.Settings;
     _componentRegistrar = componentRegistrar;
     _treeControllers = _componentRegistrar.TreeControllers;
     _editorControllers = _componentRegistrar.EditorControllers;
     _surfaceControllers = _componentRegistrar.SurfaceControllers;
 }
        public DefaultBackOfficeRequestContext(IRebelApplicationContext applicationContext,
            HttpContextBase httpContext,
            ComponentRegistrations components,
            IPackageContext packageContext,
            IRoutingEngine routingEngine)
            : base(applicationContext, components, routingEngine)
        {

            //create the IO resolvers
            var urlHelper = new UrlHelper(httpContext.Request.RequestContext);
            DocumentTypeIconResolver = new DocumentTypeIconFileResolver(httpContext.Server, applicationContext.Settings, urlHelper);
            DocumentTypeThumbnailResolver = new DocumentTypeThumbnailFileResolver(httpContext.Server, applicationContext.Settings, urlHelper);
            ApplicationIconResolver = new ApplicationIconFileResolver(httpContext.Server, applicationContext.Settings, urlHelper);

            PackageContext = packageContext;
        }
        public void InitTest()
        {

            Init();

            RenderModelFactory = FakeRenderModelFactory.CreateWithApp();
            var frontEndRouteHandler = new RenderRouteHandler(new TestControllerFactory(), RebelApplicationContext, RenderModelFactory);

            //register areas/routes...            

            RouteTable.Routes.Clear();

            var packageFolder = new DirectoryInfo(Path.Combine(Common.CurrentAssemblyDirectory, "App_Plugins", PluginManager.PackagesFolderName, "TestPackage"));

            Components = new ComponentRegistrations(new List<Lazy<MenuItem, MenuItemMetadata>>(),
                                                    PluginHelper.GetEditorMetadata(packageFolder),
                                                    PluginHelper.GetTreeMetadata(packageFolder),
                                                    PluginHelper.GetSurfaceMetadata(packageFolder),
                                                    new List<Lazy<AbstractTask, TaskMetadata>>(),
                                                    new List<Lazy<PropertyEditor, PropertyEditorMetadata>>(),
                                                    new List<Lazy<AbstractParameterEditor, ParameterEditorMetadata>>(),
                                                    new List<Lazy<DashboardMatchRule, DashboardRuleMetadata>>(),
                                                    new List<Lazy<DashboardFilter, DashboardRuleMetadata>>(),
                                                    new List<Lazy<Permission, PermissionMetadata>>(),
                                                    new List<Lazy<AbstractMacroEngine, MacroEngineMetadata>>());

            var componentRegistration = new PackageAreaRegistration(packageFolder, RebelApplicationContext, Components);
            var areaRegistration = new RebelAreaRegistration(RebelApplicationContext, Components);
            var installRegistration = new InstallAreaRegistration(RebelApplicationContext.Settings);

            var cmsBootstrapper = new CmsBootstrapper(RebelApplicationContext.Settings, areaRegistration, installRegistration, new[] { componentRegistration }, new DefaultAttributeTypeRegistry());
            var renderBootstrapper = new RenderBootstrapper(RebelApplicationContext, frontEndRouteHandler, RenderModelFactory);

            //bootstrappers setup the routes
            cmsBootstrapper.Boot(RouteTable.Routes);
            renderBootstrapper.Boot(RouteTable.Routes);

            RebelWebApplication.RegisterDefaultRoutes(RouteTable.Routes);
        }