View Javadoc

1   /*
2    * <cvs:source>$Source: /devel/astrogrid/community/common/src/java/org/astrogrid/community/common/exception/CommunityException.java,v $</cvs:source>
3    * <cvs:author>$Author: dave $</cvs:author>
4    * <cvs:date>$Date: 2004/06/18 13:45:20 $</cvs:date>
5    * <cvs:version>$Revision: 1.6 $</cvs:version>
6    *
7    * <cvs:log>
8    *   $Log: CommunityException.java,v $
9    *   Revision 1.6  2004/06/18 13:45:20  dave
10   *   Merged development branch, dave-dev-200406081614, into HEAD
11   *
12   *   Revision 1.5.36.1  2004/06/17 13:38:58  dave
13   *   Tidied up old CVS log entries
14   *
15   * </cvs:log>
16   *
17   */
18  package org.astrogrid.community.common.exception ;
19  
20  import org.astrogrid.store.Ivorn ;
21  
22  /***
23   * Base class for our Exceptions.
24   * This means that client applications can catch a generic CommunityException if they need to.
25   * <br>
26   * According to the Axis documentation, this must either extend RemoteException, or have get set methods like a Bean.
27   * This implementation goes for the Bean approach for now, but this may change.
28   *
29   */
30  public class CommunityException
31      extends Exception
32      {
33      /***
34       * Protected constructor.
35       * This enables Axis to re-construct the Exception on the client side by treating it as a Bean.
36       * <br>
37       * This isn't really deprecated, I just don't want you to use it.
38       * Marking it as deprecated means that any compiled code that uses this will get a warning.
39       * The Axis Bean-Serialiser invokes this at run time, and won't get a warning.
40       * @deprecated
41       *
42       */
43      protected CommunityException()
44          {
45          super() ;
46          }
47  
48      /***
49       * Protected constructor.
50       *
51       */
52      protected CommunityException(String message)
53          {
54          super(message) ;
55          }
56  
57      /***
58       * Protected constructor.
59       * @param cause The root cause of this Exception.
60       *
61       */
62      protected CommunityException(Throwable cause)
63          {
64          super(cause) ;
65          }
66  
67      /***
68       * Protected constructor.
69       * @param message The Exception message.
70       * @param cause   The root cause of this Exception.
71       *
72       */
73      protected CommunityException(String message, Throwable cause)
74          {
75          super(message, cause) ;
76          }
77  
78      /***
79       * Public constructor.
80       * @param message The Exception message.
81       * @param ident   The identifier that caused the Exception.
82       *
83       */
84      protected CommunityException(String message, String ident)
85          {
86          super(message) ;
87          this.ident = ident ;
88          }
89  
90      /***
91       * Public constructor.
92       * @param message The Exception message.
93       * @param ident   The identifier that caused the Exception.
94       * @param cause   The root cause of this Exception.
95       *
96       */
97      protected CommunityException(String message, String ident, Throwable cause)
98          {
99          super(message, cause) ;
100         this.ident = ident ;
101         }
102 
103     /***
104      * The Exception message.
105      * This enables Axis to re-construct the Exception on the client side by treating it as a Bean.
106      *
107      */
108     private String message ;
109 
110     /***
111      * Access to the message.
112      * This enables Axis to re-construct the Exception on the client side by treating it as a Bean.
113      *
114      */
115     public String getMessage()
116         {
117         if (null != this.message)
118             {
119             return this.message ;
120             }
121         else {
122             return super.getMessage() ;
123             }
124         }
125 
126     /***
127      * Access to the message.
128      * This enables Axis to re-construct the Exception on the client side by treating it as a Bean.
129      * @param message The Exception message.
130      * <br>
131      * This isn't really deprecated, I just don't want you to use it.
132      * Marking it as deprecated means that any compiled code that uses this will get a warning.
133      * The Axis Bean-Serialiser invokes this at run time, and won't get a warning.
134      * @deprecated
135      *
136      */
137     public void setMessage(String message)
138         {
139         this.message = message ;
140         }
141 
142     /***
143      * The identifier that caused the Exception.
144      *
145      */
146     private String ident ;
147 
148     /***
149      * Access to the identifier.
150      *
151      */
152     public String getIdent()
153         {
154         return this.ident ;
155         }
156 
157     /***
158      * Access to the identifier.
159      * This is required to allow Axis to re-construct the Exception on the client side by treating it as a Bean.
160      * @param ident The identifier that caused the Exception.
161      * <br>
162      * This isn't really deprecated, I just don't want you to use it.
163      * Marking it as deprecated means that any compiled code that uses this will get a warning.
164      * The Axis Bean-Serialiser invokes this at run time, and won't get a warning.
165      * @deprecated
166      *
167      */
168     public void setIdent(String ident)
169         {
170         this.ident = ident ;
171         }
172 
173     /***
174      * Protected constructor.
175      * @param message The Exception message.
176      * @param ivorn   The identifier that caused the Exception.
177      *
178      */
179     protected CommunityException(String message, Ivorn ivorn)
180         {
181         super(message) ;
182         if (null != ivorn)
183             {
184             this.ident = ivorn.toString() ;
185             }
186         }
187 
188     /***
189      * Protected constructor.
190      * @param message The Exception message.
191      * @param ivorn   The identifier that caused the Exception.
192      * @param cause   The root cause of this Exception.
193      *
194      */
195     protected CommunityException(String message, Ivorn ivorn, Throwable cause)
196         {
197         super(message, cause) ;
198         if (null != ivorn)
199             {
200             this.ident = ivorn.toString() ;
201             }
202         }
203     }