Source Code Cross Referenced for Level.java in  » Net » edtftpj » com » enterprisedt » util » debug » 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 » Net » edtftpj » com.enterprisedt.util.debug 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         *  Copyright (C) 2000-2004 Enterprise Distributed Technologies Ltd
004:         *
005:         *  www.enterprisedt.com
006:         *
007:         *  This library is free software; you can redistribute it and/or
008:         *  modify it under the terms of the GNU Lesser General Public
009:         *  License as published by the Free Software Foundation; either
010:         *  version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *  This library is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *  Lesser General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU Lesser General Public
018:         *  License along with this library; if not, write to the Free Software
019:         *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         *
021:         *  Bug fixes, suggestions and comments should be sent to bruce@enterprisedt.com
022:         *
023:         *  Change Log:
024:         *
025:         *    $Log: Level.java,v $
026:         *    Revision 1.8  2007-07-05 05:19:40  bruceb
027:         *    make getLevel() public
028:         *
029:         *    Revision 1.7  2006/10/11 08:43:54  hans
030:         *    made cvsId and all the static Level declarations final
031:         *
032:         *    Revision 1.6  2005/02/04 12:20:37  bruceb
033:         *    made getLevel public
034:         *
035:         *    Revision 1.5  2004/08/31 13:54:49  bruceb
036:         *    remove compile warnings
037:         *
038:         *    Revision 1.4  2004/08/16 21:08:08  bruceb
039:         *    made cvsids public
040:         *
041:         *    Revision 1.3  2004/06/25 11:52:26  bruceb
042:         *    fixed logging bug
043:         *
044:         *    Revision 1.2  2004/05/08 21:14:20  bruceb
045:         *    string -> level
046:         *
047:         *    Revision 1.1  2004/05/01 16:55:42  bruceb
048:         *    first cut
049:         *
050:         *
051:         */package com.enterprisedt.util.debug;
052:
053:        /**
054:         *  Simple debug level class. Uses the same interface (but
055:         *  not implementation) as log4j, so that the debug
056:         *  classes could be easily replaced by log4j (by changing 
057:         *  imports - too dangerous to rely on class path and using
058:         *  the same package names)
059:         *
060:         *  @author      Bruce Blackshaw
061:         *  @version     $Revision: 1.8 $
062:         */
063:        public class Level {
064:
065:            /**
066:             *  Revision control id
067:             */
068:            final public static String cvsId = "@(#)$Id: Level.java,v 1.8 2007-07-05 05:19:40 bruceb Exp $";
069:
070:            final static int OFF_INT = -1;
071:
072:            final private static String OFF_STR = "OFF";
073:
074:            final static int FATAL_INT = 0;
075:
076:            final private static String FATAL_STR = "FATAL";
077:
078:            final static int ERROR_INT = 1;
079:
080:            final private static String ERROR_STR = "ERROR";
081:
082:            final static int WARN_INT = 2;
083:
084:            final private static String WARN_STR = "WARN";
085:
086:            final static int INFO_INT = 3;
087:
088:            final private static String INFO_STR = "INFO";
089:
090:            final static int DEBUG_INT = 4;
091:
092:            final private static String DEBUG_STR = "DEBUG";
093:
094:            final static int ALL_INT = 10;
095:
096:            final private static String ALL_STR = "ALL";
097:
098:            final static int LEVEL_COUNT = 5;
099:
100:            /**
101:             * Off level
102:             */
103:            final public static Level OFF = new Level(OFF_INT, OFF_STR);
104:
105:            /**
106:             * Fatal level
107:             */
108:            final public static Level FATAL = new Level(FATAL_INT, FATAL_STR);
109:
110:            /**
111:             * OFF level
112:             */
113:            final public static Level ERROR = new Level(ERROR_INT, ERROR_STR);
114:
115:            /**
116:             * Warn level
117:             */
118:            final public static Level WARN = new Level(WARN_INT, WARN_STR);
119:
120:            /**
121:             * Info level
122:             */
123:            final public static Level INFO = new Level(INFO_INT, INFO_STR);
124:
125:            /**
126:             * Debug level
127:             */
128:            final public static Level DEBUG = new Level(DEBUG_INT, DEBUG_STR);
129:
130:            /**
131:             * All level
132:             */
133:            final public static Level ALL = new Level(ALL_INT, ALL_STR);
134:
135:            /**
136:             * The level's integer value
137:             */
138:            private int level = OFF_INT;
139:
140:            /**
141:             * The level's string representation
142:             */
143:            private String string;
144:
145:            /**
146:             * Private constructor so no-one outside the class can
147:             * create any more instances
148:             * 
149:             * @param level     level to set this instance at
150:             * @param string    string representation
151:             */
152:            private Level(int level, String string) {
153:                this .level = level;
154:                this .string = string;
155:            }
156:
157:            /**
158:             * Get integer log level
159:             * 
160:             * @return log level
161:             */
162:            public int getLevel() {
163:                return level;
164:            }
165:
166:            /**
167:             * Is this level greater or equal to the supplied level
168:             * 
169:             * @param l      level to test against
170:             * @return  true if greater or equal to, false if less than
171:             */
172:            boolean isGreaterOrEqual(Level l) {
173:                if (this .level >= l.level)
174:                    return true;
175:                return false;
176:            }
177:
178:            /**
179:             * Get level from supplied string
180:             * 
181:             * @param level level as a string
182:             * @return level object or null if not found
183:             */
184:            public static Level getLevel(String level) {
185:                if (OFF.toString().equalsIgnoreCase(level))
186:                    return OFF;
187:                if (FATAL.toString().equalsIgnoreCase(level))
188:                    return FATAL;
189:                if (ERROR.toString().equalsIgnoreCase(level))
190:                    return ERROR;
191:                if (WARN.toString().equalsIgnoreCase(level))
192:                    return WARN;
193:                if (INFO.toString().equalsIgnoreCase(level))
194:                    return INFO;
195:                if (DEBUG.toString().equalsIgnoreCase(level))
196:                    return DEBUG;
197:                if (ALL.toString().equalsIgnoreCase(level))
198:                    return ALL;
199:                return null;
200:            }
201:
202:            /**
203:             * String representation
204:             * 
205:             * @return string
206:             */
207:            public String toString() {
208:                return string;
209:            }
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.