Source Code Cross Referenced for JavaMethod.java in  » 6.0-JDK-Modules-com.sun » xml » com » sun » xml » internal » ws » model » 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 » 6.0 JDK Modules com.sun » xml » com.sun.xml.internal.ws.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Portions Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:        package com.sun.xml.internal.ws.model;
026:
027:        import java.lang.reflect.Method;
028:        import java.util.ArrayList;
029:        import java.util.Collections;
030:        import java.util.List;
031:
032:        import com.sun.xml.internal.bind.api.TypeReference;
033:        import com.sun.xml.internal.ws.model.soap.SOAPBinding;
034:        import com.sun.xml.internal.ws.pept.presentation.MessageStruct;
035:
036:        /**
037:         * Build this runtime model using java SEI and annotations
038:         *
039:         * @author Vivek Pandey
040:         */
041:        public class JavaMethod {
042:            /**
043:             * 
044:             */
045:            public JavaMethod(Method method) {
046:                this .method = method;
047:            }
048:
049:            /**
050:             * @return Returns the method.
051:             */
052:            public Method getMethod() {
053:                return method;
054:            }
055:
056:            /**
057:             * @return Returns the mep.
058:             */
059:            public int getMEP() {
060:                return mep;
061:            }
062:
063:            /**
064:             * @param mep
065:             *            The mep to set.
066:             */
067:            public void setMEP(int mep) {
068:                this .mep = mep;
069:            }
070:
071:            /**
072:             * @return the Binding object
073:             */
074:            public Object getBinding() {
075:                if (binding == null)
076:                    return new SOAPBinding();
077:                return binding;
078:            }
079:
080:            /**
081:             * @param binding
082:             */
083:            public void setBinding(Object binding) {
084:                this .binding = binding;
085:            }
086:
087:            public void setOperationName(String operationName) {
088:                this .operationName = operationName;
089:            }
090:
091:            public String getOperationName() {
092:                return operationName;
093:            }
094:
095:            /**
096:             * @return returns unmodifiable list of request parameters
097:             */
098:            public List<Parameter> getRequestParameters() {
099:                return unmReqParams;
100:            }
101:
102:            /**
103:             * @return returns unmodifiable list of response parameters
104:             */
105:            public List<Parameter> getResponseParameters() {
106:                return unmResParams;
107:            }
108:
109:            /**
110:             * @param p
111:             */
112:            public void addParameter(Parameter p) {
113:                if (p.isIN() || p.isINOUT()) {
114:                    if (requestParams.contains(p)) {
115:                        // TODO throw exception
116:                    }
117:                    requestParams.add(p);
118:                }
119:
120:                if (p.isOUT() || p.isINOUT()) {
121:                    // this check is only for out parameters
122:                    if (requestParams.contains(p)) {
123:                        // TODO throw exception
124:                    }
125:                    responseParams.add(p);
126:                }
127:            }
128:
129:            public void addRequestParameter(Parameter p) {
130:                if (p.isIN() || p.isINOUT()) {
131:                    requestParams.add(p);
132:                }
133:            }
134:
135:            public void addResponseParameter(Parameter p) {
136:                if (p.isOUT() || p.isINOUT()) {
137:                    responseParams.add(p);
138:                }
139:            }
140:
141:            /**
142:             * @return Returns number of java method parameters - that will be all the
143:             *         IN, INOUT and OUT holders
144:             */
145:            public int getInputParametersCount() {
146:                int count = 0;
147:                for (Parameter param : requestParams) {
148:                    if (param.isWrapperStyle()) {
149:                        count += ((WrapperParameter) param)
150:                                .getWrapperChildren().size();
151:                    } else {
152:                        count++;
153:                    }
154:                }
155:
156:                for (Parameter param : responseParams) {
157:                    if (param.isWrapperStyle()) {
158:                        for (Parameter wc : ((WrapperParameter) param)
159:                                .getWrapperChildren()) {
160:                            if (!wc.isResponse() && wc.isOUT()) {
161:                                count++;
162:                            }
163:                        }
164:                    } else if (!param.isResponse() && param.isOUT()) {
165:                        count++;
166:                    }
167:                }
168:
169:                return count;
170:            }
171:
172:            /**
173:             * @param ce
174:             */
175:            public void addException(CheckedException ce) {
176:                if (!exceptions.contains(ce))
177:                    exceptions.add(ce);
178:            }
179:
180:            /**
181:             * @param exceptionClass
182:             * @return CheckedException corresponding to the exceptionClass. Returns
183:             *         null if not found.
184:             */
185:            public CheckedException getCheckedException(Class exceptionClass) {
186:                for (CheckedException ce : exceptions) {
187:                    if (ce.getExcpetionClass().equals(exceptionClass))
188:                        return ce;
189:                }
190:                return null;
191:            }
192:
193:            /**
194:             * @return a list of checked Exceptions thrown by this method
195:             */
196:            public List<CheckedException> getCheckedExceptions() {
197:                return Collections.unmodifiableList(exceptions);
198:            }
199:
200:            /**
201:             * @param detailType
202:             * @return Gets the CheckedException corresponding to detailType. Returns
203:             *         null if no CheckedExcpetion with the detailType found.
204:             */
205:            public CheckedException getCheckedException(TypeReference detailType) {
206:                for (CheckedException ce : exceptions) {
207:                    TypeReference actual = ce.getDetailType();
208:                    if (actual.tagName.equals(detailType.tagName)
209:                            && actual.type.getClass().getName().equals(
210:                                    detailType.type.getClass().getName())) {
211:                        return ce;
212:                    }
213:                }
214:                return null;
215:            }
216:
217:            /**
218:             * Returns if the java method MEP is async
219:             * @return if this is an Asynch MEP
220:             */
221:            public boolean isAsync() {
222:                return mep == MessageStruct.ASYNC_CALLBACK_MEP
223:                        || mep == MessageStruct.ASYNC_POLL_MEP;
224:            }
225:
226:            private List<CheckedException> exceptions = new ArrayList<CheckedException>();
227:            private Method method;
228:            private final List<Parameter> requestParams = new ArrayList<Parameter>();
229:            private final List<Parameter> responseParams = new ArrayList<Parameter>();
230:            private final List<Parameter> unmReqParams = Collections
231:                    .unmodifiableList(requestParams);
232:            private final List<Parameter> unmResParams = Collections
233:                    .unmodifiableList(responseParams);
234:            private Object binding;
235:            private int mep;
236:            private String operationName;
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.