Source Code Cross Referenced for ErrorHandler.java in  » J2EE » Enhydra-Demos » org » enhydra » dm » presentation » 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 » J2EE » Enhydra Demos » org.enhydra.dm.presentation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Enhydra Java Application Server Project The contents of this file are subject to the
03:         * Enhydra Public License Version 1.1 (the "License"); you may not use this file except in
04:         * compliance with the License. You may obtain a copy of the License on the Enhydra web
05:         * site ( http://www.enhydra.org/ ). Software distributed under the License is distributed
06:         * on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
07:         * License for the specific terms governing rights and limitations under the License. The
08:         * Initial Developer of the Enhydra Application Server is Lutris Technologies, Inc. The
09:         * Enhydra Application Server and portions created by Lutris Technologies, Inc. are
10:         * Copyright Lutris Technologies, Inc. All Rights Reserved. Contributor(s): $Id:
11:         * ErrorHandler.java,v 1.1 2006/09/04 09:07:38 alex Exp $
12:         */
13:
14:        package org.enhydra.dm.presentation;
15:
16:        import java.io.PrintWriter;
17:        import java.io.StringWriter;
18:
19:        import org.enhydra.dm.api.exceptions.BaseException;
20:        import org.enhydra.dm.business.exceptions.ActionNotAllowedException;
21:        import org.enhydra.dm.business.exceptions.ConfigurationException;
22:        import org.enhydra.dm.business.exceptions.DatabaseException;
23:        import org.enhydra.dm.business.exceptions.DesEncryptionException;
24:        import org.enhydra.dm.business.exceptions.DocumentStoreException;
25:        import org.enhydra.dm.business.exceptions.LockException;
26:
27:        import com.lutris.appserver.server.httpPresentation.*;
28:
29:        /**
30:         * Trivial error handler.
31:         */
32:        public class ErrorHandler implements  HttpPresentation {
33:            ErrorHandlerHTML page;
34:
35:            /**
36:             * Entry.
37:             */
38:            public void run(HttpPresentationComms comms)
39:                    throws HttpPresentationException {
40:                page = (ErrorHandlerHTML) comms.xmlcFactory
41:                        .create(ErrorHandlerHTML.class);
42:
43:                if (null != comms.exception) {
44:                    if (comms.exception.getCause() instanceof  BaseException) {
45:                        BaseException busEx = (BaseException) comms.exception
46:                                .getCause();
47:                        if (busEx instanceof  LockException
48:                                || busEx.getCause() instanceof  LockException) {
49:                            setErrorMessageTypeColor("red", LockException.class
50:                                    .getName());
51:                        } else if (busEx instanceof  DatabaseException
52:                                || busEx.getCause() instanceof  DatabaseException) {
53:                            setErrorMessageTypeColor("blue",
54:                                    DatabaseException.class.getName());
55:                        } else if (busEx instanceof  DocumentStoreException
56:                                || busEx.getCause() instanceof  DocumentStoreException) {
57:                            setErrorMessageTypeColor("green",
58:                                    DocumentStoreException.class.getName());
59:                        } else if (busEx instanceof  DesEncryptionException
60:                                || busEx.getCause() instanceof  DesEncryptionException) {
61:                            setErrorMessageTypeColor("orange",
62:                                    DesEncryptionException.class.getName());
63:                        } else if (busEx instanceof  ActionNotAllowedException
64:                                || busEx.getCause() instanceof  ActionNotAllowedException) {
65:                            setErrorMessageTypeColor("brown",
66:                                    ActionNotAllowedException.class.getName());
67:                        } else if (busEx instanceof  ConfigurationException
68:                                || busEx.getCause() instanceof  ConfigurationException) {
69:                            setErrorMessageTypeColor("darkblue",
70:                                    ConfigurationException.class.getName());
71:                        }
72:                    }
73:                    StringWriter stringWriter = new StringWriter();
74:                    comms.exception.printStackTrace();
75:                    comms.exception.printStackTrace(new PrintWriter(
76:                            stringWriter));
77:
78:                    page.setTextStackTrace(stringWriter.toString());
79:                    String m = comms.exception.getMessage();
80:                    if (null == m)
81:                        m = "NULL message";
82:                    page.setTextErrorMessage(m);
83:                }
84:                comms.response.writeDOM(page);
85:            }
86:
87:            private void setErrorMessageTypeColor(String color, String type) {
88:                page.getElementErrorMessageFont().setColor(color);
89:                page.getElementStackTraceFont().setColor(color);
90:
91:            }
92:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.