Source Code Cross Referenced for PropertiesServiceContext.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 2001 Sun Microsystems, Inc.  All rights reserved. 
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
004:         */
005:        package com.sun.portal.desktop.context;
006:
007:        import javax.servlet.http.HttpServletRequest;
008:
009:        import java.util.Properties;
010:        import java.util.Set;
011:        import java.util.Locale;
012:
013:        import java.io.File;
014:        import java.io.IOException;
015:        import java.io.FileInputStream;
016:        import java.io.FileOutputStream;
017:        import com.iplanet.sso.SSOToken;
018:
019:        /**
020:         * This class implements the DesktopContext interface using Java
021:         * properties files.
022:         */
023:
024:        public class PropertiesServiceContext implements  ServiceContext {
025:            protected Properties properties = null;
026:            protected String filename = null;
027:
028:            protected static final String CONTAINERPROVIDERCONTEXTCLASSNAME_KEY = "containerProviderContextClassName";
029:            protected static final String PROVIDERMANAGERCONTEXTCLASSNAME_KEY = "providerManagerContextClassName";
030:            protected static final String DPCONTEXTCLASSNAME_KEY = "dpContextClassName";
031:            protected static final String DPUSERCONTEXTCLASSNAME_KEY = "dpUserContextClassName";
032:            protected static final String DEBUGCONTEXTCLASSNAME_KEY = "debugContextClassName";
033:            protected static final String SESSIONCONTEXTCLASSNAME_KEY = "sessionContextClassName";
034:            protected static final String TEMPLATECONTEXTCLASSNAME_KEY = "templateContextClassName";
035:            protected static final String CLIENTCONTEXTCLASSNAME_KEY = "clientContextClassName";
036:            protected static final String PROPERTIESCONTEXTCLASSNAME_KEY = "propertiesContextClassName";
037:
038:            protected static final String LOCALESTRING_KEY = "localeString";
039:            protected static final String NOSESSIONURL_KEY = "noSessionURL";
040:            protected static final String SESSIONRETURNURLPARAMNAME_KEY = "sessionReturnURLParamName";
041:            protected static final String DESKTOPURL_KEY = "desktopURL";
042:            protected static final String LOGOUTURL_KEY = "logoutURL";
043:            protected static final String LOGINURL_KEY = "loginURL";
044:            protected static final String TYPE_KEY = "type";
045:            protected static final String DEFAULTCHANNELNAME_KEY = "defaultChannelName";
046:            protected static final String EDITPROVIDERCONTAINERNAME_KEY = "editProviderContainerName";
047:            protected static final String TEMPLATEBASEDIR_KEY = "templateBaseDir";
048:
049:            protected static final String DEFAULT_FILENAME = "/etc/opt/SUNWportal/service-context.properties";
050:
051:            public PropertiesServiceContext() {
052:                this (DEFAULT_FILENAME);
053:            }
054:
055:            public PropertiesServiceContext(String filename) {
056:                properties = new Properties();
057:                this .filename = filename;
058:
059:                FileInputStream fis = null;
060:                try {
061:                    fis = new FileInputStream(new File(filename));
062:                    properties.load(fis);
063:                } catch (IOException ioe) {
064:                    throw new ContextError("PropertiesContext.getDP(): ", ioe);
065:                }
066:            }
067:
068:            public void init(SSOToken token) {
069:                // nothing
070:            }
071:
072:            public void init(HttpServletRequest req) {
073:                // nothing
074:            }
075:
076:            public void init(HttpServletRequest req, String uid, String pw) {
077:                // nothing
078:            }
079:
080:            public String getLocaleString() {
081:                return properties.getProperty(LOCALESTRING_KEY);
082:            }
083:
084:            public String getDesktopType() {
085:                return properties.getProperty(TYPE_KEY);
086:            }
087:
088:            public String getDefaultChannelName() {
089:                return properties.getProperty(DEFAULTCHANNELNAME_KEY);
090:            }
091:
092:            public String getEditProviderContainerName() {
093:                return properties.getProperty(EDITPROVIDERCONTAINERNAME_KEY);
094:            }
095:
096:            public String getDPContextClassName() {
097:                return properties.getProperty(DPCONTEXTCLASSNAME_KEY);
098:            }
099:
100:            public String getDPUserContextClassName() {
101:                return properties.getProperty(DPUSERCONTEXTCLASSNAME_KEY);
102:            }
103:
104:            public String getContainerProviderContextClassName() {
105:                return properties
106:                        .getProperty(CONTAINERPROVIDERCONTEXTCLASSNAME_KEY);
107:            }
108:
109:            public String getProviderManagerContextClassName() {
110:                return properties
111:                        .getProperty(PROVIDERMANAGERCONTEXTCLASSNAME_KEY);
112:            }
113:
114:            public String getPropertiesContextClassName() {
115:                return properties.getProperty(PROPERTIESCONTEXTCLASSNAME_KEY);
116:            }
117:
118:            public String getTemplateContextClassName() {
119:                return properties.getProperty(TEMPLATECONTEXTCLASSNAME_KEY);
120:            }
121:
122:            public String getClientContextClassName() {
123:                return properties.getProperty(CLIENTCONTEXTCLASSNAME_KEY);
124:            }
125:
126:            public String getDesktopServletPath() {
127:                return properties.getProperty(DESKTOPURL_KEY);
128:            }
129:
130:            public String getNoSessionURL() {
131:                return properties.getProperty(NOSESSIONURL_KEY);
132:            }
133:
134:            public String getSessionReturnURLParamName() {
135:                return properties.getProperty(SESSIONRETURNURLPARAMNAME_KEY);
136:            }
137:
138:            public String getLogoutURL() {
139:                return properties.getProperty(LOGOUTURL_KEY);
140:            }
141:
142:            public String getLoginURL() {
143:                return properties.getProperty(LOGINURL_KEY);
144:            }
145:
146:            public String getDebugContextClassName() {
147:                return properties.getProperty(DEBUGCONTEXTCLASSNAME_KEY);
148:            }
149:
150:            public String getSessionContextClassName() {
151:                return properties.getProperty(SESSIONCONTEXTCLASSNAME_KEY);
152:            }
153:
154:            public String getAuthlessSessionContextClassName() {
155:                //
156:                // not supported in properties impl
157:                //
158:                return null;
159:            }
160:
161:            public String getWSRPSessionContextClassName() {
162:                //
163:                // not supported in properties impl
164:                //
165:                return null;
166:            }
167:
168:            public String getStringAttribute(String name) {
169:                return properties.getProperty(name);
170:            }
171:
172:            public String getStringAttribute(String name, Locale locale) {
173:                return getStringAttribute(name);
174:            }
175:
176:            public void setStringAttribute(String name, String val) {
177:                properties.setProperty(name, val);
178:
179:                FileOutputStream fos = null;
180:                try {
181:                    fos = new FileOutputStream(new File(filename));
182:                    properties.store(fos, "Last updated at: ");
183:                } catch (IOException ioe) {
184:                    throw new ContextError(
185:                            "PropertiesContext.storeAttribute()", ioe);
186:                }
187:            }
188:
189:            public Set getRoles() {
190:                //not supported in Properties impl
191:                return null;
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.