01: /*
02: * Copyright 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.control;
17:
18: import java.io.IOException;
19:
20: import javax.servlet.ServletException;
21: import javax.servlet.http.HttpServletRequest;
22: import javax.servlet.http.HttpServletResponse;
23:
24: import de.odysseus.calyxo.base.ModuleContext;
25: import de.odysseus.calyxo.control.conf.ActionsConfig;
26:
27: public interface Module {
28:
29: /**
30: * Module scope key where {@link ActionsConfig} instance is stored
31: */
32: public static final String ACTIONS_CONFIG_KEY = "de.odysseus.calyxo.control.actions";
33:
34: /**
35: * Request scope key where the selected action path is stored.
36: */
37: public static final String ACTION_PATH_KEY = "de.odysseus.calyxo.control.action.path";
38:
39: /**
40: * Request scope key where the requested module path is stored.
41: * This path differs from the path of the selected action
42: * if it uses a pattern like <code>"/foo/*"</code>.
43: */
44: public static final String MODULE_PATH_KEY = "de.odysseus.calyxo.control.action.path.info";
45:
46: /**
47: * Initialize module.
48: * @param moduleContext our module context
49: */
50: public void init(ModuleContext moduleContext)
51: throws ServletException;
52:
53: /**
54: * Destroy module.
55: */
56: public void destroy();
57:
58: /**
59: * Process request.
60: * <p/>
61: * Invoke action and dispatch according to the result.
62: * @param request the request we are processing
63: * @param response the response we are creating
64: * @param path module path used to lookup action configuration
65: * @throws ServletException if action lookup fails or if action instantiation
66: * fails. Also exceptions passed through by the invoker are caught, wrapped
67: * and thrown.
68: * @throws IOException passed through from dispatcher
69: */
70: public void process(HttpServletRequest request,
71: HttpServletResponse response, String path)
72: throws ServletException, IOException;
73:
74: }
|