Source Code Cross Referenced for ExtensionHandler.java in  » GIS » GeoTools-2.4.1 » org » geotools » xml » handlers » xsi » 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 » GIS » GeoTools 2.4.1 » org.geotools.xml.handlers.xsi 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005:         *    
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library 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 GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.xml.handlers.xsi;
017:
018:        import java.util.LinkedList;
019:        import java.util.List;
020:
021:        import org.geotools.xml.XSIElementHandler;
022:        import org.xml.sax.Attributes;
023:        import org.xml.sax.SAXException;
024:        import org.xml.sax.SAXNotRecognizedException;
025:
026:        /**
027:         * <p>
028:         * Represents an Extension element
029:         * </p>
030:         *
031:         * @author dzwiers www.refractions.net
032:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/handlers/xsi/ExtensionHandler.java $
033:         */
034:        public class ExtensionHandler extends XSIElementHandler {
035:            /** 'extension' */
036:            public static final String LOCALNAME = "extension";
037:            private String base;
038:
039:            //    private AnyAttributeHandler anyAttribute;
040:            // TODO USE the anyAttribute !
041:            private Object child;
042:            private List attributeDec;
043:
044:            /**
045:             * @see java.lang.Object#hashCode()
046:             */
047:            public int hashCode() {
048:                return LOCALNAME.hashCode()
049:                        * ((base == null) ? 1 : base.hashCode())
050:                        * ((child == null) ? 1 : child.hashCode());
051:            }
052:
053:            /**
054:             * @see org.geotools.xml.XSIElementHandler#getHandler(java.lang.String,
055:             *      java.lang.String)
056:             */
057:            public XSIElementHandler getHandler(String namespaceURI,
058:                    String localName) throws SAXException {
059:                if (SchemaHandler.namespaceURI.equalsIgnoreCase(namespaceURI)) {
060:                    // child types
061:                    //
062:                    logger.fine("Getting Handler for " + localName
063:                            + " inside Extension");
064:
065:                    // all
066:                    if (AllHandler.LOCALNAME.equalsIgnoreCase(localName)) {
067:                        AllHandler ah = new AllHandler();
068:
069:                        if (child == null) {
070:                            child = ah;
071:                        } else {
072:                            throw new SAXNotRecognizedException(getLocalName()
073:                                    + " may only have one '"
074:                                    + AllHandler.LOCALNAME + "' declaration.");
075:                        }
076:
077:                        return ah;
078:                    }
079:                    if (AttributeHandler.LOCALNAME.equalsIgnoreCase(localName)) {
080:                        if (attributeDec == null) {
081:                            attributeDec = new LinkedList();
082:                        }
083:
084:                        AttributeHandler ah = new AttributeHandler();
085:                        attributeDec.add(ah);
086:
087:                        return ah;
088:                    }
089:
090:                    // attributeGroup
091:                    if (AttributeGroupHandler.LOCALNAME
092:                            .equalsIgnoreCase(localName)) {
093:                        if (attributeDec == null) {
094:                            attributeDec = new LinkedList();
095:                        }
096:
097:                        AttributeGroupHandler ah = new AttributeGroupHandler();
098:                        attributeDec.add(ah);
099:
100:                        return ah;
101:                    }
102:
103:                    // choice
104:                    if (ChoiceHandler.LOCALNAME.equalsIgnoreCase(localName)) {
105:                        ChoiceHandler ah = new ChoiceHandler();
106:
107:                        if (child == null) {
108:                            child = ah;
109:                        } else {
110:                            throw new SAXNotRecognizedException(getLocalName()
111:                                    + " may only have one '"
112:                                    + ChoiceHandler.LOCALNAME
113:                                    + "' declaration.");
114:                        }
115:
116:                        return ah;
117:                    }
118:
119:                    // group
120:                    if (GroupHandler.LOCALNAME.equalsIgnoreCase(localName)) {
121:                        GroupHandler ah = new GroupHandler();
122:
123:                        if (child == null) {
124:                            child = ah;
125:                        } else {
126:                            throw new SAXNotRecognizedException(getLocalName()
127:                                    + " may only have one '"
128:                                    + GroupHandler.LOCALNAME + "' declaration.");
129:                        }
130:                        return ah;
131:                    }
132:
133:                    // sequence
134:                    if (SequenceHandler.LOCALNAME.equalsIgnoreCase(localName)) {
135:                        SequenceHandler ah = new SequenceHandler();
136:
137:                        if (child == null) {
138:                            child = ah;
139:                        } else {
140:                            throw new SAXNotRecognizedException(getLocalName()
141:                                    + " may only have one '"
142:                                    + SequenceHandler.LOCALNAME
143:                                    + "' declaration.");
144:                        }
145:
146:                        return ah;
147:                    }
148:                }
149:
150:                logger.info("Handler not found for " + localName
151:                        + " in Extension");
152:
153:                return null;
154:            }
155:
156:            /**
157:             * @see org.geotools.xml.XSIElementHandler#getLocalName()
158:             */
159:            public String getLocalName() {
160:                return LOCALNAME;
161:            }
162:
163:            /**
164:             * @see org.geotools.xml.XSIElementHandler#startElement(java.lang.String,
165:             *      java.lang.String, org.xml.sax.Attributes)
166:             */
167:            public void startElement(String namespaceURI, String localName,
168:                    Attributes atts) {
169:                base = atts.getValue("", "base");
170:
171:                if (base == null) {
172:                    base = atts.getValue(namespaceURI, "base");
173:                }
174:            }
175:
176:            /**
177:             * <p>
178:             * gets a list of AttributeHandlers
179:             * </p>
180:             *
181:             */
182:            public List getAttributeDeclarations() {
183:                return attributeDec;
184:            }
185:
186:            /**
187:             * <p>
188:             * Returns the 'base' attribute
189:             * </p>
190:             *
191:             */
192:            public String getBase() {
193:                return base;
194:            }
195:
196:            /**
197:             * <p>
198:             * Returns the child handler
199:             * </p>
200:             *
201:             */
202:            public Object getChild() {
203:                return child;
204:            }
205:
206:            /* (non-Javadoc)
207:             * @see schema.XSIElementHandler#getHandlerType()
208:             */
209:            public int getHandlerType() {
210:                return DEFAULT;
211:            }
212:
213:            /**
214:             * @see org.geotools.xml.XSIElementHandler#endElement(java.lang.String,
215:             *      java.lang.String)
216:             */
217:            public void endElement(String namespaceURI, String localName) {
218:                // do nothing
219:            }
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.