81 |
81 |
|
82 |
82 |
import edu.ucsb.nceas.metacat.dataone.v1.CNodeService;
|
83 |
83 |
import edu.ucsb.nceas.metacat.properties.PropertyService;
|
|
84 |
import edu.ucsb.nceas.metacat.restservice.D1HttpRequest;
|
84 |
85 |
import edu.ucsb.nceas.metacat.restservice.D1ResourceHandler;
|
85 |
86 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
86 |
87 |
|
... | ... | |
169 |
170 |
logMetacat.debug("Setting access policy");
|
170 |
171 |
// after the command
|
171 |
172 |
extra = parseTrailing(resource, RESOURCE_ACCESS_RULES);
|
|
173 |
extra = decode(extra);
|
172 |
174 |
setAccess(extra);
|
173 |
175 |
status = true;
|
174 |
176 |
logMetacat.debug("done setting access");
|
... | ... | |
178 |
180 |
|
179 |
181 |
// after the command
|
180 |
182 |
extra = parseTrailing(resource, RESOURCE_META);
|
181 |
|
|
|
183 |
extra = decode(extra);
|
182 |
184 |
// get
|
183 |
185 |
if (httpVerb == GET) {
|
184 |
186 |
getSystemMetadataObject(extra);
|
... | ... | |
200 |
202 |
|
201 |
203 |
// after the command
|
202 |
204 |
extra = parseTrailing(resource, RESOURCE_RESOLVE);
|
203 |
|
|
|
205 |
extra = decode(extra);
|
204 |
206 |
// resolve the object location
|
205 |
207 |
if (httpVerb == GET) {
|
206 |
208 |
resolve(extra);
|
... | ... | |
210 |
212 |
|
211 |
213 |
// after the command
|
212 |
214 |
extra = parseTrailing(resource, RESOURCE_OWNER);
|
213 |
|
|
|
215 |
extra = decode(extra);
|
214 |
216 |
// set the owner
|
215 |
217 |
if (httpVerb == PUT) {
|
216 |
218 |
owner(extra);
|
... | ... | |
220 |
222 |
|
221 |
223 |
// after the command
|
222 |
224 |
extra = parseTrailing(resource, RESOURCE_IS_AUTHORIZED);
|
223 |
|
|
|
225 |
extra = decode(extra);
|
224 |
226 |
// authorized?
|
225 |
227 |
if (httpVerb == GET) {
|
226 |
228 |
isAuthorized(extra);
|
... | ... | |
233 |
235 |
|
234 |
236 |
// after the command
|
235 |
237 |
extra = parseTrailing(resource, RESOURCE_OBJECTS);
|
236 |
|
|
|
238 |
extra = decode(extra);
|
237 |
239 |
logMetacat.debug("objectId: " + extra);
|
238 |
240 |
logMetacat.debug("verb:" + httpVerb);
|
239 |
241 |
|
... | ... | |
260 |
262 |
|
261 |
263 |
// after the command
|
262 |
264 |
extra = parseTrailing(resource, RESOURCE_FORMATS);
|
263 |
|
|
|
265 |
extra = decode(extra);
|
264 |
266 |
// handle each verb
|
265 |
267 |
if (httpVerb == GET) {
|
266 |
268 |
if (extra == null) {
|
... | ... | |
286 |
288 |
// handle archive events
|
287 |
289 |
if (httpVerb == PUT) {
|
288 |
290 |
extra = parseTrailing(resource, Constants.RESOURCE_ARCHIVE);
|
|
291 |
extra = decode(extra);
|
289 |
292 |
archive(extra);
|
290 |
293 |
status = true;
|
291 |
294 |
}
|
... | ... | |
294 |
297 |
|
295 |
298 |
// after the command
|
296 |
299 |
extra = parseTrailing(resource, Constants.RESOURCE_CHECKSUM);
|
297 |
|
|
|
300 |
extra = decode(extra);
|
298 |
301 |
// handle checksum requests
|
299 |
302 |
if (httpVerb == GET) {
|
300 |
303 |
|
... | ... | |
315 |
318 |
+ RESOURCE_REPLICATION_POLICY);
|
316 |
319 |
// get the trailing pid
|
317 |
320 |
extra = parseTrailing(resource, RESOURCE_REPLICATION_POLICY);
|
|
321 |
extra = decode(extra);
|
318 |
322 |
setReplicationPolicy(extra);
|
319 |
323 |
status = true;
|
320 |
324 |
|
... | ... | |
325 |
329 |
+ RESOURCE_REPLICATION_META);
|
326 |
330 |
// get the trailing pid
|
327 |
331 |
extra = parseTrailing(resource, RESOURCE_REPLICATION_META);
|
|
332 |
extra = decode(extra);
|
328 |
333 |
updateReplicationMetadata(extra);
|
329 |
334 |
status = true;
|
330 |
335 |
|
... | ... | |
335 |
340 |
+ RESOURCE_REPLICATION_NOTIFY);
|
336 |
341 |
// get the trailing pid
|
337 |
342 |
extra = parseTrailing(resource, RESOURCE_REPLICATION_NOTIFY);
|
|
343 |
extra = decode(extra);
|
338 |
344 |
setReplicationStatus(extra);
|
339 |
345 |
status = true;
|
340 |
346 |
|
... | ... | |
346 |
352 |
// get the trailing pid
|
347 |
353 |
extra = parseTrailing(resource,
|
348 |
354 |
RESOURCE_REPLICATION_AUTHORIZED);
|
|
355 |
extra = decode(extra);
|
349 |
356 |
isNodeAuthorized(extra);
|
350 |
357 |
status = true;
|
351 |
358 |
|
... | ... | |
353 |
360 |
if (httpVerb == GET) {
|
354 |
361 |
// after the command
|
355 |
362 |
extra = parseTrailing(resource, Constants.RESOURCE_MONITOR_PING);
|
356 |
|
|
|
363 |
extra = decode(extra);
|
357 |
364 |
logMetacat.debug("processing ping request");
|
358 |
365 |
Date result = CNodeService.getInstance(request).ping();
|
359 |
366 |
// TODO: send to output
|
... | ... | |
366 |
373 |
+ Constants.RESOURCE_META_OBSOLETEDBY);
|
367 |
374 |
// get the trailing pid
|
368 |
375 |
extra = parseTrailing(resource, Constants.RESOURCE_META_OBSOLETEDBY);
|
|
376 |
extra = decode(extra);
|
369 |
377 |
setObsoletedBy(extra);
|
370 |
378 |
status = true;
|
371 |
379 |
} else if (resource.startsWith(Constants.RESOURCE_REPLICATION_DELETE_REPLICA)
|
... | ... | |
375 |
383 |
+ Constants.RESOURCE_REPLICATION_DELETE_REPLICA);
|
376 |
384 |
// get the trailing pid
|
377 |
385 |
extra = parseTrailing(resource, Constants.RESOURCE_REPLICATION_DELETE_REPLICA);
|
|
386 |
extra = decode(extra);
|
378 |
387 |
deleteReplica(extra);
|
379 |
388 |
status = true;
|
380 |
389 |
}
|
Decode the string of the uri after we break the uri into parts base on the "/".