1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
18 using Castle
.MonoRail
.Framework
;
21 /// Bridge between the windsor controlled controller tree and
22 /// the monorail service provider.
24 public class ControllerTreeAccessor
: IControllerTree
26 private IControllerTree tree
;
29 /// Construct the controller tree accessor
31 public ControllerTreeAccessor()
33 tree
= ContainerAccessorUtil
.ObtainContainer().Resolve(typeof(IControllerTree
)) as IControllerTree
;
36 #region IControllerTree Members
39 /// Register a controller on the tree. If the specified
40 /// area name matches the current node, the controller is
41 /// register on the node itself, otherwise on the right or
45 /// Note that the controller is an <c>object</c>. That allows
46 /// different implementation of a controller factory to register
47 /// different representation of what a controller is (a name, a descriptor etc)
49 /// <param name="areaName">The area name, or <c>String.Empty</c></param>
50 /// <param name="controllerName">The controller name</param>
51 /// <param name="controller">The controller representation</param>
52 public void AddController(string areaName
, string controllerName
, Type controller
)
54 tree
.AddController(areaName
, controllerName
, controller
);
58 /// Returns a controller previously registered.
60 /// <param name="areaName">The area name, or <c>String.Empty</c></param>
61 /// <param name="controllerName">The controller name</param>
62 /// <returns>The controller representation or null</returns>
63 public Type
GetController(string areaName
, string controllerName
)
65 return tree
.GetController(areaName
, controllerName
);