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


001:        /**
002:         * $Id: WSRPConsumerConfig.java,v 1.13 2005/05/10 17:07:58 jtb Exp $
003:         * Copyright 2003 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wsrp.consumer.common;
014:
015:        import java.util.Properties;
016:        import java.util.Map;
017:        import java.util.HashMap;
018:        import java.util.Enumeration;
019:
020:        import java.io.FileInputStream;
021:        import java.io.IOException;
022:        import java.io.FileNotFoundException;
023:
024:        import javax.servlet.ServletContext;
025:
026:        import com.sun.portal.util.ResourceLoader;
027:
028:        public class WSRPConsumerConfig {
029:
030:            public static final String WSRP_CONSUMER_CONFIG_FILE = "wsrpconsumerconfig.properties";
031:
032:            public static final String PERF_LOGLEVEL_KEY = "perfLogLevel";
033:
034:            public static final String SOAP_DEBUG_METHOD = "soapDebugMethod";
035:
036:            public static final String MM_CLASSNAME = "mmClassname";
037:
038:            public static final String PEM_CLASSNAME = "pemClassname";
039:
040:            public static final String RSSM_CLASSNAME = "rssmClassname";
041:
042:            public static final String ANON_SUPPORTS_INIT_COOKIE = "anonSupportsInitCookie";
043:
044:            public static final String FILE_UPLOAD_MAX_SIZE = "fileUploadMaxSize";
045:
046:            //
047:            // default values (used when there is none defined in the config file
048:            //
049:            public static final String DEFAULT_MM_CLASSNAME = "com.sun.portal.wsrp.consumer.markup.impl.MarkupManagerImpl";
050:
051:            public static final String DEFAULT_PEM_CLASSNAME = "com.sun.portal.wsrp.consumer.producermanager.impl.ProducerEntityManagerImpl";
052:
053:            public static final String DEFAULT_RSSM_CLASSNAME = "com.sun.portal.wsrp.consumer.common.impl.StaticRemoteServiceStubManagerImpl";
054:
055:            public static final String DEFAULT_SOAP_DUMP_FILENAME = "/tmp/psWSRPConsumerSOAPDump";
056:
057:            //
058:            // SOAP debugging
059:            //
060:            public static final int SOAP_DEBUG_NONE = 0;
061:
062:            public static final int SOAP_DEBUG_TUNNEL = 1;
063:
064:            public static final int SOAP_DEBUG_DUMP = 2;
065:
066:            public static final String SOAP_DUMP_FILENAME = "soapDumpFile";
067:
068:            public static final String TUNNEL_PREFIX = "tunnel_";
069:
070:            public static final String TUNNEL_RSSM_CLASSNAME = "com.sun.portal.wsrp.consumer.common.impl.TunnelRemoteServiceStubManagerImpl";
071:
072:            protected static Map tunnelMap = null;
073:
074:            protected static int soapDebugMethod = SOAP_DEBUG_NONE;
075:
076:            //
077:            // static instance
078:            //
079:            protected static Properties properties = null;
080:
081:            protected static WSRPConsumerConfig config = null;
082:
083:            protected WSRPConsumerConfig() {
084:            }
085:
086:            public static void init(ServletContext sc)
087:                    throws WSRPConsumerException {
088:
089:                init(WSRP_CONSUMER_CONFIG_FILE, null);
090:            }
091:
092:            public static void init(String filename, String portalId)
093:                    throws WSRPConsumerException {
094:                config = new WSRPConsumerConfig();
095:                if (filename != null && filename.length() > 0) {
096:                    config.doInit(filename, portalId);
097:                } else {
098:                    throw new WSRPConsumerException(
099:                            "WSRPConsumerConfig.init(): properties file name not found.");
100:                }
101:            }
102:
103:            public static WSRPConsumerConfig getInstance() {
104:                //
105:                // we assume that config has been initialized by the time
106:                // this gets called
107:                //
108:                return config;
109:            }
110:
111:            protected void doInit(String filename, String portalId)
112:                    throws WSRPConsumerException {
113:                ResourceLoader resourceLoader = null;
114:                if (portalId == null) {
115:                    resourceLoader = ResourceLoader.getInstance(System
116:                            .getProperties());
117:                } else {
118:                    resourceLoader = ResourceLoader.getInstance(portalId);
119:                }
120:
121:                try {
122:                    properties = resourceLoader.getProperties(filename);
123:
124:                } catch (FileNotFoundException fnfe) {
125:                    throw new WSRPConsumerException(
126:                            "WSRPConsumerConfig.doInit(): ", fnfe);
127:                } catch (IOException ioe) {
128:                    throw new WSRPConsumerException(
129:                            "WSRPConsumerConfig.doInit(): ", ioe);
130:                }
131:
132:                soapDebugMethod = initSOAPDebugMethod();
133:                tunnelMap = initTunnelMap();
134:            }
135:
136:            protected int initSOAPDebugMethod() throws WSRPConsumerException {
137:
138:                String soapDebugMethod = properties
139:                        .getProperty(SOAP_DEBUG_METHOD);
140:
141:                int method = SOAP_DEBUG_NONE;
142:
143:                if (soapDebugMethod.equals("tunnel")) {
144:                    method = SOAP_DEBUG_TUNNEL;
145:                } else if (soapDebugMethod.equals("dump")) {
146:                    //
147:                    // not actiavated.  (pending jaxrpc bug #5006641)
148:                    //
149:                    //method = SOAP_DEBUG_DUMP;
150:                    method = SOAP_DEBUG_NONE;
151:                }
152:
153:                return method;
154:            }
155:
156:            public int getSOAPDebugMethod() {
157:
158:                return soapDebugMethod;
159:            }
160:
161:            protected Map initTunnelMap() throws WSRPConsumerException {
162:
163:                Map tMap = new HashMap();
164:                for (Enumeration i = properties.propertyNames(); i
165:                        .hasMoreElements();) {
166:                    String key = (String) i.nextElement();
167:                    if (key.startsWith(TUNNEL_PREFIX)
168:                            && key.length() > TUNNEL_PREFIX.length()) {
169:                        String tunnelKey = key
170:                                .substring(TUNNEL_PREFIX.length());
171:                        tMap.put(tunnelKey, properties.getProperty(key));
172:                    }
173:                }
174:
175:                return tMap;
176:            }
177:
178:            public Map getTunnelMap() {
179:
180:                return tunnelMap;
181:            }
182:
183:            public String getSOAPDumpFilename() throws WSRPConsumerException {
184:
185:                String filename = properties.getProperty(SOAP_DUMP_FILENAME);
186:
187:                if (filename != null && filename.length() > 0) {
188:                    return filename;
189:                } else {
190:                    return DEFAULT_SOAP_DUMP_FILENAME;
191:                }
192:            }
193:
194:            public boolean doesAnonSupportInitCookie() {
195:                String support = properties
196:                        .getProperty(ANON_SUPPORTS_INIT_COOKIE);
197:                if (support != null && (support.equals("true"))) {
198:                    return true;
199:                } else {
200:                    return false;
201:                }
202:            }
203:
204:            public int getFileUploadMaxSize() {
205:                String fileUploadSizeLimit = properties
206:                        .getProperty(FILE_UPLOAD_MAX_SIZE);
207:
208:                if (fileUploadSizeLimit == null) {
209:                    return -1;
210:                }
211:
212:                try {
213:                    return Integer.parseInt(fileUploadSizeLimit);
214:                } catch (NumberFormatException ex) {
215:                    return -1;
216:                }
217:            }
218:
219:            public String getMarkupManagerClassname() {
220:                String mmClassname = properties.getProperty(MM_CLASSNAME);
221:                if (mmClassname == null) {
222:                    mmClassname = DEFAULT_MM_CLASSNAME;
223:                }
224:
225:                return mmClassname;
226:            }
227:
228:            public String getProducerEntityManagerClassname() {
229:                String pemClassname = properties.getProperty(PEM_CLASSNAME);
230:                if (pemClassname == null) {
231:                    pemClassname = DEFAULT_PEM_CLASSNAME;
232:                }
233:
234:                return pemClassname;
235:            }
236:
237:            public String getRemoteServiceStubManagerClassname()
238:                    throws WSRPConsumerException {
239:                String rssmClassname = null;
240:
241:                if (getSOAPDebugMethod() == SOAP_DEBUG_TUNNEL) {
242:                    rssmClassname = TUNNEL_RSSM_CLASSNAME;
243:                } else {
244:                    rssmClassname = properties.getProperty(RSSM_CLASSNAME);
245:                }
246:
247:                if (rssmClassname == null) {
248:                    rssmClassname = DEFAULT_RSSM_CLASSNAME;
249:                }
250:
251:                return rssmClassname;
252:            }
253:
254:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.