Source Code Cross Referenced for UserContainer.java in  » GIS » GeoServer » org » vfny » geoserver » global » 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.global 
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.global;
006:
007:        import org.geotools.coverage.grid.GridCoverage2D;
008:        import org.geotools.data.DataStore;
009:        import org.geotools.feature.AttributeType;
010:        import org.geotools.feature.FeatureType;
011:        import org.opengis.coverage.grid.*;
012:        import org.vfny.geoserver.config.AttributeTypeInfoConfig;
013:        import org.vfny.geoserver.config.CoverageConfig;
014:        import org.vfny.geoserver.config.CoverageStoreConfig;
015:        import org.vfny.geoserver.config.DataStoreConfig;
016:        import org.vfny.geoserver.config.FeatureTypeConfig;
017:        import org.vfny.geoserver.config.NameSpaceConfig;
018:        import org.vfny.geoserver.config.StyleConfig;
019:        import java.util.Locale;
020:        import javax.servlet.http.HttpSessionBindingEvent;
021:        import javax.servlet.http.HttpSessionBindingListener;
022:
023:        /**
024:         * Represents a User for GeoServer.
025:         *
026:         * <p>
027:         * Used as a typesafe Session container. This is an alternative to using calls
028:         * to request.getAttributes( key ) and casting.
029:         * </p>
030:         *
031:         * <p>
032:         * The User object is saved in session scope by ConfigAction:
033:         * </p>
034:         * <pre><code>
035:         * HttpSession session = request.getSession();
036:         * User user = request.getAttributes( UserContainer.WEB_CONTAINER_KEY );
037:         * if( user == null ){
038:         *     user = new UserContainer( request.getLocal() );
039:         *     session.setAttributes( UserContainer.WEB_CONTAINER_KEY, user );
040:         * }
041:         * </code></pre>
042:         *
043:         * <p>
044:         * This class is based on the UserContainer class outlined in the book
045:         * "Programming Jakarta Struts" by Chuck Cavaness.
046:         * </p>
047:         *
048:         * @author jgarnett, Refractions Research, Inc.
049:         * @author $Author: jive $ (last modification)
050:         * @version $Id: UserContainer.java 6326 2007-03-15 18:36:40Z jdeolive $
051:         */
052:        public class UserContainer implements  HttpSessionBindingListener {
053:            public final static String SESSION_KEY = "GEOSERVER.USER";
054:
055:            /** User name for this user */
056:            private String username;
057:
058:            /** User's locale */
059:            private Locale locale;
060:
061:            /**
062:             * Selected dataFormatId
063:             *
064:             */
065:            private String dataFormatID;
066:
067:            /**
068:            /** Selected dataStoreId */
069:            private String dataStoreID;
070:
071:            /** Selected prefix */
072:            private String prefix;
073:
074:            /**
075:             * Selected CoverageStoreConfig held in session for creation/editing.
076:             *
077:             */
078:            private CoverageStoreConfig dataFormatConfig;
079:
080:            /**
081:             * Selected DataStoreConfig held in session for creation/editing.
082:             */
083:            private DataStoreConfig dataStoreConfig;
084:
085:            /**
086:             * Cached Format being worked on.
087:             *
088:             * <p>
089:             * This should agree with the value of dataFormatConfig.
090:             * </p>
091:             *
092:             */
093:            private Format dataFormat;
094:
095:            /**
096:             * Cached DataStore being worked on.
097:             *
098:             * <p>
099:             * This should agree with the value of dataStoreConfig.
100:             * </p>
101:             */
102:            private DataStore dataStore;
103:
104:            /**
105:             * Cached NamespaceConfig held in session for creation/editing.
106:             */
107:            private NameSpaceConfig namespaceConfig;
108:
109:            /** Selected styleId */
110:            private StyleConfig style;
111:
112:            /**
113:             * Selected FeatureType Config held in session for editing/creation.
114:             *
115:             * <p>
116:             * Pending: Make change over to UserContainer.
117:             * </p>
118:             */
119:            private FeatureTypeConfig featureTypeConfig;
120:
121:            /**
122:             *
123:             */
124:            private CoverageConfig coverageConfig;
125:
126:            /**
127:             * Cached FeatureType being worked on.
128:             *
129:             * <p>
130:             * This should agree with the value of featureTypeConfig.
131:             * </p>
132:             *
133:             * <p></p>
134:             */
135:            private FeatureType featureType;
136:
137:            /**
138:             *
139:             */
140:            private GridCoverage2D coverage;
141:
142:            /**
143:             * Selected AttributeType being worked on.
144:             *
145:             * <p>
146:             * Pending: Make change over to User Container.
147:             * </p>
148:             *
149:             * <p></p>
150:             */
151:            private AttributeTypeInfoConfig attributeTypeConfig;
152:
153:            /**
154:             * Cached AttributeType being worked on.
155:             *
156:             * <p>
157:             * This should agree with the value of attributeTypeConfig.
158:             * </p>
159:             *
160:             * <p></p>
161:             */
162:            private AttributeType attributeType;
163:
164:            /**
165:             * New DataStore info before it is added to DataConfig.
166:             *
167:             * <p>
168:             * Unlike the DataStores in DataConfig this one does not yet have to work.
169:             * </p>
170:             */
171:            private DataStoreConfig newDataStore;
172:
173:            /**
174:             * Create User Container for the current locale
175:             */
176:            public UserContainer() {
177:                this (Locale.getDefault());
178:            }
179:
180:            /**
181:             * Create User Container for the provided locale
182:             *
183:             * @param local DOCUMENT ME!
184:             */
185:            public UserContainer(Locale local) {
186:            }
187:
188:            /**
189:             * User's Locale.
190:             *
191:             * <p>
192:             * Used to format messages. Should be used in conjunction with
193:             * internatalization support.
194:             * </p>
195:             *
196:             * @return Locale for the User.
197:             */
198:            public Locale getLocale() {
199:                return locale;
200:            }
201:
202:            /**
203:             * Set the user's Locale.
204:             *
205:             * @param locale User's locale.
206:             */
207:            public void setLocale(Locale locale) {
208:                this .locale = locale;
209:            }
210:
211:            /**
212:             * Session callback.
213:             *
214:             * @param arg0
215:             *
216:             * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
217:             */
218:            public void valueBound(HttpSessionBindingEvent arg0) {
219:                // not needed
220:            }
221:
222:            /**
223:             * Clean up user resources when unbound from session.
224:             *
225:             * @param arg0
226:             *
227:             * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
228:             */
229:            public void valueUnbound(HttpSessionBindingEvent arg0) {
230:                cleanUp();
231:            }
232:
233:            /**
234:             * Clean up user resources.
235:             */
236:            private void cleanUp() {
237:                locale = null;
238:                dataStoreID = null;
239:            }
240:
241:            /**
242:             * Access attributeType property.
243:             *
244:             * @return Returns the attributeType.
245:             */
246:            public AttributeType getAttributeType() {
247:                return attributeType;
248:            }
249:
250:            /**
251:             * Set attributeType to attributeType.
252:             *
253:             * @param attributeType The attributeType to set.
254:             */
255:            public void setAttributeType(AttributeType attributeType) {
256:                this .attributeType = attributeType;
257:            }
258:
259:            /**
260:             * Access attributeTypeConfig property.
261:             *
262:             * @return Returns the attributeTypeConfig.
263:             */
264:            public AttributeTypeInfoConfig getAttributeTypeConfig() {
265:                return attributeTypeConfig;
266:            }
267:
268:            /**
269:             * Set attributeTypeConfig to attributeTypeConfig.
270:             *
271:             * @param attributeTypeConfig The attributeTypeConfig to set.
272:             */
273:            public void setAttributeTypeConfig(
274:                    AttributeTypeInfoConfig attributeTypeConfig) {
275:                this .attributeTypeConfig = attributeTypeConfig;
276:            }
277:
278:            /**
279:             * Access dataStore property.
280:             *
281:             * @return Returns the dataStore.
282:             */
283:            public DataStore getDataStore() {
284:                return dataStore;
285:            }
286:
287:            /**
288:             * Set dataStore to dataStore.
289:             *
290:             * @param dataStore The dataStore to set.
291:             */
292:            public void setDataStore(DataStore dataStore) {
293:                this .dataStore = dataStore;
294:            }
295:
296:            /**
297:             * Access dataStoreConfig property.
298:             *
299:             * @return Returns the dataStoreConfig.
300:             */
301:            public DataStoreConfig getDataStoreConfig() {
302:                return dataStoreConfig;
303:            }
304:
305:            /**
306:             * Set dataStoreConfig to dataStoreConfig.
307:             *
308:             * @param dataStoreConfig The dataStoreConfig to set.
309:             */
310:            public void setDataStoreConfig(DataStoreConfig dataStoreConfig) {
311:                this .dataStoreConfig = dataStoreConfig;
312:            }
313:
314:            /**
315:             * Access dataStoreID property.
316:             *
317:             * @return Returns the dataStoreID.
318:             */
319:            public String getDataStoreID() {
320:                return dataStoreConfig.getId();
321:            }
322:
323:            /**
324:             * Access featureType property.
325:             *
326:             * @return Returns the featureType.
327:             */
328:            public FeatureType getFeatureType() {
329:                return featureType;
330:            }
331:
332:            /**
333:             * Access featureTypeConfig property.
334:             *
335:             * @return Returns the featureTypeConfig.
336:             */
337:            public FeatureTypeConfig getFeatureTypeConfig() {
338:                return featureTypeConfig;
339:            }
340:
341:            /**
342:             * Access newDataStore property.
343:             *
344:             * @return Returns the newDataStore.
345:             */
346:            public DataStoreConfig getNewDataStore() {
347:                return newDataStore;
348:            }
349:
350:            /**
351:             * Set newDataStore to newDataStore.
352:             *
353:             * @param newDataStore The newDataStore to set.
354:             */
355:            public void setNewDataStore(DataStoreConfig newDataStore) {
356:                this .newDataStore = newDataStore;
357:            }
358:
359:            /**
360:             * Access username property.
361:             *
362:             * @return Returns the username.
363:             */
364:            public String getUsername() {
365:                return username;
366:            }
367:
368:            /**
369:             * Set username to username.
370:             *
371:             * @param username The username to set.
372:             */
373:            public void setUsername(String username) {
374:                this .username = username;
375:            }
376:
377:            /**
378:             * Set dataStoreID to dataStoreID.
379:             *
380:             * @param dataStoreID The dataStoreID to set.
381:             */
382:            public void setDataStoreID(String dataStoreID) {
383:                this .dataStoreID = dataStoreID;
384:            }
385:
386:            /**
387:             * Set featureType to featureType.
388:             *
389:             * @param featureType The featureType to set.
390:             */
391:            public void setFeatureType(FeatureType featureType) {
392:                this .featureType = featureType;
393:            }
394:
395:            /**
396:             * Set featureTypeConfig to featureTypeConfig.
397:             *
398:             * @param featureTypeConfig The featureTypeConfig to set.
399:             */
400:            public void setFeatureTypeConfig(FeatureTypeConfig featureTypeConfig) {
401:                this .featureTypeConfig = featureTypeConfig;
402:            }
403:
404:            /**
405:             * Access namespaceConfig property.
406:             *
407:             * @return Returns the namespaceConfig.
408:             */
409:            public NameSpaceConfig getNamespaceConfig() {
410:                return namespaceConfig;
411:            }
412:
413:            /**
414:             * Set namespaceConfig to namespaceConfig.
415:             *
416:             * @param namespaceConfig The namespaceConfig to set.
417:             */
418:            public void setNamespaceConfig(NameSpaceConfig namespaceConfig) {
419:                this .namespaceConfig = namespaceConfig;
420:            }
421:
422:            /**
423:             * Access prefix property.
424:             *
425:             * @return Returns the prefix.
426:             */
427:            public String getPrefix() {
428:                return prefix;
429:            }
430:
431:            /**
432:             * Set prefix to prefix.
433:             *
434:             * @param prefix The prefix to set.
435:             */
436:            public void setPrefix(String prefix) {
437:                this .prefix = prefix;
438:            }
439:
440:            /**
441:             * Access style property.
442:             *
443:             * @return Returns the style.
444:             */
445:            public StyleConfig getStyle() {
446:                return style;
447:            }
448:
449:            /**
450:             * Set style to style.
451:             *
452:             * @param style The style to set.
453:             */
454:            public void setStyle(StyleConfig style) {
455:                this .style = style;
456:            }
457:
458:            /**
459:             * @return Returns the dataFormat.
460:             *
461:             */
462:            public Format getDataFormat() {
463:                return dataFormat;
464:            }
465:
466:            /**
467:             * @param dataFormat The dataFormat to set.
468:             *
469:             */
470:            public void setDataFormat(Format dataFormat) {
471:                this .dataFormat = dataFormat;
472:            }
473:
474:            /**
475:             * @return Returns the dataFormatConfig.
476:             *
477:             */
478:            public CoverageStoreConfig getDataFormatConfig() {
479:                return dataFormatConfig;
480:            }
481:
482:            /**
483:             * @param dataFormatConfig The dataFormatConfig to set.
484:             *
485:             */
486:            public void setDataFormatConfig(CoverageStoreConfig dataFormatConfig) {
487:                this .dataFormatConfig = dataFormatConfig;
488:            }
489:
490:            /**
491:             * @return Returns the dataFormatID.
492:             *
493:             */
494:            public String getDataFormatID() {
495:                return dataFormatID;
496:            }
497:
498:            /**
499:             * @param dataFormatID The dataFormatID to set.
500:             *
501:             */
502:            public void setDataFormatID(String dataFormatID) {
503:                this .dataFormatID = dataFormatID;
504:            }
505:
506:            /**
507:             * @return Returns the coverageConfig.
508:             *
509:             */
510:            public CoverageConfig getCoverageConfig() {
511:                return coverageConfig;
512:            }
513:
514:            /**
515:             * @param coverageConfig The coverageConfig to set.
516:             *
517:             */
518:            public void setCoverageConfig(CoverageConfig coverageConfig) {
519:                this .coverageConfig = coverageConfig;
520:            }
521:
522:            /**
523:             * @return Returns the coverage.
524:             *
525:             */
526:            public GridCoverage2D getCoverage() {
527:                return coverage;
528:            }
529:
530:            /**
531:             * @param coverage The coverage to set.
532:             *
533:             */
534:            public void setCoverage(GridCoverage2D coverage) {
535:                this.coverage = coverage;
536:            }
537:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.