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


001:        /*
002:         * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004:         */
005:
006:        //
007:        package com.sun.portal.ffj.options;
008:
009:        //
010:        import java.io.File;
011:        import java.util.HashMap;
012:        import java.util.StringTokenizer;
013:
014:        import org.openide.options.SystemOption;
015:        import org.openide.util.HelpCtx;
016:        import org.openide.util.NbBundle;
017:
018:        import com.sun.portal.ffj.filesystems.PSFileSystem;
019:        import com.sun.portal.ffj.util.PSConstants;
020:
021:        //
022:        public class PSSettings extends SystemOption implements  PSConstants {
023:            //
024:            public static final String PROP_CLASSPATH = "classpath";
025:            public static final String PROP_DOCROOT = "docroot";
026:            public static final String PROP_DEBUGTRACE = "debugtrace";
027:            public static final String PROP_USERNAME = "username";
028:            public static final String PROP_CONFIGDIR = "configdir";
029:            public static HashMap debugMap = new HashMap();
030:
031:            //
032:            // No constructor please!
033:            //
034:
035:            //
036:            //
037:            //
038:            private void initializeDebugMap() {
039:                //
040:                String key = NbBundle.getMessage(PSSettings.class,
041:                        "LBL_DEBUG_OFF");
042:                debugMap.put(key, new Short(DEBUG_OFF));
043:
044:                key = NbBundle
045:                        .getMessage(PSSettings.class, "LBL_DEBUG_WARNING");
046:                debugMap.put(key, new Short(DEBUG_WARNING));
047:
048:                key = NbBundle
049:                        .getMessage(PSSettings.class, "LBL_DEBUG_MESSAGE");
050:                debugMap.put(key, new Short(DEBUG_MESSAGE));
051:
052:                key = NbBundle.getMessage(PSSettings.class, "LBL_DEBUG_ERROR");
053:                debugMap.put(key, new Short(DEBUG_ERROR));
054:            }
055:
056:            protected void initialize() {
057:                //
058:                super .initialize();
059:
060:                // If you have more complex default values which might require
061:                // other parts of the module to already be installed, do not
062:                // put them here; e.g. make the getter return them as a
063:                // default if getProperty returns null. (The class might be
064:                // initialized partway through module installation.)
065:
066:                //
067:                String fsRootPath = PSFileSystem.getRootPath();
068:
069:                //
070:                setClasspath(fsRootPath);
071:                setDocroot(fsRootPath);
072:
073:                initializeDebugMap();
074:                setDebugtrace(DEBUG_OFF);
075:
076:                setUsername(USER_NAME);
077:                setConfigdir(fsRootPath);
078:            }
079:
080:            //
081:            //
082:            //
083:            public String displayName() {
084:                return NbBundle.getMessage(PSSettings.class, "LBL_PSSettings");
085:            }
086:
087:            public HelpCtx getHelpCtx() {
088:                return HelpCtx.DEFAULT_HELP;
089:                // If you provide context help then use:
090:                // return new HelpCtx (PSSettings.class);
091:            }
092:
093:            //
094:            //
095:            //
096:            public static PSSettings getDefault() {
097:                return (PSSettings) findObject(PSSettings.class, true);
098:            }
099:
100:            //
101:            //
102:            //
103:            public String getClasspath() {
104:                return (String) getProperty(PROP_CLASSPATH);
105:            }
106:
107:            public void setClasspath(String classPath) {
108:                //
109:                if (validClasspath(classPath))
110:                    putProperty(PROP_CLASSPATH, classPath, true);
111:            }
112:
113:            //
114:            //
115:            //
116:            public String getDocroot() {
117:                return (String) getProperty(PROP_DOCROOT);
118:            }
119:
120:            public void setDocroot(String docRoot) {
121:                //
122:                if (exists(docRoot))
123:                    putProperty(PROP_DOCROOT, docRoot, true);
124:            }
125:
126:            //
127:            //
128:            //
129:            public short getDebugtrace() {
130:                return ((Short) getProperty(PROP_DEBUGTRACE)).shortValue();
131:            }
132:
133:            public void setDebugtrace(short debugTrace) {
134:                putProperty(PROP_DEBUGTRACE, new Short(debugTrace), true);
135:            }
136:
137:            //
138:            //
139:            //
140:            public String getUsername() {
141:                return (String) getProperty(PROP_USERNAME);
142:            }
143:
144:            public void setUsername(String userName) {
145:                // Null/empty userName is not allowed.
146:                if (userName == null)
147:                    return;
148:
149:                if (userName.length() == 0)
150:                    return;
151:
152:                //
153:                putProperty(PROP_USERNAME, userName, true);
154:            }
155:
156:            //
157:            //
158:            //
159:            public String getConfigdir() {
160:                return (String) getProperty(PROP_CONFIGDIR);
161:            }
162:
163:            public void setConfigdir(String configDir) {
164:                // ConfigDir cannot be null or empty.
165:                // If it is, we set it to default
166:                if (configDir == null)
167:                    configDir = "";
168:
169:                if (configDir.length() == 0)
170:                    configDir = PSFileSystem.getRootPath();
171:
172:                //
173:                if (exists(configDir))
174:                    putProperty(PROP_CONFIGDIR, configDir, true);
175:            }
176:
177:            //
178:            //
179:            //
180:            private boolean exists(String path) {
181:                boolean retVal = true;
182:
183:                // null Path is like empty path!
184:                if (path == null)
185:                    return retVal;
186:
187:                // Empty path is of course ok.
188:                if (path.length() == 0)
189:                    return retVal;
190:
191:                //
192:                File f = new File(path);
193:                retVal = f.exists();
194:
195:                return retVal;
196:            }
197:
198:            private boolean validClasspath(String classPath) {
199:                boolean retVal = true;
200:
201:                // null Classpath is like empty classpath!
202:                if (classPath == null)
203:                    return retVal;
204:
205:                // Empty classpath is of course ok.
206:                if (classPath.length() == 0)
207:                    return retVal;
208:
209:                //
210:                StringTokenizer tokenizer = new StringTokenizer(classPath,
211:                        File.pathSeparator);
212:                while (tokenizer.hasMoreTokens()) {
213:                    String cpElement = tokenizer.nextToken();
214:                    retVal = exists(cpElement);
215:
216:                    //
217:                    if (!retVal)
218:                        break;
219:                }
220:
221:                return retVal;
222:            }
223:
224:            //
225:            //
226:            //
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.