Source Code Cross Referenced for InterfaceImpl.java in  » ESB » open-esb » com » sun » jbi » wsdl2 » 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 » ESB » open esb » com.sun.jbi.wsdl2.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)InterfaceImpl.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.wsdl2.impl;
030:
031:        import java.net.URI;
032:
033:        import java.util.ArrayList;
034:        import java.util.HashMap;
035:        import java.util.Iterator;
036:        import java.util.List;
037:        import java.util.Map;
038:
039:        import javax.xml.namespace.QName;
040:
041:        import org.w3.ns.wsdl.InterfaceType;
042:
043:        /**
044:         * Implementation of WSDL 2.0 Interface Component.
045:         * 
046:         * @author Sun Microsystems, Inc.
047:         */
048:        final class InterfaceImpl extends Interface {
049:            /** The container for this component */
050:            private DescriptionImpl mContainer;
051:
052:            /**
053:             * Get the container for this component.
054:             * 
055:             * @return The component for this component
056:             */
057:            protected DescriptionImpl getContainer() {
058:                return this .mContainer;
059:            }
060:
061:            /**
062:             * Construct an Interface component implementation from an Interface XML bean.
063:             * @param bean The XML bean to construct the component from.
064:             * @param defs The container for this component.
065:             */
066:            private InterfaceImpl(InterfaceType bean, DescriptionImpl defs) {
067:                super (bean);
068:                this .mContainer = defs;
069:            }
070:
071:            /** Map of WSDL-defined attribute QNames. Keyed by QName.toString value */
072:            private static java.util.Map sWsdlAttributeQNames = null;
073:
074:            /** 
075:             * Worker class method for {@link #getWsdlAttributeNameMap()}.
076:             * 
077:             * @return Map of WSDL-defined attribute QNames for this component, 
078:             *         indexed by QName.toString()
079:             */
080:            static synchronized java.util.Map getAttributeNameMap() {
081:                if (sWsdlAttributeQNames == null) {
082:                    sWsdlAttributeQNames = XmlBeansUtil
083:                            .getAttributesMap(InterfaceType.type);
084:                }
085:
086:                return sWsdlAttributeQNames;
087:            }
088:
089:            /**
090:             * Get map of WSDL-defined attribute QNames for this component, indexed by 
091:             * canonical QName string (see {@link javax.xml.namespace.QName#toString()}.
092:             *
093:             * @return Map of WSDL-defined attribute QNames for this component, 
094:             *         indexed by QName.toString()
095:             */
096:            public java.util.Map getWsdlAttributeNameMap() {
097:                return getAttributeNameMap();
098:            }
099:
100:            /**
101:             * Get the target namespace of this interface's.
102:             * 
103:             * @return The target namespace of this interface's container.
104:             */
105:            public String getTargetNamespace() {
106:                return this .mContainer.getTargetNamespace();
107:            }
108:
109:            /**
110:             * Get the qualified name of this binding component.
111:             * 
112:             * @return The qualified name of this binding component.
113:             */
114:            public QName getQName() {
115:                return new QName(this .mContainer.getTargetNamespace(),
116:                        getName());
117:            }
118:
119:            /**
120:             * Get local name of this interface component.
121:             *
122:             * @return Local name of this interface component
123:             */
124:            public String getName() {
125:                return getBean().getName();
126:            }
127:
128:            /**
129:             * Set local name of this interface component.
130:             *
131:             * @param theName Local name of this interface component
132:             */
133:            public void setName(String theName) {
134:                getBean().setName(theName);
135:            }
136:
137:            /**
138:             * Get the number of Interface items in interfaces.
139:             *
140:             * @return The number of Interface items in interfaces
141:             */
142:            public int getInterfacesLength() {
143:                List extendsList = getBean().getExtends();
144:
145:                return extendsList != null ? extendsList.size() : 0;
146:            }
147:
148:            /**
149:             * Get interfaces this interface subclasses, if any by indexed position.
150:             *
151:             * @param index Indexed position value 0..length-1
152:             * @return Interfaces this interface subclasses, if any at given 
153:             *         <code>index</code> position.
154:             */
155:            public com.sun.jbi.wsdl2.Interface getInterface(int index) {
156:                com.sun.jbi.wsdl2.Interface result = null;
157:                List extendsList = getBean().getExtends();
158:
159:                if (extendsList != null && index < extendsList.size()) {
160:                    QName ifaceName = (QName) extendsList.get(index);
161:
162:                    result = this .mContainer.findInterface(ifaceName);
163:                }
164:
165:                return result;
166:            }
167:
168:            /**
169:             * Set interfaces this interface subclasses, if any by indexed position.
170:             *
171:             * @param index Indexed position value (0..length-1) of the item to set.
172:             * @param theInterface Item to add at position <code>index</code>.
173:             */
174:            public void setInterface(int index,
175:                    com.sun.jbi.wsdl2.Interface theInterface) {
176:                synchronized (getBean().monitor()) {
177:                    List extendsList = getBean().getExtends();
178:
179:                    extendsList.set(index, theInterface != null ? theInterface
180:                            .getQName() : null);
181:
182:                    getBean().setExtends(extendsList);
183:                }
184:            }
185:
186:            /**
187:             * Append an item to interfaces this interface subclasses, if any.
188:             *
189:             * @param theInterface Item to append to interfaces
190:             */
191:            public void appendInterface(com.sun.jbi.wsdl2.Interface theInterface) {
192:                synchronized (getBean().monitor()) {
193:                    List extendsList = getBean().getExtends();
194:
195:                    extendsList.set(extendsList.size(),
196:                            theInterface != null ? theInterface.getQName()
197:                                    : null);
198:                    getBean().setExtends(extendsList);
199:                }
200:            }
201:
202:            /**
203:             * Remove interfaces this interface subclasses, if any by index position.
204:             *
205:             * @param index The index position of the interface to remove
206:             * @return The Interface removed, if any.
207:             */
208:            public com.sun.jbi.wsdl2.Interface removeInterface(int index) {
209:                com.sun.jbi.wsdl2.Interface result = null;
210:                List extendsList;
211:                QName ifaceName;
212:
213:                synchronized (getBean().monitor()) {
214:                    extendsList = getBean().getExtends();
215:                    ifaceName = (QName) extendsList.remove(index);
216:                }
217:
218:                if (ifaceName != null) {
219:                    result = this .mContainer.findInterface(ifaceName);
220:                }
221:
222:                return result;
223:            }
224:
225:            /**
226:             * Get the default style for the message prop of operations contained in 
227:             * this interface.
228:             *
229:             * @return The default style for the message prop of operations contained 
230:             * in this interface
231:             */
232:            public java.net.URI[] getStyleDefault() {
233:                List list = getBean().getStyleDefault();
234:                URI[] result = new URI[list != null ? list.size() : 0];
235:
236:                for (int i = 0; i < result.length; i++) {
237:                    result[i] = (URI) list.get(i);
238:                }
239:
240:                return result;
241:            }
242:
243:            /**
244:             * Set the default style for the message prop of operations contained 
245:             * in this interface.
246:             *
247:             * @param theStyleDefault The default styles for the message prop of 
248:             *                        operations contained in this interface.
249:             */
250:            public void setStyleDefault(java.net.URI[] theStyleDefault) {
251:                List list = new ArrayList();
252:
253:                if (theStyleDefault != null) {
254:                    for (int i = 0; i < theStyleDefault.length; i++) {
255:                        list.add(theStyleDefault[i]);
256:                    }
257:                }
258:            }
259:
260:            /**
261:             * Get the number of InterfaceFault items in faults.
262:             *
263:             * @return The number of InterfaceFault items in faults
264:             */
265:            public int getFaultsLength() {
266:                return getBean().sizeOfFaultArray();
267:            }
268:
269:            /**
270:             * Get faults that may occur executing operations of this interface by
271:             * indexed position.
272:             *
273:             * @param index Indexed position value 0..length-1
274:             * @return Faults that may occur executing operations of this interface
275:             * at given <code>index</code> position.
276:             */
277:            public com.sun.jbi.wsdl2.InterfaceFault getFault(int index) {
278:                return InterfaceFaultImpl.Factory.getInstance(getBean()
279:                        .getFaultArray(index), this .mContainer);
280:            }
281:
282:            /**
283:             * Set faults that may occur executing operations of this interface by
284:             * indexed position.
285:             *
286:             * @param index Indexed position value (0..length-1) of the item to set
287:             * @param  theFault Item to add at position <code>index</code>.
288:             */
289:            public void setFault(int index,
290:                    com.sun.jbi.wsdl2.InterfaceFault theFault) {
291:                getBean().setFaultArray(
292:                        index,
293:                        theFault != null ? ((InterfaceFaultImpl) theFault)
294:                                .getBean() : null);
295:            }
296:
297:            /**
298:             * Append an item to faults that may occur executing operations of this
299:             * interface.
300:             *
301:             * @param theFault Item to append to faults
302:             */
303:            public void appendFault(com.sun.jbi.wsdl2.InterfaceFault theFault) {
304:                synchronized (getBean().monitor()) {
305:                    setFault(getFaultsLength(), theFault);
306:                }
307:            }
308:
309:            /**
310:             * Remove faults that may occur executing operations of this interface by
311:             * index position.
312:             *
313:             * @param index The index position of the fault to remove
314:             * @return The InterfaceFault removed, if any.
315:             */
316:            public com.sun.jbi.wsdl2.InterfaceFault removeFault(int index) {
317:                com.sun.jbi.wsdl2.InterfaceFault result;
318:
319:                synchronized (getBean().monitor()) {
320:                    result = getFault(index);
321:                    getBean().removeFault(index);
322:                }
323:
324:                return result;
325:            }
326:
327:            /**
328:             * Get the number of InterfaceOperation items in operations.
329:             *
330:             * @return The number of InterfaceOperation items in operations
331:             */
332:            public int getOperationsLength() {
333:                return getBean().sizeOfOperationArray();
334:            }
335:
336:            /**
337:             * Get operations defined by this interface only, by indexed position.
338:             *
339:             * @param index Indexed position value 0..length-1
340:             * @return Operations defined by this interface only. at given 
341:             *         <code>index</code> position.
342:             */
343:            public com.sun.jbi.wsdl2.InterfaceOperation getOperation(int index) {
344:                return InterfaceOperationImpl.Factory.getInstance(getBean()
345:                        .getOperationArray(index), this .mContainer);
346:            }
347:
348:            /**
349:             * Set operations defined by this interface only, by indexed position.
350:             *
351:             * @param index Indexed position value (0..length-1) of the item to set
352:             * @param  theOperation Item to add at position <code>index</code>.
353:             */
354:            public void setOperation(int index,
355:                    com.sun.jbi.wsdl2.InterfaceOperation theOperation) {
356:                getBean()
357:                        .setOperationArray(
358:                                index,
359:                                theOperation != null ? ((InterfaceOperationImpl) theOperation)
360:                                        .getBean()
361:                                        : null);
362:            }
363:
364:            /**
365:             * Append an item to operations defined by this interface only.
366:             *
367:             * @param theOperation Item to append to operations
368:             */
369:            public void appendOperation(
370:                    com.sun.jbi.wsdl2.InterfaceOperation theOperation) {
371:                synchronized (getBean().monitor()) {
372:                    setOperation(getOperationsLength(), theOperation);
373:                }
374:            }
375:
376:            /**
377:             * Remove operations defined by this interface only, by index position.
378:             *
379:             * @param index The index position of the operation to remove
380:             * @return The InterfaceOperation removed, if any.
381:             */
382:            public com.sun.jbi.wsdl2.InterfaceOperation removeOperation(
383:                    int index) {
384:                com.sun.jbi.wsdl2.InterfaceOperation result;
385:
386:                synchronized (getBean().monitor()) {
387:                    result = getOperation(index);
388:                    getBean().removeOperation(index);
389:                }
390:
391:                return result;
392:            }
393:
394:            /**
395:             * Get the interfaces extended by this interface, including those extended by 
396:             * this interface's super-interfaces.
397:             *
398:             * @return Extended interfaces, including those extended by this interface's 
399:             *         super-interfaces
400:             */
401:            public com.sun.jbi.wsdl2.Interface[] getExtendedInterfaces() {
402:                com.sun.jbi.wsdl2.Interface[] result;
403:                Map map = new HashMap();
404:                Object[] interfaces;
405:
406:                synchronized (getBean().monitor()) {
407:                    List names = getBean().getExtends();
408:
409:                    getSuperInterfaces(names, map);
410:                    interfaces = map.values().toArray();
411:                }
412:
413:                result = new com.sun.jbi.wsdl2.Interface[interfaces.length];
414:                System.arraycopy(interfaces, 0, result, 0, interfaces.length);
415:
416:                return result;
417:            }
418:
419:            /**
420:             * Get the interfaces corresponding to each the given QNames, placing
421:             * them into the given map, key by QName string value.
422:             * 
423:             * @param names A list of QNames of interfaces to find.
424:             * @param map   A map to place the (QName, Interface) pairs into
425:             */
426:            private void getSuperInterfaces(List names, Map map) {
427:                final Iterator eachName = names != null ? names.iterator()
428:                        : null;
429:
430:                while (eachName != null && eachName.hasNext()) {
431:                    QName qName = (QName) eachName.next();
432:                    String name = qName.toString();
433:
434:                    if (!map.containsKey(name)) //  Avoid circular or duplicate inheritance
435:                    {
436:                        com.sun.jbi.wsdl2.Interface iface = mContainer
437:                                .findInterface(qName);
438:
439:                        if (iface != null) {
440:                            map.put(name, iface);
441:                            //  Recurse up the inheritance tree.
442:                            getSuperInterfaces(((InterfaceImpl) iface)
443:                                    .getBean().getExtends(), map);
444:                        }
445:                    }
446:                }
447:            }
448:
449:            /**
450:             * Get the operations defined by this interface, and all its super-interfaces
451:             *
452:             * @return Operations defined by this interface, and all super-interfaces
453:             */
454:            public com.sun.jbi.wsdl2.InterfaceOperation[] getExtendedOperations() {
455:                ArrayList result = new ArrayList();
456:                Map ifaceMap = new HashMap();
457:                List names;
458:
459:                synchronized (getBean().monitor()) {
460:                    names = getBean().getExtends();
461:                    addInterfaceOperations(this , result); //  include self-defined operations
462:                    getSuperInterfaces(names, ifaceMap);
463:
464:                    Iterator eachIface = ifaceMap.values().iterator();
465:
466:                    while (eachIface.hasNext()) {
467:                        addInterfaceOperations(
468:                                (com.sun.jbi.wsdl2.Interface) eachIface.next(),
469:                                result);
470:                    }
471:                }
472:
473:                com.sun.jbi.wsdl2.InterfaceOperation[] retVal = new com.sun.jbi.wsdl2.InterfaceOperation[result
474:                        .size()];
475:
476:                for (int idx = 0; idx < retVal.length; idx++) {
477:                    retVal[idx] = (com.sun.jbi.wsdl2.InterfaceOperation) result
478:                            .get(idx);
479:                }
480:
481:                return retVal;
482:            }
483:
484:            /**
485:             * Add the operations for the given interface to the given operations list.
486:             * <p>
487:             * This is a gathering function used by {@link #getExtendedOperations()} to
488:             * build the full operations list for all interfaces it is interested in.
489:             * 
490:             * @param iface   The interface whose operations are to be added to the given 
491:             *                list. This may be null.
492:             * @param opsList The list to which to add the operations found.
493:             */
494:            private static void addInterfaceOperations(
495:                    com.sun.jbi.wsdl2.Interface iface, List opsList) {
496:                if (iface != null) {
497:                    final int nOps = iface.getOperationsLength();
498:
499:                    for (int idx = 0; idx < nOps; idx++) {
500:                        com.sun.jbi.wsdl2.InterfaceOperation op = (com.sun.jbi.wsdl2.InterfaceOperation) iface
501:                                .getOperation(idx);
502:
503:                        if (op != null) {
504:                            opsList.add(op);
505:                        }
506:                    }
507:                }
508:            }
509:
510:            /**
511:             * Create a new operation, appending it to this interface's operations list.
512:             *
513:             * @return Newly created operation, appended to the operations list.
514:             */
515:            public com.sun.jbi.wsdl2.InterfaceOperation addNewOperation() {
516:                return InterfaceOperationImpl.Factory.getInstance(getBean()
517:                        .addNewOperation(), this .mContainer);
518:            }
519:
520:            /**
521:             * Create a new fault, and append it to this interface's faults list.
522:             *
523:             * @param name Name of the new fault
524:             * @return Newly created interface, appended to the faults list.
525:             */
526:            public com.sun.jbi.wsdl2.InterfaceFault addNewFault(String name) {
527:                return null; // $$TOD
528:            }
529:
530:            /**
531:             * A factory class for creating / finding components for given XML beans.
532:             * <p>
533:             * This factory guarantees that there will only be one component for each
534:             * XML bean instance.
535:             */
536:            static class Factory {
537:                /**
538:                 * Find the WSDL interface component associated with the given XML
539:                 * bean, creating a new component if necessary.
540:                 * <p>
541:                 * This is thread-safe.<p>
542:                 * 
543:                 * @param bean The XML bean to find the component for.
544:                 * @param defs The container for the component.
545:                 * @return The WSDL interface component for the given <code>bean</code>
546:                 *         (null if the <code>bean</code> is null).
547:                 */
548:                static InterfaceImpl getInstance(InterfaceType bean,
549:                        DescriptionImpl defs) {
550:                    InterfaceImpl result;
551:
552:                    if (bean != null) {
553:                        Map map = defs.getInterfaceMap();
554:
555:                        synchronized (map) {
556:                            result = (InterfaceImpl) map.get(bean);
557:
558:                            if (result == null) {
559:                                result = new InterfaceImpl(bean, defs);
560:                                map.put(bean, result);
561:                            }
562:                        }
563:                    } else {
564:                        result = null;
565:                    }
566:
567:                    return result;
568:                }
569:            } //  end inner class Factory
570:        }
571:
572:        // End-of-file: InterfaceImpl.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.