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
/
AsyncRequestMapPersistenceUtil.java
601 lines (495 loc) · 22.8 KB
/
AsyncRequestMapPersistenceUtil.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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
/*
* Copyright 1999-2008 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.persistence.impls;
import org.globus.workspace.async.AsyncRequest;
import org.globus.workspace.async.AsyncRequestStatus;
import org.globus.workspace.network.Association;
import org.globus.workspace.network.AssociationEntry;
import org.globus.workspace.persistence.DataConvert;
import org.globus.workspace.persistence.PersistenceAdapterConstants;
import org.globus.workspace.persistence.WorkspaceDatabaseException;
import org.globus.workspace.service.binding.vm.FileCopyNeed;
import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.globus.workspace.service.binding.vm.VirtualMachineDeployment;
import org.globus.workspace.service.binding.vm.VirtualMachinePartition;
import org.nimbustools.api._repr._Caller;
import org.nimbustools.api.repr.AsyncCreateRequest;
import org.nimbustools.api.repr.Caller;
import org.nimbustools.api.repr.CannotTranslateException;
import org.nimbustools.api.repr.ReprFactory;
import org.nimbustools.api.repr.ctx.Context;
import org.nimbustools.api.repr.vm.NIC;
import org.nimbustools.api.services.rm.ManageException;
import org.springframework.scheduling.annotation.Async;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ConcurrentNavigableMap;
public class AsyncRequestMapPersistenceUtil
implements PersistenceAdapterConstants {
public static PreparedStatement getInsertAsyncRequest(AsyncRequest asyncRequest, ReprFactory repr, Connection c)
throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUEST);
pstmt.setString(1, asyncRequest.getId());
pstmt.setDouble(2, asyncRequest.getMaxBid());
if (asyncRequest.isSpotRequest()) {
pstmt.setInt(3, 1);
}
else {
pstmt.setInt(3, 0);
}
pstmt.setString(4, asyncRequest.getGroupID());
if (asyncRequest.isPersistent()) {
pstmt.setInt(5, 1);
}
else {
pstmt.setInt(5, 0);
}
pstmt.setString(6, asyncRequest.getCaller().getIdentity());
if (asyncRequest.getCaller().isSuperUser()) {
pstmt.setInt(7, 1);
}
else {
pstmt.setInt(7, 0);
}
pstmt.setString(8, asyncRequest.getSshKeyName());
if (asyncRequest.getCreationTime() != null) {
pstmt.setLong(9, asyncRequest.getCreationTime().getTimeInMillis());
}
else {
pstmt.setInt(9, 0);
}
DataConvert dataConvert = new DataConvert(repr);
String nics = dataConvert.nicsAsString(asyncRequest.getRequestedNics());
pstmt.setString(10, nics);
pstmt.setString(11, asyncRequest.getStatus().toString());
return pstmt;
}
public static void putAllocatedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
for (int vmid : asyncRequest.getAllocatedVMs()) {
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_ALLOCATED_VMS);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, vmid);
pstmt.executeUpdate();
pstmt.close();
}
}
public static void putFinishedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
for (int vmid : asyncRequest.getFinishedVMs()) {
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_FINISHED_VMS);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, vmid);
pstmt.executeUpdate();
pstmt.close();
}
}
public static void putToBePreempted(AsyncRequest asyncRequest, Connection c) throws SQLException {
for (int vmid : asyncRequest.getToBePreempted()) {
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_TO_BE_PREEMPTED);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, vmid);
pstmt.executeUpdate();
pstmt.close();
}
}
public static void removeAllocatedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_ALLOCATED_VMS);
pstmt.setString(1, asyncRequest.getId());
pstmt.executeUpdate();
pstmt.close();
}
public static void removeFinishedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_FINISHED_VMS);
pstmt.setString(1, asyncRequest.getId());
pstmt.executeUpdate();
pstmt.close();
}
public static void removeToBePreempted(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_TO_BE_PREEMPTED);
pstmt.setString(1, asyncRequest.getId());
pstmt.executeUpdate();
pstmt.close();
}
public static void addAllocatedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_ALLOCATED_VMS);
pstmt.setString(1, asyncRequest.getId());
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
return;
}
do {
asyncRequest.addAllocatedVM(rs.getInt(1));
} while (rs.next());
pstmt.close();
}
public static void addFinishedVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_FINISHED_VMS);
pstmt.setString(1, asyncRequest.getId());
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
return;
}
do {
asyncRequest.addFinishedVM(rs.getInt(1));
} while (rs.next());
pstmt.close();
}
public static void addToBePreempted(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_TO_BE_PREEMPTED);
pstmt.setString(1, asyncRequest.getId());
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
return;
}
do {
asyncRequest.addToBePreempted(rs.getInt(1));
} while (rs.next());
pstmt.close();
}
public static PreparedStatement getUpdateAsyncRequest(AsyncRequest asyncRequest, ReprFactory repr, Connection c)
throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_UPDATE_ASYNC_REQUEST);
pstmt.setString(1, asyncRequest.getId());
pstmt.setDouble(2, asyncRequest.getMaxBid());
if (asyncRequest.isSpotRequest()) {
pstmt.setInt(3, 1);
}
else {
pstmt.setInt(3, 0);
}
pstmt.setString(4, asyncRequest.getGroupID());
if (asyncRequest.isPersistent()) {
pstmt.setInt(5, 1);
}
else {
pstmt.setInt(5, 0);
}
pstmt.setString(6, asyncRequest.getCaller().getIdentity());
if (asyncRequest.getCaller().isSuperUser()) {
pstmt.setInt(7, 1);
}
else {
pstmt.setInt(7, 0);
}
pstmt.setString(8, asyncRequest.getSshKeyName());
if (asyncRequest.getCreationTime() != null) {
pstmt.setLong(9, asyncRequest.getCreationTime().getTimeInMillis());
}
else {
pstmt.setInt(9,0);
}
DataConvert dataConvert = new DataConvert(repr);
String nics = dataConvert.nicsAsString(asyncRequest.getRequestedNics());
pstmt.setString(10, nics);
pstmt.setString(11, asyncRequest.getStatus().toString());
pstmt.setString(12, asyncRequest.getId());
return pstmt;
}
public static PreparedStatement getAsyncRequest(String id, Connection c)
throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUEST);
pstmt.setString(1, id);
return pstmt;
}
public static PreparedStatement getAllAsyncRequests(Connection c)
throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ALL_ASYNC_REQUESTS);
return pstmt;
}
public static PreparedStatement getDeleteAsyncRequestVMs(AsyncRequest asyncRequest, Connection c)
throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_VMS);
pstmt.setString(1, asyncRequest.getId());
return pstmt;
}
public static AsyncRequest rsToAsyncRequest(ResultSet rs, ReprFactory repr, Connection c)
throws SQLException, CannotTranslateException {
final String id = rs.getString("id");
final Double maxBid = rs.getDouble("max_bid");
final boolean isSpotInstance = rs.getBoolean("spot");
final String groupID = rs.getString("group_id");
final boolean isPersistent = rs.getBoolean("persistent");
final String creatorDN = rs.getString("creator_dn");
final boolean isSuperuser = rs.getBoolean("creator_is_superuser");
_Caller caller = repr._newCaller();
caller.setIdentity(creatorDN);
caller.setSuperUser(isSuperuser);
// NOTE: this context isn't persisted because it doesn't seem to be used
final Context context = repr._newContext();
final long t = rs.getLong("creation_time");
final String sshKeyName = rs.getString("ssh_key_name");
final Calendar creationTime = Calendar.getInstance();
creationTime.setTimeInMillis(t);
final String nicsAsString = rs.getString("nics");
DataConvert dataConvert = new DataConvert(repr);
NIC[] nics = null;
nics = dataConvert.getNICs(nicsAsString);
AsyncRequestStatus status = AsyncRequestStatus.valueOf(rs.getString("status"));
//public AsyncRequest(String id, boolean spotinstances, Double spotPrice, boolean persistent, Caller caller, String groupID, VirtualMachine[] bindings, Context context, NIC[] requestedNics, String sshKeyName, Calendar creationTime) {
//AsyncRequest testRequest = new AsyncRequest(testID, testSpotinstances, testMaxBid, false, null, testGroupID, null, null, null, null, null);
AsyncRequest asyncRequest = new AsyncRequest(id, isSpotInstance, maxBid, isPersistent, caller, groupID, null, context, nics, sshKeyName, creationTime);
asyncRequest.setStatus(status);
return asyncRequest;
}
public static VirtualMachine[] getAsyncVMs(String asyncID, Connection c) throws SQLException, WorkspaceDatabaseException{
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_VMS);
pstmt.setString(1, asyncID);
ResultSet rs = pstmt.executeQuery();
ArrayList<VirtualMachine> vms = new ArrayList<VirtualMachine>();
if (rs == null || !rs.next()) {
return vms.toArray(new VirtualMachine[vms.size()]);
}
do {
VirtualMachine newVM = new VirtualMachine();
newVM.setID(rs.getInt("id"));
newVM.setName(rs.getString("name"));
newVM.setNode(rs.getString("node"));
newVM.setPropagateRequired(rs.getBoolean("prop_required"));
newVM.setUnPropagateRequired(rs.getBoolean("unprop_required"));
newVM.setNetwork(rs.getString("network"));
newVM.setKernel(rs.getString("kernel_parameters"));
newVM.setVmm(rs.getString("vmm"));
newVM.setVmmVersion(rs.getString("vmm_version"));
newVM.setAssociationsNeeded(rs.getString("assocs_needed"));
newVM.setMdUserData(rs.getString("md_user_data"));
newVM.setPreemptable(rs.getBoolean("preemptable"));
newVM.setCredentialName(rs.getString("credential_name"));
int binding_index = rs.getInt("binding_index");
addDeployment(newVM, asyncID, binding_index, c);
addPartitions(newVM, asyncID, binding_index, c);
addFileCopies(newVM, asyncID, binding_index, c);
vms.add(newVM);
} while (rs.next());
rs.close();
pstmt.close();
VirtualMachine[] final_vms = vms.toArray(new VirtualMachine[vms.size()]);
return final_vms;
}
public static void addDeployment(VirtualMachine vm, String asyncID, int binding_index, Connection c) throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_VM_DEPLOYMENT);
pstmt.setString(1, asyncID);
pstmt.setInt(2, binding_index);
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
//No deployment for this VM
return;
}
final VirtualMachineDeployment dep = new VirtualMachineDeployment();
dep.setRequestedState(rs.getInt("requested_state"));
dep.setRequestedShutdown(rs.getInt("requested_shutdown"));
dep.setMinDuration(rs.getInt("min_duration"));
dep.setIndividualPhysicalMemory(rs.getInt("ind_physmem"));
dep.setIndividualCPUCount(rs.getInt("ind_physcpu"));
vm.setDeployment(dep);
}
public static void addPartitions(VirtualMachine vm, String asyncID, int binding_index, Connection c) throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_VM_PARTITIONS);
pstmt.setString(1, asyncID);
pstmt.setInt(2, binding_index);
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
//No partitions for this VM
return;
}
final ArrayList<VirtualMachinePartition> partitions = new ArrayList<VirtualMachinePartition>(8);
do {
final VirtualMachinePartition partition =
new VirtualMachinePartition();
partition.setImage(rs.getString("image"));
partition.setImagemount(rs.getString("imagemount"));
partition.setReadwrite(rs.getBoolean("readwrite"));
partition.setRootdisk(rs.getBoolean("rootdisk"));
partition.setBlankspace(rs.getInt("blankspace"));
partition.setPropRequired(rs.getBoolean("prop_required"));
partition.setUnPropRequired(rs.getBoolean("unprop_required"));
partition.setAlternateUnpropTarget(rs.getString("alternate_unprop"));
partitions.add(partition);
} while (rs.next());
VirtualMachinePartition[] final_partitions = partitions.toArray(new VirtualMachinePartition[partitions.size()]);
vm.setPartitions(final_partitions);
}
public static void addFileCopies(VirtualMachine vm, String asyncID, int binding_index, Connection c) throws SQLException, WorkspaceDatabaseException {
final PreparedStatement pstmt = c.prepareStatement(SQL_LOAD_ASYNC_REQUESTS_VM_FILE_COPY);
pstmt.setString(1, asyncID);
pstmt.setInt(2, binding_index);
ResultSet rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
//No file copies for this VM
return;
}
do {
String sourcePath = rs.getString("sourcepath");
String destPath = rs.getString("destpath");
boolean onImage = rs.getBoolean("on_image");
try {
FileCopyNeed need = new FileCopyNeed(sourcePath, destPath, onImage);
vm.addFileCopyNeed(need);
} catch(Exception e) {
throw new WorkspaceDatabaseException("", e);
}
} while(rs.next());
}
public static void putAsyncRequestBindings(AsyncRequest asyncRequest, Connection c) throws SQLException {
VirtualMachine[] bindings = asyncRequest.getBindings();
for (int i=0; i<bindings.length; i++) {
VirtualMachine binding = bindings[i];
final PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VMS);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, i);
pstmt.setInt(3, binding.getID());
pstmt.setString(4, binding.getName());
pstmt.setString(5, binding.getNode());
boolean propRequired = binding.isPropagateRequired();
if (propRequired) {
pstmt.setInt(6, 1);
}
else {
pstmt.setInt(6, 0);
}
boolean unpropRequired = binding.isUnPropagateRequired();
if (unpropRequired) {
pstmt.setInt(7, 1);
}
else {
pstmt.setInt(7, 0);
}
pstmt.setString(8, binding.getNetwork());
pstmt.setString(9, binding.getKernelParameters());
pstmt.setString(10, binding.getVmm());
pstmt.setString(11, binding.getVmmVersion());
pstmt.setString(12, binding.getAssociationsNeeded());
pstmt.setString(13, binding.getMdUserData());
boolean preemptable = binding.isPreemptable();
if (preemptable) {
pstmt.setInt(14, 1);
}
else {
pstmt.setInt(14, 0);
}
pstmt.setString(15, binding.getCredentialName());
pstmt.executeUpdate();
pstmt.close();
putAsyncRequestVMDeployment(asyncRequest, i, c);
putAsyncRequestVMPartitions(asyncRequest, i, c);
putAsyncRequestVMFileCopies(asyncRequest, i, c);
}
}
public static void putAsyncRequestVMDeployment(AsyncRequest asyncRequest, int binding_index, Connection c) throws SQLException {
VirtualMachine binding = asyncRequest.getBindings()[binding_index];
VirtualMachineDeployment dep = binding.getDeployment();
if (dep == null) {
return;
}
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VM_DEPLOYMENT);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, binding_index);
pstmt.setInt(3, binding.getID());
pstmt.setInt(4, dep.getRequestedState());
pstmt.setInt(5, dep.getRequestedShutdown());
pstmt.setInt(6, dep.getMinDuration());
pstmt.setInt(7, dep.getIndividualPhysicalMemory());
pstmt.setInt(8, dep.getIndividualCPUCount());
pstmt.executeUpdate();
pstmt.close();
}
public static void putAsyncRequestVMPartitions(AsyncRequest asyncRequest, int binding_index, Connection c) throws SQLException {
VirtualMachine binding = asyncRequest.getBindings()[binding_index];
VirtualMachinePartition[] partitions = binding.getPartitions();
if (partitions == null) {
return;
}
for (VirtualMachinePartition partition : binding.getPartitions()) {
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VM_PARTITIONS);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, binding_index);
pstmt.setInt(3, binding.getID());
pstmt.setString(4, partition.getImage());
pstmt.setString(5, partition.getImagemount());
boolean isReadWrite = partition.isReadwrite();
if (isReadWrite) {
pstmt.setInt(6, 1);
}
else {
pstmt.setInt(6, 0);
}
boolean isRootDisk = partition.isRootdisk();
if (isRootDisk) {
pstmt.setInt(7, 1);
}
else {
pstmt.setInt(7, 0);
}
pstmt.setInt(8, partition.getBlankspace());
boolean isPropRequired = partition.isPropRequired();
if (isPropRequired) {
pstmt.setInt(9, 1);
}
else {
pstmt.setInt(9, 0);
}
boolean isUnPropRequired = partition.isUnPropRequired();
if (isUnPropRequired) {
pstmt.setInt(10, 1);
}
else {
pstmt.setInt(10, 0);
}
pstmt.setString(11, partition.getAlternateUnpropTarget());
pstmt.executeUpdate();
pstmt.close();
}
}
public static void putAsyncRequestVMFileCopies(AsyncRequest asyncRequest, int binding_index, Connection c) throws SQLException {
VirtualMachine binding = asyncRequest.getBindings()[binding_index];
for (FileCopyNeed copy : binding.getFileCopyNeeds()) {
PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VM_FILE_COPY);
pstmt.setString(1, asyncRequest.getId());
pstmt.setInt(2, binding_index);
pstmt.setInt(3, binding.getID());
pstmt.setString(4, copy.sourcePath);
pstmt.setString(5, copy.destPath);
boolean onImage = copy.onImage();
if (onImage) {
pstmt.setInt(6, 1);
}
else {
pstmt.setInt(6, 0);
}
pstmt.executeUpdate();
pstmt.close();
}
}
public static PreparedStatement getInsertAsyncRequestVM(String id, int vmid, Connection c) throws SQLException {
final PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VMS);
pstmt.setString(1, id);
pstmt.setInt(2, vmid);
return pstmt;
}
public static PreparedStatement[] getRemoveAsyncVMs(AsyncRequest asyncRequest, Connection c) throws SQLException {
PreparedStatement[] pstmts = new PreparedStatement[4];
pstmts[0] = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_VMS);
pstmts[0].setString(1, asyncRequest.getId());
pstmts[1] = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_VM_DEPLOYMENT);
pstmts[1].setString(1, asyncRequest.getId());
pstmts[2] = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_VM_PARTITIONS);
pstmts[2].setString(1, asyncRequest.getId());
pstmts[3] = c.prepareStatement(SQL_DELETE_ASYNC_REQUESTS_VM_FILE_COPY);
pstmts[3].setString(1, asyncRequest.getId());
return pstmts;
}
}