Revision 9374
Added by Jing Tao about 9 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
2468 | 2468 |
/* |
2469 | 2469 |
* Determine if the current node is the authoritative node for the given pid. |
2470 | 2470 |
*/ |
2471 |
protected boolean isAuthoritativeNode(Identifier pid) { |
|
2471 |
protected boolean isAuthoritativeNode(Identifier pid) throws InvalidRequest {
|
|
2472 | 2472 |
boolean isAuthoritativeNode = false; |
2473 | 2473 |
if(pid != null && pid.getValue() != null) { |
2474 | 2474 |
SystemMetadata sys = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
... | ... | |
2486 | 2486 |
//System.out.println("They are matching"); |
2487 | 2487 |
isAuthoritativeNode = true; |
2488 | 2488 |
} |
2489 |
} else { |
|
2490 |
throw new InvalidRequest("4869", "Coudn't find the authoritative member node in the system metadata associated with the pid "+pid.getValue()); |
|
2489 | 2491 |
} |
2492 |
} else { |
|
2493 |
throw new InvalidRequest("4869", "Coudn't find the system metadata associated with the pid "+pid.getValue()); |
|
2490 | 2494 |
} |
2495 |
} else { |
|
2496 |
throw new InvalidRequest("4869", "The request pid is null"); |
|
2491 | 2497 |
} |
2492 | 2498 |
return isAuthoritativeNode; |
2493 | 2499 |
} |
... | ... | |
2497 | 2503 |
* 1. If the session has an cn object, it is allowed. |
2498 | 2504 |
* 2. If it is not a cn object, the client should have approperate permission and it should also happen on the authorative node. |
2499 | 2505 |
*/ |
2500 |
private boolean allowUpdating(Session session, Identifier pid, Permission permission) throws NotAuthorized, NotFound{ |
|
2506 |
private boolean allowUpdating(Session session, Identifier pid, Permission permission) throws NotAuthorized, NotFound, InvalidRequest {
|
|
2501 | 2507 |
boolean allow = false; |
2502 | 2508 |
if(isCNAdmin (session)) { |
2503 | 2509 |
allow = true; |
Also available in: Unified diff
Make the isAuthoritativeNode throw exception if some value is null.