Revision 6792
Added by Chris Jones about 13 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
39 | 39 |
import org.dataone.service.cn.v1.CNCore; |
40 | 40 |
import org.dataone.service.cn.v1.CNRead; |
41 | 41 |
import org.dataone.service.cn.v1.CNReplication; |
42 |
import org.dataone.service.exceptions.BaseException; |
|
42 | 43 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
43 | 44 |
import org.dataone.service.exceptions.InsufficientResources; |
44 | 45 |
import org.dataone.service.exceptions.InvalidRequest; |
... | ... | |
202 | 203 |
*/ |
203 | 204 |
@Override |
204 | 205 |
public boolean setReplicationStatus(Session session, Identifier pid, |
205 |
NodeReference targetNode, ReplicationStatus status, long serialVersion)
|
|
206 |
NodeReference targetNode, ReplicationStatus status, BaseException failure)
|
|
206 | 207 |
throws ServiceFailure, NotImplemented, InvalidToken, NotAuthorized, |
207 | 208 |
InvalidRequest, NotFound { |
208 | 209 |
|
... | ... | |
286 | 287 |
|
287 | 288 |
} |
288 | 289 |
|
289 |
// does the request have the most current system metadata? |
|
290 |
if ( systemMetadata.getSerialVersion().longValue() != serialVersion ) { |
|
291 |
String msg = "The requested system metadata version number " + |
|
292 |
serialVersion + " differs from the current version at " + |
|
293 |
systemMetadata.getSerialVersion().longValue() + |
|
294 |
". Please get the latest copy in order to modify it."; |
|
295 |
throw new InvalidRequest("4730", msg); |
|
290 |
// was there a failure? log it |
|
291 |
if ( failure != null && status == ReplicationStatus.FAILED ) { |
|
292 |
String msg = "The replication request of the object identified by " + |
|
293 |
pid.getValue() + " failed. The error message was " + |
|
294 |
failure.getMessage() + "."; |
|
296 | 295 |
} |
297 | 296 |
|
298 | 297 |
} catch (RuntimeException e) { // Catch is generic since HZ throws RuntimeException |
... | ... | |
321 | 320 |
systemMetadata.setSerialVersion(systemMetadata.getSerialVersion().add(BigInteger.ONE)); |
322 | 321 |
systemMetadata.setDateSysMetadataModified(Calendar.getInstance().getTime()); |
323 | 322 |
HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata); |
324 |
|
|
323 |
|
|
324 |
if ( status == ReplicationStatus.FAILED && failure != null ) { |
|
325 |
logMetacat.warn("Replication failed for identifier " + pid.getValue() + |
|
326 |
" on target node " + targetNode + ". The exception was: " + |
|
327 |
failure.getMessage()); |
|
328 |
} |
|
325 | 329 |
} catch (Exception e) { |
326 | 330 |
throw new ServiceFailure("4700", e.getMessage()); |
327 | 331 |
|
Also available in: Unified diff
Change setReplicationStatus() to drop serialVersion and report the failure exception message in the CN log.