Source Code Cross Referenced for LogEvent.java in  » Net » openfire » org » jivesoftware » util » log » 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 » openfire » org.jivesoftware.util.log 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) The Apache Software Foundation. All rights reserved.
003:         *
004:         * This software is published under the terms of the Apache Software License
005:         * version 1.1, a copy of which has been included with this distribution in
006:         * the LICENSE file.
007:         */
008:
009:        package org.jivesoftware.util.log;
010:
011:        import java.io.ObjectStreamException;
012:        import java.io.Serializable;
013:
014:        /**
015:         * This class encapsulates each individual log event.
016:         * LogEvents usually originate at a Logger and are routed
017:         * to LogTargets.
018:         *
019:         * @author <a href="mailto:peter@apache.org">Peter Donald</a>
020:         */
021:        public final class LogEvent implements  Serializable {
022:            //A Constant used when retrieving time relative to start of applicaiton start
023:            private final static long START_TIME = System.currentTimeMillis();
024:
025:            ///The category that this LogEvent concerns. (Must not be null)
026:            private String m_category;
027:
028:            ///The message to be logged. (Must not be null)
029:            private String m_message;
030:
031:            ///The exception that caused LogEvent if any. (May be null)
032:            private Throwable m_throwable;
033:
034:            ///The time in millis that LogEvent occurred
035:            private long m_time;
036:
037:            ///The priority of LogEvent. (Must not be null)
038:            private Priority m_priority;
039:
040:            ///The context map associated with LogEvent. (May be null).
041:            private ContextMap m_contextMap;
042:
043:            /**
044:             * Get Priority for LogEvent.
045:             *
046:             * @return the LogEvent Priority
047:             */
048:            public final Priority getPriority() {
049:                return m_priority;
050:            }
051:
052:            /**
053:             * Set the priority of LogEvent.
054:             *
055:             * @param priority the new LogEvent priority
056:             */
057:            public final void setPriority(final Priority priority) {
058:                m_priority = priority;
059:            }
060:
061:            /**
062:             * Get ContextMap associated with LogEvent
063:             *
064:             * @return the ContextMap
065:             */
066:            public final ContextMap getContextMap() {
067:                return m_contextMap;
068:            }
069:
070:            /**
071:             * Set the ContextMap for this LogEvent.
072:             *
073:             * @param contextMap the context map
074:             */
075:            public final void setContextMap(final ContextMap contextMap) {
076:                m_contextMap = contextMap;
077:            }
078:
079:            //    /**
080:            //     * Get ContextStack associated with LogEvent
081:            //     *
082:            //     * @return the ContextStack
083:            //     * @deprecated ContextStack has been deprecated and thus so has this method
084:            //     */
085:            //    public final ContextStack getContextStack()
086:            //    {
087:            //        return m_contextStack;
088:            //    }
089:
090:            //    /**
091:            //     * Set the ContextStack for this LogEvent.
092:            //     * Note that if this LogEvent ever changes threads, the
093:            //     * ContextStack must be cloned.
094:            //     *
095:            //     * @param contextStack the context stack
096:            //     * @deprecated ContextStack has been deprecated and thus so has this method
097:            //     */
098:            //    public final void setContextStack( final ContextStack contextStack )
099:            //    {
100:            //        m_contextStack = contextStack;
101:            //    }
102:
103:            /**
104:             * Get the category that LogEvent relates to.
105:             *
106:             * @return the name of category
107:             */
108:            public final String getCategory() {
109:                return m_category;
110:            }
111:
112:            /**
113:             * Get the message associated with event.
114:             *
115:             * @return the message
116:             */
117:            public final String getMessage() {
118:                return m_message;
119:            }
120:
121:            /**
122:             * Get throwabe instance associated with event.
123:             *
124:             * @return the Throwable
125:             */
126:            public final Throwable getThrowable() {
127:                return m_throwable;
128:            }
129:
130:            /**
131:             * Get the absolute time of the log event.
132:             *
133:             * @return the absolute time
134:             */
135:            public final long getTime() {
136:                return m_time;
137:            }
138:
139:            /**
140:             * Get the time of the log event relative to start of application.
141:             *
142:             * @return the time
143:             */
144:            public final long getRelativeTime() {
145:                return m_time - START_TIME;
146:            }
147:
148:            /**
149:             * Set the LogEvent category.
150:             *
151:             * @param category the category
152:             */
153:            public final void setCategory(final String category) {
154:                m_category = category;
155:            }
156:
157:            /**
158:             * Set the message for LogEvent.
159:             *
160:             * @param message the message
161:             */
162:            public final void setMessage(final String message) {
163:                m_message = message;
164:            }
165:
166:            /**
167:             * Set the throwable for LogEvent.
168:             *
169:             * @param throwable the instance of Throwable
170:             */
171:            public final void setThrowable(final Throwable throwable) {
172:                m_throwable = throwable;
173:            }
174:
175:            /**
176:             * Set the absolute time of LogEvent.
177:             *
178:             * @param time the time
179:             */
180:            public final void setTime(final long time) {
181:                m_time = time;
182:            }
183:
184:            /**
185:             * Helper method that replaces deserialized priority with correct singleton.
186:             *
187:             * @return the singleton version of object
188:             * @throws ObjectStreamException if an error occurs
189:             */
190:            private Object readResolve() throws ObjectStreamException {
191:                if (null == m_category)
192:                    m_category = "";
193:                if (null == m_message)
194:                    m_message = "";
195:
196:                String priorityName = "";
197:                if (null != m_priority) {
198:                    priorityName = m_priority.getName();
199:                }
200:
201:                m_priority = Priority.getPriorityForName(priorityName);
202:
203:                return this;
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.