Source Code Cross Referenced for SessionLogEntry.java in  » Database-ORM » toplink » oracle » toplink » essentials » logging » 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 » toplink » oracle.toplink.essentials.logging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         * 
004:         * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005:         * 
006:         *
007:         * The contents of this file are subject to the terms of either the GNU
008:         * General Public License Version 2 only ("GPL") or the Common Development
009:         * and Distribution License("CDDL") (collectively, the "License").  You
010:         * may not use this file except in compliance with the License. You can obtain
011:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
012:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
013:         * language governing permissions and limitations under the License.
014:         * 
015:         * When distributing the software, include this License Header Notice in each
016:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
017:         * Sun designates this particular file as subject to the "Classpath" exception
018:         * as provided by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code.  If applicable, add the following below the License
020:         * Header, with the fields enclosed by brackets [] replaced by your own
021:         * identifying information: "Portions Copyrighted [year]
022:         * [name of copyright owner]"
023:         * 
024:         * Contributor(s):
025:         * 
026:         * If you wish your version of this file to be governed by only the CDDL or
027:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
028:         * elects to include this software in this distribution under the [CDDL or GPL
029:         * Version 2] license."  If you don't indicate a single choice of license, a
030:         * recipient has the option to distribute your version of this file under
031:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
032:         * its licensees as provided above.  However, if you add GPL Version 2 code
033:         * and therefore, elected the GPL Version 2 license, then the option applies
034:         * only if the new code is made subject to such option by the copyright
035:         * holder.
036:         */
037:        package oracle.toplink.essentials.logging;
038:
039:        import java.util.Date;
040:        import java.io.Serializable;
041:        import oracle.toplink.essentials.internal.sessions.AbstractSession;
042:        import oracle.toplink.essentials.internal.databaseaccess.Accessor;
043:
044:        /**
045:         * SessionLogEntry is a simple container object that holds
046:         * all the information pertinent to a TopLink logging event.
047:         * It has a date/time stamp indicating when the event took
048:         * place. It holds the session, thread, and accessor
049:         * responsible for the event. And it holds whatever message
050:         * was passed through to be logged.
051:         *
052:         * @see SessionLog
053:         * @see DefaultSessionLog
054:         *
055:         * @author Big Country
056:         * @since TOPLink/Java 3.0
057:         */
058:        public class SessionLogEntry implements  Serializable {
059:            protected Date date;
060:            protected transient AbstractSession session;
061:            protected transient Thread thread;
062:            protected transient Accessor connection;
063:            protected String message;
064:            protected Throwable throwable;
065:            protected int level;
066:            protected String nameSpace;
067:            protected Object[] parameters;
068:            protected boolean shouldTranslate;
069:
070:            /**
071:             * PUBLIC:
072:             * Create a new session log entry for a session
073:             */
074:            public SessionLogEntry(AbstractSession session) {
075:                this .date = new Date();
076:                this .thread = Thread.currentThread();
077:                this .session = session;
078:                this .message = "";
079:                this .level = SessionLog.INFO;
080:            }
081:
082:            /**
083:             * PUBLIC:
084:             * Create a new session log entry for a session and an exception
085:             */
086:            public SessionLogEntry(AbstractSession session, Throwable throwable) {
087:                this (session);
088:                this .throwable = throwable;
089:                this .level = SessionLog.SEVERE;
090:            }
091:
092:            /**
093:             * PUBLIC:
094:             * Create a new session log entry for a session and a message
095:             */
096:            public SessionLogEntry(AbstractSession session, String message) {
097:                this (session);
098:                this .message = message;
099:            }
100:
101:            /**
102:             * PUBLIC:
103:             * Create a new session log entry for a session, a message and an accessor
104:             */
105:            public SessionLogEntry(AbstractSession session, String message,
106:                    Accessor connection) {
107:                this (session, message);
108:                this .connection = connection;
109:            }
110:
111:            /**
112:             * PUBLIC:
113:             * Create a new session log entry for a request level, a session, a message and an accessor
114:             */
115:            public SessionLogEntry(int level, AbstractSession session,
116:                    String message, Object[] params, Accessor connection,
117:                    boolean shouldTranslate) {
118:                this (session, message, connection);
119:                this .level = level;
120:                this .parameters = params;
121:                this .shouldTranslate = shouldTranslate;
122:            }
123:
124:            /**
125:             * PUBLIC:
126:             * Create a new session log entry for a request level, a session, a message and an accessor
127:             */
128:            public SessionLogEntry(int level, String category,
129:                    AbstractSession session, String message, Object[] params,
130:                    Accessor connection, boolean shouldTranslate) {
131:                this (level, session, message, params, connection,
132:                        shouldTranslate);
133:                this .nameSpace = category;
134:            }
135:
136:            /**
137:             * PUBLIC:
138:             * Create a new session log entry for a session, a level, a category and an exception
139:             */
140:            public SessionLogEntry(AbstractSession session, int level,
141:                    String category, Throwable throwable) {
142:                this (session, throwable);
143:                this .level = level;
144:                this .nameSpace = category;
145:            }
146:
147:            /**
148:             * PUBLIC:
149:             * Return the connection that generated the log entry.
150:             */
151:            public Accessor getConnection() {
152:                return connection;
153:            }
154:
155:            /**
156:             * PUBLIC:
157:             * Return the date of the log entry.
158:             */
159:            public Date getDate() {
160:                return date;
161:            }
162:
163:            /**
164:             * PUBLIC:
165:             * Return the exception that caused the log entry.
166:             */
167:            public Throwable getException() {
168:                return throwable;
169:            }
170:
171:            /**
172:             * PUBLIC:
173:             * Return the log entry's message.
174:             */
175:            public String getMessage() {
176:                return message;
177:            }
178:
179:            /**
180:             * PUBLIC:
181:             * Return the session that generated the log entry.
182:             */
183:            public AbstractSession getSession() {
184:                return session;
185:            }
186:
187:            /**
188:             * PUBLIC:
189:             * Return the thread that was active when the log entry was generated.
190:             */
191:            public Thread getThread() {
192:                return thread;
193:            }
194:
195:            /**
196:             * PUBLIC:
197:             * Return the request level of the log entry.
198:             */
199:            public int getLevel() {
200:                return level;
201:            }
202:
203:            /**
204:             * PUBLIC:
205:             * Return the name space of the log entry.
206:             */
207:            public String getNameSpace() {
208:                return nameSpace;
209:            }
210:
211:            /**
212:             * PUBLIC:
213:             * Return the array of parameters to the message.
214:             */
215:            public Object[] getParameters() {
216:                return parameters;
217:            }
218:
219:            /**
220:             * PUBLIC:
221:             * Return if the message should be translated.
222:             */
223:            public boolean shouldTranslate() {
224:                return shouldTranslate;
225:            }
226:
227:            /**
228:             * PUBLIC:
229:             * Return if the log entry was for an exception.
230:             */
231:            public boolean hasException() {
232:                return getException() != null;
233:            }
234:
235:            /**
236:             * PUBLIC:
237:             * Set the connection that generated the log entry.
238:             */
239:            public void setConnection(Accessor connection) {
240:                this .connection = connection;
241:            }
242:
243:            /**
244:             * PUBLIC:
245:             * Set the date of the log entry.
246:             */
247:            public void setDate(Date date) {
248:                this .date = date;
249:            }
250:
251:            /**
252:             * PUBLIC:
253:             * Set the exception that caused the log entry.
254:             */
255:            public void setException(Throwable throwable) {
256:                this .throwable = throwable;
257:            }
258:
259:            /**
260:             * PUBLIC:
261:             * Set the entry's message.
262:             */
263:            public void setMessage(String message) {
264:                this .message = message;
265:            }
266:
267:            /**
268:             * PUBLIC:
269:             * Set the session that generated the log entry.
270:             */
271:            public void setSession(AbstractSession session) {
272:                this .session = session;
273:            }
274:
275:            /**
276:             * PUBLIC:
277:             * Set the thread that was active when the log entry was generated.
278:             */
279:            public void setThread(Thread thread) {
280:                this .thread = thread;
281:            }
282:
283:            /**
284:             * PUBLIC:
285:             * Set the request level of the log entry.
286:             */
287:            public void setLevel(int level) {
288:                this .level = level;
289:            }
290:
291:            /**
292:             * PUBLIC:
293:             * Set the name space of the log entry.
294:             */
295:            public void setNameSpace(String nameSpace) {
296:                this .nameSpace = nameSpace;
297:            }
298:
299:            /**
300:             * PUBLIC:
301:             * Set the array of parameters to the message.
302:             */
303:            public void setParameters(Object[] params) {
304:                this .parameters = params;
305:            }
306:
307:            /**
308:             * PUBLIC:
309:             * Set if the message should be translated.
310:             */
311:            public void setShouldTranslate(boolean shouldTranslate) {
312:                this .shouldTranslate = shouldTranslate;
313:            }
314:
315:            /**
316:             * PUBLIC:
317:             * Print message.
318:             */
319:            public String toString() {
320:                return oracle.toplink.essentials.internal.helper.Helper
321:                        .getShortClassName(getClass())
322:                        + "(" + getMessage() + ")";
323:            }
324:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.