Source Code Cross Referenced for SlideLoggerAdapter.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » slide » impl » 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 » apache lenya 2.0 » org.apache.cocoon.components.slide.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.components.slide.impl;
018:
019:        import org.apache.avalon.framework.logger.Logger;
020:
021:        /**
022:         * The class represent an adapter for the logger for jakarta slide
023:         *
024:         * @version CVS $Id: SlideLoggerAdapter.java 433543 2006-08-22 06:22:54Z crossley $
025:         */
026:        public class SlideLoggerAdapter implements 
027:                org.apache.slide.util.logger.Logger {
028:            private Logger logger;
029:            private int currentLogLevel = ERROR;
030:
031:            public SlideLoggerAdapter(Logger logger) {
032:                this .logger = logger;
033:            }
034:
035:            public void log(Object data, Throwable t, String channel, int level) {
036:                if (level == CRITICAL) {
037:                    this .logger.fatalError(data.toString(), t);
038:                } else if (level == ERROR) {
039:                    this .logger.error(data.toString(), t);
040:                } else if (level == WARNING) {
041:                    this .logger.warn(data.toString(), t);
042:                } else if (level == INFO) {
043:                    this .logger.info(data.toString(), t);
044:                } else if (level == DEBUG) {
045:                    this .logger.debug(data.toString(), t);
046:                } else {
047:                    this .logger.error(data.toString(), t);
048:                }
049:            }
050:
051:            /**
052:             * Log an object thru the specified channel and with the specified level.
053:             *
054:             * @param data The object to log.
055:             * @param channel The channel name used for logging.
056:             * @param level The level used for logging.
057:             */
058:            public void log(Object data, String channel, int level) {
059:                if (level == CRITICAL) {
060:                    this .logger.fatalError(data.toString());
061:                } else if (level == ERROR) {
062:                    this .logger.error(data.toString());
063:                } else if (level == WARNING) {
064:                    this .logger.warn(data.toString());
065:                } else if (level == INFO) {
066:                    this .logger.info(data.toString());
067:                } else if (level == DEBUG) {
068:                    this .logger.debug(data.toString());
069:                } else {
070:                    this .logger.error(data.toString());
071:                }
072:            }
073:
074:            /**
075:             * Log an object with the specified level.
076:             *
077:             * @param data The object to log.
078:             * @param level The level used for logging.
079:             */
080:            public void log(Object data, int level) {
081:                if (level == CRITICAL) {
082:                    this .logger.fatalError(data.toString());
083:                } else if (level == ERROR) {
084:                    this .logger.error(data.toString());
085:                } else if (level == WARNING) {
086:                    this .logger.warn(data.toString());
087:                } else if (level == INFO) {
088:                    this .logger.info(data.toString());
089:                } else if (level == DEBUG) {
090:                    this .logger.debug(data.toString());
091:                } else {
092:                    this .logger.error(data.toString());
093:                }
094:            }
095:
096:            /**
097:             * Log an object.
098:             *
099:             * @param data The object to log.
100:             */
101:            public void log(Object data) {
102:                if (currentLogLevel == CRITICAL) {
103:                    this .logger.fatalError(data.toString());
104:                } else if (currentLogLevel == ERROR) {
105:                    this .logger.error(data.toString());
106:                } else if (currentLogLevel == WARNING) {
107:                    this .logger.warn(data.toString());
108:                } else if (currentLogLevel == INFO) {
109:                    this .logger.info(data.toString());
110:                } else if (currentLogLevel == DEBUG) {
111:                    this .logger.debug(data.toString());
112:                } else {
113:                    this .logger.error(data.toString());
114:                }
115:            }
116:
117:            /**
118:             * Set the logger level for the default channel
119:             *
120:             * @param level the logger level
121:             */
122:            public void setLoggerLevel(int level) {
123:                currentLogLevel = level;
124:            }
125:
126:            /**
127:             * Set the logger level for the specified channel
128:             *
129:             * @param channel
130:             * @param level the logger level
131:             */
132:            public void setLoggerLevel(String channel, int level) {
133:                currentLogLevel = level;
134:            }
135:
136:            /**
137:             * Get the logger level for the default channel
138:             * @return logger level
139:             */
140:            public int getLoggerLevel() {
141:                return currentLogLevel;
142:            }
143:
144:            /**
145:             * Get the logger level for the specified channel
146:             *
147:             * @param channel the channel
148:             * @return logger level
149:             */
150:            public int getLoggerLevel(String channel) {
151:                if (this .logger.isDebugEnabled()) {
152:                    return DEBUG;
153:                } else if (this .logger.isInfoEnabled()) {
154:                    return INFO;
155:                } else if (this .logger.isWarnEnabled()) {
156:                    return WARNING;
157:                } else if (this .logger.isErrorEnabled()) {
158:                    return ERROR;
159:                } else if (this .logger.isFatalErrorEnabled()) {
160:                    return CRITICAL;
161:                } else {
162:                    return ERROR;
163:                }
164:            }
165:
166:            /**
167:             * Check if the channel with the specified level is enabled for logging.
168:             *
169:             * @param channel The channel specification
170:             * @param level   The level specification
171:             */
172:            public boolean isEnabled(String channel, int level) {
173:                if (this .logger.isDebugEnabled()) {
174:                    return DEBUG <= level;
175:                } else if (this .logger.isInfoEnabled()) {
176:                    return INFO <= level;
177:                } else if (this .logger.isWarnEnabled()) {
178:                    return WARNING <= level;
179:                } else if (this .logger.isErrorEnabled()) {
180:                    return ERROR <= level;
181:                } else if (this .logger.isFatalErrorEnabled()) {
182:                    return CRITICAL <= level;
183:                } else {
184:                    return ERROR <= level;
185:                }
186:            }
187:
188:            /**
189:             * Check if the default channel with the specified level is enabled for logging.
190:             *
191:             * @param level   The level specification
192:             */
193:            public boolean isEnabled(int level) {
194:                if (this.logger.isDebugEnabled()) {
195:                    return DEBUG <= level;
196:                } else if (this.logger.isInfoEnabled()) {
197:                    return INFO <= level;
198:                } else if (this.logger.isWarnEnabled()) {
199:                    return WARNING <= level;
200:                } else if (this.logger.isErrorEnabled()) {
201:                    return ERROR <= level;
202:                } else if (this.logger.isFatalErrorEnabled()) {
203:                    return CRITICAL <= level;
204:                } else {
205:                    return ERROR <= level;
206:                }
207:            }
208:
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.