Source Code Cross Referenced for AbstractEventLogger.java in  » Content-Management-System » harmonise » org » openharmonise » rm » 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 » Content Management System » harmonise » org.openharmonise.rm.logging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.rm.logging;
020:
021:        import java.util.Date;
022:        import java.util.Map;
023:
024:        import org.openharmonise.rm.sessions.Session;
025:
026:        /**
027:         * This class provides the base functionality, and specifies the interface,
028:         * for storing logging events in a repository.
029:         * 
030:         * @author Michael Bell
031:         * @version $Revision: 1.2 $
032:         *
033:         */
034:        public abstract class AbstractEventLogger implements  EventLogger {
035:
036:            /**
037:             * Constructs an <code>AbstractEventLogger</code>.
038:             */
039:            public AbstractEventLogger() {
040:                super ();
041:            }
042:
043:            /* (non-Javadoc)
044:             * @see org.openharmonise.rm.logging.EventLogger#logEvent(org.openharmonise.rm.logging.LogEvent)
045:             */
046:            public void logEvent(LogEvent event) throws LogException {
047:                int nUserId = -1;
048:                String sSessId = null;
049:                int nObjectId = -1;
050:                String sObjectType = null;
051:                String sAction = null;
052:                Date timestamp = null;
053:                String sIP = null;
054:                String sUserAgent = null;
055:                String sReferer = null;
056:                String sHeaderInfo = null;
057:
058:                timestamp = event.getTimestamp();
059:
060:                if (event.getUser() != null) {
061:                    nUserId = event.getUser().getId();
062:                }
063:
064:                Session sess = event.getSession();
065:                if (sess != null) {
066:                    sSessId = sess.getSessionId();
067:                }
068:
069:                if (event.getObject() != null) {
070:                    sObjectType = event.getObject().getClass().getName();
071:                    nObjectId = event.getObjectId();
072:                }
073:
074:                sAction = event.getLabel();
075:
076:                Map headers = null;
077:
078:                if (event.getState() != null) {
079:                    headers = event.getState().getHeaders();
080:
081:                    sIP = event.getState().getRemoteAddress();
082:                }
083:
084:                if (headers == null) {
085:                    String sAdditional = event.getAdditionalInfo();
086:
087:                    saveData(nUserId, sSessId, nObjectId, sObjectType, sAction,
088:                            timestamp, sIP, sAdditional);
089:
090:                } else {
091:                    saveData(nUserId, sSessId, nObjectId, sObjectType, sAction,
092:                            timestamp, sIP, headers);
093:                }
094:
095:            }
096:
097:            /**
098:             * Saves event data to a repository.
099:             * 
100:             * @param nUserId the user identifier
101:             * @param sSessionId the session identifier
102:             * @param nObjectId the object identifier
103:             * @param sObjectType the object type/class name
104:             * @param sAction the event description
105:             * @param timestamp the timestamp of the event
106:             * @param sIP the IP address of the user agent which initiated the event
107:             * @param headers the header data associated with the remote request which initiated this event
108:             * @throws LogException if an error occurs saving the data
109:             */
110:            abstract protected void saveData(int nUserId, String sSessionId,
111:                    int nObjectId, String sObjectType, String sAction,
112:                    Date timestamp, String sIP, Map headers)
113:                    throws LogException;
114:
115:            /**
116:             * Saves event data to a repository.
117:             * 
118:             * @param nUserId the user identifier
119:             * @param sSessionId the session identifier
120:             * @param nObjectId the object identifier
121:             * @param sObjectType the object type/class name
122:             * @param sAction the event description
123:             * @param timestamp the timestamp of the event
124:             * @param sIP the IP address of the user agent which initiated the event
125:             * @param sAdditional additional data to be stored with event
126:             * @throws LogException if an error occurs saving the data
127:             */
128:            abstract protected void saveData(int nUserId, String sSessionId,
129:                    int nObjectId, String sObjectType, String sAction,
130:                    Date timestamp, String sIP, String sAdditional)
131:                    throws LogException;
132:
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.