This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
IdempotentInstanceResource.java
327 lines (259 loc) · 9.38 KB
/
IdempotentInstanceResource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*
* Copyright 1999-2010 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.globus.workspace.creation.defaults;
import org.globus.workspace.service.InstanceResource;
import org.globus.workspace.service.binding.vm.FileCopyNeed;
import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.nimbustools.api.repr.ShutdownTasks;
import org.nimbustools.api.services.rm.DestructionCallback;
import org.nimbustools.api.services.rm.StateChangeCallback;
import java.util.Calendar;
/**
* This class is used for returns from repeated idempotent create requests with
* instances that have already been terminated.
*/
public class IdempotentInstanceResource implements InstanceResource {
private static final String UNSUPPORTED_MSG = "this InstanceResource object " +
"is only for CreationManager returns, not mutative operations";
protected int id;
protected String name;
protected String ensembleId;
protected String groupId;
protected int groupSize;
protected int launchIndex;
protected String creatorId;
protected VirtualMachine vm;
protected int state;
protected String clientToken;
public IdempotentInstanceResource(int id,
String name,
String ensembleId,
String groupId,
int groupSize,
int launchIndex,
String creatorId,
VirtualMachine vm,
int state,
String clientToken) {
this.id = id;
this.name = name;
this.ensembleId = ensembleId;
this.groupId = groupId;
this.groupSize = groupSize;
this.launchIndex = launchIndex;
this.creatorId = creatorId;
this.vm = vm;
this.state = state;
this.clientToken = clientToken;
}
public int getID() {
return id;
}
public void setID(int id) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public String getName() {
return name;
}
public void setName(String name) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public String getEnsembleId() {
return ensembleId;
}
public void setEnsembleId(String name) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String name) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public int getGroupSize() {
return groupSize;
}
public void setGroupSize(int groupsize) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean isLastInGroup() {
return launchIndex == groupSize-1;
}
public void setLastInGroup(boolean lastInGroup) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean isPartOfGroupRequest() {
return groupId != null;
}
public void setPartOfGroupRequest(boolean isInGroupRequest) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public int getLaunchIndex() {
return launchIndex;
}
public void setLaunchIndex(int launchIndex) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public VirtualMachine getVM() {
return vm;
}
public String getCreatorID() {
return creatorId;
}
public void setCreatorID(String ID) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public String getClientToken() {
return clientToken;
}
public void setClientToken(String clientToken) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public Calendar getStartTime() {
// we don't know the actual time, so we just return the unix epoch.
// weak, I know.
Calendar epoch = Calendar.getInstance();
epoch.setTimeInMillis(0);
return epoch;
}
public Calendar getTerminationTime() {
// we don't know the actual time, so we just return the unix epoch.
// weak, I know.
Calendar epoch = Calendar.getInstance();
epoch.setTimeInMillis(1);
return epoch;
}
public void setTerminationTime(Calendar termTime) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setStartTime(Calendar startTime) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void activate() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void activateOverride(int targetState) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void start() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void shutdown(ShutdownTasks tasks) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void shutdownSave(ShutdownTasks tasks) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void pause(ShutdownTasks tasks) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void serialize(ShutdownTasks tasks) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void reboot(ShutdownTasks tasks) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void newStartTime(Calendar startTime) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void newStopTime(Calendar stopTime) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void newNetwork(String network) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void newFileCopyNeed(FileCopyNeed need) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean remove() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setState(int state, Throwable throwable) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public int getState() {
return state;
}
public Throwable getStateThrowable() {
return null;
}
public void setTargetState(int state) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setTargetStateUnderLockEvaluate(int state) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public int getTargetState() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean isOpsEnabled() {
return false;
}
public void setOpsEnabled(boolean opsEnabled) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean isPropagateRequired() {
return false;
}
public boolean isUnPropagateRequired() {
return false;
}
public boolean isPropagateStartOK() {
return false;
}
public boolean isVMMaccessOK() {
return false;
}
public void setVMMaccessOK(boolean vmmAccessOK) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void newHostname(String hostname) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void registerStateChangeListener(StateChangeCallback listener) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void registerDestructionListener(DestructionCallback listener) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void populate(int id, VirtualMachine binding, Calendar startTime, Calendar termTime, String node, double chargeRatio) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void load(String key) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setInitialOpsEnabled(boolean opsEnabled) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setInitialState(int state, Throwable throwable) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setInitialTargetState(int state) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setInitialVMMaccessOK(boolean trashOK) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public void setChargeRatio(double chargeRatio) {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public double getChargeRatio() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
public boolean isZombie() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
}