1 | /*
|
---|
2 | * GSStatus.java
|
---|
3 | * Copyright (C) 2008 New Zealand Digital Library, http://www.nzdl.org
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation; either version 2 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 | */
|
---|
19 | package org.greenstone.gsdl3.util;
|
---|
20 |
|
---|
21 | public class GSStatus {
|
---|
22 |
|
---|
23 | // responses for initial request
|
---|
24 | public static final int SUCCESS = 1; // request succeeded
|
---|
25 | public static final int ACCEPTED = 2; // request accepted but not completed
|
---|
26 | public static final int ERROR = 3; // error and process stopped
|
---|
27 |
|
---|
28 | // responses for status requests
|
---|
29 | public static final int CONTINUING = 10; // request still continuing
|
---|
30 | public static final int COMPLETED = 11; // request finished
|
---|
31 | public static final int HALTED = 12; // process stopped
|
---|
32 |
|
---|
33 | // other
|
---|
34 | public static final int INFO = 20; // just an info message that doesnt mean anything
|
---|
35 |
|
---|
36 | /** returns true if teh code indicates that a process is no longer running
|
---|
37 | */
|
---|
38 | public static boolean isCompleted(int code) {
|
---|
39 | if (code == SUCCESS || code == ERROR || code == COMPLETED || code == HALTED) {
|
---|
40 | return true;
|
---|
41 | }
|
---|
42 | return false;
|
---|
43 | }
|
---|
44 |
|
---|
45 | // there may be other types of error codes
|
---|
46 | public static boolean isError(int code) {
|
---|
47 | if (code == ERROR) {
|
---|
48 | return true;
|
---|
49 | }
|
---|
50 | return false;
|
---|
51 | }
|
---|
52 |
|
---|
53 | }
|
---|
54 |
|
---|