Minor style changes
[castle.git] / MonoRail / Castle.MonoRail.Framework / IControllerLifecycleExecutor.cs
blob45b53947f743fcdffa6bce6009baedf4cfd7c1dc
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.Framework
17 using System;
18 using System.Collections;
20 /// <summary>
21 /// Manages the execution of a controller action.
22 /// <para>
23 /// The order of methods invocation is the following:
24 /// </para>
25 /// <para>
26 /// 1. InitializeController
27 /// </para>
28 /// <para>
29 /// 2. SelectAction
30 /// </para>
31 /// <para>
32 /// 3. RunStartRequestFilters (if false is returned - or an exception -
33 /// you might want to invoke PerformErrorHandling)
34 /// </para>
35 /// <para>
36 /// 4. ProcessSelectedAction
37 /// </para>
38 /// <para>
39 /// 5. Dispose
40 /// </para>
41 /// </summary>
42 public interface IControllerLifecycleExecutor : IDisposable
44 /// <summary>
45 /// Should bring the controller to an usable
46 /// state by populating its fields with values that
47 /// represent the current request
48 /// </summary>
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);
54 /// <summary>
55 /// Should resolve the action to be executed (method or dynamic
56 /// action) based on the parameters
57 /// </summary>
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);
63 /// <summary>
64 /// Should resolve the action to be executed (method or dynamic
65 /// action) based on the parameters and custom arguments
66 /// </summary>
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);
73 /// <summary>
74 /// Runs the action (or the dynamic action),
75 /// process the rescue or the view accordingly
76 /// to the process result.
77 /// </summary>
78 void ProcessSelectedAction();
80 /// <summary>
81 /// Runs the action (or the dynamic action),
82 /// process the rescue or the view accordingly
83 /// to the process result.
84 /// </summary>
85 /// <param name="actionArgs">Custom arguments</param>
86 void ProcessSelectedAction(IDictionary actionArgs);
88 /// <summary>
89 /// Should performs the rescue (if available), raise
90 /// the global error event and throw the exception
91 /// if the rescue was not found
92 /// </summary>
93 void PerformErrorHandling();
95 /// <summary>
96 /// Runs the start request filters.
97 /// </summary>
98 /// <returns><c>false</c> if the process should be stopped</returns>
99 bool RunStartRequestFilters();
101 /// <summary>
102 /// Gets the controller instance.
103 /// </summary>
104 /// <value>The controller.</value>
105 Controller Controller { get; }
107 /// <summary>
108 /// Gets a value indicating whether an error has happened during controller processing
109 /// </summary>
110 /// <value>
111 /// <see langword="true"/> if has error; otherwise, <see langword="false"/>.
112 /// </value>
113 bool HasError { get; }