Source Code Cross Referenced for PathInfo.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » qti » util » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.assessment.qti.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL$
003:         * $Id$
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Sakai Foundation.
007:         *
008:         * Licensed under the Educational Community License, Version 1.0 (the"License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         *
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         *
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.tool.assessment.qti.util;
021:
022:        import java.io.FileInputStream;
023:        import java.io.IOException;
024:        import java.util.Properties;
025:
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:
029:        /**
030:         * Utility class used for accessing settings and security directories
031:         * (and associated Properties).
032:         *
033:         * @author <a href="mailto:lance@indiana.edu">Lance Speelmon</a>
034:         * @version $Id: PathInfo.java 1288 2005-08-19 02:58:02Z esmiley@stanford.edu $
035:         */
036:        public class PathInfo {
037:            private static Log log = LogFactory.getLog(PathInfo.class);
038:            private static final String SETTINGS_DIR = "/org/sakaiproject/settings/sam";
039:            private static final String SECURITY_DIR = "/org/sakaiproject/security/sam";
040:            private static PathInfo _INSTANCE = new PathInfo();
041:            private String basePathToSecurity = "";
042:            private String basePathToSettings = "";
043:            private String pathToSecurity = "";
044:            private String pathToSettings = "";
045:
046:            /**
047:             * Returns an instance of PathInfo.
048:             *
049:             * @return
050:             */
051:            public static PathInfo getInstance() {
052:                log.debug("getInstance()");
053:
054:                return _INSTANCE;
055:            }
056:
057:            /**
058:             * Constructor should never be exposed.  Singleton pattern.
059:             */
060:            private PathInfo() {
061:                log.debug("new PathInfo()");
062:            }
063:
064:            /**
065:             * Returns a Properties from the security directory.
066:             *
067:             * @param fileName
068:             *
069:             * @return
070:             *
071:             * @throws IOException
072:             */
073:            public Properties getSecurityProperties(String fileName)
074:                    throws IOException {
075:                if (log.isDebugEnabled()) {
076:                    log.debug("getSecurityProperties(String " + fileName + ")");
077:                }
078:
079:                Properties props = null;
080:                props = new Properties();
081:                props
082:                        .load(new FileInputStream(pathToSecurity + "/"
083:                                + fileName));
084:
085:                return props;
086:            }
087:
088:            /**
089:             * Load properties from a file.
090:             *
091:             * @param fileName file name
092:             *
093:             * @return Properties object
094:             *
095:             * @throws IOException in reading file
096:             */
097:            public Properties getSettingsProperties(String fileName)
098:                    throws IOException {
099:                if (log.isDebugEnabled()) {
100:                    log.debug("getSettingsProperties(String " + fileName + ")");
101:                }
102:
103:                Properties props = null;
104:                props = new Properties();
105:                props
106:                        .load(new FileInputStream(pathToSettings + "/"
107:                                + fileName));
108:
109:                return props;
110:            }
111:
112:            /**
113:             * Get base path string to security.
114:             *
115:             * @return the path
116:             */
117:            public String getBasePathToSecurity() {
118:                log.debug("getBasePathToSecurity()");
119:
120:                return basePathToSecurity;
121:            }
122:
123:            /**
124:             * Set base path to security.
125:             *
126:             * @param basePathToSettings DOCUMENTATION PENDING
127:             *
128:             * @throws IllegalArgumentException if this is invalid path.
129:             */
130:            public void setBasePathToSecurity(String basePathToSecurity)
131:                    throws IllegalArgumentException {
132:                if (log.isDebugEnabled()) {
133:                    log.debug("setBasePathToSecurity(String "
134:                            + basePathToSecurity + ")");
135:                }
136:
137:                if (basePathToSecurity == null) {
138:                    throw new IllegalArgumentException(
139:                            "illegal String basePathToSecurity argument: "
140:                                    + basePathToSecurity);
141:                }
142:
143:                synchronized (this .basePathToSecurity) {
144:                    this .basePathToSecurity = basePathToSecurity;
145:                }
146:
147:                synchronized (this .pathToSecurity) {
148:                    this .pathToSecurity = this .basePathToSecurity
149:                            + SECURITY_DIR;
150:                }
151:            }
152:
153:            /**
154:             * Get base path string to settings.
155:             *
156:             * @return the path
157:             */
158:            public String getBasePathToSettings() {
159:                log.debug("getBasePathToSettings()");
160:
161:                return basePathToSettings;
162:            }
163:
164:            /**
165:             * Set base path to settings.
166:             *
167:             * @param basePathToSettings DOCUMENTATION PENDING
168:             *
169:             * @throws IllegalArgumentException if this is invalid path.
170:             */
171:            public void setBasePathToSettings(String basePathToSettings)
172:                    throws IllegalArgumentException {
173:                if (log.isDebugEnabled()) {
174:                    log.debug("setBasePathToSettings(String "
175:                            + basePathToSettings + ")");
176:                }
177:
178:                if (basePathToSettings == null) {
179:                    throw new IllegalArgumentException(
180:                            "illegal String basePathToSettings argument: "
181:                                    + basePathToSettings);
182:                }
183:
184:                synchronized (this .basePathToSettings) {
185:                    this .basePathToSettings = basePathToSettings;
186:                }
187:
188:                synchronized (this .pathToSettings) {
189:                    this .pathToSettings = this .basePathToSettings
190:                            + SETTINGS_DIR;
191:                }
192:            }
193:
194:            /**
195:             * Get base path string to security.
196:             *
197:             * @return the path
198:             */
199:            public String getPathToSecurity() {
200:                return pathToSecurity;
201:            }
202:
203:            /**
204:             * Get base path string to settings.
205:             *
206:             * @return the path
207:             */
208:            public String getPathToSettings() {
209:                return pathToSettings;
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.