KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jpublish > action > ActionManager


1 /*--
2
3  Copyright (C) 2001-2003 Aetrion LLC.
4  All rights reserved.
5  
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions
8  are met:
9  
10  1. Redistributions of source code must retain the above copyright
11     notice, this list of conditions, and the following disclaimer.
12  
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions, and the disclaimer that follows
15     these conditions in the documentation and/or other materials
16     provided with the distribution.
17
18  3. The name "JPublish" must not be used to endorse or promote products
19     derived from this software without prior written permission. For
20     written permission, please contact info@aetrion.com.
21  
22  4. Products derived from this software may not be called "JPublish", nor
23     may "JPublish" appear in their name, without prior written permission
24     from Aetrion LLC (info@aetrion.com).
25  
26  In addition, the authors of this software request (but do not require)
27  that you include in the end-user documentation provided with the
28  redistribution and/or in the software itself an acknowledgement equivalent
29  to the following:
30      "This product includes software developed by
31       Aetrion LLC (http://www.aetrion.com/)."
32
33  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
34  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
35  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
37  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43  POSSIBILITY OF SUCH DAMAGE.
44
45  For more information on JPublish, please see <http://www.jpublish.org/>.
46  
47  */

48
49 package org.jpublish.action;
50
51 import java.util.List JavaDoc;
52 import java.util.Map JavaDoc;
53
54 import org.jpublish.Manager;
55 import org.jpublish.RequestContext;
56
57 /**
58  * Class which manages all actions in the JPublish framework.
59  *
60  * @author Anthony Eden
61  */

62 public interface ActionManager extends Manager {
63
64     /**
65      * Get a Map of all defined actions.
66      *
67      * @return A Map of defined actions
68      */

69     public Map JavaDoc getDefinedActions();
70
71     /**
72      * Get a List of startup actions.
73      *
74      * @return List of startup actions
75      */

76     public List JavaDoc getStartupActions();
77
78     /**
79      * Get a List of shutdown actions.
80      *
81      * @return List of shutdown actions
82      */

83     public List JavaDoc getShutdownActions();
84
85     /**
86      * Get a List of global actions.
87      *
88      * @return List of global actions
89      */

90     public List JavaDoc getGlobalActions();
91
92     /**
93      * Get the List of path actions.
94      *
95      * @return The path actions
96      */

97     public List JavaDoc getPathActions();
98
99     /**
100      * Get the List of actions which are executed immediately upon receipt of any request. These actions are executed
101      * before a page search occurs.
102      *
103      * @return The pre-evaluation actions
104      */

105     public List JavaDoc getPreEvaluationActions();
106
107     /**
108      * Get the List of actions which are executed after the HTTP request has been completed, but before the response is
109      * sent back to the client.
110      *
111      * @return The post-evaluation actions
112      */

113     public List JavaDoc getPostEvaluationActions();
114
115     /**
116      * Execute all startup actions.
117      */

118     public void executeStartupActions();
119
120     /**
121      * Execute all shutdown actions.
122      */

123     public void executeShutdownActions();
124
125     /**
126      * Execute all global actions using the given context.
127      *
128      * @param context The current context
129      */

130     public void executeGlobalActions(RequestContext context);
131
132     /**
133      * Execute the path actions with the given context. If any of the actions sets the value redirect in the context
134      * then that signals that the servlet should redirect the request to the specified URL.
135      *
136      * @param path The request path
137      * @param context The current context
138      */

139     public void executePathActions(String JavaDoc path, RequestContext context);
140
141     /**
142      * Execute pre-evaluation actions. Pre-evaluation actions are only executed if their path argument matches the
143      * current path.
144      *
145      * <p><b>Note:</b> Since these actions are executed prior to locating the page the page variable is not in the
146      * context.
147      *
148      * <p>To stop processing and return immediately, set the value <code>stop-processing</code> in the context to a
149      * non-null value.
150      *
151      * @param path The request path
152      * @param context The current request context
153      * @return True if the processing should stop
154      */

155     public boolean executePreEvaluationActions(String JavaDoc path,
156             RequestContext context);
157
158     /**
159      * Execute post-evaluation actions.
160      *
161      * @param path The request path
162      * @param context The request context
163      */

164     public void executePostEvaluationActions(String JavaDoc path,
165             RequestContext context);
166
167     /**
168      * Execute the named action with the current context.
169      *
170      * @param name The action name
171      */

172     public void execute(String JavaDoc name);
173
174     /**
175      * Execute the named action with the given context.
176      *
177      * @param name The action name
178      * @param context The current context
179      */

180     public void execute(String JavaDoc name, RequestContext context);
181
182     /**
183      * Find an action with the given name. The name may be the name of an action registered with the ActionManager at
184      * startup, an action from a module, a partial file path rooted in the action root directory or a fully qualified
185      * Java class. If an action is not found then this method will throw an ActionNotFoundException.
186      *
187      * @param name The name of the action
188      * @return The action
189      * @throws ActionNotFoundException
190      */

191     public Action findAction(String JavaDoc name) throws ActionNotFoundException;
192
193 }
194
Popular Tags