Source Code Cross Referenced for TypeTable.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » description » java2wsdl » 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 » Web Services AXIS2 » kernal » org.apache.axis2.description.java2wsdl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.axis2.description.java2wsdl;
020:
021:        import org.apache.axiom.om.OMElement;
022:
023:        import javax.xml.namespace.QName;
024:        import java.util.*;
025:
026:        public class TypeTable {
027:
028:            private static HashMap simpleTypetoxsd;
029:            public static final QName ANY_TYPE = new QName(
030:                    Java2WSDLConstants.URI_2001_SCHEMA_XSD, "anyType", "xs");
031:
032:            private HashMap complexTypeMap;
033:
034:            public TypeTable() {
035:                //complex type table is resetted every time this is
036:                //instantiated
037:                complexTypeMap = new HashMap();
038:            }
039:
040:            /* statically populate the simple type map  - this is not likely to
041:             * change and we need not populate it over and over */
042:            static {
043:                populateSimpleTypes();
044:            }
045:
046:            /* populate the simpletype hashmap */
047:            private static void populateSimpleTypes() {
048:                simpleTypetoxsd = new HashMap();
049:                //todo pls use the types from org.apache.ws.commons.schema.constants.Constants
050:                simpleTypetoxsd.put("int", new QName(
051:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs"));
052:                simpleTypetoxsd
053:                        .put("java.lang.String", new QName(
054:                                Java2WSDLConstants.URI_2001_SCHEMA_XSD,
055:                                "string", "xs"));
056:                simpleTypetoxsd.put("boolean",
057:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
058:                                "boolean", "xs"));
059:                simpleTypetoxsd.put("float", new QName(
060:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs"));
061:                simpleTypetoxsd
062:                        .put("double", new QName(
063:                                Java2WSDLConstants.URI_2001_SCHEMA_XSD,
064:                                "double", "xs"));
065:                simpleTypetoxsd.put("short", new QName(
066:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs"));
067:                simpleTypetoxsd.put("long", new QName(
068:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs"));
069:                simpleTypetoxsd.put("byte", new QName(
070:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs"));
071:                simpleTypetoxsd.put("char", ANY_TYPE);
072:                simpleTypetoxsd.put("java.lang.Integer", new QName(
073:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "int", "xs"));
074:                simpleTypetoxsd
075:                        .put("java.lang.Double", new QName(
076:                                Java2WSDLConstants.URI_2001_SCHEMA_XSD,
077:                                "double", "xs"));
078:                simpleTypetoxsd.put("java.lang.Float", new QName(
079:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "float", "xs"));
080:                simpleTypetoxsd.put("java.lang.Long", new QName(
081:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "long", "xs"));
082:                simpleTypetoxsd.put("java.lang.Character", ANY_TYPE);
083:                simpleTypetoxsd.put("java.lang.Boolean",
084:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
085:                                "boolean", "xs"));
086:                simpleTypetoxsd.put("java.lang.Byte", new QName(
087:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "byte", "xs"));
088:                simpleTypetoxsd.put("java.lang.Short", new QName(
089:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "short", "xs"));
090:                simpleTypetoxsd.put("java.util.Date", new QName(
091:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime",
092:                        "xs"));
093:                simpleTypetoxsd.put("java.util.Calendar", new QName(
094:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime",
095:                        "xs"));
096:
097:                // SQL date time
098:                simpleTypetoxsd.put("java.sql.Date", new QName(
099:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime",
100:                        "xs"));
101:                simpleTypetoxsd.put("java.sql.Time", new QName(
102:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "time", "xs"));
103:                simpleTypetoxsd.put("java.sql.Timestamp", new QName(
104:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "dateTime",
105:                        "xs"));
106:
107:                //consider BigDecimal, BigInteger, Day, Duration, Month, MonthDay,
108:                //Time, Year, YearMonth as SimpleType as well
109:                simpleTypetoxsd.put("java.math.BigDecimal",
110:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
111:                                "decimal", "xs"));
112:                simpleTypetoxsd.put("java.math.BigInteger",
113:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
114:                                "integer", "xs"));
115:                simpleTypetoxsd.put("org.apache.axis2.databinding.types.Day",
116:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
117:                                "gDay", "xs"));
118:                simpleTypetoxsd.put(
119:                        "org.apache.axis2.databinding.types.Duration",
120:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
121:                                "duration", "xs"));
122:                simpleTypetoxsd.put("org.apache.axis2.databinding.types.Month",
123:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
124:                                "gMonth", "xs"));
125:                simpleTypetoxsd.put(
126:                        "org.apache.axis2.databinding.types.MonthDay",
127:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
128:                                "gMonthDay", "xs"));
129:                simpleTypetoxsd.put("org.apache.axis2.databinding.types.Time",
130:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
131:                                "time", "xs"));
132:                simpleTypetoxsd.put("org.apache.axis2.databinding.types.Year",
133:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
134:                                "gYear", "xs"));
135:                simpleTypetoxsd.put(
136:                        "org.apache.axis2.databinding.types.YearMonth",
137:                        new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD,
138:                                "gYearMonth", "xs"));
139:
140:                simpleTypetoxsd.put("java.lang.Object", ANY_TYPE);
141:
142:                // Any types
143:                simpleTypetoxsd.put(OMElement.class.getName(), ANY_TYPE);
144:                simpleTypetoxsd.put(ArrayList.class.getName(), ANY_TYPE);
145:                simpleTypetoxsd.put(Vector.class.getName(), ANY_TYPE);
146:                simpleTypetoxsd.put(List.class.getName(), ANY_TYPE);
147:                simpleTypetoxsd.put(HashMap.class.getName(), ANY_TYPE);
148:                simpleTypetoxsd.put(Hashtable.class.getName(), ANY_TYPE);
149:                //byteArrat
150:                simpleTypetoxsd.put("base64Binary", new QName(
151:                        Java2WSDLConstants.URI_2001_SCHEMA_XSD, "base64Binary",
152:                        "xs"));
153:            }
154:
155:            /**
156:             * Return the schema type QName given the type class name
157:             * @param typeName  the name of the type
158:             * @return   the name of the simple type or null if it is not a simple type
159:             */
160:            public QName getSimpleSchemaTypeName(String typeName) {
161:                QName qName = (QName) simpleTypetoxsd.get(typeName);
162:                if (qName == null) {
163:                    if ((typeName.startsWith("java.lang") || typeName
164:                            .startsWith("javax."))
165:                            && !Exception.class.getName().equals(typeName)) {
166:                        return ANY_TYPE;
167:                    }
168:                }
169:                return qName;
170:            }
171:
172:            /**
173:             * Return whether the given type is a simple type or not
174:             * @param typeName the name of the type
175:             * @return  true if the type is a simple type
176:             */
177:            public boolean isSimpleType(String typeName) {
178:
179:                if (simpleTypetoxsd.keySet().contains(typeName)) {
180:                    return true;
181:                } else if (typeName.startsWith("java.lang")
182:                        || typeName.startsWith("javax.")) {
183:                    return true;
184:                }
185:                return false;
186:            }
187:
188:            /**
189:             * Return the complex type map
190:             * @return  the map with complex types
191:             */
192:            public Map getComplexSchemaMap() {
193:                return complexTypeMap;
194:            }
195:
196:            public void addComplexSchema(String name, QName schemaType) {
197:                complexTypeMap.put(name, schemaType);
198:            }
199:
200:            public QName getComplexSchemaType(String name) {
201:                return (QName) complexTypeMap.get(name);
202:            }
203:
204:            /**
205:             * Get the qname for a type
206:             * first try the simple types if not try the complex types
207:             * @param typeName  name of the type
208:             * @return  the Qname for this type
209:             */
210:            public QName getQNamefortheType(String typeName) {
211:                QName type = getSimpleSchemaTypeName(typeName);
212:                if (type == null) {
213:                    type = getComplexSchemaType(typeName);
214:                }
215:                return type;
216:            }
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.