This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
/
PersistenceAdapter.java
208 lines (123 loc) · 5.99 KB
/
PersistenceAdapter.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
/*
* 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;
import java.util.Calendar;
import java.util.Hashtable;
import java.util.List;
import org.globus.workspace.network.AssociationEntry;
import org.globus.workspace.scheduler.defaults.ResourcepoolEntry;
import org.globus.workspace.service.CoschedResource;
import org.globus.workspace.service.GroupResource;
import org.globus.workspace.service.InstanceResource;
import org.globus.workspace.service.binding.vm.FileCopyNeed;
import org.nimbustools.api.services.rm.DoesNotExistException;
/**
* TODO: each module implementation needs to encapsulate its own persistence,
* the persistence package will go away entirely
*/
public interface PersistenceAdapter {
public void setState(int id, int state, Throwable t)
throws WorkspaceDatabaseException;
public void setTargetState(int id, int targetState)
throws WorkspaceDatabaseException;
public void setOpsEnabled(int id, boolean enabled)
throws WorkspaceDatabaseException;
public void setNetwork(int id, String network)
throws WorkspaceDatabaseException;
public void setVMMaccessOK(int resourceID, boolean vmmAccessOK)
throws WorkspaceDatabaseException;
public void setHostname(int id, String hostname)
throws WorkspaceDatabaseException;
public void setRootUnpropTarget(int id, String path)
throws WorkspaceDatabaseException;
public void setFileCopyOnImage(int id, FileCopyNeed need)
throws WorkspaceDatabaseException;
public void setStartTime(int id, Calendar startTime)
throws WorkspaceDatabaseException;
public void setTerminationTime(int id, Calendar termTime)
throws WorkspaceDatabaseException;
public void remove(int id, InstanceResource resource)
throws WorkspaceDatabaseException;
public void removeGroup(String id)
throws WorkspaceDatabaseException;
public void removeEnsemble(String id)
throws WorkspaceDatabaseException;
public int[] findActiveWorkspacesIDs()
throws WorkspaceDatabaseException;
public boolean isActiveWorkspaceID(int id)
throws WorkspaceDatabaseException;
public int[] findVMsInGroup(String groupID)
throws WorkspaceDatabaseException;
public int[] findVMsInEnsemble(String ensembleID)
throws WorkspaceDatabaseException;
public int[] findVMsByOwner(String ownerID)
throws WorkspaceDatabaseException;
public void add(InstanceResource resource)
throws WorkspaceDatabaseException;
public void addGroup(GroupResource resource)
throws WorkspaceDatabaseException;
public void addEnsemble(CoschedResource resource)
throws WorkspaceDatabaseException;
public void load(int id, InstanceResource resource)
throws DoesNotExistException,
WorkspaceDatabaseException;
public void loadGroup(String id, GroupResource resource)
throws DoesNotExistException,
WorkspaceDatabaseException;
public void loadEnsemble(String id, CoschedResource resource)
throws DoesNotExistException,
WorkspaceDatabaseException;
public void replaceAssocations(Hashtable associations)
throws WorkspaceDatabaseException;
public void replaceAssociationEntry(String name,
AssociationEntry entry)
throws WorkspaceDatabaseException;
public Hashtable currentAssociations()
throws WorkspaceDatabaseException;
public Hashtable currentAssociations(boolean cachedIsFine)
throws WorkspaceDatabaseException;
public void updateResourcepoolEntryAvailableMemory(String hostname, int newAvailMemory)
throws WorkspaceDatabaseException;
public int memoryUsedOnPoolnode(String poolnode)
throws WorkspaceDatabaseException;
public List<ResourcepoolEntry> currentResourcepoolEntries() throws WorkspaceDatabaseException;
public ResourcepoolEntry getResourcepoolEntry(String hostname)
throws WorkspaceDatabaseException;
public void addResourcepoolEntry(ResourcepoolEntry entry)
throws WorkspaceDatabaseException;
public boolean removeResourcepoolEntry(String hostname)
throws WorkspaceDatabaseException;
public void addCustomizationNeed(int id, FileCopyNeed need)
throws WorkspaceDatabaseException;
public int readPropagationCounter()
throws WorkspaceDatabaseException;
public long currentCursorPosition()
throws WorkspaceDatabaseException;
public void updatePropagationCounter(int n)
throws WorkspaceDatabaseException;
public void updateCursorPosition(long currentPosition)
throws WorkspaceDatabaseException;
//SQL processing
public List<ResourcepoolEntry> getAvailableEntriesSortedByFreeMemoryPercentage(int requestedMem)
throws WorkspaceDatabaseException;
boolean updateResourcepoolEntry(String hostname,
String pool,
String networks,
Integer memoryMax,
Integer memoryAvail,
Boolean active)
throws WorkspaceDatabaseException;
}