01: /*
02: Very Quick Wiki - WikiWikiWeb clone
03: Copyright (C) 2001-2002 Gareth Cronin
04:
05: This program is free software; you can redistribute it and/or modify
06: it under the terms of the latest version of the GNU Lesser General
07: Public License as published by the Free Software Foundation;
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 Lesser General Public License for more details.
13:
14: You should have received a copy of the GNU Lesser General Public License
15: along with this program (gpl.txt); if not, write to the Free Software
16: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: */
18: package vqwiki;
19:
20: import org.apache.log4j.Logger;
21:
22: public class WikiException extends java.lang.Exception {
23:
24: protected static Logger logger = Logger
25: .getLogger(WikiException.class);
26: public final static int UNKNOWN = -1;
27: public final static int TOPIC_LOCKED = 0;
28: public final static int LOCK_TIMEOUT = 1;
29: public final static int READ_ONLY = 2;
30: protected int type;
31: protected String message;
32:
33: /**
34: *
35: */
36: public WikiException(String s) {
37: super (s);
38: this .type = -1;
39: }
40:
41: /**
42: *
43: */
44: public WikiException(int type) {
45: this .type = type;
46: switch (type) {
47: case TOPIC_LOCKED:
48: this .message = "The topic is already locked for editing";
49: break;
50: case LOCK_TIMEOUT:
51: this .message = "Your lock has timed out and is now held by someone else";
52: break;
53: case READ_ONLY:
54: this .message = "The topic is read-only";
55: break;
56: default:
57: this .message = "General error, see logs for details";
58: }
59: }
60:
61: /**
62: *
63: */
64: public int getType() {
65: return type;
66: }
67:
68: /**
69: *
70: */
71: public void setType(int type) {
72: this .type = type;
73: }
74:
75: /**
76: *
77: */
78: public String getMessage() {
79: return message;
80: }
81:
82: /**
83: *
84: */
85: public void setMessage(String message) {
86: this.message = message;
87: }
88: }
|