Source Code Cross Referenced for PrimitiveLogImpl.java in  » Database-ORM » ODAL » com » completex » objective » components » log » 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 » Database ORM » ODAL » com.completex.objective.components.log.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Objective Database Abstraction Layer (ODAL)
003:         *  Copyright (c) 2004, The ODAL Development Group
004:         *  All rights reserved.
005:         *  For definition of the ODAL Development Group please refer to LICENCE.txt file
006:         *
007:         *  Distributable under LGPL license.
008:         *  See terms of license at gnu.org.
009:         */package com.completex.objective.components.log.impl;
010:
011:        import com.completex.objective.components.log.Log;
012:        import com.completex.objective.components.log.LogConsts;
013:
014:        import java.io.PrintStream;
015:
016:        /**
017:         * Primitive log implementation that prints the messages to the PrintStream
018:         * provided as a constructor argument
019:         * @see Log
020:         * 
021:         * @author Gennady Krizhevsky
022:         */
023:        public abstract class PrimitiveLogImpl implements  Log, LogConsts {
024:
025:            private boolean traceEnabled = false;
026:            private boolean debugEnabled = true;
027:            private boolean infoEnabled = true;
028:            private boolean warnEnabled = true;
029:            private boolean errorEnabled = true;
030:            private boolean fatalEnabled = true;
031:            private PrintStream printStream;
032:
033:            /**
034:             * @param printStream - stream to print out messages 
035:             */
036:            protected PrimitiveLogImpl(PrintStream printStream) {
037:                this .printStream = printStream;
038:            }
039:
040:            public boolean isTraceEnabled() {
041:                return traceEnabled;
042:            }
043:
044:            public void setTraceEnabled(boolean traceEnabled) {
045:                this .traceEnabled = traceEnabled;
046:            }
047:
048:            public boolean isDebugEnabled() {
049:                return debugEnabled;
050:            }
051:
052:            public void setDebugEnabled(boolean debugEnabled) {
053:                this .debugEnabled = debugEnabled;
054:            }
055:
056:            public boolean isInfoEnabled() {
057:                return infoEnabled;
058:            }
059:
060:            public void setInfoEnabled(boolean infoEnabled) {
061:                this .infoEnabled = infoEnabled;
062:            }
063:
064:            public boolean isWarnEnabled() {
065:                return warnEnabled;
066:            }
067:
068:            public void setWarnEnabled(boolean warnEnabled) {
069:                this .warnEnabled = warnEnabled;
070:            }
071:
072:            public boolean isErrorEnabled() {
073:                return errorEnabled;
074:            }
075:
076:            public void setErrorEnabled(boolean errorEnabled) {
077:                this .errorEnabled = errorEnabled;
078:            }
079:
080:            public boolean isFatalEnabled() {
081:                return fatalEnabled;
082:            }
083:
084:            public void setFatalEnabled(boolean fatalEnabled) {
085:                this .fatalEnabled = fatalEnabled;
086:            }
087:
088:            private void logMessage(String level, Object s, Throwable throwable) {
089:                printStream.print(level + ": " + s);
090:                if (throwable != null) {
091:                    throwable.printStackTrace(System.out);
092:                } else {
093:                    printStream.println();
094:                }
095:            }
096:
097:            public void trace(Object o) {
098:                if (traceEnabled) {
099:                    logMessage(TRACE, o, null);
100:                }
101:            }
102:
103:            public void trace(Object o, Throwable throwable) {
104:                if (traceEnabled) {
105:                    logMessage(TRACE, o, throwable);
106:                }
107:            }
108:
109:            public void debug(Object s, Throwable throwable) {
110:                if (debugEnabled) {
111:                    logMessage(DEBUG, s, throwable);
112:                }
113:            }
114:
115:            public void debug(Object s) {
116:                if (debugEnabled) {
117:                    logMessage(DEBUG, s, null);
118:                }
119:            }
120:
121:            public void info(Object s, Throwable throwable) {
122:                if (infoEnabled) {
123:                    logMessage(INFO, s, throwable);
124:                }
125:            }
126:
127:            public void info(Object s) {
128:                if (infoEnabled) {
129:                    logMessage(INFO, s, null);
130:                }
131:            }
132:
133:            public void warn(Object s, Throwable throwable) {
134:                logMessage(WARN, s, throwable);
135:            }
136:
137:            public void warn(Object s) {
138:                logMessage(WARN, s, null);
139:            }
140:
141:            public void error(Object s, Throwable throwable) {
142:                logMessage(ERROR, s, throwable);
143:            }
144:
145:            public void error(Object s) {
146:                logMessage(ERROR, s, null);
147:            }
148:
149:            public void fatal(Object s, Throwable throwable) {
150:                logMessage(FATAL, s, null);
151:            }
152:
153:            public void fatal(Object s) {
154:                logMessage(ERROR, s, null);
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.