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
|
package server;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImageBaseWrite;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.ImageVersionWrite;
import org.openslx.bwlp.thrift.iface.LecturePermissions;
import org.openslx.bwlp.thrift.iface.LectureRead;
import org.openslx.bwlp.thrift.iface.LectureSummary;
import org.openslx.bwlp.thrift.iface.LectureWrite;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.Organization;
import org.openslx.bwlp.thrift.iface.SatelliteServer;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
import org.openslx.bwlp.thrift.iface.TInvalidTokenException;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.TTransferRejectedException;
import org.openslx.bwlp.thrift.iface.TransferInformation;
import org.openslx.bwlp.thrift.iface.UploadStatus;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.bwlp.thrift.iface.Virtualizer;
import org.openslx.sat.thrift.version.Version;
import sql.models.DbImage;
import thrift.OperatingSystemList;
import fileserv.ActiveUpload;
import fileserv.FileServer;
public class ServerHandler implements SatelliteServer.Iface {
private static final Logger log = Logger.getLogger(ServerHandler.class);
private static final FileServer fileServer = FileServer.instance();
@Override
public long getVersion() throws TException {
return Version.VERSION;
}
@Override
public TransferInformation requestImageVersionUpload(String userToken, String imageBaseId, long fileSize,
List<ByteBuffer> blockHashes) throws TTransferRejectedException, TAuthorizationException,
TException {
// TODO Auto-generated method stub
return null;
}
@Override
public void cancelUpload(String uploadToken) throws TException {
ActiveUpload upload = fileServer.getUploadByToken(uploadToken);
if (upload != null)
upload.cancel();
}
@Override
public UploadStatus queryUploadStatus(String uploadToken) throws TInvalidTokenException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public TransferInformation requestDownload(String userToken, String imageVersionId)
throws TAuthorizationException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public void cancelDownload(String downloadToken) throws TException {
// TODO Auto-generated method stub
}
@Override
public boolean isAuthenticated(String userToken) throws TException {
return SessionManager.get(userToken) != null;
}
@Override
public void invalidateSession(String userToken) throws TException {
SessionManager.remove(userToken);
}
@Override
public List<OperatingSystem> getOperatingSystems() throws TException {
return OperatingSystemList.get();
}
@Override
public List<Virtualizer> getVirtualizers() throws TException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Organization> getAllOrganizations() throws TException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ImageSummaryRead> getImageList(String userToken, List<String> tagSearch)
throws TAuthorizationException, TException {
UserInfo user = SessionManager.getOrFail(userToken);
return DbImage.getAllVisible(user, tagSearch);
}
@Override
public ImageDetailsRead getImageDetails(String userToken, String imageBaseId)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean updateImageBase(String userToken, String imageBaseId, ImageBaseWrite image)
throws TAuthorizationException, TException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean updateImageVersion(String userToken, String imageVersionId, ImageVersionWrite image)
throws TAuthorizationException, TException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean deleteImageVersion(String userToken, String imageVersionId)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean writeImagePermissions(String userToken, String imageId,
Map<String, ImagePermissions> permissions) throws TAuthorizationException, TNotFoundException,
TException {
// TODO Auto-generated method stub
return false;
}
@Override
public Map<String, ImagePermissions> getImagePermissions(String userToken, String imageBaseId)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public String createLecture(String userToken, LectureWrite lecture) throws TAuthorizationException,
TException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean updateLecture(String userToken, String lectureId, LectureWrite lecture)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return false;
}
@Override
public List<LectureSummary> getLectureList(String userToken) throws TAuthorizationException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public LectureRead getLectureDetails(String userToken, String lectureId) throws TAuthorizationException,
TNotFoundException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<LectureSummary> getLecturesByImageVersion(String userToken, String imageVersionId)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean deleteLecture(String userToken, String lectureId) throws TAuthorizationException,
TNotFoundException, TException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean writeLecturePermissions(String userToken, String lectureId,
Map<String, LecturePermissions> permissions) throws TAuthorizationException, TNotFoundException,
TException {
// TODO Auto-generated method stub
return false;
}
@Override
public Map<String, LecturePermissions> getLecturePermissions(String userToken, String lectureId)
throws TAuthorizationException, TNotFoundException, TException {
// TODO Auto-generated method stub
return null;
}
}// end class
|