01: /*
02: * (C) Copyright 2000 - 2005 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19:
20: package com.nabhinc.ws.core;
21:
22: /**
23: * Thrown by a Web service to indicate its unavailability to
24: * process requests. The service may indicate number of seconds
25: * for which it is unavailable via this exception.
26: *
27: * @author Padmanabh Dabke
28: * (c) 2005 Nabh Information Systems, Inc. All Rights Reserved.
29: */
30: public class UnavailableException extends WebServiceException {
31:
32: /**
33: *
34: */
35: private static final long serialVersionUID = 3258688819002881073L;
36:
37: /**
38: * Seconds for which the web service is unavailable. If this is
39: * not positive, the web service is either permanently unavailable,
40: * or cannot determine how long it is unavailable.
41: */
42: private int ueUnavailableSeconds = 0;
43:
44: /**
45: * @param msg Error message
46: */
47: public UnavailableException(String msg) {
48: super (msg);
49: }
50:
51: public UnavailableException(String msg, Throwable t) {
52: super (msg, t);
53: }
54:
55: /**
56: * @param msg Error message
57: * @param unSeconds Number of seconds this web service is unavailable
58: */
59: public UnavailableException(String msg, int unSeconds) {
60: super (msg);
61: ueUnavailableSeconds = unSeconds;
62: }
63:
64: public int getUnavailableSeconds() {
65: return ueUnavailableSeconds;
66: }
67:
68: public boolean isPermanent() {
69: return ueUnavailableSeconds <= 0;
70: }
71:
72: }
|