Source Code Cross Referenced for DefaultConfiguration.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.webwork.config;
006:
007:        import com.opensymphony.xwork.util.LocalizedTextUtil;
008:        import com.opensymphony.webwork.WebWorkConstants;
009:        import org.apache.commons.logging.Log;
010:        import org.apache.commons.logging.LogFactory;
011:
012:        import java.util.ArrayList;
013:        import java.util.Iterator;
014:        import java.util.StringTokenizer;
015:
016:        /**
017:         * Default implementation of Configuration - creates and delegates to other configurations by using an internal
018:         * {@link DelegatingConfiguration}.
019:         *
020:         * @author Rickard �berg
021:         * @author Jason Carreira
022:         * @author Bill Lynch (docs)
023:         */
024:        public class DefaultConfiguration extends Configuration {
025:
026:            protected Log log = LogFactory.getLog(this .getClass());
027:            Configuration config;
028:
029:            /**
030:             * Creates a new DefaultConfiguration object by loading all property files
031:             * and creating an internal {@link DelegatingConfiguration} object. All calls to get and set
032:             * in this class will call that configuration object.
033:             */
034:            public DefaultConfiguration() {
035:                // Create default implementations 
036:                // Use default properties and webwork.properties
037:                ArrayList list = new ArrayList();
038:
039:                try {
040:                    list.add(new PropertiesConfiguration("webwork"));
041:                } catch (Exception e) {
042:                    log.warn("Could not find webwork.properties");
043:                }
044:
045:                try {
046:                    list.add(new PropertiesConfiguration(
047:                            "com/opensymphony/webwork/default"));
048:                } catch (Exception e) {
049:                    log
050:                            .error(
051:                                    "Could not find com/opensymphony/webwork/default.properties",
052:                                    e);
053:                }
054:
055:                Configuration[] configList = new Configuration[list.size()];
056:                config = new DelegatingConfiguration((Configuration[]) list
057:                        .toArray(configList));
058:
059:                // Add list of additional properties configurations
060:                try {
061:                    StringTokenizer configFiles = new StringTokenizer(
062:                            (String) config
063:                                    .getImpl(WebWorkConstants.WEBWORK_CUSTOM_PROPERTIES),
064:                            ",");
065:
066:                    while (configFiles.hasMoreTokens()) {
067:                        String name = configFiles.nextToken();
068:
069:                        try {
070:                            list.add(new PropertiesConfiguration(name));
071:                        } catch (Exception e) {
072:                            log.error("Could not find " + name
073:                                    + ".properties. Skipping");
074:                        }
075:                    }
076:
077:                    configList = new Configuration[list.size()];
078:                    config = new DelegatingConfiguration((Configuration[]) list
079:                            .toArray(configList));
080:                } catch (IllegalArgumentException e) {
081:                }
082:
083:                // Add addtional list of i18n global resource bundles
084:                try {
085:
086:                    LocalizedTextUtil
087:                            .addDefaultResourceBundle("com/opensymphony/webwork/webwork-messages");
088:                    StringTokenizer bundleFiles = new StringTokenizer(
089:                            (String) config
090:                                    .getImpl(WebWorkConstants.WEBWORK_CUSTOM_I18N_RESOURCES),
091:                            ", ");
092:
093:                    while (bundleFiles.hasMoreTokens()) {
094:                        String name = bundleFiles.nextToken();
095:
096:                        try {
097:                            log.info("Loading global messages from " + name);
098:                            LocalizedTextUtil.addDefaultResourceBundle(name);
099:                        } catch (Exception e) {
100:                            log.error("Could not find " + name
101:                                    + ".properties. Skipping");
102:                        }
103:                    }
104:                } catch (IllegalArgumentException e) {
105:                    // webwork.custom.i18n.resources wasn't provided
106:                }
107:            }
108:
109:            /**
110:             * Sets the given property - delegates to the internal config implementation.
111:             *
112:             * @see #set(String, Object)
113:             */
114:            public void setImpl(String aName, Object aValue)
115:                    throws IllegalArgumentException,
116:                    UnsupportedOperationException {
117:                config.setImpl(aName, aValue);
118:            }
119:
120:            /**
121:             * Gets the specified property - delegates to the internal config implementation.
122:             *
123:             * @see #get(String)
124:             */
125:            public Object getImpl(String aName) throws IllegalArgumentException {
126:                // Delegate
127:                return config.getImpl(aName);
128:            }
129:
130:            /**
131:             * Determines whether or not a value has been set - delegates to the internal config implementation.
132:             *
133:             * @see #isSet(String)
134:             */
135:            public boolean isSetImpl(String aName) {
136:                return config.isSetImpl(aName);
137:            }
138:
139:            /**
140:             * Returns a list of all property names - delegates to the internal config implementation.
141:             *
142:             * @see #list()
143:             */
144:            public Iterator listImpl() {
145:                return config.listImpl();
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.