Source Code Cross Referenced for UncaughtExcpetionsModel.java in  » Report » pentaho-report » org » pentaho » reportdesigner » lib » client » util » 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 » Report » pentaho report » org.pentaho.reportdesigner.lib.client.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 Pentaho Corporation.  All rights reserved.
003:         * This software was developed by Pentaho Corporation and is provided under the terms
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005:         * this file except in compliance with the license. If you need a copy of the license,
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007:         *
008:         * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
010:         * the license for the specific language governing your rights and limitations.
011:         *
012:         * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013:         */
014:        package org.pentaho.reportdesigner.lib.client.util;
015:
016:        import org.jetbrains.annotations.NonNls;
017:        import org.jetbrains.annotations.NotNull;
018:
019:        import java.util.Date;
020:        import java.util.LinkedHashSet;
021:        import java.util.LinkedList;
022:        import java.util.logging.Level;
023:        import java.util.logging.Logger;
024:
025:        /**
026:         * User: Martin
027:         * Date: 24.02.2006
028:         * Time: 09:36:43
029:         */
030:        public class UncaughtExcpetionsModel {
031:            @NotNull
032:            @NonNls
033:            private static final Logger LOG = Logger
034:                    .getLogger(UncaughtExcpetionsModel.class.getName());
035:
036:            private static final int MAXIMUM_SIZE = 100;
037:
038:            @NotNull
039:            private static final UncaughtExcpetionsModel instance = new UncaughtExcpetionsModel();
040:
041:            @NotNull
042:            public static UncaughtExcpetionsModel getInstance() {
043:                return instance;
044:            }
045:
046:            @NotNull
047:            private LinkedHashSet<UncaughtExceptionModelListener> uncaughtExceptionModelListeners;
048:            @NotNull
049:            private LinkedList<ThrowableInfo> throwables;
050:
051:            public UncaughtExcpetionsModel() {
052:                uncaughtExceptionModelListeners = new LinkedHashSet<UncaughtExceptionModelListener>();
053:                throwables = new LinkedList<ThrowableInfo>();
054:            }
055:
056:            public void addException(@NotNull
057:            Throwable throwable) {
058:                if (LOG.isLoggable(Level.SEVERE))
059:                    LOG.log(Level.SEVERE,
060:                            "UncaughtExcpetionsModel.addException ", throwable);
061:
062:                throwables.add(new ThrowableInfo(System.currentTimeMillis(),
063:                        throwable));
064:                if (throwables.size() > MAXIMUM_SIZE) {
065:                    throwables.removeFirst();
066:                }
067:
068:                LinkedHashSet<UncaughtExceptionModelListener> uncaughtExceptionModelListeners = new LinkedHashSet<UncaughtExceptionModelListener>(
069:                        this .uncaughtExceptionModelListeners);
070:                for (UncaughtExceptionModelListener uncaughtExceptionModelListener : uncaughtExceptionModelListeners) {
071:                    uncaughtExceptionModelListener.exceptionCaught(throwable);
072:                }
073:            }
074:
075:            @NotNull
076:            public LinkedList<ThrowableInfo> getThrowables() {
077:                return throwables;
078:            }
079:
080:            public void addUncaughtExceptionModelListener(@NotNull
081:            UncaughtExceptionModelListener uncaughtExceptionModelListener) {
082:                uncaughtExceptionModelListeners
083:                        .add(uncaughtExceptionModelListener);
084:            }
085:
086:            public void removeUncaughtExceptionModelListener(@NotNull
087:            UncaughtExceptionModelListener uncaughtExceptionModelListener) {
088:                uncaughtExceptionModelListeners
089:                        .remove(uncaughtExceptionModelListener);
090:            }
091:
092:            public void clearExceptions() {
093:                throwables.clear();
094:
095:                LinkedHashSet<UncaughtExceptionModelListener> uncaughtExceptionModelListeners = new LinkedHashSet<UncaughtExceptionModelListener>(
096:                        this .uncaughtExceptionModelListeners);
097:                for (UncaughtExceptionModelListener uncaughtExceptionModelListener : uncaughtExceptionModelListeners) {
098:                    uncaughtExceptionModelListener.exceptionsCleared();
099:                }
100:            }
101:
102:            public void exceptionsViewed() {
103:                LinkedHashSet<UncaughtExceptionModelListener> uncaughtExceptionModelListeners = new LinkedHashSet<UncaughtExceptionModelListener>(
104:                        this .uncaughtExceptionModelListeners);
105:                for (UncaughtExceptionModelListener uncaughtExceptionModelListener : uncaughtExceptionModelListeners) {
106:                    uncaughtExceptionModelListener.exceptionsViewed();
107:                }
108:            }
109:
110:            public static class ThrowableInfo {
111:                private boolean submitted;
112:                private long millis;
113:                @NotNull
114:                private Throwable throwable;
115:
116:                public ThrowableInfo(long millis, @NotNull
117:                Throwable throwable) {
118:                    //noinspection ConstantConditions
119:                    if (throwable == null) {
120:                        throw new IllegalArgumentException(
121:                                "throwable must not be null");
122:                    }
123:
124:                    submitted = false;
125:                    this .millis = millis;
126:                    this .throwable = throwable;
127:                }
128:
129:                public long getMillis() {
130:                    return millis;
131:                }
132:
133:                @NotNull
134:                public Throwable getThrowable() {
135:                    return throwable;
136:                }
137:
138:                public boolean isSubmitted() {
139:                    return submitted;
140:                }
141:
142:                public void setSubmitted(boolean submitted) {
143:                    this .submitted = submitted;
144:                }
145:
146:                @NotNull
147:                public String toString() {
148:                    return (submitted ? "" : "* ") + new Date(millis) + " "
149:                            + throwable;
150:                }
151:            }
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.