Source Code Cross Referenced for CollectingErrorHandler.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » 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 » Workflow Engines » wfmopen 2.1.1 » de.danet.an.workflow.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the WfMOpen project.
003:         * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004:         * All rights reserved.
005:         *
006:         * This program is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU General Public License as published by
008:         * the Free Software Foundation; either version 2 of the License, or
009:         * (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         * 
020:         * $Id: CollectingErrorHandler.java,v 1.2 2006/09/29 12:32:10 drmlipp Exp $
021:         *
022:         * $Log: CollectingErrorHandler.java,v $
023:         * Revision 1.2  2006/09/29 12:32:10  drmlipp
024:         * Consistently using WfMOpen as projct name now.
025:         *
026:         * Revision 1.1.1.1  2003/06/30 20:05:17  drmlipp
027:         * Initial import
028:         *
029:         * Revision 1.3  2003/06/27 08:51:44  lipp
030:         * Fixed copyright/license information.
031:         *
032:         * Revision 1.2  2003/04/25 14:50:58  lipp
033:         * Fixed javadoc errors and warnings.
034:         *
035:         * Revision 1.1  2003/03/07 08:01:29  huaiyang
036:         * initial.
037:         *
038:         *
039:         */
040:        package de.danet.an.workflow.util;
041:
042:        import java.util.ArrayList;
043:        import java.util.List;
044:
045:        import org.xml.sax.ErrorHandler;
046:        import org.xml.sax.SAXException;
047:        import org.xml.sax.SAXParseException;
048:
049:        import de.danet.an.workflow.api.PrioritizedMessage;
050:
051:        /**
052:         * This class collects errors while parsing and validating document.
053:         */
054:        public class CollectingErrorHandler implements  ErrorHandler {
055:
056:            private List debugs = new ArrayList();
057:            private List infos = new ArrayList();
058:            private List warnings = new ArrayList();
059:            private List errors = new ArrayList();
060:            private List fatals = new ArrayList();
061:            private List messages = new ArrayList();
062:
063:            /**
064:             * Return all accumulated debug messages.
065:             * @return list with debug messages (may be an empty list).
066:             */
067:            public List getDebugs() {
068:                return debugs;
069:            }
070:
071:            /**
072:             * Return all accumulated infos messages.
073:             * @return list with info messages (may be an empty list).
074:             */
075:            public List getInfos() {
076:                return infos;
077:            }
078:
079:            /**
080:             * Return all accumulated warnings.
081:             * @return list with warning messages (may be an empty list).
082:             */
083:            public List getWarnings() {
084:                return warnings;
085:            }
086:
087:            /**
088:             * Return all accumulated errors.
089:             * @return list with error messages (may be an empty list).
090:             */
091:            public List getErrors() {
092:                return errors;
093:            }
094:
095:            /**
096:             * Return all accumulated fatal errors.
097:             * @return list with fatal error messages (may be an empty list).
098:             */
099:            public List getFatalErrors() {
100:                return fatals;
101:            }
102:
103:            /**
104:             * Return all accumulated messages, i.e. debugs, info, warnings, 
105:             * errors and fatal errors.
106:             * @return list with error messages (may be an empty list).
107:             */
108:            public List getMessages() {
109:                return messages;
110:            }
111:
112:            private String layoutMessage(SAXParseException exc) {
113:                return Integer.toString(exc.getLineNumber()) + ": "
114:                        + exc.getMessage();
115:            }
116:
117:            /**
118:             * Handles parser warnings.
119:             * @param exc Parser exception
120:             */
121:            public void warning(SAXParseException exc) {
122:                PrioritizedMessage pm = new PrioritizedMessage(
123:                        PrioritizedMessage.Priority.WARN, layoutMessage(exc));
124:                warnings.add(pm);
125:                messages.add(pm);
126:            }
127:
128:            /**
129:             * Handles parser errors.
130:             * @param exc Parser exception
131:             * @throws SAXException Propagation of given SAXParseException
132:             */
133:            public void error(SAXParseException exc) throws SAXException {
134:                PrioritizedMessage pm = new PrioritizedMessage(
135:                        PrioritizedMessage.Priority.ERROR, layoutMessage(exc));
136:                errors.add(pm);
137:                messages.add(pm);
138:            }
139:
140:            /**
141:             * Handles fatal parser errors.
142:             * @param exc Parser exception
143:             * @throws SAXException Propagation of given SAXParseException
144:             */
145:            public void fatalError(SAXParseException exc) throws SAXException {
146:                PrioritizedMessage pm = new PrioritizedMessage(
147:                        PrioritizedMessage.Priority.FATAL, layoutMessage(exc));
148:                fatals.add(pm);
149:                messages.add(pm);
150:            }
151:
152:            /**
153:             * Append a prioritized message. This method may be used to add a message 
154:             * from outside the immediate scope of the parser, and handle it like a 
155:             * parse exception.
156:             * @param prioritizedMessage the given message.
157:             */
158:            public void add(PrioritizedMessage prioritizedMessage) {
159:                PrioritizedMessage.Priority priority = prioritizedMessage
160:                        .priority();
161:                if (priority.compareTo(PrioritizedMessage.Priority.DEBUG) == 0) {
162:                    debugs.add(prioritizedMessage);
163:                } else if (priority.compareTo(PrioritizedMessage.Priority.INFO) == 0) {
164:                    infos.add(prioritizedMessage);
165:                } else if (priority.compareTo(PrioritizedMessage.Priority.WARN) == 0) {
166:                    warnings.add(prioritizedMessage);
167:                } else if (priority
168:                        .compareTo(PrioritizedMessage.Priority.ERROR) == 0) {
169:                    errors.add(prioritizedMessage);
170:                } else if (priority
171:                        .compareTo(PrioritizedMessage.Priority.FATAL) == 0) {
172:                    fatals.add(prioritizedMessage);
173:                }
174:                messages.add(prioritizedMessage);
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.