Source Code Cross Referenced for PropertiesConfigContext.java in  » Portal » Open-Portal » com » sun » portal » desktop » context » 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 » Portal » Open Portal » com.sun.portal.desktop.context 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved. 
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
004:         */
005:
006:        package com.sun.portal.desktop.context;
007:
008:        import com.sun.portal.util.ResourceLoader;
009:
010:        import javax.servlet.ServletContext;
011:
012:        import java.io.FileInputStream;
013:        import java.io.FileNotFoundException;
014:        import java.io.IOException;
015:        import java.util.ArrayList;
016:        import java.util.List;
017:        import java.util.Properties;
018:        import java.util.StringTokenizer;
019:
020:        public class PropertiesConfigContext implements  ConfigContext {
021:            public static final String PROPERTIESFILE = "desktop.propertiesFile";
022:            public static final String DESKTOP_CONFIG_FILE = "desktopconfig.properties";
023:
024:            public static final String SERVICEAPPCONTEXTCLASSNAME_KEY = "serviceAppContextClassName";
025:            public static final String TEMPLATEBASEDIR_KEY = "templateBaseDir";
026:            public static final String PROVIDERCLASSBASEDIR_KEY = "providerClassBaseDir";
027:            public static final String JSPCOMPILERWARCLASSPATH_KEY = "jspCompilerWARClassPath";
028:            public static final String DEFAULT_DESKTOPTYPE_KEY = "defaultDesktopType";
029:
030:            public static final String TEMPLATE_SCAN_INTERVAL = "templateScanInterval";
031:            public static final String DP_SCAN_INTERVAL = "dpScanInterval";
032:            public static final String CLASSLOADER_REVALIDATE_INTERVAL = "classLoaderRevalidateInterval";
033:            public static final String BROWSER_CACHE_INTERVAL = "browserCacheInterval";
034:
035:            public static final String GETTER_POOL_MIN_SIZE_KEY = "getterPoolMinSize";
036:            public static final String GETTER_POOL_MAX_SIZE_KEY = "getterPoolMaxSize";
037:            public static final String GETTER_POOL_PARTITION_SIZE_KEY = "getterPoolPartitionSize";
038:
039:            public static final String CALLER_POOL_MIN_SIZE_KEY = "callerPoolMinSize";
040:            public static final String CALLER_POOL_MAX_SIZE_KEY = "callerPoolMaxSize";
041:            public static final String CALLER_POOL_PARTITION_SIZE_KEY = "callerPoolPartitionSize";
042:
043:            public static final String COOKIEPREFIX_KEY = "cookiePrefix";
044:            public static final String LB_COOKIE_NAME = "lb.cookie.name";
045:            public static final String JSPSCRATCHDIR_KEY = "jspScratchDir";
046:            public static final String MAX_EVENT_GENERATIONS = "maxEventGenerations";
047:            public static final String PORTLET_RENDER_MODE_PARALLEL = "portletRenderModeParallel";
048:
049:            public static final String COMMUNITY_CONTRIBUTOR_TYPES = "community.contributor.types";
050:            protected static final String COMMUNITY_CONTRIBUTOR_TYPES_DELIMITERS = " ,|";
051:            protected static final String COMMUNITY_CONTRIBUTOR_TYPES_DEFAULT = "jdo";
052:            protected static List communityContributorTypes = null;
053:
054:            protected static Properties properties = null;
055:
056:            public PropertiesConfigContext() {
057:            }
058:
059:            public void init(ServletContext sc) {
060:                ResourceLoader resourceLoader = ResourceLoader
061:                        .getInstance(System.getProperties());
062:                try {
063:                    properties = resourceLoader
064:                            .getProperties(DESKTOP_CONFIG_FILE);
065:                } catch (FileNotFoundException fnfe) {
066:                    throw new ContextError("PropertiesConfigContext.init(): ",
067:                            fnfe);
068:                } catch (IOException ioe) {
069:                    throw new ContextError("PropertiesConfigContext.init(): ",
070:                            ioe);
071:                }
072:            }
073:
074:            public void init(String filename) {
075:                properties = new Properties();
076:                try {
077:                    properties.load(new FileInputStream(filename));
078:                } catch (FileNotFoundException fnfe) {
079:                    throw new ContextError("PropertiesConfigContext.init(): ",
080:                            fnfe);
081:                } catch (IOException ioe) {
082:                    throw new ContextError("PropertiesConfigContext.init(): ",
083:                            ioe);
084:                }
085:            }
086:
087:            public String getServiceAppContextClassName() {
088:                return properties.getProperty(SERVICEAPPCONTEXTCLASSNAME_KEY);
089:            }
090:
091:            public String getConfigProperty(String key) {
092:                return properties.getProperty(key);
093:            }
094:
095:            public String getTemplateBaseDir() {
096:                return properties.getProperty(TEMPLATEBASEDIR_KEY);
097:            }
098:
099:            public String getCookiePrefix() {
100:                return properties.getProperty(COOKIEPREFIX_KEY);
101:            }
102:
103:            public String getLBCookieName() {
104:                return properties.getProperty(LB_COOKIE_NAME);
105:            }
106:
107:            public String getProviderClassBaseDir() {
108:                return properties.getProperty(PROVIDERCLASSBASEDIR_KEY);
109:            }
110:
111:            public String getJSPCompilerWARClassPath() {
112:                return properties.getProperty(JSPCOMPILERWARCLASSPATH_KEY);
113:            }
114:
115:            public String getJSPScratchDir() {
116:                return properties.getProperty(JSPSCRATCHDIR_KEY);
117:            }
118:
119:            public String getDefaultDesktopType() {
120:                return properties.getProperty(DEFAULT_DESKTOPTYPE_KEY);
121:            }
122:
123:            public String getPortalId() {
124:                return ResourceLoader.getInstance(System.getProperties())
125:                        .getPortalId();
126:            }
127:
128:            public String getInstanceId() {
129:                return ResourceLoader.getInstance(System.getProperties())
130:                        .getInstanceId();
131:            }
132:
133:            //Execution mode for portlets in Appserver
134:            //(true: parallel exec, false: serial exec)
135:            //true by default
136:            public String getPortletRenderModeParallel() {
137:                String portletRenderModeParallel = properties
138:                        .getProperty(PORTLET_RENDER_MODE_PARALLEL);
139:                //Make sure that the default works ...
140:                if (portletRenderModeParallel == null)
141:                    portletRenderModeParallel = new String("true");
142:                return portletRenderModeParallel;
143:            }
144:
145:            public int getGetterPoolMinSize() {
146:                return getIntegerProperty(GETTER_POOL_MIN_SIZE_KEY);
147:            }
148:
149:            public int getGetterPoolMaxSize() {
150:                return getIntegerProperty(GETTER_POOL_MAX_SIZE_KEY);
151:            }
152:
153:            public int getGetterPoolPartitionSize() {
154:                return getIntegerProperty(GETTER_POOL_PARTITION_SIZE_KEY);
155:            }
156:
157:            public int getCallerPoolMinSize() {
158:                return getIntegerProperty(CALLER_POOL_MIN_SIZE_KEY);
159:            }
160:
161:            public int getCallerPoolMaxSize() {
162:                return getIntegerProperty(CALLER_POOL_MAX_SIZE_KEY);
163:            }
164:
165:            public int getCallerPoolPartitionSize() {
166:                return getIntegerProperty(CALLER_POOL_PARTITION_SIZE_KEY);
167:            }
168:
169:            public int getTemplateScanInterval() {
170:                return getIntegerProperty(TEMPLATE_SCAN_INTERVAL);
171:            }
172:
173:            public int getDPScanInterval() {
174:                return getIntegerProperty(DP_SCAN_INTERVAL);
175:            }
176:
177:            public int getClassLoaderRevalidateInterval() {
178:                return getIntegerProperty(CLASSLOADER_REVALIDATE_INTERVAL);
179:            }
180:
181:            public int getBrowserCacheInterval() {
182:                return getIntegerProperty(BROWSER_CACHE_INTERVAL);
183:            }
184:
185:            public int getMaxEventGenerations() {
186:                return getIntegerProperty(MAX_EVENT_GENERATIONS);
187:            }
188:
189:            public List getCommunityContributorTypes() {
190:                if (communityContributorTypes == null) {
191:                    communityContributorTypes = new ArrayList();
192:
193:                    StringTokenizer tokenizer = new StringTokenizer(properties
194:                            .getProperty(COMMUNITY_CONTRIBUTOR_TYPES,
195:                                    COMMUNITY_CONTRIBUTOR_TYPES_DEFAULT),
196:                            COMMUNITY_CONTRIBUTOR_TYPES_DELIMITERS);
197:                    while (tokenizer.hasMoreTokens()) {
198:                        communityContributorTypes.add(tokenizer.nextToken());
199:                    }
200:                }
201:
202:                return communityContributorTypes;
203:            }
204:
205:            private int getIntegerProperty(String key) {
206:                String strInt = properties.getProperty(key);
207:                int result = 0;
208:                if (strInt != null && strInt.length() > 0) {
209:                    try {
210:                        result = Integer.parseInt(strInt);
211:                    } catch (NumberFormatException e) {
212:                        throw new ContextError(
213:                                "PropertiesConfigContext.getIntegerProperty(): invalid number format for key "
214:                                        + key, e);
215:                    }
216:                }
217:                return result;
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.