Source Code Cross Referenced for GlobalConfig.java in  » GIS » GeoServer » org » vfny » geoserver » config » 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.config 
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.config;
006:
007:        import org.vfny.geoserver.global.Data;
008:        import org.vfny.geoserver.global.GeoServer;
009:        import org.vfny.geoserver.global.dto.ContactDTO;
010:        import org.vfny.geoserver.global.dto.DataDTO;
011:        import org.vfny.geoserver.global.dto.GeoServerDTO;
012:        import java.nio.charset.Charset;
013:        import java.util.logging.Level;
014:
015:        /**
016:         * Global GeoServer Configuration model.
017:         *
018:         * <p>
019:         * GlobalConfig represents the configuration model needed to set up GeoServer
020:         * for use.
021:         * </p>
022:         *
023:         * @author David Zwiers, Refractions Research, Inc.
024:         * @version $Id: GlobalConfig.java 8406 2008-02-14 19:49:39Z saul.farber $
025:         */
026:        public class GlobalConfig {
027:            public static final String CONFIG_KEY = "Config.Global";
028:
029:            /** Sets the max number of Features returned by GetFeature */
030:            private int maxFeatures = 20000;
031:
032:            /**
033:             * XML Verbosity.
034:             *
035:             * <p>
036:             * Whether newlines and indents should be returned in XML responses.
037:             * </p>
038:             *
039:             * <p>
040:             * This should be called something other than verbose. Verbose should
041:             * control things like printing out "magic" comments that tell people how
042:             * to edit the xml files by hand.
043:             * </p>
044:             * Default is true
045:             */
046:            private boolean verbose = true;
047:
048:            /**
049:             * Number of decimal places returned in a GetFeature response.
050:             *
051:             * <p>
052:             * Sets the max number of decimal places past the zero returned in a
053:             * GetFeature response.  Default is 4.
054:             * </p>
055:             * DZ - should it be moved to FeatureTypeInfo level? JG - no WMS also has a
056:             * getFeature response
057:             */
058:            private int numDecimals = 8;
059:
060:            /**
061:             * Sets the global character set.
062:             *
063:             * <p>
064:             * This could use some more testing from international users. What it does
065:             * is sets the encoding globally for all postgis database connections (the
066:             * charset tag in FeatureTypeInfo), as well as specifying the encoding in
067:             * the return
068:             * <code>org.vfny.geoserver.config.org.vfny.geoserver.global.xml</code>
069:             * header and mime type.
070:             * </p>
071:             *
072:             * <p>
073:             * The default is UTF-8
074:             * </p>
075:             *
076:             * <p>
077:             * Also be warned that GeoServer does not check if the CharSet is valid
078:             * before attempting to use it, so it will fail miserably if a bad charset
079:             * is used.
080:             * </p>
081:             */
082:            private Charset charSet;
083:
084:            /**
085:             * The base URL where this servlet will run.
086:             *
087:             * <p>
088:             * If running locally then <code>http://localhost:8080</code> (or whatever
089:             * port you're running on) should work.
090:             * </p>
091:             *
092:             * <p>
093:             * If you are serving to the world then this must be the location where the
094:             * geoserver servlets appear
095:             * </p>
096:             *
097:             * <p>
098:             * JG - can we figure this out at runtime?
099:             * </p>
100:             */
101:            private String proxyBaseUrl;
102:
103:            /**
104:             * Define a base url for the location of the wfs schemas.
105:             *
106:             * <p>
107:             * By default GeoServer  loads and references its own at
108:             * <code>/data/capabilities</code>.
109:             * </p>
110:             *
111:             * <p>
112:             * The standalone Tomcat server needs SchemaBaseUrl defined for validation.
113:             * </p>
114:             */
115:            private String schemaBaseUrl;
116:
117:            /**
118:             * Defines the Application logging level.
119:             *
120:             * <p>
121:             * Common options are SEVERE, WARNING, INFO, CONFIG,  FINER, FINEST, in
122:             * order of Increasing statements logged.
123:             * </p>
124:             *
125:             * <p>
126:             * There may be more then one point of control - the web containers often
127:             * controls logging, the jakarta commons logging system is used by struts,
128:             * these names seem taken from the jdk14 logging framework and GeoServer
129:             * seems to also use log4j.
130:             * 
131:             * See http://docs.codehaus.org/display/GEOS/GSIP+13+-+Logging
132:             * for how this is now implemented.
133:             * </p>
134:             */
135:            private String log4jConfigFile = null;
136:            private boolean suppressStdOutLogging = false;
137:            /** custom log location **/
138:            private String logLocation = null;
139:
140:            private String adminUserName;
141:            private String adminPassword;
142:
143:            /** Whether the exceptions returned to the client should contain full stack traces */
144:            private boolean verboseExceptions;
145:
146:            /** The Server contact person and their contact information. */
147:            private ContactConfig contact = null;
148:
149:            private double jaiMemoryCapacity;
150:            private double jaiMemoryThreshold;
151:            private int jaiTileThreads;
152:            private int jaiTilePriority;
153:            private boolean jaiRecycling;
154:            private boolean imageIOCache;
155:            private boolean jaiJPEGNative;
156:            private boolean jaiPNGNative;
157:
158:            /** tile cache location, full url or relative path */
159:            private String tileCache;
160:
161:            private int updateSequence;
162:
163:            /**
164:             * GlobalConfig constructor.
165:             *
166:             * <p>
167:             * Creates an instance of GlobalConfig and initializes to default settings.
168:             * </p>
169:             *
170:             * @see defaultSettings()
171:             */
172:            public GlobalConfig() {
173:                maxFeatures = 20000;
174:                verbose = true;
175:                numDecimals = 8;
176:                charSet = Charset.forName("UTF-8");
177:                proxyBaseUrl = null;
178:                schemaBaseUrl = null;
179:                contact = null;
180:                verboseExceptions = true;
181:                logLocation = null;
182:            }
183:
184:            /**
185:             * Instantiates the global config from the geoServer module.
186:             *
187:             * @param geoserver The geoServer module.
188:             */
189:            public GlobalConfig(GeoServer geoserver) {
190:                this ((GeoServerDTO) geoserver.toDTO());
191:            }
192:
193:            /**
194:             * GlobalConfig constructor.
195:             *
196:             * <p>
197:             * Creates a copy of the GeoServerDTO object provided.  Charset is not
198:             * cloned, everything else is.
199:             * </p>
200:             *
201:             * @param g
202:             *
203:             * @throws NullPointerException DOCUMENT ME!
204:             */
205:            public GlobalConfig(GeoServerDTO g) {
206:                if (g == null) {
207:                    throw new NullPointerException();
208:                }
209:
210:                maxFeatures = g.getMaxFeatures();
211:                verbose = g.isVerbose();
212:                numDecimals = g.getNumDecimals();
213:                charSet = g.getCharSet();
214:                proxyBaseUrl = g.getProxyBaseUrl();
215:                schemaBaseUrl = g.getSchemaBaseUrl();
216:                adminUserName = g.getAdminUserName();
217:                adminPassword = g.getAdminPassword();
218:                verboseExceptions = g.isVerboseExceptions();
219:
220:                log4jConfigFile = g.getLog4jConfigFile();
221:                suppressStdOutLogging = g.getSuppressStdOutLogging();
222:                logLocation = g.getLogLocation();
223:
224:                jaiMemoryCapacity = g.getJaiMemoryCapacity();
225:                jaiMemoryThreshold = g.getJaiMemoryThreshold();
226:                jaiTileThreads = g.getJaiTileThreads();
227:                jaiTilePriority = g.getJaiTilePriority();
228:                jaiRecycling = g.getJaiRecycling().booleanValue();
229:                imageIOCache = g.getImageIOCache().booleanValue();
230:                jaiJPEGNative = g.getJaiJPEGNative().booleanValue();
231:                jaiPNGNative = g.getJaiPNGNative().booleanValue();
232:
233:                tileCache = g.getTileCache();
234:
235:                updateSequence = g.getUpdateSequence();
236:
237:                if (g.getContact() != null) {
238:                    contact = new ContactConfig(g.getContact());
239:                } else {
240:                    contact = new ContactConfig();
241:                }
242:            }
243:
244:            /**
245:             * Implement updateDTO.
246:             *
247:             * <p>
248:             * Populates this instance with the GeoServerDTO object provided.
249:             * </p>
250:             *
251:             * @param g A valid GeoServerDTO object to populate this object from
252:             *
253:             * @throws NullPointerException DOCUMENT ME!
254:             *
255:             * @see org.vfny.geoserver.config.DataStructure#updateDTO(java.lang.Object)
256:             */
257:            public void update(GeoServerDTO g) {
258:                if (g == null) {
259:                    throw new NullPointerException(
260:                            "GeoServer Data Transfer Object required");
261:                }
262:
263:                maxFeatures = g.getMaxFeatures();
264:                verbose = g.isVerbose();
265:                numDecimals = g.getNumDecimals();
266:                charSet = g.getCharSet();
267:                schemaBaseUrl = g.getSchemaBaseUrl();
268:                proxyBaseUrl = g.getProxyBaseUrl();
269:
270:                verboseExceptions = g.isVerboseExceptions();
271:
272:                log4jConfigFile = g.getLog4jConfigFile();
273:                suppressStdOutLogging = g.getSuppressStdOutLogging();
274:                logLocation = g.getLogLocation();
275:
276:                jaiMemoryCapacity = g.getJaiMemoryCapacity();
277:                jaiMemoryThreshold = g.getJaiMemoryThreshold();
278:                jaiTileThreads = g.getJaiTileThreads();
279:                jaiTilePriority = g.getJaiTilePriority();
280:                jaiRecycling = g.getJaiRecycling().booleanValue();
281:                imageIOCache = g.getImageIOCache().booleanValue();
282:                jaiJPEGNative = g.getJaiJPEGNative().booleanValue();
283:                jaiPNGNative = g.getJaiPNGNative().booleanValue();
284:
285:                tileCache = g.getTileCache();
286:
287:                updateSequence = g.getUpdateSequence();
288:
289:                if (g.getContact() != null) {
290:                    contact = new ContactConfig(g.getContact());
291:                } else {
292:                    contact = new ContactConfig();
293:                }
294:            }
295:
296:            /**
297:             * Implement toDTO.
298:             *
299:             * <p>
300:             * Creates a copy of the data in a GeoServerDTO representation
301:             * </p>
302:             *
303:             * @return a copy of the data in a GeoServerDTO representation
304:             *
305:             * @see org.vfny.geoserver.config.DataStructure#toDTO()
306:             */
307:            public GeoServerDTO toDTO() {
308:                GeoServerDTO g = new GeoServerDTO();
309:                g.setMaxFeatures(maxFeatures);
310:                g.setVerbose(verbose);
311:                g.setAdminPassword(adminPassword);
312:                g.setAdminUserName(adminUserName);
313:                g.setNumDecimals(numDecimals);
314:                g.setCharSet(charSet);
315:                g.setSchemaBaseUrl(schemaBaseUrl);
316:                g.setVerboseExceptions(verboseExceptions);
317:                g.setContact((ContactDTO) contact.toDTO());
318:                g.setLog4jConfigFile(log4jConfigFile);
319:                g.setSuppressStdOutLogging(suppressStdOutLogging);
320:                g.setLogLocation(logLocation);
321:                g.setJaiMemoryCapacity(jaiMemoryCapacity);
322:                g.setJaiMemoryThreshold(jaiMemoryThreshold);
323:                g.setJaiTileThreads(jaiTileThreads);
324:                g.setJaiTilePriority(jaiTilePriority);
325:                g.setJaiRecycling(Boolean.valueOf(jaiRecycling));
326:                g.setImageIOCache(Boolean.valueOf(imageIOCache));
327:                g.setJaiJPEGNative(Boolean.valueOf(jaiJPEGNative));
328:                g.setJaiPNGNative(Boolean.valueOf(jaiPNGNative));
329:                g.setProxyBaseUrl(proxyBaseUrl);
330:                g.setTileCache(tileCache);
331:                g.setUpdateSequence(updateSequence);
332:
333:                return g;
334:            }
335:
336:            /**
337:             * getBaseUrl purpose.
338:             *
339:             * <p>
340:             * Description ...
341:             * </p>
342:             *
343:             * @return
344:             */
345:            public String getProxyBaseUrl() {
346:                return proxyBaseUrl;
347:            }
348:
349:            /**
350:             * getCharSet purpose.
351:             *
352:             * <p>
353:             * Description ...
354:             * </p>
355:             *
356:             * @return
357:             */
358:            public Charset getCharSet() {
359:                return charSet;
360:            }
361:
362:            /**
363:             * getContact purpose.
364:             *
365:             * <p>
366:             * Description ...
367:             * </p>
368:             *
369:             * @return
370:             */
371:            public ContactConfig getContact() {
372:                return contact;
373:            }
374:
375:            /**
376:             * getMaxFeatures purpose.
377:             *
378:             * <p>
379:             * Description ...
380:             * </p>
381:             *
382:             * @return
383:             */
384:            public int getMaxFeatures() {
385:                return maxFeatures;
386:            }
387:
388:            /**
389:             * getNumDecimals purpose.
390:             *
391:             * <p>
392:             * Description ...
393:             * </p>
394:             *
395:             * @return
396:             */
397:            public int getNumDecimals() {
398:                return numDecimals;
399:            }
400:
401:            /**
402:             * getSchemaBaseUrl purpose.
403:             *
404:             * <p>
405:             * Description ...
406:             * </p>
407:             *
408:             * @return
409:             */
410:            public String getSchemaBaseUrl() {
411:                return schemaBaseUrl;
412:            }
413:
414:            /**
415:             * isVerbose purpose.
416:             *
417:             * <p>
418:             * Description ...
419:             * </p>
420:             *
421:             * @return
422:             */
423:            public boolean isVerbose() {
424:                return verbose;
425:            }
426:
427:            /**
428:             * setBaseUrl purpose.
429:             *
430:             * <p>
431:             * Description ...
432:             * </p>
433:             *
434:             * @param url
435:             */
436:            public void setProxyBaseUrl(String url) {
437:                proxyBaseUrl = url;
438:            }
439:
440:            /**
441:             * setCharSet purpose.
442:             *
443:             * <p>
444:             * Description ...
445:             * </p>
446:             *
447:             * @param charset
448:             */
449:            public void setCharSet(Charset charset) {
450:                if (charset == null) {
451:                    charset = Charset.forName("ISO-8859-1");
452:                }
453:
454:                charSet = charset;
455:            }
456:
457:            /**
458:             * setContact purpose.
459:             *
460:             * <p>
461:             * Description ...
462:             * </p>
463:             *
464:             * @param contact
465:             */
466:            public void setContact(ContactConfig contact) {
467:                if (contact == null) {
468:                    contact = new ContactConfig();
469:                }
470:
471:                this .contact = contact;
472:            }
473:
474:            /**
475:             * setMaxFeatures purpose.
476:             *
477:             * <p>
478:             * Description ...
479:             * </p>
480:             *
481:             * @param i
482:             */
483:            public void setMaxFeatures(int i) {
484:                maxFeatures = i;
485:            }
486:
487:            /**
488:             * setNumDecimals purpose.
489:             *
490:             * <p>
491:             * Description ...
492:             * </p>
493:             *
494:             * @param i
495:             */
496:            public void setNumDecimals(int i) {
497:                numDecimals = i;
498:            }
499:
500:            /**
501:             * setSchemaBaseUrl purpose.
502:             *
503:             * <p>
504:             * Description ...
505:             * </p>
506:             *
507:             * @param url
508:             */
509:            public void setSchemaBaseUrl(String url) {
510:                schemaBaseUrl = url;
511:            }
512:
513:            /**
514:             * setVerbose purpose.
515:             *
516:             * <p>
517:             * Description ...
518:             * </p>
519:             *
520:             * @param b
521:             */
522:            public void setVerbose(boolean b) {
523:                verbose = b;
524:            }
525:
526:            /**
527:             * getLoggingLevel purpose.
528:             *
529:             * <p>
530:             * Description ...
531:             * </p>
532:             *
533:             * @return
534:             */
535:            public String getLog4jConfigFile() {
536:                return log4jConfigFile;
537:            }
538:
539:            /**
540:             * setLoggingLevel purpose.
541:             *
542:             * <p>
543:             * Description ...
544:             * </p>
545:             *
546:             * @param level
547:             */
548:            public void setLog4jConfigFile(String s) {
549:                log4jConfigFile = s;
550:            }
551:
552:            /**
553:             * Gets the user name of the administrator.
554:             *
555:             * @return The user name to be checked for on login.
556:             */
557:            public String getAdminUserName() {
558:                return adminUserName;
559:            }
560:
561:            /**
562:             * Gets the password of the administrator.
563:             *
564:             * @return The password to be checked for on login.
565:             */
566:            public String getAdminPassword() {
567:                return adminPassword;
568:            }
569:
570:            /**
571:             * Sets the user name of the administrator of GeoServer, for login
572:             * purposes.
573:             *
574:             * @param username the String to set as the admin username.
575:             */
576:            public void setAdminUserName(String username) {
577:                this .adminUserName = username;
578:            }
579:
580:            /**
581:             * Sets the password of the administrator of GeoServer, for login purposes.
582:             *
583:             * @param password The password to set as the login password.
584:             */
585:            public void setAdminPassword(String password) {
586:                this .adminPassword = password;
587:            }
588:
589:            /**
590:             * Should we display stackTraces or not? (And give them a nice little
591:             * message instead?)
592:             *
593:             * @return Returns the showStackTraces.
594:             */
595:            public boolean isVerboseExceptions() {
596:                return verboseExceptions;
597:            }
598:
599:            /**
600:             * If set to true, response exceptions will throw their stack trace back to
601:             * the end user.
602:             *
603:             * @param showStackTraces The showStackTraces to set.
604:             */
605:            public void setVerboseExceptions(boolean showStackTraces) {
606:                this .verboseExceptions = showStackTraces;
607:            }
608:
609:            /**
610:             * @return The string representation of the path on disk in which the
611:             * server logs to.
612:             */
613:            public String getLogLocation() {
614:                return logLocation;
615:            }
616:
617:            /**
618:             * @param logLocation The string representation of the path on disk in which
619:             * the server logs to.
620:             */
621:            public void setLogLocation(String logLocation) {
622:                this .logLocation = logLocation;
623:            }
624:
625:            /**
626:             * @return True if the server is logging to file, otherwise false.
627:             */
628:            public boolean getSuppressStdOutLogging() {
629:                return suppressStdOutLogging;
630:            }
631:
632:            /**
633:             * Toggles server logging to file.
634:             */
635:            public void setSuppressStdOutLogging(boolean b) {
636:                this .suppressStdOutLogging = b;
637:            }
638:
639:            public double getJaiMemoryCapacity() {
640:                return jaiMemoryCapacity;
641:            }
642:
643:            public void setJaiMemoryCapacity(double jaiMemoryCapacity) {
644:                this .jaiMemoryCapacity = jaiMemoryCapacity;
645:            }
646:
647:            public boolean isJaiRecycling() {
648:                return jaiRecycling;
649:            }
650:
651:            public void setJaiRecycling(boolean jaiRecycling) {
652:                this .jaiRecycling = jaiRecycling;
653:            }
654:
655:            public boolean isImageIOCache() {
656:                return imageIOCache;
657:            }
658:
659:            public void setImageIOCache(boolean imageIOCache) {
660:                this .imageIOCache = imageIOCache;
661:            }
662:
663:            public boolean isJaiJPEGNative() {
664:                return jaiJPEGNative;
665:            }
666:
667:            public void setJaiJPEGNative(boolean jaiJPEGNative) {
668:                this .jaiJPEGNative = jaiJPEGNative;
669:            }
670:
671:            public boolean isJaiPNGNative() {
672:                return jaiPNGNative;
673:            }
674:
675:            public void setJaiPNGNative(boolean jaiPNGNative) {
676:                this .jaiPNGNative = jaiPNGNative;
677:            }
678:
679:            public double getJaiMemoryThreshold() {
680:                return jaiMemoryThreshold;
681:            }
682:
683:            public void setJaiMemoryThreshold(double jaiMemoryThreshold) {
684:                this .jaiMemoryThreshold = jaiMemoryThreshold;
685:            }
686:
687:            public int getJaiTilePriority() {
688:                return jaiTilePriority;
689:            }
690:
691:            public void setJaiTilePriority(int jaiTilePriority) {
692:                this .jaiTilePriority = jaiTilePriority;
693:            }
694:
695:            public int getJaiTileThreads() {
696:                return jaiTileThreads;
697:            }
698:
699:            public void setJaiTileThreads(int jaiTileThreads) {
700:                this .jaiTileThreads = jaiTileThreads;
701:            }
702:
703:            /**
704:             * tile cache parameter
705:             * @see GeoServer#getTileCache()
706:             */
707:            public String getTileCache() {
708:                return tileCache;
709:            }
710:
711:            public void setTileCache(String tileCache) {
712:                this .tileCache = tileCache;
713:            }
714:
715:            /**
716:             * @return the updateSequence
717:             */
718:            public int getUpdateSequence() {
719:                return updateSequence;
720:            }
721:
722:            /**
723:             * @param updateSequence the updateSequence to set
724:             */
725:            public void setUpdateSequence(int updateSequence) {
726:                this.updateSequence = updateSequence;
727:            }
728:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.