Source Code Cross Referenced for WSDLTypesCollector.java in  » Portal » Open-Portal » com » sun » portal » providers » simplewebservice » wsdl » impl » 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 » Portal » Open Portal » com.sun.portal.providers.simplewebservice.wsdl.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.providers.simplewebservice.wsdl.impl;
002:
003:        import com.sun.portal.providers.simplewebservice.wsdl.TypeElementDescriptor;
004:        import com.sun.portal.providers.simplewebservice.wsdl.TypeDescriptor;
005:        import com.sun.xml.rpc.processor.model.literal.*;
006:        import com.sun.xml.rpc.processor.model.soap.SOAPStructureType;
007:        import com.sun.xml.rpc.processor.model.soap.SOAPStructureMember;
008:        import com.sun.xml.rpc.processor.model.soap.SOAPType;
009:        import com.sun.xml.rpc.processor.model.AbstractType;
010:        import com.sun.xml.rpc.processor.model.java.JavaSimpleType;
011:        import com.sun.xml.rpc.processor.model.java.JavaArrayType;
012:
013:        import java.util.*;
014:
015:        /**
016:         * User: Ravikiran
017:         * Date: Oct 9, 2003
018:         * Time: 2:52:18 PM
019:         */
020:        class WSDLTypesCollector implements 
021:                com.sun.xml.rpc.processor.model.literal.LiteralTypeVisitor,
022:                com.sun.xml.rpc.processor.model.soap.SOAPTypeVisitor {
023:
024:            private Map typeDescriptors = null;
025:
026:            WSDLTypesCollector(String name, Map typeDescriptors) {
027:
028:                this .typeDescriptors = typeDescriptors;
029:            }
030:
031:            public void doAccept(String name, AbstractType type)
032:                    throws Exception {
033:
034:                //     System.out.println("Doing " + name + " Type " + type.getName()+"props"+ type.getPropertiesMap()+"Javatype"+type.getJavaType().getName());
035:                if (type.isLiteralType()) {
036:                    ((LiteralType) type).accept(this );
037:                } else if (type.isSOAPType()) {
038:                    ((SOAPType) type).accept(this );
039:                }
040:            }
041:
042:            public void visit(
043:                    com.sun.xml.rpc.processor.model.literal.LiteralFragmentType literalFragmentType)
044:                    throws java.lang.Exception {
045:
046:                throw new WSDLException(WSDLException.OTHER_ERROR,
047:                        "Literal Fragment Type" + literalFragmentType.getName()
048:                                + " not supported");
049:
050:            }
051:
052:            public void visit(
053:                    com.sun.xml.rpc.processor.model.literal.LiteralSimpleType literalSimpleType)
054:                    throws java.lang.Exception {
055:
056:            }
057:
058:            public void visit(
059:                    com.sun.xml.rpc.processor.model.literal.LiteralAttachmentType literalAttachementType)
060:                    throws java.lang.Exception {
061:
062:            }
063:
064:            public void visit(
065:                    com.sun.xml.rpc.processor.model.literal.LiteralAllType literalAllType)
066:                    throws java.lang.Exception {
067:
068:                visitLiteralStructuredType(literalAllType);
069:            }
070:
071:            public void visit(
072:                    com.sun.xml.rpc.processor.model.literal.LiteralArrayType literalArrayType)
073:                    throws java.lang.Exception {
074:
075:                Map elementsMap = new HashMap();
076:                List elementsList = new ArrayList();
077:
078:                TypeElementDescriptor arrayTypeElementDescriptor = new TypeElementDescriptorImpl(
079:                        literalArrayType.getElementType().getName()
080:                                .getLocalPart(),
081:                        getActualTypeName(literalArrayType.getElementType()),
082:                        "");
083:
084:                elementsMap.put(arrayTypeElementDescriptor.getName(),
085:                        arrayTypeElementDescriptor);
086:                elementsList.add(arrayTypeElementDescriptor.getName());
087:                TypeDescriptor arraytypeDescriptor = new TypeDescriptorImpl(
088:                        literalArrayType.getName().getLocalPart(), elementsMap,
089:                        elementsList, literalArrayType.getName()
090:                                .getNamespaceURI());
091:
092:                arraytypeDescriptor.setArrayType(true);
093:                arraytypeDescriptor.setArrayTypeName(literalArrayType
094:                        .getElementType().getName().getLocalPart());
095:
096:                typeDescriptors.put(arraytypeDescriptor.getName(),
097:                        arraytypeDescriptor);
098:
099:                doAccept(literalArrayType.getElementType().getName()
100:                        .getLocalPart(), literalArrayType.getElementType());
101:
102:                //literalArrayType.getElementType().accept(new WSDLTypesVisitorImpl(literalArrayType.getElementType().getName().getLocalPart()));
103:
104:            }
105:
106:            public void visit(
107:                    com.sun.xml.rpc.processor.model.literal.LiteralSequenceType litealSequenceType)
108:                    throws java.lang.Exception {
109:                visitLiteralSequenceType(litealSequenceType);
110:            }
111:
112:            public void visitLiteralSequenceType(
113:                    com.sun.xml.rpc.processor.model.literal.LiteralSequenceType literalsequenceType)
114:                    throws java.lang.Exception {
115:
116:                Iterator it = literalsequenceType.getElementMembers();
117:                LiteralElementMember literalElementMember = null;
118:                Map literalElementsMap = new HashMap();
119:                List literalElementsList = new ArrayList();
120:                TypeDescriptor literalSequencetypeDescriptor = new TypeDescriptorImpl(
121:                        literalsequenceType.getName().getLocalPart(),
122:                        literalElementsMap, literalElementsList,
123:                        literalsequenceType.getName().getNamespaceURI());
124:                //System.out.println("I am in Literal Sequnece Type "+literalSequencetypeDescriptor.getName());
125:                while (it.hasNext()) {
126:                    literalElementMember = (LiteralElementMember) it.next();
127:                    TypeElementDescriptor td = new TypeElementDescriptorImpl(
128:                            literalElementMember.getName().getLocalPart(),
129:                            getActualTypeName(literalElementMember.getType()),
130:                            "");
131:                    literalElementsMap.put(td.getName(), td);
132:                    literalElementsList.add(td.getName());
133:                    if (literalElementMember.isRepeated()) {
134:                        td.setIsRepeated(true);
135:                    }
136:
137:                    doAccept(literalElementMember.getName().getLocalPart(),
138:                            literalElementMember.getType());
139:                    //literalElementMember.getType().accept(new WSDLTypesVisitorImpl(literalElementMember.getName().getLocalPart()));
140:                }
141:
142:                typeDescriptors.put(literalSequencetypeDescriptor.getName(),
143:                        literalSequencetypeDescriptor);
144:
145:            }
146:
147:            public void visit(
148:                    com.sun.xml.rpc.processor.model.literal.LiteralEnumerationType Type)
149:                    throws java.lang.Exception {
150:
151:                if (Type.getBaseType().getJavaType() instanceof  JavaSimpleType) {
152:                    return;
153:                } else {
154:                    throw new WSDLException(WSDLException.OTHER_ERROR,
155:                            "Enumeration type currently not supported");
156:                }
157:
158:            }
159:
160:            public void visit(
161:                    com.sun.xml.rpc.processor.model.literal.LiteralListType literalListType)
162:                    throws java.lang.Exception {
163:                Map elementsMap = new HashMap();
164:                List elementsList = new ArrayList();
165:
166:                TypeElementDescriptor arrayTypeElementDescriptor = new TypeElementDescriptorImpl(
167:                        literalListType.getItemType().getName().getLocalPart(),
168:                        getActualTypeName(literalListType.getItemType()), "");
169:
170:                elementsMap.put(arrayTypeElementDescriptor.getName(),
171:                        arrayTypeElementDescriptor);
172:                elementsList.add(arrayTypeElementDescriptor.getName());
173:                TypeDescriptor arraytypeDescriptor = new TypeDescriptorImpl(
174:                        literalListType.getName().getLocalPart(), elementsMap,
175:                        elementsList, literalListType.getName()
176:                                .getNamespaceURI());
177:
178:                arraytypeDescriptor.setArrayType(true);
179:                arraytypeDescriptor.setArrayTypeName(literalListType
180:                        .getItemType().getName().getLocalPart());
181:
182:                typeDescriptors.put(arraytypeDescriptor.getName(),
183:                        arraytypeDescriptor);
184:
185:                doAccept(
186:                        literalListType.getItemType().getName().getLocalPart(),
187:                        literalListType.getItemType());
188:                // throw new WSDLException(WSDLException.OTHER_ERROR, "Literal List type currently not supported");
189:            }
190:
191:            public void visit(
192:                    com.sun.xml.rpc.processor.model.literal.LiteralIDType Type)
193:                    throws java.lang.Exception {
194:
195:                throw new WSDLException(WSDLException.OTHER_ERROR,
196:                        "Literal ID Type not supported");
197:
198:            }
199:
200:            public void visit(
201:                    com.sun.xml.rpc.processor.model.literal.LiteralArrayWrapperType Type)
202:                    throws java.lang.Exception {
203:
204:                //	visitLiteralSequenceType(Type);
205:                throw new WSDLException(WSDLException.OTHER_ERROR,
206:                        "Literal Array Wrapper not supported");
207:            }
208:
209:            public void visitLiteralStructuredType(
210:                    LiteralStructuredType literalStructureType)
211:                    throws Exception {
212:                Map structureElementsMap = new HashMap();
213:                List structureElementsList = new ArrayList();
214:
215:                //We need to create Type Descriptor in the begining because
216:                // the "name" member variable would be modified when the doAccept() method is
217:                //called with a element member name
218:                TypeDescriptor literalStructureTypeDescriptor = new TypeDescriptorImpl(
219:                        literalStructureType.getName().getLocalPart(),
220:                        structureElementsMap, structureElementsList,
221:                        literalStructureType.getName().getNamespaceURI());
222:                for (Iterator iter = literalStructureType.getAttributeMembers(); iter
223:                        .hasNext();) {
224:                    LiteralAttributeMember attribute = (LiteralAttributeMember) iter
225:                            .next();
226:                    TypeElementDescriptor td = new TypeElementDescriptorImpl(
227:                            attribute.getName().getLocalPart(),
228:                            getActualTypeName(attribute.getType()), "");
229:                    structureElementsMap.put(td.getName(), td);
230:                    structureElementsList.add(td.getName());
231:
232:                    doAccept(attribute.getName().getLocalPart(), attribute
233:                            .getType());
234:                    //attribute.getType().accept(new WSDLTypesVisitorImpl(attribute.getName().getLocalPart()));
235:                }
236:                for (Iterator iter = literalStructureType.getElementMembers(); iter
237:                        .hasNext();) {
238:                    LiteralElementMember element = (LiteralElementMember) iter
239:                            .next();
240:                    TypeElementDescriptor td = new TypeElementDescriptorImpl(
241:                            element.getName().getLocalPart(),
242:                            getActualTypeName(element.getType()), "");
243:                    structureElementsMap.put(td.getName(), td);
244:                    structureElementsList.add(td.getName());
245:                    if (element.isRepeated()) {
246:                        td.setIsRepeated(true);
247:                    }
248:                    doAccept(element.getName().getLocalPart(), element
249:                            .getType());
250:                    //element.getType().accept(new WSDLTypesVisitorImpl(element.getName().getLocalPart()));
251:                }
252:
253:                typeDescriptors.put(literalStructureTypeDescriptor.getName(),
254:                        literalStructureTypeDescriptor);
255:            }
256:
257:            public void visit(
258:                    com.sun.xml.rpc.processor.model.soap.SOAPCustomType sOAPCustomType)
259:                    throws java.lang.Exception {
260:
261:                throw new WSDLException(WSDLException.OTHER_ERROR,
262:                        "SOAP Custom Type not supported");
263:            }
264:
265:            public void visit(
266:                    com.sun.xml.rpc.processor.model.soap.SOAPArrayType soapArrayType)
267:                    throws java.lang.Exception {
268:                Map soapArrayElementsMap = new HashMap();
269:                List soapArrayElementsList = new ArrayList();
270:
271:                //  System.out.println("IN SOAP ARRAY TYPE" + soapArrayType.getName()+soapArrayType.getElementName()+"  "+soapArrayType.getElementType().getName());
272:                TypeElementDescriptor soapArrayTypeElementDesc = new TypeElementDescriptorImpl(
273:                        soapArrayType.getElementType().getName().getLocalPart(),
274:                        soapArrayType.getElementType().getName().getLocalPart(),
275:                        "");
276:
277:                soapArrayElementsMap.put(soapArrayTypeElementDesc.getName(),
278:                        soapArrayTypeElementDesc);
279:                soapArrayElementsList.add(soapArrayTypeElementDesc.getName());
280:                TypeDescriptor td = new TypeDescriptorImpl(soapArrayType
281:                        .getName().getLocalPart(), soapArrayElementsMap,
282:                        soapArrayElementsList, soapArrayType.getName()
283:                                .getNamespaceURI());
284:
285:                td.setArrayType(true);
286:                td.setArrayTypeName(soapArrayType.getElementType().getName()
287:                        .getLocalPart());
288:
289:                typeDescriptors.put(td.getName(), td);
290:                doAccept(soapArrayType.getElementType().getName()
291:                        .getLocalPart(), soapArrayType.getElementType());
292:                //soapArrayType.getElementType().accept(new WSDLTypesVisitorImpl(soapArrayType.getElementType().getName().getLocalPart()));
293:
294:            }
295:
296:            public void visit(
297:                    com.sun.xml.rpc.processor.model.soap.SOAPUnorderedStructureType type)
298:                    throws java.lang.Exception {
299:
300:                visitSOAPStructureType(type);
301:            }
302:
303:            public void visit(
304:                    com.sun.xml.rpc.processor.model.soap.SOAPOrderedStructureType type)
305:                    throws java.lang.Exception {
306:                visitSOAPStructureType(type);
307:            }
308:
309:            public void visit(
310:                    com.sun.xml.rpc.processor.model.soap.RPCRequestOrderedStructureType type)
311:                    throws java.lang.Exception {
312:                visitSOAPStructureType(type);
313:            }
314:
315:            public void visit(
316:                    com.sun.xml.rpc.processor.model.soap.RPCRequestUnorderedStructureType type)
317:                    throws java.lang.Exception {
318:                visitSOAPStructureType(type);
319:            }
320:
321:            public void visit(
322:                    com.sun.xml.rpc.processor.model.soap.SOAPEnumerationType soapEnumerationType)
323:                    throws java.lang.Exception {
324:
325:                throw new WSDLException(WSDLException.OTHER_ERROR,
326:                        "SOAP Enumeration Type is Not Supported");
327:
328:            }
329:
330:            public void visit(
331:                    com.sun.xml.rpc.processor.model.soap.SOAPSimpleType Type)
332:                    throws java.lang.Exception {
333:
334:            }
335:
336:            public void visit(
337:                    com.sun.xml.rpc.processor.model.soap.RPCResponseStructureType type)
338:                    throws java.lang.Exception {
339:                visitSOAPStructureType(type);
340:            }
341:
342:            public void visit(
343:                    com.sun.xml.rpc.processor.model.soap.SOAPAnyType soapAnyType)
344:                    throws java.lang.Exception {
345:
346:                throw new WSDLException(WSDLException.OTHER_ERROR,
347:                        "SOAP any Type not supported");
348:            }
349:
350:            public void visit(
351:                    com.sun.xml.rpc.processor.model.soap.SOAPListType soapListType)
352:                    throws java.lang.Exception {
353:                Map elementsMap = new HashMap();
354:                List elementsList = new ArrayList();
355:
356:                TypeElementDescriptor arrayTypeElementDescriptor = new TypeElementDescriptorImpl(
357:                        soapListType.getItemType().getName().getLocalPart(),
358:                        soapListType.getItemType().getName().getLocalPart(), "");
359:
360:                elementsMap.put(arrayTypeElementDescriptor.getName(),
361:                        arrayTypeElementDescriptor);
362:                elementsList.add(arrayTypeElementDescriptor.getName());
363:                TypeDescriptor arraytypeDescriptor = new TypeDescriptorImpl(
364:                        soapListType.getName().getLocalPart(), elementsMap,
365:                        elementsList, soapListType.getName().getNamespaceURI());
366:
367:                arraytypeDescriptor.setArrayType(true);
368:                arraytypeDescriptor.setArrayTypeName(soapListType.getItemType()
369:                        .getName().getLocalPart());
370:
371:                typeDescriptors.put(arraytypeDescriptor.getName(),
372:                        arraytypeDescriptor);
373:                doAccept(soapListType.getItemType().getName().getLocalPart(),
374:                        soapListType.getItemType());
375:                //throw new WSDLException(WSDLException.OTHER_ERROR, "SOAP List Type is not supported");
376:            }
377:
378:            public void visitSOAPStructureType(
379:                    SOAPStructureType soapStructureType) throws Exception {
380:                Map soapStructureElementsMap = new HashMap();
381:                List soapStructureElementsList = new ArrayList();
382:                TypeDescriptor tdesc = new TypeDescriptorImpl(soapStructureType
383:                        .getName().getLocalPart(), soapStructureElementsMap,
384:                        soapStructureElementsList, soapStructureType.getName()
385:                                .getNamespaceURI());
386:                for (Iterator iter = soapStructureType.getMembers(); iter
387:                        .hasNext();) {
388:                    SOAPStructureMember soapStructureMember = (SOAPStructureMember) iter
389:                            .next();
390:
391:                    TypeElementDescriptor td = new TypeElementDescriptorImpl(
392:                            soapStructureMember.getName().getLocalPart(),
393:                            soapStructureMember.getType().getName()
394:                                    .getLocalPart(), "");
395:                    soapStructureElementsMap.put(td.getName(), td);
396:                    soapStructureElementsList.add(td.getName());
397:                    doAccept(soapStructureMember.getName().getLocalPart(),
398:                            soapStructureMember.getType());
399:                    //soapStructureMember.getType().accept(new WSDLTypesVisitorImpl(soapStructureMember.getName().getLocalPart()));
400:                }
401:
402:                for (Iterator iter = soapStructureType.getSubtypes(); iter != null
403:                        && iter.hasNext();) {
404:                    SOAPStructureType element = (SOAPStructureType) iter.next();
405:                    TypeElementDescriptor td = new TypeElementDescriptorImpl(
406:                            element.getName().getLocalPart(), element.getName()
407:                                    .getLocalPart(), "");
408:                    soapStructureElementsMap.put(td.getName(), td);
409:                    soapStructureElementsList.add(td.getName());
410:                    doAccept(element.getName().getLocalPart(), element);
411:                    //element.accept(new WSDLTypesVisitorImpl(element.getName().getLocalPart()));
412:                }
413:
414:                typeDescriptors.put(tdesc.getName(), tdesc);
415:
416:            }
417:
418:            /**
419:             * The type of a enum type variable is the type of its Base as against the
420:             * the name of the enumeration type.Handling this case
421:             *
422:             * @param type
423:             * @return
424:             */
425:            private String getActualTypeName(LiteralType type) {
426:                //TODO:
427:                //Do the same for SOAPTypes Also.
428:                String typeName = "";
429:                if (type instanceof  LiteralEnumerationType) {
430:                    typeName = ((LiteralEnumerationType) type).getBaseType()
431:                            .getName().getLocalPart();
432:                } else {
433:                    typeName = type.getName().getLocalPart();
434:                }
435:
436:                return typeName;
437:            }
438:        }
w___ww__.__j__ava__2_s___.___c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.