Source Code Cross Referenced for JwmaException.java in  » Web-Mail » Jwma » dtw » webmail » model » 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 » Web Mail » Jwma » dtw.webmail.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***
002:         * jwma Java WebMail
003:         * Copyright (c) 2000-2003 jwma team
004:         *
005:         * jwma is free software; you can distribute and use this source
006:         * under the terms of the BSD-style license received along with
007:         * the distribution.
008:         ***/package dtw.webmail.model;
009:
010:        import java.io.*;
011:        import java.util.*;
012:
013:        import dtw.webmail.JwmaKernel;
014:
015:        /**
016:         * Class implementing the JwmaError model.
017:         * It can contain an embedded exception and allows
018:         * access to it and it's corresponding stack trace.
019:         *
020:         * @author Dieter Wimberger
021:         * @version 0.9.7 07/02/2003
022:         */
023:        public class JwmaException extends Exception implements  JwmaError {
024:
025:            //instance attributes
026:            private boolean inline;
027:            private boolean displayed = false;
028:            private Set m_Descriptions = new HashSet(5);
029:            private Exception m_Exception;
030:
031:            /**
032:             * Constructs a new <tt>JwmaException</tt> instance
033:             * with a given description.
034:             *
035:             * @param msg the description of the Exception as <tt>String</tt>.
036:             */
037:            public JwmaException(String msg) {
038:                super (msg);
039:                addDescription(msg);
040:                inline = false;
041:            }//constructor
042:
043:            /**
044:             * Constructs a new <tt>JwmaException</tt> instance.
045:             * with a given description and possibly as inline error.
046:             *
047:             * @param msg the description of the Exception as <tt>String</tt>.
048:             * @param inlined true when inline error, false otherwise.
049:             */
050:            public JwmaException(String msg, boolean inlined) {
051:                super (msg);
052:                addDescription(msg);
053:                inline = inlined;
054:            }//constructor
055:
056:            /**
057:             * Sets the flag that controls if the Exception represents
058:             * an inline error.
059:             * <p>
060:             * An inline error should be displayed within the same view
061:             * and not on the error view.
062:             *
063:             * @param true if the overriding is to be allowed, false otherwise.
064:             * @return reference to this exception.
065:             */
066:            public JwmaException setInlineError(boolean b) {
067:                inline = b;
068:                return this ;
069:            }//setInlineError
070:
071:            public boolean isInlineError() {
072:                return inline;
073:            }//isInlineError
074:
075:            public void addDescription(String description) {
076:                m_Descriptions.add(description);
077:            }//addDescription
078:
079:            public String[] getDescriptions() {
080:                String[] desc = new String[m_Descriptions.size()];
081:                return (String[]) m_Descriptions.toArray(desc);
082:            }//getDescriptions
083:
084:            public Iterator iterator() {
085:                return m_Descriptions.iterator();
086:            }//iterator
087:
088:            /**
089:             * Resolves the description for the error in the
090:             * given language.
091:             *
092:             * @param language the string denoting the language.
093:             *
094:             public void resolveDescription(String language) {
095:             if(!isResolved()) {
096:             m_Description= JwmaKernel.getReference()
097:             .getErrorMessage(super.getMessage(),language);
098:             setResolved(true);
099:             }
100:             }//resolveDescription
101:
102:             /**
103:             * Tests if the error has been resolved to
104:             * an i18n description.
105:             *
106:             * @return true if it was resolved, false otherwise.
107:             *
108:             public boolean isResolved() {
109:             return m_Resolved;
110:             }//isResolved
111:
112:             /**
113:             * Sets the flag that controls if this error has already
114:             * i18n resolved the description.
115:             *
116:             * @param true if resolved, false otherwise.
117:             * @return reference to this exception.
118:             *
119:             public JwmaException setResolved(boolean b) {
120:             m_Resolved=true;
121:             return this;
122:             }//setResolved
123:             */
124:
125:            /**
126:             * Sets the flag that controls if this error was already
127:             * displayed.
128:             *
129:             * @param true if the overriding is to be allowed, false otherwise.
130:             */
131:            public void setDisplayed(boolean b) {
132:                displayed = b;
133:            }//setDisplayed
134:
135:            public boolean isDisplayed() {
136:                return displayed;
137:            }//isDisplayed
138:
139:            /**
140:             * Sets an embedded exception.
141:             *
142:             * @param ex the exception to be embedded.
143:             * @return reference to this exception.
144:             */
145:            public JwmaException setException(Exception ex) {
146:                m_Exception = ex;
147:                return this ;
148:            }//setException
149:
150:            public boolean hasException() {
151:                return (m_Exception != null);
152:            }//hasException
153:
154:            public String getExceptionTrace() {
155:                if (hasException()) {
156:                    StringWriter trace = new StringWriter();
157:                    m_Exception.printStackTrace(new PrintWriter(trace));
158:                    return trace.toString();
159:                } else {
160:                    return "";
161:                }
162:            }//getExceptionTrace
163:
164:            /**
165:             * Returns the embedded exception.
166:             *
167:             * @return the embedded exception.
168:             */
169:            public Exception getException() {
170:                return m_Exception;
171:            }//getException
172:
173:        }//JwmaException
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.