Source Code Cross Referenced for PropertiesServiceAppContext.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 java.util.Properties;
008:        import java.util.Map;
009:        import java.util.HashMap;
010:
011:        import java.io.File;
012:        import java.io.IOException;
013:        import java.io.FileInputStream;
014:        import java.io.FileOutputStream;
015:
016:        /**
017:         * This class implements the DesktopContext interface using Java
018:         * properties files.
019:         */
020:
021:        public class PropertiesServiceAppContext implements  ServiceAppContext {
022:            protected Properties properties = null;
023:            protected String filename = null;
024:
025:            protected static final String NOSESSIONURL_KEY = "noSessionURL";
026:            protected static final String SESSIONRETURNURLPARAMNAME_KEY = "sessionReturnURLParamName";
027:            protected static final String DEBUGCONTEXTCLASSNAME_KEY = "debugContextClassName";
028:            protected static final String SESSIONAPPCONTEXTCLASSNAME_KEY = "sessionAppContextClassName";
029:            protected static final String AUTHLESSSESSIONAPPCONTEXTCLASSNAME_KEY = "sessionAppContextClassName";
030:            protected static final String DESKTOPCONTEXTCLASSNAME_KEY = "desktopContextClassName";
031:            protected static final String SERVICECONTEXTCLASSNAME_KEY = "serviceContextClassName";
032:            protected static final String SESSIONCONTEXTCLASSNAME_KEY = "sessionContextClassName";
033:            protected static final String CLIENTCONTEXTCLASSNAME_KEY = "clientContextClassName";
034:            protected static final String TEMPLATECONTEXTCLASSNAME_KEY = "templateContextClassName";
035:            protected static final String INACTIVE_MAX_KEY = "inactiveMax";
036:            protected static final String REAP_INTERVAL_KEY = "reapInterval";
037:            protected static final String CLIENT_SESSION_INACTIVE_MAX_KEY = "clientSessionInactiveMax";
038:            protected static final String CLIENT_SESSION_REAP_INTERVAL_KEY = "clientSessionReapInterval";
039:            protected static final String CLIENT_SESSIONS_MAX_KEY = "clientSessionsMax";
040:            protected static final String ENABLE_AUTHLESS_DESKTOP_KEY = "enableAuthlessDesktop";
041:            protected static final String ENABLE_FEDERATION_KEY = "enableFederation";
042:            protected static final String PRELOGIN_URL_KEY = "preLoginURL";
043:            protected static final String ACCESS_URL_KEY = "accessURL";
044:
045:            protected static final String DEFAULT_FILENAME = "/etc/opt/SUNWportal/service-context.properties";
046:
047:            public PropertiesServiceAppContext() {
048:                this (DEFAULT_FILENAME);
049:            }
050:
051:            public PropertiesServiceAppContext(String filename) {
052:                properties = new Properties();
053:                this .filename = filename;
054:
055:                FileInputStream fis = null;
056:                try {
057:                    fis = new FileInputStream(new File(filename));
058:                    properties.load(fis);
059:                } catch (IOException ioe) {
060:                    throw new ContextError(
061:                            "PropertiesServiceAppContext.PropertiesServiceAppContext(): ",
062:                            ioe);
063:                }
064:            }
065:
066:            public void init(String portalId) {
067:                // nothing
068:            }
069:
070:            public String getDebugContextClassName() {
071:                return properties.getProperty(DEBUGCONTEXTCLASSNAME_KEY);
072:            }
073:
074:            public String getSessionAppContextClassName() {
075:                return properties.getProperty(SESSIONAPPCONTEXTCLASSNAME_KEY);
076:            }
077:
078:            public String getAuthlessSessionAppContextClassName() {
079:                return properties
080:                        .getProperty(AUTHLESSSESSIONAPPCONTEXTCLASSNAME_KEY);
081:            }
082:
083:            public String getWSRPSessionAppContextClassName() {
084:                return properties
085:                        .getProperty(AUTHLESSSESSIONAPPCONTEXTCLASSNAME_KEY);
086:            }
087:
088:            public String getDesktopContextClassName() {
089:                return properties.getProperty(DESKTOPCONTEXTCLASSNAME_KEY);
090:            }
091:
092:            public String getSessionContextClassName() {
093:                return properties.getProperty(SESSIONCONTEXTCLASSNAME_KEY);
094:            }
095:
096:            public String getServiceContextClassName() {
097:                return properties.getProperty(SERVICECONTEXTCLASSNAME_KEY);
098:            }
099:
100:            public String getClientContextClassName() {
101:                return properties.getProperty(CLIENTCONTEXTCLASSNAME_KEY);
102:            }
103:
104:            public String getTemplateContextClassName() {
105:                return properties.getProperty(TEMPLATECONTEXTCLASSNAME_KEY);
106:            }
107:
108:            public String getNoSessionURL() {
109:                return properties.getProperty(NOSESSIONURL_KEY);
110:            }
111:
112:            public String getLogoutURL() {
113:                return properties.getProperty(NOSESSIONURL_KEY);
114:            }
115:
116:            public String getAccessURL() {
117:                return properties.getProperty(ACCESS_URL_KEY);
118:            }
119:
120:            public String getSessionReturnURLParamName() {
121:                return properties.getProperty(SESSIONRETURNURLPARAMNAME_KEY);
122:            }
123:
124:            public Map getAuthorizedAuthlessUIDs() {
125:                HashMap somemap = new HashMap();
126:                return somemap;
127:            }
128:
129:            public String getDefaultAuthlessUID() {
130:                return "userid";
131:            }
132:
133:            public long getReapInterval() {
134:                long interval = Long.parseLong(properties
135:                        .getProperty(REAP_INTERVAL_KEY));
136:                return interval;
137:            }
138:
139:            public long getInactiveMax() {
140:                long maxInactive = Long.parseLong(properties
141:                        .getProperty(INACTIVE_MAX_KEY));
142:                return maxInactive;
143:            }
144:
145:            public long getClientSessionReapInterval() {
146:                long interval = Long.parseLong(properties
147:                        .getProperty(CLIENT_SESSION_REAP_INTERVAL_KEY));
148:                return interval;
149:            }
150:
151:            public long getClientSessionInactiveMax() {
152:                long maxInactive = Long.parseLong(properties
153:                        .getProperty(CLIENT_SESSION_INACTIVE_MAX_KEY));
154:                return maxInactive;
155:            }
156:
157:            public long getClientSessionsMax() {
158:                long maxSessions = Long.parseLong(properties
159:                        .getProperty(CLIENT_SESSIONS_MAX_KEY));
160:                return maxSessions;
161:            }
162:
163:            public boolean isAuthlessEnabled() {
164:                Boolean authlessEnabled = Boolean.valueOf(properties
165:                        .getProperty(ENABLE_AUTHLESS_DESKTOP_KEY));
166:                return authlessEnabled.booleanValue();
167:            }
168:
169:            public boolean isFederationEnabled() {
170:                Boolean federationEnabled = Boolean.valueOf(properties
171:                        .getProperty(ENABLE_FEDERATION_KEY));
172:                return federationEnabled.booleanValue();
173:            }
174:
175:            /* This ServiceAppContext has no Liberty implementation.
176:             * Thus, isFederationEnabled should have already returned false and then
177:             * this method should never get called.
178:             * If atall it is called then return whatever value is there in the key. 
179:             * (Value might have been hardcoded in the properties file)
180:             */
181:            public String getPreLoginURL(String returnURL,
182:                    String libertySSOFailedParamName) {
183:                return properties.getProperty(PRELOGIN_URL_KEY);
184:            }
185:
186:            public String getStringAttribute(String name) {
187:                return properties.getProperty(name);
188:            }
189:
190:            public void setStringAttribute(String name, String val) {
191:                properties.setProperty(name, val);
192:
193:                FileOutputStream fos = null;
194:                try {
195:                    fos = new FileOutputStream(new File(filename));
196:                    properties.store(fos, "Last updated at: ");
197:                } catch (IOException ioe) {
198:                    throw new ContextError(
199:                            "PropertiesContext.storeAttribute()", ioe);
200:                }
201:            }
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.