01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.action.data;
06:
07: import org.apache.struts.action.ActionForm;
08: import org.apache.struts.action.ActionForward;
09: import org.apache.struts.action.ActionMapping;
10: import org.vfny.geoserver.action.ConfigAction;
11: import org.vfny.geoserver.config.DataConfig;
12: import org.vfny.geoserver.config.NameSpaceConfig;
13: import org.vfny.geoserver.form.data.DataNamespacesEditorForm;
14: import org.vfny.geoserver.global.UserContainer;
15: import java.io.IOException;
16: import javax.servlet.ServletException;
17: import javax.servlet.http.HttpServletRequest;
18: import javax.servlet.http.HttpServletResponse;
19:
20: /**
21: * DOCUMENT ME!
22: *
23: * @author rgould To change the template for this generated type comment go to
24: * Window>Preferences>Java>Code Generation>Code and Comments
25: */
26: public class DataNamespacesEditorAction extends ConfigAction {
27: public ActionForward execute(ActionMapping mapping,
28: ActionForm form, UserContainer user,
29: HttpServletRequest request, HttpServletResponse response)
30: throws IOException, ServletException {
31: DataNamespacesEditorForm namespacesForm = (DataNamespacesEditorForm) form;
32:
33: String URI = namespacesForm.getURI();
34: String prefix = namespacesForm.getPrefix();
35:
36: DataConfig dataConfig = (DataConfig) getDataConfig();
37: NameSpaceConfig config = null;
38:
39: config = getUserContainer(request).getNamespaceConfig();
40:
41: config.setPrefix(prefix);
42: config.setUri(URI);
43:
44: dataConfig.addNameSpace(prefix, config);
45: getApplicationState().notifyConfigChanged();
46:
47: return mapping.findForward("config.data.namespace");
48: }
49: }
|