QManFault.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.management.wsdm.common;
22 
23 import javax.xml.namespace.QName;
24 
25 import org.apache.muse.ws.addressing.EndpointReference;
26 import org.apache.muse.ws.resource.basefaults.BaseFault;
27 import org.apache.qpid.management.Names;
28 
29 /**
30  * Base class for QMan thrown faults.
31  * This should be thrown to denote a situation where a not-well cause could be determined.
32  */
33 public class QManFault extends BaseFault 
34 {  
35   private static final long serialVersionUID = 5977379710882983474L;
36   private final static QName SERVICE = new QName(
37       Names.NAMESPACE_URI,
38       "QMan",
39       Names.PREFIX);
40   
41   private final static QName EXCEPTION_QNAME = new QName(
42       Names.NAMESPACE_URI,
43       "QManFault",
44       Names.PREFIX);
45   
46   /**
47    * Builds a new exception with the given endpoint reference and the exception cause.
48    
49    @param endpointReference the endpoint reference.
50    @param cause the exception cause.
51    */
52   public QManFault(EndpointReference endpointReference, Exception cause
53   {
54     super(EXCEPTION_QNAME,cause.getMessage());
55     setCode(SERVICE);
56     setOriginReference(endpointReference);
57   }
58   
59   /**
60    * Builds a new exception with the given endpoint reference, qname and detail message.
61    
62    @param endpointReference the endpoint reference.
63    @param qname the qname of this exception.
64    @param message the detail message of this exception.
65    */
66   public QManFault(EndpointReference endpointReference, QName qname, String message
67   {
68     super(qname,message);
69     setOriginReference(endpointReference);
70     setCode(SERVICE);    
71   }
72 }