Source Code Cross Referenced for EventLogController.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 org.openharmonise.commons.dsi.*;
022:        import org.openharmonise.rm.config.*;
023:        import org.openharmonise.rm.dsi.*;
024:
025:        /**
026:         * Controls the logging of events within the Harmonise framework. There are two 
027:         * available implementations of <code>EventLogger</code> which can be used 
028:         * and this class controls which is used in a particular deployment based 
029:         * on the configuration property 'LOG_OUTPUT', which can take a value of 
030:         * either 'XML' or 'DB'. This class provides a single point of access for 
031:         * the core classes of the framework to log events with.
032:         * 
033:         * @author Michael Bell
034:         * @version $Revision: 1.2 $
035:         *
036:         */
037:        public class EventLogController implements  EventLogger {
038:
039:            /**
040:             * The singleton instance of this class
041:             */
042:            static EventLogController m_instance = null;
043:
044:            /**
045:             * The event logger for the current deployment
046:             */
047:            private EventLogger m_logger = null;
048:
049:            /**
050:             * Configuration parameter name which determines the type of event 
051:             * logger that is used
052:             */
053:            private static String PNAME_LOG_OUTPUT = "LOG_OUTPUT";
054:
055:            /**
056:             * Database logging constant. Value for the <code>PNAME_LOG_OUTPUT</code>
057:             * configuration parameter which specifies that events should be logged
058:             * to the database
059:             */
060:            public static final String LOGTYPE_DB = "DB";
061:
062:            /**
063:             * XML logging constant. Value for the <code>PNAME_LOG_OUTPUT</code>
064:             * configuration parameter which specifies that events should be logged
065:             * to an XML file
066:             */
067:            public static final String LOGTYPE_XML = "XML";
068:
069:            /**
070:             * Creates a new instance of a event log controller
071:             */
072:            protected EventLogController() throws LogException {
073:                try {
074:                    String sLogType = ConfigSettings.getProperty(
075:                            PNAME_LOG_OUTPUT, "DB");
076:
077:                    if (sLogType != null) {
078:                        if (sLogType.equals(LOGTYPE_DB) == true) {
079:                            m_logger = new DBEventLogger(
080:                                    DataStoreInterfaceFactory
081:                                            .getDataStoreInterface());
082:                        } else if (sLogType.equals(LOGTYPE_XML) == true) {
083:                            m_logger = new XMLEventLogger();
084:                        }
085:                    } else {
086:                        throw new LogException(
087:                                "Error getting log config setting");
088:                    }
089:                } catch (ConfigException e) {
090:                    throw new LogException("Error getting log config setting",
091:                            e);
092:                } catch (DataStoreException e) {
093:                    throw new LogException("Error getting data store inteface",
094:                            e);
095:                }
096:            }
097:
098:            /**
099:             * Returns the singleton instance of the event log controller
100:             * 
101:             * @return the singleton instance of the event log controller
102:             */
103:            public static EventLogController getInstance() throws LogException {
104:                if (m_instance == null) {
105:                    m_instance = new EventLogController();
106:                }
107:
108:                return m_instance;
109:            }
110:
111:            /* (non-Javadoc)
112:             * @see org.openharmonise.rm.logging.EventLogger#logEvent(org.openharmonise.rm.logging.LogEvent)
113:             */
114:            public void logEvent(LogEvent event) throws LogException {
115:
116:                if (m_logger != null) {
117:                    m_logger.logEvent(event);
118:                }
119:            }
120:
121:            /**
122:             * Resets cached singleton instance to null such that it can be
123:             * reconstructed using configuration settings.
124:             */
125:            public static void reset() {
126:                m_instance = null;
127:            }
128:
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.