Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / MonoRail / Castle.MonoRail.WindsorExtension / ControllerTreeAccessor.cs
blob3168a362b75e1ebdfb10510a373044c69aa7b415
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.WindsorExtension
17 using System;
18 using Castle.MonoRail.Framework;
19 using Castle.MonoRail.Framework.Services;
21 /// <summary>
22 /// Bridge between the windsor controlled controller tree and
23 /// the monorail service provider.
24 /// </summary>
25 public class ControllerTreeAccessor : IControllerTree
27 private IControllerTree tree;
29 /// <summary>
30 /// Construct the controller tree accessor
31 /// </summary>
32 public ControllerTreeAccessor()
34 tree = WindsorContainerAccessorUtil.ObtainContainer().Resolve(typeof(IControllerTree)) as IControllerTree;
37 #region IControllerTree Members
39 /// <summary>
40 /// Register a controller on the tree. If the specified
41 /// area name matches the current node, the controller is
42 /// register on the node itself, otherwise on the right or
43 /// on the left node.
44 /// </summary>
45 /// <remarks>
46 /// Note that the controller is an <c>object</c>. That allows
47 /// different implementation of a controller factory to register
48 /// different representation of what a controller is (a name, a descriptor etc)
49 /// </remarks>
50 /// <param name="areaName">The area name, or <c>String.Empty</c></param>
51 /// <param name="controllerName">The controller name</param>
52 /// <param name="controller">The controller representation</param>
53 public void AddController(string areaName, string controllerName, Type controller)
55 tree.AddController(areaName, controllerName, controller);
58 /// <summary>
59 /// Returns a controller previously registered.
60 /// </summary>
61 /// <param name="areaName">The area name, or <c>String.Empty</c></param>
62 /// <param name="controllerName">The controller name</param>
63 /// <returns>The controller representation or null</returns>
64 public Type GetController(string areaName, string controllerName)
66 return tree.GetController(areaName, controllerName);
70 public event EventHandler<ControllerAddedEventArgs> ControllerAdded {
71 add {
72 tree.ControllerAdded += value;
74 remove {
75 tree.ControllerAdded -= value;
79 #endregion