Source Code Cross Referenced for ElementContentHandler.java in  » Code-Analyzer » JBlanket » csdl » jblanket » report » element » 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 » Code Analyzer » JBlanket » csdl.jblanket.report.element 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package csdl.jblanket.report.element;
002:
003:        import java.util.HashMap;
004:        import java.util.Iterator;
005:        import java.util.Map;
006:
007:        import org.xml.sax.Attributes;
008:        import org.xml.sax.ContentHandler;
009:        import org.xml.sax.Locator;
010:        import org.xml.sax.SAXException;
011:
012:        /**
013:         * Handles the content of an XML file as it is encountered by the SAX parser for the report.
014:         * <p>
015:         * NOTE: Method descriptions taken from org.xml.sax.ContentHandler.
016:         * 
017:         * @author Joy M. Agustin
018:         * @version $Id: ElementContentHandler.java,v 1.2 2004/11/07 08:53:26 timshadel Exp $
019:         */
020:        public class ElementContentHandler implements  ContentHandler {
021:
022:            /** Locates any  content handler event in the XML source document */
023:            private Locator locator;
024:            /** Container for names spaces */
025:            private Map namespaceMappings;
026:
027:            /** Set of all MethodSets */
028:            private MethodSetsElement methodSets;
029:            /** Current MethodElement being processed */
030:            private MethodElement currentMethodElement;
031:
032:            /** Category of methods being processed */
033:            private String methodCategory;
034:
035:            private String timeStamp;
036:
037:            /**
038:             * Constructs a new ElementContentHandler object.
039:             * 
040:             * @param methodSets the set of MethodSets being processed.
041:             * @param methodCategory the category of methods being processed.
042:             */
043:            public ElementContentHandler(MethodSetsElement methodSets,
044:                    String methodCategory) {
045:
046:                this .namespaceMappings = new HashMap();
047:
048:                this .methodSets = methodSets;
049:
050:                this .methodCategory = methodCategory;
051:            }
052:
053:            /**
054:             * Processes notification of character data -- not implemented.
055:             * 
056:             * @param chars the characters making up the data within the element.
057:             * @param start the starting index of characters.
058:             * @param length the number of characters in <code>chars</code>.
059:             * @throws SAXException if any SAX error occurs.
060:             */
061:            public void characters(char[] chars, int start, int length)
062:                    throws SAXException {
063:            }
064:
065:            /**
066:             * Processes notification of the end of a document -- not implemented.
067:             * 
068:             * @throws SAXException if any SAX error occurs.
069:             */
070:            public void endDocument() throws SAXException {
071:            }
072:
073:            /**
074:             * Processes notification of the end of an element.
075:             * 
076:             * @param namespaceURI namespace URI of current element in context wrt document's complete set of
077:             *                      namespaces.
078:             * @param localName local, unprefixed name of current element.
079:             * @param qName unmodified, unchanged name of current element.
080:             * @throws SAXException if any SAX error occurs.
081:             */
082:            public void endElement(String namespaceURI, String localName,
083:                    String qName) throws SAXException {
084:
085:                if (!localName.equals("Method")) {
086:                    return;
087:                }
088:
089:                // get MethodSetElement from methodSetMap
090:                String className = this .currentMethodElement.getClassName();
091:                MethodSetElement methodSet = (MethodSetElement) this .methodSets
092:                        .get(className);
093:                if (methodSet == null) {
094:                    String packageName = className.substring(0, className
095:                            .lastIndexOf("."));
096:                    methodSet = new MethodSetElement(className.substring(0,
097:                            className.lastIndexOf(".")), className
098:                            .substring(className.lastIndexOf(".") + 1));
099:                    this .methodSets.put(className, methodSet);
100:                }
101:
102:                if ("tested".equals(this .methodCategory)) {
103:                    methodSet.addTestMethod(this .currentMethodElement);
104:                } else if ("untested".equals(this .methodCategory)) {
105:                    methodSet.addUntestMethod(this .currentMethodElement);
106:                } else if ("untestable".equals(this .methodCategory)) {
107:                    methodSet.addUntestableMethod(this .currentMethodElement);
108:                } else if ("oneline".equals(this .methodCategory)) {
109:                    methodSet.addOneLineMethod(this .currentMethodElement);
110:                } else if ("constructor".equals(this .methodCategory)) {
111:                    methodSet.addConstructorMethod(this .currentMethodElement);
112:                } else if ("excludedIndividual".equals(this .methodCategory)) {
113:                    methodSet
114:                            .addExcludedIndividualMethod(this .currentMethodElement);
115:                }
116:
117:                // get time stamp
118:                methodSet.setTimeStamp(this .timeStamp);
119:            }
120:
121:            /**
122:             * Processes end of the scope of a prefix-URI mapping.
123:             * 
124:             * @param prefix the prefix that was being mapped.
125:             * @throws SAXException if any SAX error occurs.
126:             */
127:            public void endPrefixMapping(String prefix) throws SAXException {
128:
129:                for (Iterator i = this .namespaceMappings.keySet().iterator(); i
130:                        .hasNext();) {
131:                    String uri = (String) i.next();
132:                    String this Prefix = (String) this .namespaceMappings
133:                            .get(uri);
134:                    if (prefix.equals(this Prefix)) {
135:                        this .namespaceMappings.remove(uri);
136:                        break;
137:                    }
138:                }
139:            }
140:
141:            /**
142:             * Processes notification of ignorable whitespace in element content -- not implemented.
143:             * 
144:             * @param chars the characters making up the data within the element.
145:             * @param start the starting index of characters.
146:             * @param length the number of characters in <code>chars</code>.
147:
148:             * @throws SAXException if any SAX error occurs.
149:             */
150:            public void ignorableWhitespace(char[] chars, int start, int length)
151:                    throws SAXException {
152:            }
153:
154:            /**
155:             * Processes notification of a processing instruction -- not implemented. 
156:             * 
157:             * @param target the processing instruction target.
158:             * @param data the processing instruction data, or null if none was supplied.
159:             * @throws SAXException if any SAX error occurs.
160:             */
161:            public void processingInstruction(String target, String data)
162:                    throws SAXException {
163:            }
164:
165:            /**
166:             * Processes an object for locating the origin of SAX document events.
167:             * 
168:             * @param locator an object that can return the location of any SAX document event.
169:             */
170:            public void setDocumentLocator(Locator locator) {
171:                this .locator = locator;
172:            }
173:
174:            /**
175:             * Processes notification of a skipped entity -- not implemented.
176:             * 
177:             * @param name the name of the skipped entry.
178:             * @throws SAXException if any SAX error occurs.
179:             */
180:            public void skippedEntity(String name) throws SAXException {
181:            }
182:
183:            /**
184:             * Processes notification of the beginning of a document - not implememented.
185:             * 
186:             * @throws SAXException if any SAX error occurs.
187:             */
188:            public void startDocument() throws SAXException {
189:            }
190:
191:            /**
192:             * Processes notification of the beginning of an element.
193:             * 
194:             * @param namespaceURI namespace URI of current element in context wrt document's complete set of
195:             *                      namespaces.
196:             * @param localName local, unprefixed name of current element.
197:             * @param qName unmodified, unchanged name of current element.
198:             * @param atts reference to all of the attributes within current element.
199:             * @throws SAXException if any SAX error occurs.
200:             */
201:            public void startElement(String namespaceURI, String localName,
202:                    String qName, Attributes atts) throws SAXException {
203:
204:                if (localName.equals("MethodSet")) {
205:
206:                    this .timeStamp = atts.getValue("timestamp");
207:                } else if (localName.equals("Method")) {
208:
209:                    // get class name
210:                    String className = atts.getValue("class");
211:                    String methodName = atts.getValue("method");
212:                    MethodElement method = new MethodElement(className,
213:                            methodName);
214:
215:                    //this.methodSetsMap.put(className, method);
216:                    this .currentMethodElement = method;
217:                } else if (localName.equals("Parameter")) {
218:
219:                    ParameterElement parameter = new ParameterElement(atts
220:                            .getValue("type"));
221:                    this .currentMethodElement.addParameter(parameter);
222:                }
223:
224:            }
225:
226:            /**
227:             * Processes begin of the scope of a prefix-URI Namespace mapping.
228:             * 
229:             * @param prefix the namespace prefix being declared.
230:             * @param uri the namespace URI the prefix is mapped to.
231:             * @throws SAXException if any SAX error occurs.
232:             */
233:            public void startPrefixMapping(String prefix, String uri)
234:                    throws SAXException {
235:                this.namespaceMappings.put(uri, prefix);
236:            }
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.