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


001:        /**
002:         * $Id: PSConfigContextImpl.java,v 1.35 2007/01/26 03:47:09 portalbld Exp $
003:         * Copyright 2004 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.admin.common.context;
014:
015:        import java.io.File;
016:        import java.io.FileNotFoundException;
017:        import java.io.IOException;
018:        import java.util.Properties;
019:
020:        import sun.misc.BASE64Decoder;
021:
022:        import com.sun.portal.util.ResourceLoader;
023:        import com.sun.portal.util.Platform;
024:
025:        public class PSConfigContextImpl implements  PSConfigContext {
026:
027:            protected static final String FS = Platform.fs;
028:            protected String domainDir = null;
029:            protected Properties isConfig = null;
030:            protected Properties psConfig = null;
031:            protected Properties domainConfig = null;
032:            protected Properties portalVersion = null;
033:            protected BASE64Decoder decoder = new BASE64Decoder();
034:
035:            public PSConfigContextImpl(String domainID)
036:                    throws FileNotFoundException, IOException {
037:
038:                ResourceLoader rl = ResourceLoader.getInstance(System
039:                        .getProperties());
040:                psConfig = rl.getProperties(PS_CONFIG_FILE);
041:
042:                if (psConfig != null) {
043:                    domainDir = getPSConfigDir() + FS + DOMAINS + FS + domainID;
044:                    String file = domainDir + FS + DOMAIN_CONFIG_FILE;
045:                    domainConfig = rl.getProperties(file);
046:                    String amconf = getUserAuthConfigFile();
047:                    isConfig = rl.getProperties(amconf);
048:
049:                    String portalVersionFile = getPSBaseDir() + FS + "lib" + FS
050:                            + PS_VERSION_FILE;
051:                    portalVersion = rl.getProperties(portalVersionFile);
052:                }
053:            }
054:
055:            public String getPathSeparator() {
056:                return Platform.pathSep;
057:            }
058:
059:            /**
060:             * IMPORTANT: If this function messes up, PS/AM seperated configurations
061:             * can get messed up. So change with care. 
062:             * @return
063:             */
064:            public String getAMVersion() {
065:                //Note: The JES3 Linux AS install return different string
066:                String version = isConfig.getProperty(AM_VERSION).trim();
067:                String AMVer6Regex = "\\s*6.*"; //first non-whitespace character should be 6
068:                String AMVer7Regex = "\\s*7.*"; //first non-whitespace character should be 7
069:                if (version.matches(AMVer7Regex))
070:                    return "7";
071:                else if (version.matches(AMVer6Regex))
072:                    return "6";
073:                else
074:                    return "invalid";
075:            }
076:
077:            public String getJavaHome() {
078:                return psConfig.getProperty(JAVA_HOME);
079:            }
080:
081:            public String getPSBaseDir() {
082:                return psConfig.getProperty(PS_BASE_DIR);
083:            }
084:
085:            public String getPSDataDir() {
086:                return psConfig.getProperty(PS_DATA_DIR);
087:            }
088:
089:            public String getPSConfigDir() {
090:                return psConfig.getProperty(PS_CONFIG_DIR);
091:
092:            }
093:
094:            public String getISBaseDir() {
095:                return psConfig.getProperty(IS_BASE_DIR);
096:            }
097:
098:            public String getISConfigDir() {
099:                return psConfig.getProperty(IS_CONFIG_DIR);
100:            }
101:
102:            public String getISDataDir() {
103:                return psConfig.getProperty(IS_DATA_DIR);
104:            }
105:
106:            public String getCacaoBaseDir() {
107:                return psConfig.getProperty(CACAO_BASE_DIR);
108:            }
109:
110:            public String getCacaoConfigDir() {
111:                return psConfig.getProperty(CACAO_CONFIG_DIR);
112:            }
113:
114:            public String getSharedLibsDir() {
115:                return psConfig.getProperty(SHARED_LIB_DIR);
116:            }
117:
118:            public String getPrivateSharedLibsDir() {
119:                return psConfig.getProperty(PRIVATE_SHARE_LIB_DIR);
120:            }
121:
122:            public String getJSSNSSLibDir() {
123:                return psConfig.getProperty(JSS_NSS_LIB_DIR);
124:            }
125:
126:            public String getJSSJARDir() {
127:                return psConfig.getProperty(JSS_JAR_DIR);
128:            }
129:
130:            public String getJDMKLibDir() {
131:                return psConfig.getProperty(JDMK_LIB_DIR);
132:            }
133:
134:            public String getDerbyLibDir() {
135:                return psConfig.getProperty(DERBY_LIB_DIR);
136:            }
137:
138:            public String getAntHomeDir() {
139:                return psConfig.getProperty(ANT_HOME_DIR);
140:            }
141:
142:            public String getAntLibDir() {
143:                return psConfig.getProperty(ANT_LIB_DIR);
144:            }
145:
146:            public String getRegistryLibDir() {
147:                return psConfig.getProperty(REGISTRY_LIB_DIR);
148:            }
149:
150:            public String getJESMFLibDir() {
151:                return psConfig.getProperty(JESMF_LIB_DIR);
152:            }
153:
154:            public String getJESMFBinDir() {
155:                return psConfig.getProperty(JESMF_BIN_DIR);
156:            }
157:
158:            public String getJAXLibDir() {
159:                return psConfig.getProperty(JAX_LIB_DIR);
160:            }
161:
162:            public String getOrgNamingAttribute() {
163:                return psConfig.getProperty(ORG_NAMING_ATTR);
164:            }
165:
166:            public String getRoleNamingAttribute() {
167:                return psConfig.getProperty(ROLE_NAMING_ATTR);
168:            }
169:
170:            public String getUserNamingAttribute() {
171:                return psConfig.getProperty(USER_NAMING_ATTR);
172:            }
173:
174:            public String getPeopleContainerNamingAttribute() {
175:                return psConfig.getProperty(PEOPLE_CONTAINER_NAMING_ATTR);
176:            }
177:
178:            public String getUserAuthConfigFile() {
179:                return domainConfig.getProperty(USER_AUTH_CONFIG_FILE);
180:            }
181:
182:            public String getUserDataStoreManager() {
183:                return domainConfig.getProperty(USER_STORE_MANAGER);
184:            }
185:
186:            public String getUserDataStoreManagerCredentials() {
187:                String cred = domainConfig
188:                        .getProperty(USER_STORE_MANAGER_CREDENTIALS);
189:
190:                try {
191:                    return new String(decoder.decodeBuffer(cred), "8859_1");
192:                } catch (Exception e) {
193:                    return cred;
194:                }
195:            }
196:
197:            public String getDomainDataClass() {
198:                return domainConfig.getProperty(DOMAIN_DATA_CLASS);
199:            }
200:
201:            public String getDomainDataHost() {
202:                return domainConfig.getProperty(DOMAIN_DATA_HOST);
203:            }
204:
205:            public String getDomainDataPort() {
206:                return domainConfig.getProperty(DOMAIN_DATA_PORT);
207:            }
208:
209:            public boolean isDomainDataSecure() {
210:                String isSecure = domainConfig.getProperty(DOMAIN_DATA_SECURE);
211:
212:                if ((isSecure == null) || (isSecure.trim().length() == 0)) {
213:                    isSecure = isConfig.getProperty(AM_LDAP_SERVER_SECURE);
214:                }
215:
216:                return Boolean.valueOf(isSecure).booleanValue();
217:            }
218:
219:            public String getDomainDataRootSuffix() {
220:                return domainConfig.getProperty(DOMAIN_DATA_ROOTSUFFIX);
221:            }
222:
223:            public String getDomainDataPrincipal() {
224:                return domainConfig.getProperty(DOMAIN_DATA_PRINCIPAL);
225:            }
226:
227:            public String getDomainDataCredentials() {
228:                String cred = domainConfig.getProperty(DOMAIN_DATA_CREDENTIALS);
229:
230:                try {
231:                    return new String(decoder.decodeBuffer(cred), "8859_1");
232:                } catch (Exception e) {
233:                    return cred;
234:                }
235:            }
236:
237:            public String getSessionServiceProtocol() {
238:                return isConfig.getProperty(AM_SERVER_PROTOCOL);
239:            }
240:
241:            public String getSessionServiceHost() {
242:                return isConfig.getProperty(AM_SERVER_HOST);
243:            }
244:
245:            public String getSessionServicePort() {
246:                return isConfig.getProperty(AM_SERVER_PORT);
247:            }
248:
249:            public String getDefaultOrganization() {
250:                String amDefaultOrg = isConfig.getProperty(AM_DEFAULTORG);
251:                String amRootSuffix = getRootSuffix();
252:
253:                if (amDefaultOrg.equalsIgnoreCase(amRootSuffix)) {
254:                    return amDefaultOrg;
255:                }
256:                return amDefaultOrg + "," + amRootSuffix;
257:            }
258:
259:            public String getRootSuffix() {
260:                return isConfig.getProperty(AM_ROOTSUFFIX);
261:            }
262:
263:            public String getDefaultPeopleDN() {
264:                return getPeopleContainerNamingAttribute() + "=People,"
265:                        + getDefaultOrganization();
266:            }
267:
268:            public String getDomainComponent() {
269:                return isConfig.getProperty(AM_DOMAINCOMPONENT);
270:            }
271:
272:            public String getEncryptionKey() {
273:                return isConfig.getProperty(AM_ENCRYPTION_PWD);
274:            }
275:
276:            public String getDirectoryServerHost() {
277:                return isConfig.getProperty(AM_LDAP_SERVER_HOST);
278:            }
279:
280:            public String getDirectoryServerPort() {
281:                return isConfig.getProperty(AM_LDAP_SERVER_PORT);
282:            }
283:
284:            public String getAdminUserDN() {
285:                return isConfig.getProperty(AM_ADMIN_USER_DN);
286:            }
287:
288:            public String getAMSpecialUsersDN() {
289:                String userDNs = isConfig.getProperty(AM_SPECIAL_USER_DN);
290:                int index = userDNs.indexOf("|");
291:                return (index < 0) ? userDNs : userDNs.substring(0, index);
292:            }
293:
294:            public String getAMLDAPUserDN() {
295:                return psConfig.getProperty(AM_LDAP_USER_DN).replaceAll("\\=",
296:                        "=");
297:            }
298:
299:            public String getISConsoleURI() {
300:                return isConfig.getProperty(AM_CONSOLE_URI);
301:            }
302:
303:            public String getISServerURI() {
304:                return isConfig.getProperty(AM_SERVER_URI);
305:            }
306:
307:            public String getAttributeHandlerName(String component) {
308:                return domainConfig.getProperty(ATTRIBUTE_HANDLER_PREFIX
309:                        + component);
310:            }
311:
312:            public String getPortalProductName() {
313:                return portalVersion.getProperty(PS_PROD_NAME);
314:            }
315:
316:            public String getPortalVersion() {
317:                return portalVersion.getProperty(PS_PROD_VERSION);
318:            }
319:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.