Source Code Cross Referenced for BasicLogger.java in  » Development » Monolog » org » objectweb » util » monolog » wrapper » config » 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 » Development » Monolog » org.objectweb.util.monolog.wrapper.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (C) 2001-2003 France Telecom R&D
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */package org.objectweb.util.monolog.wrapper.config;
018:
019:        import org.objectweb.util.monolog.api.Handler;
020:        import org.objectweb.util.monolog.api.Level;
021:        import org.objectweb.util.monolog.api.LevelFactory;
022:        import org.objectweb.util.monolog.api.TopicalLogger;
023:
024:        import java.io.Serializable;
025:        import java.util.ArrayList;
026:        import java.util.Enumeration;
027:        import java.util.HashMap;
028:
029:        /**
030:         * This class is a basic implementatio of the TopicalLogger interface. It is not
031:         * linked to any underlying log system. The log methods do nothing. Only the
032:         * configuration aspect is treated. Therefore all the logger structure is
033:         * stored into internal struture.
034:         *
035:         * @author Sebastien Chassande-Barrioz
036:         */
037:        public class BasicLogger implements  TopicalLogger, Serializable {
038:
039:            /**
040:             * This fields references by their name the handlers associated to the
041:             * logger.
042:             * key = a handler name
043:             * value = a Handler instance
044:             */
045:            protected HashMap handlers = null;
046:
047:            /**
048:             * The fields lists all topics the logger.
049:             */
050:            protected ArrayList topics = null;
051:
052:            /**
053:             * This field references the level factory.
054:             */
055:            protected LevelFactory levelFactory = null;
056:
057:            boolean additivity = true;
058:
059:            /**
060:             * The current level of the logger.
061:             */
062:            protected Level level = null;
063:
064:            BasicLogger(String topic, LevelFactory lf) {
065:                topics = new ArrayList();
066:                handlers = new HashMap();
067:                topics.add(topic);
068:                levelFactory = lf;
069:            }
070:
071:            // IMPLEMENTATION OF THE TopicalLogger INTERFACE //
072:            //--------------------------------------------//
073:
074:            public void addHandler(Handler h) throws Exception {
075:                handlers.put(h.getName(), h);
076:            }
077:
078:            public void removeHandler(Handler h) throws Exception {
079:                handlers.remove(h.getName());
080:            }
081:
082:            public Handler[] getHandler() {
083:                return (Handler[]) handlers.values().toArray(new Handler[0]);
084:            }
085:
086:            public Handler getHandler(String hn) {
087:                return (Handler) handlers.get(hn);
088:            }
089:
090:            public void removeAllHandlers() throws Exception {
091:                handlers.clear();
092:            }
093:
094:            public void setAdditivity(boolean a) {
095:                additivity = a;
096:            }
097:
098:            public boolean getAdditivity() {
099:                return additivity;
100:            }
101:
102:            public void addTopic(String topic) throws Exception {
103:                if (!topics.contains(topic)) {
104:                    topics.add(topic);
105:                }
106:            }
107:
108:            /**
109:             * TODO
110:             */
111:            public Enumeration getTopics() {
112:                //TODO
113:                return null;
114:            }
115:
116:            public String[] getTopic() {
117:                return (String[]) topics.toArray(new String[0]);
118:            }
119:
120:            public void removeTopic(String topic) throws Exception {
121:                topics.remove(topic);
122:            }
123:
124:            // IMPLEMENTATION OF THE Handler INTERFACE //
125:            //----------------------------------------//
126:            public String getName() {
127:                return (String) topics.get(0);
128:            }
129:
130:            public void setName(String name) {
131:                topics.set(0, name);
132:            }
133:
134:            public String getType() {
135:                return "logger";
136:            }
137:
138:            public String[] getAttributeNames() {
139:                return new String[0];
140:            }
141:
142:            public Object getAttribute(String name) {
143:                return null;
144:            }
145:
146:            public Object setAttribute(String name, Object value) {
147:                return null;
148:            }
149:
150:            // IMPLEMENTATION OF THE Logger INTERFACE //
151:            //----------------------------------------//
152:
153:            public void setIntLevel(int l) {
154:                level = levelFactory.getLevel(l);
155:            }
156:
157:            public void setLevel(Level l) {
158:                level = l;
159:            }
160:
161:            public int getCurrentIntLevel() {
162:                return (level != null ? level.getIntValue() : 0);
163:            }
164:
165:            public Level getCurrentLevel() {
166:                return level;
167:            }
168:
169:            public boolean isLoggable(int level) {
170:                return false;
171:            }
172:
173:            public boolean isLoggable(Level l) {
174:                return false;
175:            }
176:
177:            public boolean isOn() {
178:                return false;
179:            }
180:
181:            public void log(int level, Object message) {
182:            }
183:
184:            public void log(Level level, Object message) {
185:            }
186:
187:            public void log(int level, Object message, Throwable throwable) {
188:            }
189:
190:            public void log(Level level, Object message, Throwable throwable) {
191:            }
192:
193:            public void log(int level, Object message, Object location,
194:                    Object method) {
195:            }
196:
197:            public void log(Level l, Object message, Object location,
198:                    Object method) {
199:            }
200:
201:            public void log(int level, Object message, Throwable throwable,
202:                    Object location, Object method) {
203:            }
204:
205:            public void log(Level level, Object message, Throwable throwable,
206:                    Object location, Object method) {
207:            }
208:
209:            public void turnOn() {
210:            }
211:
212:            public void turnOff() {
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.