Source Code Cross Referenced for DaemonProperties.java in  » Web-Server » Jigsaw » org » w3c » jigsaw » daemon » 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 » Web Server » Jigsaw » org.w3c.jigsaw.daemon 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // DaemonProperties.java
002:        // $Id: DaemonProperties.java,v 1.12 2000/08/16 21:37:34 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigsaw.daemon;
007:
008:        import java.util.Hashtable;
009:        import java.util.Properties;
010:
011:        import java.io.BufferedInputStream;
012:        import java.io.File;
013:        import java.io.FileInputStream;
014:        import java.io.FileNotFoundException;
015:        import java.io.IOException;
016:        import java.io.InputStream;
017:        import java.io.PrintStream;
018:
019:        import org.w3c.util.ObservableProperties;
020:
021:        /**
022:         * Subclass of Properties, to deal with daemon specific usage of them.
023:         * This class refines the basic Properties class, in order to tune them for
024:         * ServerHandler specific needs:
025:         * <ul>
026:         * <li>Properties can be observed through the PropertyMonitoring interface,
027:         * <li>Properties are multiplexed according to the server identifier. Two
028:         * servers can rely on the same set of properties, but each of them can
029:         * have its own property value. Eg the org.w3c.jigsaw.http package host
030:         * property can be set fro server1 to host1 and for server2 to host2. 
031:         * This is done by defining server1.org.w3c.jigsaw.http.host 
032:         * and server2.org.w3c.jigsaw.http.host
033:         * </ul>
034:         * <p>Each property can be monitored, to allow for dynamic reconfiguration of
035:         * the server.
036:         * @see org.w3c.util.PropertyMonitoring
037:         */
038:
039:        public class DaemonProperties {
040:            /**
041:             * The set of loaded properties set.
042:             */
043:            protected Hashtable propspace = new Hashtable(5);
044:            /**
045:             * The global set of properties (inherited by all spaces).
046:             */
047:            protected Properties globprops = null;
048:            /**
049:             * Our base config directory.
050:             */
051:            protected File configdir = null;
052:
053:            /**
054:             * Extend a property space.
055:             * @param id The identifier of the property set to extend.
056:             * @param in The input stream containing Java properties to add.
057:             * @exception IOException If the input stream couldn't be read.
058:             */
059:
060:            public ObservableProperties loadPropertySpace(String id,
061:                    InputStream in) throws IOException {
062:                ObservableProperties p = (ObservableProperties) propspace
063:                        .get(id);
064:                if (p == null) {
065:                    p = new ObservableProperties(globprops);
066:                    propspace.put(id, p);
067:                }
068:                p.load(in);
069:                return p;
070:            }
071:
072:            /**
073:             * Load in the default properties for the given space.
074:             * The file from which properties are loaded is kept itself as the
075:             * <code>org.w3c.jigsaw.propfile</code> property.
076:             * @param id The identifier of the property set to load.
077:             * @exception FileNotFoundException If the default property file wasn't 
078:             * found.
079:             * @exception IOException If default property file couldn't be read.
080:             */
081:
082:            public ObservableProperties loadPropertySpace(String id)
083:                    throws IOException, FileNotFoundException {
084:                File file = new File(configdir, id + ".props");
085:                ObservableProperties p = null;
086:                p = loadPropertySpace(id, (new BufferedInputStream(
087:                        new FileInputStream(file))));
088:                p
089:                        .put(org.w3c.jigsaw.http.httpd.PROPS_P, file
090:                                .getAbsolutePath());
091:                return p;
092:            }
093:
094:            /**
095:             * Get the properties for the given space.
096:             * @param id The identifier for a property set space.
097:             * @return An ObservableProperties instance, or <strong>null</strong>.
098:             */
099:
100:            public ObservableProperties getPropertySpace(String id) {
101:                return (ObservableProperties) propspace.get(id);
102:            }
103:
104:            // FIXME
105:            public void save() {
106:                System.out.println("DaemonProperties.save: not implemented !");
107:            }
108:
109:            // FIXME 
110:            public void savePropertySpace(String id) {
111:                System.out.println("DaemonProperties.save [" + id
112:                        + "]; not implemented!");
113:            }
114:
115:            // FIXME doc
116:            public void load(InputStream in) throws IOException {
117:                if (globprops == null)
118:                    globprops = new Properties();
119:                globprops.load(in);
120:            }
121:
122:            // FIXME doc
123:            public String getProperty(String name) {
124:                return (globprops != null) ? globprops.getProperty(name) : null;
125:            }
126:
127:            public String getString(String name, String def) {
128:                return (globprops != null) ? globprops.getProperty(name, def)
129:                        : def;
130:            }
131:
132:            /**
133:             * @param props The global properties to use in all spaces.
134:             */
135:
136:            public DaemonProperties(File configdir, Properties props) {
137:                this.configdir = configdir;
138:                this.globprops = props;
139:            }
140:
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.