Revision 6177
Added by Chris Jones over 13 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Copyright: 2000-2011 Regents of the University of California and the |
|
4 |
* National Center for Ecological Analysis and Synthesis |
|
5 |
* |
|
6 |
* '$Author: $' |
|
7 |
* '$Date: $' |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or modify |
|
10 |
* it under the terms of the GNU General Public License as published by |
|
11 |
* the Free Software Foundation; either version 2 of the License, or |
|
12 |
* (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
|
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
*/ |
|
23 |
|
|
24 |
package edu.ucsb.nceas.metacat.dataone; |
|
25 |
|
|
26 |
import java.io.InputStream; |
|
27 |
import java.util.Date; |
|
28 |
|
|
29 |
import org.dataone.service.cn.CNAuthorization; |
|
30 |
import org.dataone.service.cn.CNCore; |
|
31 |
import org.dataone.service.cn.CNIdentity; |
|
32 |
import org.dataone.service.cn.CNRead; |
|
33 |
import org.dataone.service.cn.CNRegister; |
|
34 |
import org.dataone.service.cn.CNReplication; |
|
35 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
|
36 |
import org.dataone.service.exceptions.InsufficientResources; |
|
37 |
import org.dataone.service.exceptions.InvalidCredentials; |
|
38 |
import org.dataone.service.exceptions.InvalidRequest; |
|
39 |
import org.dataone.service.exceptions.InvalidSystemMetadata; |
|
40 |
import org.dataone.service.exceptions.InvalidToken; |
|
41 |
import org.dataone.service.exceptions.NotAuthorized; |
|
42 |
import org.dataone.service.exceptions.NotFound; |
|
43 |
import org.dataone.service.exceptions.NotImplemented; |
|
44 |
import org.dataone.service.exceptions.ServiceFailure; |
|
45 |
import org.dataone.service.exceptions.UnsupportedType; |
|
46 |
import org.dataone.service.types.AccessPolicy; |
|
47 |
import org.dataone.service.types.Checksum; |
|
48 |
import org.dataone.service.types.Event; |
|
49 |
import org.dataone.service.types.Identifier; |
|
50 |
import org.dataone.service.types.Log; |
|
51 |
import org.dataone.service.types.Node; |
|
52 |
import org.dataone.service.types.NodeList; |
|
53 |
import org.dataone.service.types.NodeReference; |
|
54 |
import org.dataone.service.types.ObjectFormat; |
|
55 |
import org.dataone.service.types.ObjectFormatIdentifier; |
|
56 |
import org.dataone.service.types.ObjectFormatList; |
|
57 |
import org.dataone.service.types.ObjectList; |
|
58 |
import org.dataone.service.types.ObjectLocationList; |
|
59 |
import org.dataone.service.types.Person; |
|
60 |
import org.dataone.service.types.QueryType; |
|
61 |
import org.dataone.service.types.ReplicationPolicy; |
|
62 |
import org.dataone.service.types.ReplicationStatus; |
|
63 |
import org.dataone.service.types.Session; |
|
64 |
import org.dataone.service.types.Subject; |
|
65 |
import org.dataone.service.types.SubjectList; |
|
66 |
import org.dataone.service.types.SystemMetadata; |
|
67 |
|
|
68 |
/** |
|
69 |
* Represents Metacat's implementation of the DataONE Coordinating Node |
|
70 |
* service API. Methods override the various CN* interfaces, and methods common |
|
71 |
* to both Member Node and Coordinating Node interfaces are found in the |
|
72 |
* D1NodeService super class. |
|
73 |
* |
|
74 |
*/ |
|
75 |
public class CNodeService extends D1NodeService implements CNAuthorization, |
|
76 |
CNCore, CNIdentity, CNRead, CNRegister, CNReplication { |
|
77 |
|
|
78 |
|
|
79 |
/** |
|
80 |
* Constructor: create a CNodeService instance |
|
81 |
* TODO: should we make this a singleton class like CNCoreImpl? |
|
82 |
*/ |
|
83 |
public CNodeService() { |
|
84 |
super(); |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
/** |
|
90 |
* Set the replication policy for an object given the object identifier |
|
91 |
* |
|
92 |
* @param session - the Session object containing the credentials for the Subject |
|
93 |
* @param pid - the object identifier for the given object |
|
94 |
* @param policy - the replication policy to be applied |
|
95 |
* |
|
96 |
* @return true or false |
|
97 |
* |
|
98 |
* @throws NotImplemented |
|
99 |
* @throws NotAuthorized |
|
100 |
* @throws ServiceFailure |
|
101 |
* @throws InvalidRequest |
|
102 |
* |
|
103 |
*/ |
|
104 |
@Override |
|
105 |
public boolean setReplicationPolicy(Session session, Identifier pid, |
|
106 |
ReplicationPolicy policy) |
|
107 |
throws NotImplemented, NotAuthorized, ServiceFailure, InvalidRequest { |
|
108 |
|
|
109 |
return false; |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* Set the replication status for an object given the object identifier |
|
114 |
* |
|
115 |
* @param session - the Session object containing the credentials for the Subject |
|
116 |
* @param pid - the object identifier for the given object |
|
117 |
* @param status - the replication status to be applied |
|
118 |
* |
|
119 |
* @return true or false |
|
120 |
* |
|
121 |
* @throws NotImplemented |
|
122 |
* @throws NotAuthorized |
|
123 |
* @throws ServiceFailure |
|
124 |
* @throws InvalidRequest |
|
125 |
* @throws InvalidToken |
|
126 |
* @throws NotFound |
|
127 |
* |
|
128 |
*/ |
|
129 |
@Override |
|
130 |
public boolean setReplicationStatus(Session session, Identifier pid, |
|
131 |
ReplicationStatus status) |
|
132 |
throws ServiceFailure, NotImplemented, InvalidToken, NotAuthorized, |
|
133 |
InvalidRequest, NotFound { |
|
134 |
|
|
135 |
return false; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Add capabilities to the node description |
|
140 |
* |
|
141 |
* @param session - the Session object containing the credentials for the Subject |
|
142 |
* @param nodeid - the node identifier for the given node be modified |
|
143 |
* @param node - the node information to be added |
|
144 |
* |
|
145 |
* @return true or false |
|
146 |
* |
|
147 |
* @throws NotImplemented |
|
148 |
* @throws NotAuthorized |
|
149 |
* @throws ServiceFailure |
|
150 |
* @throws InvalidRequest |
|
151 |
* @throws NotFound |
|
152 |
*/ |
|
153 |
@Override |
|
154 |
public boolean addNodeCapabilities(Session session, NodeReference nodeid, Node node) |
|
155 |
throws NotImplemented, NotAuthorized, ServiceFailure, InvalidRequest, |
|
156 |
NotFound { |
|
157 |
|
|
158 |
return false; |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* Register a Coordinating Node |
|
163 |
* |
|
164 |
* @param session - the Session object containing the credentials for the Subject |
|
165 |
* @param node - the node information for the given node be modified |
|
166 |
* |
|
167 |
* @return nodeid - the identifier of the node to be registered |
|
168 |
* |
|
169 |
* @throws NotImplemented |
|
170 |
* @throws NotAuthorized |
|
171 |
* @throws ServiceFailure |
|
172 |
* @throws InvalidRequest |
|
173 |
* @throws IdentifierNotUnique |
|
174 |
*/ |
|
175 |
@Override |
|
176 |
public Identifier register(Session session, Node node) |
|
177 |
throws NotImplemented, NotAuthorized, ServiceFailure, InvalidRequest, |
|
178 |
IdentifierNotUnique { |
|
179 |
|
|
180 |
return null; |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* Test that the specified relationship between pidOfSubject and pidOfObject exists |
|
185 |
* |
|
186 |
* @param session - the Session object containing the credentials for the Subject |
|
187 |
* @param node - the node information for the given node be modified |
|
188 |
* |
|
189 |
* @return true if the relationship exists |
|
190 |
* |
|
191 |
* @throws InvalidToken |
|
192 |
* @throws ServiceFailure |
|
193 |
* @throws NotAuthorized |
|
194 |
* @throws NotFound |
|
195 |
* @throws InvalidRequest |
|
196 |
* @throws NotImplemented |
|
197 |
*/ |
|
198 |
@Override |
|
199 |
public boolean assertRelation(Session session, Identifier pidofsubject, |
|
200 |
String relationship, Identifier pidOfObject) |
|
201 |
throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, |
|
202 |
InvalidRequest, NotImplemented { |
|
203 |
|
|
204 |
return false; |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Return the object identified by the given object identifier |
|
209 |
* |
|
210 |
* @param session - the Session object containing the credentials for the Subject |
|
211 |
* @param pid - the object identifier for the given object |
|
212 |
* |
|
213 |
* @return inputStream - the input stream of the given object |
|
214 |
* |
|
215 |
* @throws InvalidToken |
|
216 |
* @throws ServiceFailure |
|
217 |
* @throws NotAuthorized |
|
218 |
* @throws InvalidRequest |
|
219 |
* @throws NotImplemented |
|
220 |
*/ |
|
221 |
@Override |
|
222 |
public InputStream get(Session session, Identifier pid) |
|
223 |
throws InvalidRequest, InvalidToken, ServiceFailure, NotAuthorized, |
|
224 |
NotFound, NotImplemented { |
|
225 |
|
|
226 |
return super.get(session, pid); |
|
227 |
} |
|
228 |
|
|
229 |
/** |
|
230 |
* Return a checksum of the object given the object identifier and the name |
|
231 |
* of the checksum algorithm (the default being SHA-1) |
|
232 |
* |
|
233 |
* @param session - the Session object containing the credentials for the Subject |
|
234 |
* @param pid - the object identifier for the given object |
|
235 |
* |
|
236 |
* @return checksum - the checksum of the object |
|
237 |
* |
|
238 |
* @throws InvalidToken |
|
239 |
* @throws ServiceFailure |
|
240 |
* @throws NotAuthorized |
|
241 |
* @throws NotFound |
|
242 |
* @throws InvalidRequest |
|
243 |
* @throws NotImplemented |
|
244 |
*/ |
|
245 |
@Override |
|
246 |
public Checksum getChecksum(Session session, Identifier pid) |
|
247 |
throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, |
|
248 |
InvalidRequest, NotImplemented { |
|
249 |
|
|
250 |
return null; |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* Return the system metadata for a given object |
|
255 |
* |
|
256 |
* @param session - the Session object containing the credentials for the Subject |
|
257 |
* @param pid - the object identifier for the given object |
|
258 |
* |
|
259 |
* @return inputStream - the input stream of the given system metadata object |
|
260 |
* |
|
261 |
* @throws InvalidToken |
|
262 |
* @throws ServiceFailure |
|
263 |
* @throws NotAuthorized |
|
264 |
* @throws NotFound |
|
265 |
* @throws InvalidRequest |
|
266 |
* @throws NotImplemented |
|
267 |
*/ |
|
268 |
@Override |
|
269 |
public SystemMetadata getSystemMetadata(Session session, Identifier pid) |
|
270 |
throws InvalidRequest, InvalidToken, ServiceFailure, NotAuthorized, |
|
271 |
NotFound, NotImplemented { |
|
272 |
|
|
273 |
return super.getSystemMetadata(session, pid); |
|
274 |
} |
|
275 |
|
|
276 |
/** |
|
277 |
* Resolve the location of a given object |
|
278 |
* |
|
279 |
* @param session - the Session object containing the credentials for the Subject |
|
280 |
* @param pid - the object identifier for the given object |
|
281 |
* |
|
282 |
* @return objectLocationList - the list of nodes known to contain the object |
|
283 |
* |
|
284 |
* @throws InvalidRequest |
|
285 |
* @throws InvalidToken |
|
286 |
* @throws ServiceFailure |
|
287 |
* @throws NotAuthorized |
|
288 |
* @throws NotFound |
|
289 |
* @throws NotImplemented |
|
290 |
*/ |
|
291 |
@Override |
|
292 |
public ObjectLocationList resolve(Session session, Identifier pid) |
|
293 |
throws InvalidRequest, InvalidToken, ServiceFailure, NotAuthorized, |
|
294 |
NotFound, NotImplemented { |
|
295 |
|
|
296 |
return null; |
|
297 |
} |
|
298 |
|
|
299 |
/** |
|
300 |
* Search the metadata catalog for identifiers that match the criteria |
|
301 |
* |
|
302 |
* @param session - the Session object containing the credentials for the Subject |
|
303 |
* @param queryType - An identifier for the type of query expression |
|
304 |
* provided in the query |
|
305 |
* @param query - The criteria for matching the characteristics of the |
|
306 |
* metadata objects of interest |
|
307 |
* |
|
308 |
* @return objectList - the list of objects matching the criteria |
|
309 |
* |
|
310 |
* @throws InvalidToken |
|
311 |
* @throws ServiceFailure |
|
312 |
* @throws NotAuthorized |
|
313 |
* @throws InvalidRequest |
|
314 |
* @throws NotImplemented |
|
315 |
*/ |
|
316 |
@Override |
|
317 |
public ObjectList search(Session session, QueryType queryType, String query) |
|
318 |
throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest, |
|
319 |
NotImplemented { |
|
320 |
|
|
321 |
return null; |
|
322 |
} |
|
323 |
|
|
324 |
/** |
|
325 |
* Add members to the named group |
|
326 |
* |
|
327 |
* @param session - the Session object containing the credentials for the Subject |
|
328 |
* @param groupName - The identifier of the group to be modified |
|
329 |
* @param members - The list of members to be added to the group |
|
330 |
* |
|
331 |
* @return true if the addition succeeds |
|
332 |
* |
|
333 |
* @throws InvalidToken |
|
334 |
* @throws ServiceFailure |
|
335 |
* @throws NotAuthorized |
|
336 |
* @throws InvalidRequest |
|
337 |
* @throws NotImplemented |
|
338 |
* @throws NotFound |
|
339 |
*/ |
|
340 |
@Override |
|
341 |
public boolean addGroupMembers(Session session, Subject groupName, SubjectList members) |
|
342 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotFound, |
|
343 |
NotImplemented, InvalidRequest { |
|
344 |
|
|
345 |
return false; |
|
346 |
} |
|
347 |
|
|
348 |
/** |
|
349 |
* Confirms a previously initiated identity mapping |
|
350 |
* |
|
351 |
* @param session - the Session object containing the credentials for the Subject |
|
352 |
* @param subject - The identifier of the subject to be used for the equivalent identity |
|
353 |
* |
|
354 |
* @return true if the mapping succeeds |
|
355 |
* |
|
356 |
* @throws InvalidToken |
|
357 |
* @throws ServiceFailure |
|
358 |
* @throws NotAuthorized |
|
359 |
* @throws InvalidRequest |
|
360 |
* @throws NotImplemented |
|
361 |
* @throws NotFound |
|
362 |
*/ |
|
363 |
@Override |
|
364 |
public boolean confirmMapIdentity(Session session, Subject subject) |
|
365 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotFound, |
|
366 |
NotImplemented, InvalidRequest { |
|
367 |
|
|
368 |
return false; |
|
369 |
} |
|
370 |
|
|
371 |
/** |
|
372 |
* Create a group with the given name |
|
373 |
* |
|
374 |
* @param session - the Session object containing the credentials for the Subject |
|
375 |
* @param groupName - The name of the group to be created |
|
376 |
* |
|
377 |
* @return true if the creation succeeds |
|
378 |
* |
|
379 |
* @throws InvalidToken |
|
380 |
* @throws ServiceFailure |
|
381 |
* @throws NotAuthorized |
|
382 |
* @throws InvalidRequest |
|
383 |
* @throws NotImplemented |
|
384 |
* @throws NotFound |
|
385 |
* @throws IdentifierNotUnique |
|
386 |
*/ |
|
387 |
@Override |
|
388 |
public boolean createGroup(Session session, Subject groupName) |
|
389 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotFound, |
|
390 |
NotImplemented, InvalidRequest, IdentifierNotUnique { |
|
391 |
|
|
392 |
return false; |
|
393 |
} |
|
394 |
|
|
395 |
/** |
|
396 |
* Get information about a Person (identities, groups, etc.) |
|
397 |
* |
|
398 |
* @param session - the Session object containing the credentials for the Subject |
|
399 |
* @param subject - The name of the group to be created |
|
400 |
* |
|
401 |
* @return true if the creation succeeds |
|
402 |
* |
|
403 |
* @throws InvalidToken |
|
404 |
* @throws ServiceFailure |
|
405 |
* @throws NotAuthorized |
|
406 |
* @throws InvalidRequest |
|
407 |
* @throws NotImplemented |
|
408 |
*/ |
|
409 |
@Override |
|
410 |
public SubjectList getSubjectInfo(Session session, Subject subject) |
|
411 |
throws ServiceFailure, InvalidRequest, NotAuthorized, NotImplemented { |
|
412 |
|
|
413 |
return null; |
|
414 |
} |
|
415 |
|
|
416 |
/** |
|
417 |
* List subjects, including users, groups, and systems, that match search criteria |
|
418 |
* |
|
419 |
* @param session - the Session object containing the credentials for the Subject |
|
420 |
* @param query - A query string criteria to be matched |
|
421 |
* @param start - The starting record number for the records to be returned |
|
422 |
* @param count - The number of records to be returned |
|
423 |
* |
|
424 |
* @return subjectList - the list of subjects matching the criteria |
|
425 |
* |
|
426 |
* @throws InvalidToken |
|
427 |
* @throws ServiceFailure |
|
428 |
* @throws NotAuthorized |
|
429 |
* @throws NotImplemented |
|
430 |
*/ |
|
431 |
@Override |
|
432 |
public SubjectList listSubjects(Session session, String query, Integer start, |
|
433 |
Integer count) |
|
434 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotImplemented { |
|
435 |
// TODO Auto-generated method stub |
|
436 |
return null; |
|
437 |
} |
|
438 |
|
|
439 |
/** |
|
440 |
* Map the two authenticated identities, asserting that they represent the same subject |
|
441 |
* |
|
442 |
* @param session - the Session object containing the credentials for the Subject |
|
443 |
* @param subject - The Subject identifier to be used for the equivalent identity |
|
444 |
* |
|
445 |
* @return true if the mapping initiation succeeds (still requires confirmation) |
|
446 |
* |
|
447 |
* @throws InvalidToken |
|
448 |
* @throws ServiceFailure |
|
449 |
* @throws NotAuthorized |
|
450 |
* @throws InvalidRequest |
|
451 |
* @throws NotImplemented |
|
452 |
* @throws NotFound |
|
453 |
*/ |
|
454 |
@Override |
|
455 |
public boolean mapIdentity(Session session, Subject subject) |
|
456 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotFound, |
|
457 |
NotImplemented, InvalidRequest { |
|
458 |
|
|
459 |
return false; |
|
460 |
} |
|
461 |
|
|
462 |
/** |
|
463 |
* Create a new subject in the DataONE system |
|
464 |
* |
|
465 |
* @param session - the Session object containing the credentials for the Subject |
|
466 |
* @param groupName - The name of the group to be created |
|
467 |
* |
|
468 |
* @return subject - the identifier of the subject created |
|
469 |
* |
|
470 |
* @throws ServiceFailure |
|
471 |
* @throws IdentifierNotUnique |
|
472 |
* @throws InvalidRequest |
|
473 |
* @throws InvalidCredentials |
|
474 |
* @throws NotImplemented |
|
475 |
*/ |
|
476 |
@Override |
|
477 |
public Subject registerAccount(Session session, Person person) |
|
478 |
throws ServiceFailure, IdentifierNotUnique, InvalidCredentials, |
|
479 |
NotImplemented, InvalidRequest { |
|
480 |
|
|
481 |
return null; |
|
482 |
} |
|
483 |
|
|
484 |
/** |
|
485 |
* Remove members from a named group |
|
486 |
* |
|
487 |
* @param session - the Session object containing the credentials for the Subject |
|
488 |
* @param groupName - The name of the group to be modified |
|
489 |
* @param members - The list of members to be removed |
|
490 |
* |
|
491 |
* @return true if the removal succeeds |
|
492 |
* |
|
493 |
* @throws ServiceFailure |
|
494 |
* @throws InvalidToken |
|
495 |
* @throws NotAuthorized |
|
496 |
* @throws NotFound |
|
497 |
* @throws NotImplemented |
|
498 |
* @throws InvalidRequest |
|
499 |
*/ |
|
500 |
@Override |
|
501 |
public boolean removeGroupMembers(Session session, Subject groupName, |
|
502 |
SubjectList members) |
|
503 |
throws ServiceFailure, InvalidToken, NotAuthorized, NotFound, |
|
504 |
NotImplemented, InvalidRequest { |
|
505 |
|
|
506 |
return false; |
|
507 |
} |
|
508 |
|
|
509 |
/** |
|
510 |
* Update an existing subject in the DataONE system |
|
511 |
* |
|
512 |
* @param session - the Session object containing the credentials for the Subject |
|
513 |
* @param person - The new information about the Subject |
|
514 |
* |
|
515 |
* @return subject - The Subject in the DataONE system that was updated. |
|
516 |
* |
|
517 |
* @throws ServiceFailure |
|
518 |
* @throws IdentifierNotUnique |
|
519 |
* @throws InvalidCredentials |
|
520 |
* @throws NotImplemented |
|
521 |
* @throws InvalidRequest |
|
522 |
*/ |
|
523 |
@Override |
|
524 |
public Subject updateAccount(Session session, Person person) |
|
525 |
throws ServiceFailure, IdentifierNotUnique, InvalidCredentials, |
|
526 |
NotImplemented, InvalidRequest { |
|
527 |
|
|
528 |
return null; |
|
529 |
} |
|
530 |
|
|
531 |
/** |
|
532 |
* Verify that the Person data associated with this Subject is a true |
|
533 |
* representation of the real world person. |
|
534 |
* |
|
535 |
* @param session - the Session object containing the credentials for the Subject |
|
536 |
* @param person - The Subject identifier of the Person to be verified |
|
537 |
* |
|
538 |
* @return true if the account verification succeeds |
|
539 |
* |
|
540 |
* @throws ServiceFailure |
|
541 |
* @throws NotAuthorized |
|
542 |
* @throws NotImplemented |
|
543 |
* @throws InvalidToken |
|
544 |
* @throws InvalidRequest |
|
545 |
*/ |
|
546 |
@Override |
|
547 |
public boolean verifyAccount(Session session, Subject person) |
|
548 |
throws ServiceFailure, NotAuthorized, NotImplemented, InvalidToken, |
|
549 |
InvalidRequest { |
|
550 |
|
|
551 |
return false; |
|
552 |
} |
|
553 |
|
|
554 |
/** |
|
555 |
* Used internally within a Coordinating Node to add a new object |
|
556 |
* to the object store |
|
557 |
* |
|
558 |
* @param session - the Session object containing the credentials for the Subject |
|
559 |
* @param pid - The object identifier to be created |
|
560 |
* @param object - the object bytes |
|
561 |
* @param sysmeta - the system metadata that describes the object |
|
562 |
* |
|
563 |
* @return pid - the object identifier created |
|
564 |
* |
|
565 |
* @throws InvalidToken |
|
566 |
* @throws ServiceFailure |
|
567 |
* @throws NotAuthorized |
|
568 |
* @throws IdentifierNotUnique |
|
569 |
* @throws UnsupportedType |
|
570 |
* @throws InsufficientResources |
|
571 |
* @throws InvalidSystemMetadata |
|
572 |
* @throws NotImplemented |
|
573 |
* @throws InvalidRequest |
|
574 |
*/ |
|
575 |
@Override |
|
576 |
public Identifier create(Session session, Identifier pid, InputStream object, |
|
577 |
SystemMetadata sysmeta) |
|
578 |
throws InvalidToken, ServiceFailure, NotAuthorized, IdentifierNotUnique, |
|
579 |
UnsupportedType, InsufficientResources, InvalidSystemMetadata, |
|
580 |
NotImplemented, InvalidRequest { |
|
581 |
|
|
582 |
return null; |
|
583 |
} |
|
584 |
|
|
585 |
/** |
|
586 |
* Returns the object format registered in the DataONE Object Format |
|
587 |
* Vocabulary for the given format identifier |
|
588 |
* |
|
589 |
* @param fmtid - the identifier of the format requested |
|
590 |
* |
|
591 |
* @return objectFormat - the object format requested |
|
592 |
* |
|
593 |
* @throws InvalidRequest |
|
594 |
* @throws ServiceFailure |
|
595 |
* @throws NotFound |
|
596 |
* @throws InsufficientResources |
|
597 |
* @throws NotImplemented |
|
598 |
*/ |
|
599 |
@Override |
|
600 |
public ObjectFormat getFormat(ObjectFormatIdentifier fmtid) |
|
601 |
throws InvalidRequest, ServiceFailure, NotFound, InsufficientResources, |
|
602 |
NotImplemented { |
|
603 |
|
|
604 |
return null; |
|
605 |
} |
|
606 |
|
|
607 |
/** |
|
608 |
* Retrieves consolidated log information for the specified date range |
|
609 |
* (inclusive) for the entire DataONE infrastructure |
|
610 |
* |
|
611 |
* @param session - the Session object containing the credentials for the Subject |
|
612 |
* @param fromDate - Starting time for records in response |
|
613 |
* @param toDate - End time for records in response. If not specified, then defaults to now. |
|
614 |
* @param event - Return only log records for the specified type of event. Default is all. |
|
615 |
* |
|
616 |
* @return log - the log records requested |
|
617 |
* |
|
618 |
* @throws InvalidRequest |
|
619 |
* @throws ServiceFailure |
|
620 |
* @throws InvalidToken |
|
621 |
* @throws NotAuthorized |
|
622 |
* @throws NotImplemented |
|
623 |
*/ |
|
624 |
@Override |
|
625 |
public Log getLogRecords(Session session, Date fromDate, Date toDate, Event event) |
|
626 |
throws InvalidToken, InvalidRequest, ServiceFailure, NotAuthorized, |
|
627 |
NotImplemented { |
|
628 |
|
|
629 |
return super.getLogRecords(session, fromDate, toDate, event); |
|
630 |
} |
|
631 |
|
|
632 |
/** |
|
633 |
* Returns a list of all object formats registered in the DataONE Object |
|
634 |
* Format Vocabulary |
|
635 |
* |
|
636 |
* @return objectFormatList - The list of object formats registered in |
|
637 |
* the DataONE Object Format Vocabulary |
|
638 |
* |
|
639 |
* @throws InvalidRequest |
|
640 |
* @throws ServiceFailure |
|
641 |
* @throws NotImplemented |
|
642 |
* @throws NotFound |
|
643 |
* @throws InsufficientResources |
|
644 |
*/ |
|
645 |
@Override |
|
646 |
public ObjectFormatList listFormats() |
|
647 |
throws InvalidRequest, ServiceFailure, NotFound, InsufficientResources, |
|
648 |
NotImplemented { |
|
649 |
|
|
650 |
return null; |
|
651 |
} |
|
652 |
|
|
653 |
/** |
|
654 |
* Returns a list of nodes that have been registered with the DataONE infrastructure |
|
655 |
* |
|
656 |
* @return nodeList - List of nodes from the registry |
|
657 |
* |
|
658 |
* @throws ServiceFailure |
|
659 |
* @throws NotImplemented |
|
660 |
*/ |
|
661 |
@Override |
|
662 |
public NodeList listNodes() |
|
663 |
throws NotImplemented, ServiceFailure { |
|
664 |
|
|
665 |
return null; |
|
666 |
} |
|
667 |
|
|
668 |
/** |
|
669 |
* Provides a mechanism for adding system metadata independently of its |
|
670 |
* associated object, such as when adding system metadata for data objects. |
|
671 |
* |
|
672 |
* @param session - the Session object containing the credentials for the Subject |
|
673 |
* @param pid - The identifier of the object to register the system metadata against |
|
674 |
* @param sysmeta - The system metadata to be registered |
|
675 |
* |
|
676 |
* @return true if the registration succeeds |
|
677 |
* |
|
678 |
* @throws NotImplemented |
|
679 |
* @throws NotAuthorized |
|
680 |
* @throws ServiceFailure |
|
681 |
* @throws InvalidRequest |
|
682 |
* @throws InvalidSystemMetadata |
|
683 |
*/ |
|
684 |
@Override |
|
685 |
public boolean registerSystemMetadata(Session session, Identifier pid, |
|
686 |
SystemMetadata sysmeta) |
|
687 |
throws NotImplemented, NotAuthorized, ServiceFailure, InvalidRequest, |
|
688 |
InvalidSystemMetadata { |
|
689 |
|
|
690 |
return false; |
|
691 |
} |
|
692 |
|
|
693 |
/** |
|
694 |
* Given an optional scope and format, reserves and returns an identifier |
|
695 |
* within that scope and format that is unique and will not be |
|
696 |
* used by any other sessions. |
|
697 |
* |
|
698 |
* @param session - the Session object containing the credentials for the Subject |
|
699 |
* @param pid - The identifier of the object to register the system metadata against |
|
700 |
* @param scope - An optional string to be used to qualify the scope of |
|
701 |
* the identifier namespace, which is applied differently |
|
702 |
* depending on the format requested. If scope is not |
|
703 |
* supplied, a default scope will be used. |
|
704 |
* @param format - The optional name of the identifier format to be used, |
|
705 |
* drawn from a DataONE-specific vocabulary of identifier |
|
706 |
* format names, including several common syntaxes such |
|
707 |
* as DOI, LSID, UUID, and LSRN, among others. If the |
|
708 |
* format is not supplied by the caller, the CN service |
|
709 |
* will use a default identifier format, which may change |
|
710 |
* over time. |
|
711 |
* |
|
712 |
* @return true if the registration succeeds |
|
713 |
* |
|
714 |
* @throws InvalidToken |
|
715 |
* @throws ServiceFailure |
|
716 |
* @throws NotAuthorized |
|
717 |
* @throws IdentifierNotUnique |
|
718 |
* @throws NotImplemented |
|
719 |
*/ |
|
720 |
@Override |
|
721 |
public Identifier reserveIdentifier(Session session, Identifier pid, |
|
722 |
String scope, String format) |
|
723 |
throws InvalidToken, ServiceFailure, NotAuthorized, IdentifierNotUnique, |
|
724 |
NotImplemented, InvalidRequest { |
|
725 |
|
|
726 |
return null; |
|
727 |
} |
|
728 |
|
|
729 |
/** |
|
730 |
* Test if the user identified by the provided token has authorization |
|
731 |
* for operation on the specified object. |
|
732 |
* |
|
733 |
* @param session - the Session object containing the credentials for the Subject |
|
734 |
* @param pid - The identifer of the resource for which access is being checked |
|
735 |
* @param operation - The type of operation which is being requested for the given pid |
|
736 |
* |
|
737 |
* @return true if the operation is allowed |
|
738 |
* |
|
739 |
* @throws ServiceFailure |
|
740 |
* @throws InvalidToken |
|
741 |
* @throws NotFound |
|
742 |
* @throws NotAuthorized |
|
743 |
* @throws NotImplemented |
|
744 |
* @throws InvalidRequest |
|
745 |
*/ |
|
746 |
@Override |
|
747 |
public boolean isAuthorized(Session session, Identifier pid, Event operation) |
|
748 |
throws ServiceFailure, InvalidToken, NotFound, NotAuthorized, |
|
749 |
NotImplemented, InvalidRequest { |
|
750 |
|
|
751 |
return false; |
|
752 |
} |
|
753 |
|
|
754 |
/** |
|
755 |
* Sets the access permissions for an object identified by pid |
|
756 |
* |
|
757 |
* @param session - the Session object containing the credentials for the Subject |
|
758 |
* @param pid - The identifer of the resource to set access on |
|
759 |
* @param accessPolicy - The access policy to be applied for the object |
|
760 |
* |
|
761 |
* @return true if the operation is allowed |
|
762 |
* |
|
763 |
* @throws ServiceFailure |
|
764 |
* @throws InvalidToken |
|
765 |
* @throws NotFound |
|
766 |
* @throws NotAuthorized |
|
767 |
* @throws NotImplemented |
|
768 |
* @throws InvalidRequest |
|
769 |
*/ |
|
770 |
@Override |
|
771 |
public boolean setAccessPolicy(Session session, Identifier pid, |
|
772 |
AccessPolicy accessPolicy) throws InvalidToken, NotFound, NotImplemented, |
|
773 |
NotAuthorized, ServiceFailure, InvalidRequest { |
|
774 |
|
|
775 |
return super.setAccessPolicy(session, pid, accessPolicy); |
|
776 |
} |
|
777 |
|
|
778 |
/** |
|
779 |
* Changes ownership (RightsHolder) of the specified object to the |
|
780 |
* subject specified by userId |
|
781 |
* |
|
782 |
* @param session - the Session object containing the credentials for the Subject |
|
783 |
* @param pid - Identifier of the object to be modified |
|
784 |
* @param userId - The subject that will be taking ownership of the specified object. |
|
785 |
* |
|
786 |
* @return pid - the identifier of the modified object |
|
787 |
* |
|
788 |
* @throws ServiceFailure |
|
789 |
* @throws InvalidToken |
|
790 |
* @throws NotFound |
|
791 |
* @throws NotAuthorized |
|
792 |
* @throws NotImplemented |
|
793 |
* @throws InvalidRequest |
|
794 |
*/ |
|
795 |
@Override |
|
796 |
public Identifier setOwner(Session session, Identifier pid, Subject userId) |
|
797 |
throws InvalidToken, ServiceFailure, NotFound, NotAuthorized, |
|
798 |
NotImplemented, InvalidRequest { |
|
799 |
|
|
800 |
return null; |
|
801 |
} |
|
802 |
|
|
803 |
} |
Also available in: Unified diff
Initial check in of the CNodeService stub methods that implement the D1 CN* interfaces. CNCoreImpl methods will be transitioned into this class. The methods follow the D1 0.6.2 API thus far.