Source Code Cross Referenced for ConfigurationManager.java in  » Content-Management-System » webman » com » teamkonzept » lib » 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 » Content Management System » webman » com.teamkonzept.lib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.teamkonzept.lib;
002:
003:        import java.util.Hashtable;
004:        import java.util.Vector;
005:
006:        /**
007:         * The Configuration Manager is designed as a registry for Configuration
008:         * Listeners. These listeners may register themselves in different arbitrary
009:         * contexts. Notification of registered listeners is triggered by a dedicated
010:         * method.
011:         *
012:         * @version 1.0
013:         * @since 1.0
014:         * @author © 2001 Team-Konzept
015:         */
016:        public class ConfigurationManager {
017:
018:            // $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/lib/ConfigurationManager.java,v 1.3 2001/02/14 15:07:11 uli Exp $
019:
020:            // Constants
021:
022:            /**
023:             * The singleton instance of the Configuration Manager.
024:             */
025:            private static ConfigurationManager SINGLETON = null;
026:
027:            // Attributes
028:
029:            /**
030:             * The registry for the listeners.
031:             */
032:            private Hashtable registry = null;
033:
034:            // Constructors
035:
036:            /**
037:             * Avoids external instantiation.
038:             */
039:            private ConfigurationManager() {
040:                this .registry = new Hashtable();
041:            }
042:
043:            // Singleton access
044:
045:            /**
046:             * Returns the singleton instance of the Configuration Manager.
047:             *
048:             * @return the singleton instance of the Configuration Manager.
049:             */
050:            public static synchronized ConfigurationManager getInstance() {
051:                if (SINGLETON == null) {
052:                    SINGLETON = new ConfigurationManager();
053:                }
054:
055:                return SINGLETON;
056:            }
057:
058:            // Method implementations
059:
060:            /**
061:             * Registers a configuration listener with the manager.
062:             * <P>
063:             * The method silently returns when either the listener or the
064:             * context object is null.
065:             *
066:             * @param listener a configuration listener.
067:             * @param context a registration context.
068:             */
069:            public synchronized void registerConfigurationListener(
070:                    ConfigurationListener listener, Object context) {
071:                if (listener == null || context == null) {
072:                    // Fail fast and safe ;-)
073:                    return;
074:                }
075:
076:                // Read registry.
077:                Vector registrees = (Vector) registry.get(context);
078:
079:                if (registrees == null) {
080:                    // Create listeners container.
081:                    registrees = new Vector();
082:                }
083:
084:                // Add registree.
085:                registrees.addElement(listener);
086:
087:                // Update registry.
088:                registry.put(context, registrees);
089:            }
090:
091:            /**
092:             * Deregisters a configuration listener with the manager.
093:             * <P>
094:             * The method silently returns when either the listener or the
095:             * context object is null.
096:             *
097:             * @param listener a configuration listener.
098:             * @param context a registration context.
099:             */
100:            public synchronized void deregisterConfigurationListener(
101:                    ConfigurationListener listener, Object context) {
102:                if (listener == null || context == null) {
103:                    // Fail fast and safe ;-)
104:                    return;
105:                }
106:
107:                // Read registry.
108:                Vector registrees = (Vector) registry.get(context);
109:
110:                if (registrees == null) {
111:                    // Terminate.
112:                    return;
113:                }
114:
115:                // Remove registree.
116:                registrees.removeElement(listener);
117:
118:                // Update registry.
119:                if (registrees.size() > 0) {
120:                    registry.put(context, registrees);
121:                } else {
122:                    registry.remove(context);
123:                }
124:            }
125:
126:            /**
127:             * Notifies all listeners filed under the registration context.
128:             * <P>
129:             * The method silently returns when the context object is null.
130:             *
131:             * @param context a registration context.
132:             */
133:            public synchronized void notifyListeners(Object context)
134:                    throws TKException {
135:                if (context == null) {
136:                    // Fail fast and safe ;-)
137:                    return;
138:                }
139:
140:                // Read registry.
141:                Vector registrees = (Vector) registry.get(context);
142:
143:                if (registrees == null) {
144:                    // Terminate.
145:                    return;
146:                }
147:
148:                // Use index driven iteration instead of an enumeration
149:                // to avoid short lived object creation.
150:                for (int i = 0; i < registrees.size(); i++) {
151:                    // Notify listener.
152:                    ((ConfigurationListener) registrees.elementAt(i))
153:                            .configurationChanged();
154:                }
155:            }
156:
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.