Source Code Cross Referenced for WebmanCategory.java in  » Content-Management-System » webman » de » webman » util » log4j » 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 » de.webman.util.log4j 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.webman.util.log4j;
002:
003:        import org.apache.log4j.Category;
004:        import org.apache.log4j.Priority;
005:        import org.apache.log4j.spi.OptionHandler;
006:        import org.apache.log4j.spi.LoggingEvent;
007:        import org.apache.log4j.spi.CategoryFactory;
008:        import org.apache.log4j.helpers.LogLog;
009:
010:        import java.util.Enumeration;
011:
012:        /**
013:         Subclassing Category from Log4j
014:         * @see org.apache.log4j.Category
015:         * @author  $Author: alex $
016:         * @version $Revision: 1.2 $
017:         */
018:        public class WebmanCategory extends Category implements  OptionHandler {
019:            public static final int ALL = 0;
020:
021:            public static final int EDITOR = 1;
022:
023:            public static final int ADMINISTRATOR = 2;
024:
025:            public static final int PRODUCER = 3;
026:
027:            private static int filter = Integer.MAX_VALUE;
028:
029:            final private static String FQCN = WebmanCategory.class.getName();
030:
031:            // It's enough to instantiate a factory once and for all.
032:            public static WebmanFactory factory = new WebmanFactory();
033:
034:            /**
035:            	Just calls the parent constructor.
036:             */
037:            protected WebmanCategory(String name) {
038:                super (name);
039:            }
040:
041:            /** 
042:            	Nothing to activate.
043:             */
044:            public void activateOptions() {
045:            }
046:
047:            public static void setFilter(int _filter) {
048:                filter = _filter;
049:            }
050:
051:            /**
052:             Set  specific options.
053:
054:             <p>The <b>Suffix</b> option is the only recognized option. It
055:             takes a string value.
056:             @deprecated
057:             */
058:            public void setOption(String option, String value) {
059:                if (option == null) {
060:                    return;
061:                }
062:            }
063:
064:            /**
065:            	Retuns the option names for this component
066:            	@deprecated
067:             */
068:            public String[] getOptionStrings() {
069:                return null;
070:            }
071:
072:            public String getOption(String option) {
073:                return null;
074:            }
075:
076:            /**
077:            	This method overrides {@link Category#getInstance} by supplying
078:            	its own factory type as a parameter.
079:             */
080:            public static Category getInstance(String name) {
081:                return Category.getInstance(name, factory);
082:            }
083:
084:            /**
085:            	This method overrides {@link Category#getInstance(Class)} by supplying
086:            	its own factory type as a parameter.
087:             */
088:            public static Category getInstance(Class clazz) {
089:                return getInstance(clazz.getName(), factory);
090:            }
091:
092:            private static boolean isUserEnabled(int user) {
093:                return user <= filter;
094:            }
095:
096:            public void debug(Object message) {
097:                if (isUserEnabled(Integer.MAX_VALUE))
098:                    super .debug(message);
099:            }
100:
101:            public void debug(Object message, int user) {
102:                if (isUserEnabled(user))
103:                    super .debug(message);
104:            }
105:
106:            public void debug(Object message, Throwable t, int user) {
107:                if (isUserEnabled(user))
108:                    super .debug(message, t);
109:            }
110:
111:            public void debug(Object message, Throwable t) {
112:                if (isUserEnabled(Integer.MAX_VALUE))
113:                    super .debug(message, t);
114:            }
115:
116:            public void info(Object message) {
117:                if (isUserEnabled(Integer.MAX_VALUE))
118:                    super .info(message);
119:            }
120:
121:            public void info(Object message, int user) {
122:                if (isUserEnabled(user))
123:                    super .info(message);
124:            }
125:
126:            public void info(Object message, Throwable t, int user) {
127:                if (isUserEnabled(user))
128:                    super .info(message, t);
129:            }
130:
131:            public void info(Object message, Throwable t) {
132:                if (isUserEnabled(Integer.MAX_VALUE))
133:                    super .info(message, t);
134:            }
135:
136:            public void warn(Object message) {
137:                if (isUserEnabled(Integer.MAX_VALUE))
138:                    super .warn(message);
139:            }
140:
141:            public void warn(Object message, int user) {
142:                if (isUserEnabled(user))
143:                    super .warn(message);
144:            }
145:
146:            public void warn(Object message, Throwable t, int user) {
147:                if (isUserEnabled(user))
148:                    super .warn(message, t);
149:            }
150:
151:            public void warn(Object message, Throwable t) {
152:                if (isUserEnabled(Integer.MAX_VALUE))
153:                    super .warn(message, t);
154:            }
155:
156:            public void error(Object message) {
157:                if (isUserEnabled(Integer.MAX_VALUE))
158:                    super .error(message);
159:            }
160:
161:            public void error(Object message, int user) {
162:                if (isUserEnabled(user))
163:                    super .error(message);
164:            }
165:
166:            public void error(Object message, Throwable t, int user) {
167:                if (isUserEnabled(user))
168:                    super .error(message, t);
169:            }
170:
171:            public void error(Object message, Throwable t) {
172:                if (isUserEnabled(Integer.MAX_VALUE))
173:                    super .error(message, t);
174:            }
175:
176:            public void fatal(Object message) {
177:                if (isUserEnabled(Integer.MAX_VALUE))
178:                    super .fatal(message);
179:            }
180:
181:            public void fatal(Object message, int user) {
182:                if (isUserEnabled(user))
183:                    super .fatal(message);
184:            }
185:
186:            public void fatal(Object message, Throwable t, int user) {
187:                if (isUserEnabled(user))
188:                    super .fatal(message, t);
189:            }
190:
191:            public void fatal(Object message, Throwable t) {
192:                if (isUserEnabled(Integer.MAX_VALUE))
193:                    super .fatal(message, t);
194:            }
195:
196:            /**
197:            	We introduce a new printing method that takes the ACCESS priority.
198:             */
199:            public void access(Object message, Throwable t) {
200:                // disable is defined in Category
201:                if (hierarchy.isDisabled(AccessPriority.ACCESS_INT))
202:                    return;
203:                if (AccessPriority.ACCESS.isGreaterOrEqual(this 
204:                        .getChainedPriority()))
205:                    forcedLog(FQCN, AccessPriority.ACCESS, message, t);
206:            }
207:
208:            /**
209:            	We introduce a new printing method that takes the ACCESS priority.
210:             */
211:            public void access(Object message) {
212:                if (hierarchy.isDisabled(AccessPriority.ACCESS_INT))
213:                    return;
214:                if (AccessPriority.ACCESS.isGreaterOrEqual(this 
215:                        .getChainedPriority())) {
216:                    forcedLog(FQCN, AccessPriority.ACCESS, message, null);
217:                    // callAppenders(new LoggingEvent(FQCN, this, AccessPriority.ACCESS, 
218:                    //			     message, null));
219:                }
220:            }
221:
222:            // Any sub-class of Category must also have its own implementation of 
223:            // CategoryFactory.
224:            public static class WebmanFactory implements  CategoryFactory {
225:
226:                public WebmanFactory() {
227:                }
228:
229:                public Category makeNewCategoryInstance(String name) {
230:                    return new WebmanCategory(name);
231:                }
232:            }
233:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.