This project has retired. For details please refer to its Attic page.
DispositionReport xref
View Javadoc
1   /*
2    * Copyright 2001-2008 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package org.uddi.v2_service;
18  
19  import java.lang.reflect.UndeclaredThrowableException;
20  import javax.xml.bind.JAXBException;
21  import javax.xml.soap.Detail;
22  import javax.xml.ws.WebFault;
23  import javax.xml.ws.soap.SOAPFaultException;
24  import org.apache.commons.logging.Log;
25  import org.apache.commons.logging.LogFactory;
26  
27  
28  
29  /**
30   * This class was generated by the JAX-WS RI.
31   * JAX-WS RI 2.2.4-b01
32   * Generated source version: 2.2
33   * 
34   */
35  @WebFault(name = "dispositionReport", targetNamespace = "urn:uddi-org:api_v2")
36  public class DispositionReport
37      extends Exception
38  {
39  
40      /**
41       * Java type that goes as soapenv:Fault detail element.
42       * 
43       */
44      private org.uddi.api_v2.DispositionReport faultInfo;
45      private static transient Log log = LogFactory.getLog(DispositionReport.class);
46  
47      /**
48       * 
49       * @param message
50       * @param faultInfo
51       */
52      public DispositionReport(String message, org.uddi.api_v2.DispositionReport faultInfo) {
53          super(message);
54          this.faultInfo = faultInfo;
55      }
56  
57      /**
58       * 
59       * @param message
60       * @param faultInfo
61       * @param cause
62       */
63      public DispositionReport(String message, org.uddi.api_v2.DispositionReport faultInfo, Throwable cause) {
64          super(message, cause);
65          this.faultInfo = faultInfo;
66      }
67  
68      /**
69       * 
70       * @return
71       *     returns fault bean: org.uddi.api_v2.DispositionReport
72       */
73      public org.uddi.api_v2.DispositionReport getFaultInfo() {
74          return faultInfo;
75      }
76  
77      
78      
79      /** 
80       * Convenience method to figure out if the Exception at hand contains a
81       * DispositionReport. Disposition report will be null if none can be found.
82       * 
83       * @param e the Exception at hang
84       * @return DispositionReport if one can be found, or null if it is not.
85       */
86      public static org.uddi.api_v2.DispositionReport getDispositionReport(Exception e) {
87      	org.uddi.api_v2.DispositionReport report = null;
88      	if (e instanceof DispositionReport) {
89      		DispositionReport faultMsg = (DispositionReport) e;
90      		report = faultMsg.faultInfo;
91      	} else if (e instanceof SOAPFaultException) {
92      		SOAPFaultException soapFault = (SOAPFaultException) e;
93      		Detail detail = soapFault.getFault().getDetail();
94      		if (detail != null && detail.getFirstChild()!=null) {
95      			try {
96      				report =  new org.uddi.api_v2.DispositionReport(detail.getFirstChild());
97      			} catch (JAXBException je) {
98      				log.error("Could not unmarshall detail to a DispositionReport");
99      			}
100     		}
101     	} else if (e instanceof UndeclaredThrowableException) {
102     		UndeclaredThrowableException ute =(UndeclaredThrowableException) e;
103     		if (ute.getUndeclaredThrowable()!=null && ute.getUndeclaredThrowable().getCause()!=null
104     		    && ute.getUndeclaredThrowable().getCause().getCause() instanceof DispositionReport) {
105     			DispositionReport faultMsg = (DispositionReport) ute.getUndeclaredThrowable().getCause().getCause();
106 	    		report = faultMsg.getFaultInfo();
107     		}
108     	} else {
109     		log.error("Unsupported Exception: " + e.getClass());
110     	}
111     	return report;
112     }
113 }