Source Code Cross Referenced for ConfigAction.java in  » GIS » GeoServer » org » vfny » geoserver » action » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoServer » org.vfny.geoserver.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.vfny.geoserver.action;
006:
007:        import org.apache.struts.Globals;
008:        import org.apache.struts.action.ActionError;
009:        import org.apache.struts.action.ActionErrors;
010:        import org.apache.struts.action.ActionForm;
011:        import org.apache.struts.action.ActionForward;
012:        import org.apache.struts.action.ActionMapping;
013:        import org.vfny.geoserver.config.DataConfig;
014:        import org.vfny.geoserver.config.GlobalConfig;
015:        import org.vfny.geoserver.config.WCSConfig;
016:        import org.vfny.geoserver.config.WFSConfig;
017:        import org.vfny.geoserver.config.WMSConfig;
018:        import org.vfny.geoserver.config.validation.ValidationConfig;
019:        import org.vfny.geoserver.global.ApplicationState;
020:        import org.vfny.geoserver.global.Data;
021:        import org.vfny.geoserver.global.UserContainer;
022:        import javax.servlet.http.HttpServletRequest;
023:        import javax.servlet.http.HttpServletResponse;
024:
025:        /**
026:         * GeoConfigAction is a common super class used by STRUTS Actions.
027:         *
028:         * <p>
029:         * ConfigAction is used to store shared services, such as looking up the
030:         * Configuration Model.
031:         * </p>
032:         * Capabilities:
033:         *
034:         * <ul>
035:         * <li>
036:         * Config (Model) Access: Convience routines have been writen to allow access
037:         * to the Config Model from the Web Container.
038:         * </li>
039:         * <li>Since configuraiton should only be attempted when logged in, an effort has been made to smooth the
040:         * required login check required by most geoserver config actions.
041:         * </li>
042:         * </ul>
043:         * <p>
044:         * Most config actions require the follow check to be made:
045:         * <pre><code>
046:         * <b>class</b> MyConfigAction <b>extends</b> ConfigAction {
047:         *   Redirect execute( HttpServletRequest request, ){
048:         *     <b>if</b>( !isLoggedIn( request )){
049:         *       return new Redirect(�Login Page�);
050:         *     }
051:         *     UserContainer user = getUserContainer( request );
052:         *     �
053:         *     <b>return new</b> Redirect(�my.jsp�);
054:         *   }
055:         * }
056:         * </code></pre>
057:         * </p>
058:         * <p>
059:         * To prevent the duplication of the above code in each and every config
060:         * action pleaes make use of the alternate execute method:
061:         * <pre><code>
062:         * <b>class</b> MyConfigAction <b>extends</b> ConfigAction {
063:         *   Redirect execute( UserContainer user, HttpServletRequest request ){
064:         *     �
065:         *     <b>return new</b> Redirect(�my.jsp�);
066:         *   }
067:         * }
068:         * </code></pre>
069:         * </p>
070:         * Please remember that Actions (like servlets) should never make use of
071:         * instance variables in order to remain thread-safe.
072:         * </p>
073:         *
074:         * @author Jody Garnett, Refractions Research, Inc.
075:         * @author jive
076:         * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
077:         * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
078:         * @version $Id: ConfigAction.java 6958 2007-06-08 16:20:59Z aaime $
079:         */
080:        public class ConfigAction extends GeoServerAction {
081:            /**
082:             * Execute method that redirects user if not loggin in.
083:             * <p>
084:             * The UserContainer is gathered from the session context using the
085:             * GeoServerAction.getUserContainer( request method ).
086:             * </p>
087:             * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
088:             */
089:            public ActionForward execute(ActionMapping mapping,
090:                    ActionForm form, HttpServletRequest request,
091:                    HttpServletResponse response) throws Exception {
092:                //        if (!isLoggedIn(request)) {
093:                //            ActionErrors errors = new ActionErrors();
094:                //            errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login.required"));
095:                //            request.setAttribute(Globals.ERROR_KEY, errors);
096:                //            request.setAttribute("forward", mapping.getForward());
097:                //
098:                //            return mapping.findForward("login");
099:                //        }
100:                return execute(mapping, form, getUserContainer(request),
101:                        request, response);
102:            }
103:
104:            /**
105:             * A "safe" execute method, only called after the user has logged in.
106:             * <p>
107:             * You may still override the normal execute method if you do not require
108:             * this service.
109:             * </p>
110:             */
111:            public ActionForward execute(ActionMapping mapping,
112:                    ActionForm form, UserContainer user,
113:                    HttpServletRequest request, HttpServletResponse response)
114:                    throws Exception {
115:                return null;
116:            }
117:
118:            /**
119:             * Access Web Map Server Configuration Model from the WebContainer.
120:             *
121:             * <p>
122:             * Note that this represents the Configuration and not the state of the Web
123:             * Feature Server.
124:             * </p>
125:             *
126:             * @return Configuration information for the Web Map Server
127:             */
128:            protected WMSConfig getWMSConfig() {
129:                return (WMSConfig) getServlet().getServletContext()
130:                        .getAttribute(WMSConfig.CONFIG_KEY);
131:            }
132:
133:            /**
134:             * Access Web Feature Server Configuration Model from the WebContainer.
135:             *
136:             * <p>
137:             * Note that this represents the Configuration and not the state of the Web
138:             * Feature Server.
139:             * </p>
140:             *
141:             * @return Configuration information for Web Feature Server
142:             */
143:            protected WFSConfig getWFSConfig() {
144:                return (WFSConfig) getServlet().getServletContext()
145:                        .getAttribute(WFSConfig.CONFIG_KEY);
146:            }
147:
148:            /**
149:             * Access Web Coverage Server Configuration Model from the WebContainer.
150:             *
151:             * <p>
152:             * Note that this represents the Configuration and not the state of the Web
153:             * Coverage Server.
154:             * </p>
155:             *
156:             * @return Configuration information for Web Coverage Server
157:             */
158:            protected WCSConfig getWCSConfig() {
159:                return (WCSConfig) getServlet().getServletContext()
160:                        .getAttribute(WCSConfig.CONFIG_KEY);
161:            }
162:
163:            /**
164:             * Access Web Map Server Configuration Model from the WebContainer.
165:             *
166:             * @return Configuration model for Global information.
167:             */
168:            protected GlobalConfig getGlobalConfig() {
169:                return (GlobalConfig) getServlet().getServletContext()
170:                        .getAttribute(GlobalConfig.CONFIG_KEY);
171:            }
172:
173:            /**
174:             * Access Catalog Configuration Model from the WebContainer.
175:             *
176:             * @return Configuration model for Catalog information.
177:             */
178:            protected DataConfig getDataConfig() {
179:                return (DataConfig) getServlet().getServletContext()
180:                        .getAttribute(DataConfig.CONFIG_KEY);
181:            }
182:
183:            /**
184:             * Access Catalog Model from the WebContainer.
185:             *
186:             * @return Configuration model for Catalog information.
187:             */
188:            protected Data getData() {
189:                return (Data) getServlet().getServletContext().getAttribute(
190:                        Data.WEB_CONTAINER_KEY);
191:            }
192:
193:            /**
194:             * Access Catalog Configuration Model from the WebContainer.
195:             *
196:             * @return Configuration model for Catalog information.
197:             */
198:            protected ValidationConfig getValidationConfig() {
199:                return (ValidationConfig) getServlet().getServletContext()
200:                        .getAttribute(ValidationConfig.CONFIG_KEY);
201:            }
202:
203:            /**
204:             * Access Catalog Configuration Model from the WebContainer.
205:             *
206:             * @return Configuration model for Catalog information.
207:             */
208:            protected ApplicationState getApplicationState() {
209:                return (ApplicationState) getServlet().getServletContext()
210:                        .getAttribute(ApplicationState.WEB_CONTAINER_KEY);
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.