1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.oness.common.webapp.controller.action;
17
18 import javax.servlet.http.HttpServletRequest;
19 import javax.servlet.http.HttpServletResponse;
20
21 import net.sf.oness.common.model.util.dbunit.DatabasePopulator;
22
23 import org.apache.struts.action.Action;
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27
28 /***
29 * Action that populates the database using the bean called "databasePopulator"
30 * in Spring Application Context
31 *
32 * @author Carlos Sanchez
33 * @version $Revision: 1.2 $
34 */
35 public class DatabasePopulatorAction extends Action {
36
37 private DatabasePopulator databasePopulator;
38
39 /***
40 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
41 * org.apache.struts.action.ActionForm,
42 * javax.servlet.http.HttpServletRequest,
43 * javax.servlet.http.HttpServletResponse)
44 */
45 public ActionForward execute(ActionMapping actionMapping,
46 ActionForm actionForm, HttpServletRequest servletRequest,
47 HttpServletResponse servletResponse) throws Exception {
48 if (databasePopulator == null)
49 databasePopulator = (DatabasePopulator) new SpringActionSupport(
50 servlet).getBean("databasePopulator");
51 databasePopulator.execute();
52 return actionMapping.findForward("success");
53 }
54
55 }