AMQConnectionFailureException.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 
22 package org.apache.qpid;
23 
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.Iterator;
27 
28 import org.apache.qpid.protocol.AMQConstant;
29 
30 /**
31  * AMQConnectionFailureException indicates that a connection to a broker could not be formed.
32  *
33  <p/><table id="crc"><caption>CRC Card</caption>
34  <tr><th> Responsibilities <th> Collaborations
35  <tr><td> Represents failure to connect to a broker.
36  </table>
37  *
38  * @todo Not an AMQP exception as no status code.
39  */
40 public class AMQConnectionFailureException extends AMQException
41 {
42     Collection<Exception> _exceptions;
43     
44   public AMQConnectionFailureException(String message, Throwable cause)
45   {
46     super(null, message, cause);
47   }
48 
49     public AMQConnectionFailureException(AMQConstant errorCode, String message, Throwable cause)
50     {
51         super(errorCode, message, cause);
52     }
53 
54     public AMQConnectionFailureException(String message, Collection<Exception> exceptions)
55     {
56         // Blah, I hate ? but java won't let super() be anything other than the first thing, sorry...
57         super (null, message, exceptions.isEmpty() null : exceptions.iterator().next());
58         this._exceptions = exceptions;
59     }
60     
61     public Collection<Exception> getLinkedExceptions()
62     {
63         return _exceptions;
64     }
65 }