Revision 9249
Added by Jing Tao almost 9 years ago
CNodeService.java | ||
---|---|---|
74 | 74 |
|
75 | 75 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
76 | 76 |
import edu.ucsb.nceas.metacat.dataone.convert.LogV2toV1Converter; |
77 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
|
77 | 78 |
|
78 | 79 |
/** |
79 | 80 |
* Represents Metacat's implementation of the DataONE Coordinating Node service |
... | ... | |
321 | 322 |
ObjectFormatIdentifier formatid, Boolean replicaStatus, Integer start, |
322 | 323 |
Integer count) throws InvalidRequest, InvalidToken, NotAuthorized, |
323 | 324 |
NotImplemented, ServiceFailure { |
324 |
return impl.listObjects(null, startTime, endTime, formatid, null, replicaStatus, start, count); |
|
325 |
NodeReference nodeId = null; |
|
326 |
if(!replicaStatus) { |
|
327 |
//not include those objects whose authoritative node is not this mn |
|
328 |
nodeId = new NodeReference(); |
|
329 |
try { |
|
330 |
String currentNodeId = PropertyService.getInstance().getProperty("dataone.nodeId"); // return only pids for which this mn |
|
331 |
nodeId.setValue(currentNodeId); |
|
332 |
} catch(Exception e) { |
|
333 |
throw new ServiceFailure("1580", e.getMessage()); |
|
334 |
} |
|
335 |
} |
|
336 |
return impl.listObjects(null, startTime, endTime, formatid, null, nodeId, start, count); |
|
325 | 337 |
} |
326 | 338 |
|
327 | 339 |
@Override |
... | ... | |
330 | 342 |
ObjectFormatIdentifier formatid, Boolean replicaStatus, Integer start, |
331 | 343 |
Integer count) throws InvalidRequest, InvalidToken, NotAuthorized, |
332 | 344 |
NotImplemented, ServiceFailure { |
333 |
return impl.listObjects(session, startTime, endTime, formatid, null, replicaStatus, start, count); |
|
345 |
NodeReference nodeId = null; |
|
346 |
if(!replicaStatus) { |
|
347 |
//not include those objects whose authoritative node is not this mn |
|
348 |
nodeId = new NodeReference(); |
|
349 |
try { |
|
350 |
String currentNodeId = PropertyService.getInstance().getProperty("dataone.nodeId"); // return only pids for which this mn |
|
351 |
nodeId.setValue(currentNodeId); |
|
352 |
} catch(Exception e) { |
|
353 |
throw new ServiceFailure("1580", e.getMessage()); |
|
354 |
} |
|
355 |
} |
|
356 |
return impl.listObjects(session, startTime, endTime, formatid, null, nodeId, start, count); |
|
334 | 357 |
} |
335 | 358 |
|
336 | 359 |
@Override |
Also available in: Unified diff
Use the NodeReference object to replace the replicaStatus to restrict the listObjects method.