Source Code Cross Referenced for FaultDescriptionImpl.java in  » Web-Services-AXIS2 » metadata » org » apache » axis2 » jaxws » description » 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 » Web Services AXIS2 » metadata » org.apache.axis2.jaxws.description.impl 
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:
020:        package org.apache.axis2.jaxws.description.impl;
021:
022:        import org.apache.axis2.jaxws.description.FaultDescription;
023:        import org.apache.axis2.jaxws.description.FaultDescriptionJava;
024:        import org.apache.axis2.jaxws.description.FaultDescriptionWSDL;
025:        import org.apache.axis2.jaxws.description.OperationDescription;
026:        import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
027:        import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
028:
029:        import javax.xml.ws.WebFault;
030:        import java.lang.reflect.Method;
031:        import java.util.StringTokenizer;
032:
033:        /** @see ../FaultDescription */
034:
035:        class FaultDescriptionImpl implements  FaultDescription,
036:                FaultDescriptionJava, FaultDescriptionWSDL {
037:
038:            private Class exceptionClass;
039:            private DescriptionBuilderComposite composite;
040:            private WebFault annotation;
041:            private OperationDescription parent;
042:
043:            private String name = ""; // WebFault.name
044:            private String faultBean = ""; // WebFault.faultBean
045:            private String targetNamespace = ""; // WebFault.targetNamespace
046:            private String faultInfo = null;
047:
048:            private static final String FAULT = "Fault";
049:
050:            /**
051:             * The FaultDescriptionImpl class will only be used to describe exceptions declared to be thrown
052:             * by a service that has a WebFault annotation.  No generic exception should ever have a
053:             * FaultDescription associated with it.  It is the responsibility of the user of the
054:             * FaultDescriptionImpl class to avoid instantiating this object for non-annotated generic
055:             * exceptions.
056:             *
057:             * @param exceptionClass an exception declared to be thrown by the service on which this
058:             *                       FaultDescription may apply.
059:             * @param beanName       fully qualified package+classname of the bean associated with this
060:             *                       exception
061:             * @param annotation     the WebFault annotation object on this exception class
062:             * @param parent         the OperationDescription that is the parent of this FaultDescription
063:             */
064:            FaultDescriptionImpl(Class exceptionClass, WebFault annotation,
065:                    OperationDescription parent) {
066:                this .exceptionClass = exceptionClass;
067:                this .annotation = annotation;
068:                this .parent = parent;
069:            }
070:
071:            FaultDescriptionImpl(DescriptionBuilderComposite faultDBC,
072:                    OperationDescription parent) {
073:                this .composite = faultDBC;
074:                this .parent = parent;
075:            }
076:
077:            public WebFault getAnnoWebFault() {
078:
079:                if (annotation == null) {
080:                    if (isDBC()) {
081:                        annotation = this .composite.getWebFaultAnnot();
082:                    }
083:                }
084:
085:                return annotation;
086:            }
087:
088:            public String getExceptionClassName() {
089:                if (!isDBC()) {
090:                    // no need for defaults here.  The exceptionClass stored in this
091:                    // FaultDescription object is one that has been declared to be
092:                    // thrown from the service method
093:                    return exceptionClass.getCanonicalName();
094:                } else {
095:                    return composite.getClassName();
096:                }
097:            }
098:
099:            public String getFaultInfo() {
100:                if (faultInfo != null) {
101:                    return faultInfo;
102:                }
103:                if (!isDBC()) {
104:                    try {
105:                        Method method = exceptionClass.getMethod(
106:                                "getFaultInfo", null);
107:                        faultInfo = method.getReturnType().getCanonicalName();
108:                    } catch (Exception e) {
109:                        // This must be a legacy exception
110:                        faultInfo = "";
111:                    }
112:                } else {
113:                    MethodDescriptionComposite mdc = composite
114:                            .getMethodDescriptionComposite("getFaultInfo", 1);
115:                    if (mdc != null) {
116:                        faultInfo = mdc.getReturnType();
117:                    } else {
118:                        faultInfo = "";
119:                    }
120:                }
121:                return faultInfo;
122:            }
123:
124:            public String getFaultBean() {
125:                if (faultBean != null && faultBean.length() > 0) {
126:                    // Return the faultBean if it was already calculated
127:                    return faultBean;
128:                } else {
129:                    // Load up the WebFault annotation and get the faultBean.
130:                    // @WebFault may not be present
131:                    WebFault annotation = getAnnoWebFault();
132:
133:                    if (annotation != null && annotation.faultBean() != null
134:                            && annotation.faultBean().length() > 0) {
135:                        faultBean = annotation.faultBean();
136:                    } else {
137:                        // There is no default.  But it seems reasonable to return
138:                        // the fault info type.
139:                        faultBean = getFaultInfo();
140:
141:                        // The faultBean still may be "" at this point.  The JAXWS runtime
142:                        // is responsible for finding/buildin a representative fault bean.
143:                    }
144:                }
145:                return faultBean;
146:            }
147:
148:            public String getName() {
149:                if (name.length() > 0) {
150:                    return name;
151:                } else {
152:                    // Load the annotation. The annotation may not be present in WSGen cases
153:                    WebFault annotation = this .getAnnoWebFault();
154:                    if (annotation != null && annotation.name().length() > 0) {
155:                        name = annotation.name();
156:                    } else {
157:                        // The default is undefined.
158:                        // The JAX-WS layer may use the fault bean information to determine the name
159:                    }
160:                }
161:                return name;
162:            }
163:
164:            public String getTargetNamespace() {
165:                if (targetNamespace.length() > 0) {
166:                    return targetNamespace;
167:                } else {
168:                    // Load the annotation. The annotation may not be present in WSGen cases
169:                    WebFault annotation = this .getAnnoWebFault();
170:                    if (annotation != null
171:                            && annotation.targetNamespace().length() > 0) {
172:                        targetNamespace = annotation.targetNamespace();
173:                    } else {
174:                        // The default is undefined
175:                        // The JAX-WS layer may use the fault bean information to determine the name
176:                    }
177:                }
178:                return targetNamespace;
179:            }
180:
181:            public OperationDescription getOperationDescription() {
182:                return parent;
183:            }
184:
185:            /**
186:             * utility method to get the last token in a "."-delimited package+classname string
187:             *
188:             * @return
189:             */
190:            private static String getSimpleName(String in) {
191:                if (in == null || in.length() == 0) {
192:                    return in;
193:                }
194:                String out = null;
195:                StringTokenizer tokenizer = new StringTokenizer(in, ".");
196:                if (tokenizer.countTokens() == 0)
197:                    out = in;
198:                else {
199:                    while (tokenizer.hasMoreTokens()) {
200:                        out = tokenizer.nextToken();
201:                    }
202:                }
203:                return out;
204:            }
205:
206:            private boolean isDBC() {
207:                if (this .composite != null)
208:                    return true;
209:                else
210:                    return false;
211:            }
212:
213:            public String toString() {
214:                final String newline = "\n";
215:                final String sameline = "; ";
216:                StringBuffer string = new StringBuffer();
217:                try {
218:                    string.append(super .toString());
219:                    string.append(newline);
220:                    string
221:                            .append("Exception class: "
222:                                    + getExceptionClassName());
223:                    string.append(newline);
224:                    string.append("Name: " + getName());
225:                    string.append(newline);
226:                    string.append("Namespace: " + getName());
227:                    string.append(newline);
228:                    string.append("FaultBean: " + getFaultBean());
229:                    string.append(newline);
230:                    string.append("FaultInfo Type Name  : " + getFaultInfo());
231:
232:                } catch (Throwable t) {
233:                    string.append(newline);
234:                    string
235:                            .append("Complete debug information not currently available for "
236:                                    + "FaultDescription");
237:                    return string.toString();
238:                }
239:                return string.toString();
240:            }
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.