Source Code Cross Referenced for PortalException.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2001-2004 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal;
007:
008:        import java.util.Date;
009:
010:        import org.apache.commons.logging.Log;
011:        import org.apache.commons.logging.LogFactory;
012:
013:        /**
014:         * Base portal exception class.
015:         * Information contained in this class allows ErrorChannel
016:         * to handle errors gracefully.
017:         * This class also reports itself to the ProblemsTable whenever it is instantiated.
018:         * The Problems servlet displays recently reported PortalExceptions.
019:         * @author Peter Kharchenko
020:         * @version $Revision: 36782 $
021:         */
022:        public class PortalException extends RuntimeException {
023:
024:            private final Log log = LogFactory.getLog(PortalException.class);
025:
026:            /** 
027:             * should the user be given an option to reinstantiate
028:             * the channel in a given session
029:             */
030:            boolean reinstantiable = true;
031:
032:            /**
033:             * should the user be given an option to retry rendering
034:             * that same channel instance
035:             */
036:            boolean refreshable = true;
037:
038:            /**
039:             * True if logging is pending on this exception instance
040:             * (has not yet been logged but potentially will be).  True
041:             * if all the logging that ought to happen has happened.
042:             */
043:            boolean logPending = true;
044:
045:            /**
046:             * ErrorID categorizing this PortalException instance.
047:             */
048:            ErrorID errorID = Errors.legacy;
049:
050:            /**
051:             * Parameter to the ErrorID's template message.
052:             */
053:            String parameter = null;
054:
055:            /**
056:             * The time at which this PortalException instance was instantiated.
057:             */
058:            Date timestamp = new Date();
059:
060:            /**
061:             * Instantiate a generic PortalException.
062:             * Instantiating a bare, no-message, no ErrorID, no frills 
063:             * PortalException is pretty anti-social.  Wouldn't you rather
064:             * use a constructor that provides more information?
065:             */
066:            public PortalException() {
067:                ProblemsTable.store(this );
068:            }
069:
070:            /**
071:             * Construct a new portal exception, recording an
072:             * underlying cause.
073:             *
074:             * @param cause a <code>Throwable</code> causing this exception
075:             */
076:            public PortalException(Throwable cause) {
077:                super (cause);
078:                ProblemsTable.store(this );
079:            }
080:
081:            /**
082:             * Creates a new <code>PortalException</code> instance,
083:             * with a contained text message.
084:             *
085:             * @param msg describes exceptional condition
086:             */
087:            public PortalException(String msg) {
088:                super (msg);
089:                ProblemsTable.store(this );
090:            }
091:
092:            /**
093:             * Instantiate a PortalException representing an instance of the
094:             * type of error represented by the given ErrorID.
095:             * @param errorid - type of error
096:             */
097:            public PortalException(ErrorID errorid) {
098:                super (errorid.getMessage());
099:                this .errorID = errorid;
100:                ProblemsTable.store(this );
101:            }
102:
103:            /**
104:             * Instantiate a PortalException with the given message and underlying cause.
105:             * @param msg - message describing the error
106:             * @param cause - underlying cause of the error
107:             */
108:            public PortalException(String msg, Throwable cause) {
109:                super (msg, cause);
110:                ProblemsTable.store(this );
111:            }
112:
113:            /**
114:             * Instantiate a PortalException representing an instance of the type of error
115:             * represented by the given ErrorID, with the given underlying cause.
116:             * @param errorid - type of error
117:             * @param cause - underlying cause of error.
118:             */
119:            public PortalException(ErrorID errorid, Throwable cause) {
120:                super (errorid.getMessage(), cause);
121:                this .errorID = errorid;
122:                ProblemsTable.store(this );
123:            }
124:
125:            /**
126:             * Check if user-mediated referesh is allowed.
127:             * @return true if refresh allowed, false otherwise.
128:             */
129:            public boolean isRefreshable() {
130:                return this .refreshable;
131:            }
132:
133:            /**
134:             * Legacy support for old name of property accessor.
135:             * @return isRefreshable()
136:             * @deprecated use isRefreshable().
137:             */
138:            public boolean allowRefresh() {
139:                return isRefreshable();
140:            }
141:
142:            /**
143:             * Check if user-mediated reinstantiation is allowed.
144:             * @return true if reinstantiation allowed, false otherwise
145:             */
146:            public boolean isReinstantiable() {
147:                return this .reinstantiable;
148:            }
149:
150:            /**
151:             * Legacy support for old name of property accessor
152:             * @return isRinstantiable();
153:             * @deprecated use isReinstantiable()
154:             */
155:            public boolean allowReinstantiation() {
156:                return isReinstantiable();
157:            }
158:
159:            /**
160:             * Retrieve an optionally recorded exception that
161:             * caused the error.
162:             * @return the cause if it is an Exception
163:             * @deprecated - use Throwable.getCause()
164:             */
165:            public Exception getRecordedException() {
166:                Throwable cause = this .getCause();
167:                if (cause != null && cause instanceof  Exception)
168:                    return (Exception) cause;
169:                return null;
170:            }
171:
172:            /**
173:             * Set if the user should be presented with an option
174:             * to retry the same operation on the component that
175:             * has generated the error.
176:             *
177:             * @param refresh a <code>boolean</code> value
178:             */
179:            public void setRefreshable(boolean refresh) {
180:                this .refreshable = refresh;
181:            }
182:
183:            /**
184:             * Set if the user should be presented with an option
185:             * to reinstantiate the component (channel) that generated
186:             * the error.
187:             *
188:             * @param reinstantiate a <code>boolean</code> value
189:             */
190:            public void setReinstantiable(boolean reinstantiate) {
191:                this .reinstantiable = reinstantiate;
192:            }
193:
194:            /**
195:             * Allows to record the exception that caused the error.
196:             * The exception information can later be used in error 
197:             * reporting and user interaction.
198:             *
199:             * @param exc an <code>Exception</code> value
200:             * @deprecated use initCause() instead.
201:             */
202:            public void setRecordedException(Exception exc) {
203:                try {
204:                    this .initCause(exc);
205:                } catch (Throwable t) {
206:                    // legacy implementation was setting a simple JavaBean property
207:                    // which could never throw an exception.
208:                    // we emulate that exceptionless behavior here.
209:                    if (log.isWarnEnabled())
210:                        log.warn(
211:                                "Exception setting the recorded exception of ["
212:                                        + this  + "] " + "to [" + exc + "]", t);
213:                }
214:
215:            }
216:
217:            /**
218:             * Determine whether logging is pending on this PortalException.
219:             * @return <code>true</code> if the log is pending, otherwise <code>false</code>
220:             */
221:            public boolean isLogPending() {
222:                return this .logPending;
223:            }
224:
225:            /**
226:             * Set whether logging is pending on this PortalException.
227:             * @param b true if logging is pending
228:             */
229:            public void setLogPending(boolean b) {
230:                this .logPending = b;
231:            }
232:
233:            /**
234:             * Get the ErrorID representing the type of this error.
235:             * @return the error ID
236:             */
237:            public ErrorID getErrorID() {
238:                return this .errorID;
239:            }
240:
241:            /**
242:             * Set the ErrorID categorizing this PortalException.
243:             * @param errorID the ErrorID categorizing this PortalException.
244:             */
245:            public void setErrorID(ErrorID errorID) {
246:                this .errorID = errorID;
247:            }
248:
249:            /**
250:             * Get the parameter to the ErrorID template message.
251:             * @return the parameter
252:             */
253:            public String getParameter() {
254:                return this .parameter;
255:            }
256:
257:            /**
258:             * Set the parameter to the ErrorID template message.
259:             * @param string - parameter to ErrorID template message.
260:             */
261:            public void setParameter(String string) {
262:                this .parameter = string;
263:            }
264:
265:            /**
266:             * Instantiate a PortalException with the given message and refresh,
267:             * reinstantiate state.
268:             * @param msg - message describing the problem
269:             * @param refresh - whether refresh is appropriate response
270:             * @param reinstantiate - whether reinstantiate is appropriate response
271:             */
272:            public PortalException(String msg, boolean refresh,
273:                    boolean reinstantiate) {
274:                super (msg);
275:                this .setReinstantiable(reinstantiate);
276:                this .setRefreshable(refresh);
277:                ProblemsTable.store(this );
278:            }
279:
280:            /**
281:             * Instantiate a PortalException with the given message, underlying cause,
282:             * refresh, and reinstantiate state.
283:             * @param msg - message describing the problem
284:             * @param cause - underlying cause of problem
285:             * @param refresh - true if refresh is an appropriate response
286:             * @param reinstantiate - true if reinstantiate is an appropriate response
287:             */
288:            public PortalException(String msg, Throwable cause,
289:                    boolean refresh, boolean reinstantiate) {
290:                super (msg, cause);
291:                this .setReinstantiable(reinstantiate);
292:                this .setRefreshable(refresh);
293:                ProblemsTable.store(this );
294:            }
295:
296:            /**
297:             * Get the Date at which this PortalException instance was instantiated.
298:             * @return Returns the timestamp.
299:             */
300:            public Date getTimestamp() {
301:                return this.timestamp;
302:            }
303:
304:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.