01: /*
02: * Created on Jan 28, 2004
03: *
04: * To change the template for this generated file go to
05: * Window - Preferences - Java - Code Generation - Code and Comments
06: */
07: package org.vfny.geoserver.action;
08:
09: import org.apache.struts.Globals;
10: import org.apache.struts.action.ActionError;
11: import org.apache.struts.action.ActionErrors;
12: import org.apache.struts.action.ActionForm;
13: import org.apache.struts.action.ActionForward;
14: import org.apache.struts.action.ActionMapping;
15: import org.vfny.geoserver.global.Data;
16: import org.vfny.geoserver.global.UserContainer;
17: import javax.servlet.http.HttpServletRequest;
18: import javax.servlet.http.HttpServletResponse;
19:
20: /**
21: * Free Locks held by each and every DataStore.
22: * <p>
23: * This represents an action that interacts with the running GeoServer
24: * application (it is not really a config action, it is just that I want the
25: * user to be logged in).
26: * </p>
27: * <p>
28: * This class is waiting on changes to the DataStore api before it will
29: * actually be useful.
30: * </p>
31: * @author Jody Garnett, Refractions Research, Inc.
32: * @author $Author: jive $ (last modification)
33: * @version $Id: FreeLocksAction.java 6177 2007-02-19 10:11:27Z aaime $
34: */
35: public class FreeLocksAction extends ConfigAction {
36: /* (non-Javadoc)
37: * @see org.vfny.geoserver.action.ConfigAction#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, org.vfny.geoserver.global.UserContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
38: */
39: public ActionForward execute(ActionMapping mapping,
40: ActionForm form, UserContainer user,
41: HttpServletRequest request, HttpServletResponse response)
42: throws Exception {
43: // WFS is only used to aquire the GeoServer
44: Data data = getWFS(request).getData();
45:
46: int count = data.lockReleaseAll();
47:
48: // Provide status message
49: //
50: ActionErrors errors = new ActionErrors();
51: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
52: "message.freeLocks", new Integer(count)));
53: request.setAttribute(Globals.ERROR_KEY, errors);
54:
55: // return back to the admin screen
56: //
57: return mapping.findForward("admin");
58: }
59: }
|