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
.Framework
18 using System
.Collections
;
21 /// Manages the execution of a controller action.
23 /// The order of methods invocation is the following:
26 /// 1. InitializeController
32 /// 3. RunStartRequestFilters (if false is returned - or an exception -
33 /// you might want to invoke PerformErrorHandling)
36 /// 4. ProcessSelectedAction
42 public interface IControllerLifecycleExecutor
: IDisposable
45 /// Should bring the controller to an usable
46 /// state by populating its fields with values that
47 /// represent the current request
49 /// <param name="action">The action name</param>
50 /// <param name="area">The area name</param>
51 /// <param name="controller">The controller name</param>
52 void InitializeController(string area
, string controller
, string action
);
55 /// Should resolve the action to be executed (method or dynamic
56 /// action) based on the parameters
58 /// <param name="action">The action name</param>
59 /// <param name="controller">The controller name</param>
60 /// <returns><c>true</c> if it was able to resolve it</returns>
61 bool SelectAction(string action
, string controller
);
64 /// Should resolve the action to be executed (method or dynamic
65 /// action) based on the parameters and custom arguments
67 /// <param name="action">The action name</param>
68 /// <param name="controller">The controller name</param>
69 /// <param name="actionArgs">Custom arguments</param>
70 /// <returns><c>true</c> if it was able to resolve it</returns>
71 bool SelectAction(string action
, string controller
, IDictionary actionArgs
);
74 /// Runs the action (or the dynamic action),
75 /// process the rescue or the view accordingly
76 /// to the process result.
78 void ProcessSelectedAction();
81 /// Runs the action (or the dynamic action),
82 /// process the rescue or the view accordingly
83 /// to the process result.
85 /// <param name="actionArgs">Custom arguments</param>
86 void ProcessSelectedAction(IDictionary actionArgs
);
89 /// Should performs the rescue (if available), raise
90 /// the global error event and throw the exception
91 /// if the rescue was not found
93 void PerformErrorHandling();
96 /// Runs the start request filters.
98 /// <returns><c>false</c> if the process should be stopped</returns>
99 bool RunStartRequestFilters();
102 /// Gets the controller instance.
104 /// <value>The controller.</value>
105 Controller Controller { get; }
108 /// Gets a value indicating whether an error has happened during controller processing
111 /// <see langword="true"/> if has error; otherwise, <see langword="false"/>.
113 bool HasError { get; }