1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1.cea.castor.types;
9
10
11
12
13
14 import java.io.Serializable;
15 import java.util.Enumeration;
16 import java.util.Hashtable;
17 import org.exolab.castor.xml.Marshaller;
18 import org.exolab.castor.xml.Unmarshaller;
19
20 /***
21 * Enumeration of possible phases of job execution
22 *
23 * @version $Revision: 1.34 $ $Date: 2007/01/04 16:26:20 $
24 */
25 public class ExecutionPhase implements java.io.Serializable {
26
27
28
29
30
31
32 /***
33 * The PENDING type
34 */
35 public static final int PENDING_TYPE = 0;
36
37 /***
38 * The instance of the PENDING type
39 */
40 public static final ExecutionPhase PENDING = new ExecutionPhase(PENDING_TYPE, "PENDING");
41
42 /***
43 * The INITIALIZING type
44 */
45 public static final int INITIALIZING_TYPE = 1;
46
47 /***
48 * The instance of the INITIALIZING type
49 */
50 public static final ExecutionPhase INITIALIZING = new ExecutionPhase(INITIALIZING_TYPE, "INITIALIZING");
51
52 /***
53 * The RUNNING type
54 */
55 public static final int RUNNING_TYPE = 2;
56
57 /***
58 * The instance of the RUNNING type
59 */
60 public static final ExecutionPhase RUNNING = new ExecutionPhase(RUNNING_TYPE, "RUNNING");
61
62 /***
63 * The COMPLETED type
64 */
65 public static final int COMPLETED_TYPE = 3;
66
67 /***
68 * The instance of the COMPLETED type
69 */
70 public static final ExecutionPhase COMPLETED = new ExecutionPhase(COMPLETED_TYPE, "COMPLETED");
71
72 /***
73 * The ERROR type
74 */
75 public static final int ERROR_TYPE = 4;
76
77 /***
78 * The instance of the ERROR type
79 */
80 public static final ExecutionPhase ERROR = new ExecutionPhase(ERROR_TYPE, "ERROR");
81
82 /***
83 * The UNKNOWN type
84 */
85 public static final int UNKNOWN_TYPE = 5;
86
87 /***
88 * The instance of the UNKNOWN type
89 */
90 public static final ExecutionPhase UNKNOWN = new ExecutionPhase(UNKNOWN_TYPE, "UNKNOWN");
91
92 /***
93 * Field _memberTable
94 */
95 private static java.util.Hashtable _memberTable = init();
96
97 /***
98 * Field type
99 */
100 private int type = -1;
101
102 /***
103 * Field stringValue
104 */
105 private java.lang.String stringValue = null;
106
107
108
109
110
111
112 private ExecutionPhase(int type, java.lang.String value) {
113 super();
114 this.type = type;
115 this.stringValue = value;
116 }
117
118
119
120
121
122
123 /***
124 * Method enumerateReturns an enumeration of all possible
125 * instances of ExecutionPhase
126 */
127 public static java.util.Enumeration enumerate()
128 {
129 return _memberTable.elements();
130 }
131
132 /***
133 * Method getTypeReturns the type of this ExecutionPhase
134 */
135 public int getType()
136 {
137 return this.type;
138 }
139
140 /***
141 * Method init
142 */
143 private static java.util.Hashtable init()
144 {
145 Hashtable members = new Hashtable();
146 members.put("PENDING", PENDING);
147 members.put("INITIALIZING", INITIALIZING);
148 members.put("RUNNING", RUNNING);
149 members.put("COMPLETED", COMPLETED);
150 members.put("ERROR", ERROR);
151 members.put("UNKNOWN", UNKNOWN);
152 return members;
153 }
154
155 /***
156 * Method toStringReturns the String representation of this
157 * ExecutionPhase
158 */
159 public java.lang.String toString()
160 {
161 return this.stringValue;
162 }
163
164 /***
165 * Method valueOfReturns a new ExecutionPhase based on the
166 * given String value.
167 *
168 * @param string
169 */
170 public static org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase valueOf(java.lang.String string)
171 {
172 java.lang.Object obj = null;
173 if (string != null) obj = _memberTable.get(string);
174 if (obj == null) {
175 String err = "'" + string + "' is not a valid ExecutionPhase";
176 throw new IllegalArgumentException(err);
177 }
178 return (ExecutionPhase) obj;
179 }
180
181 }