Revision 6869
Added by Chris Jones about 12 years ago
CNResourceHandler.java | ||
---|---|---|
54 | 54 |
import org.dataone.service.exceptions.NotImplemented; |
55 | 55 |
import org.dataone.service.exceptions.ServiceFailure; |
56 | 56 |
import org.dataone.service.exceptions.UnsupportedType; |
57 |
import org.dataone.service.exceptions.VersionMismatch; |
|
57 | 58 |
import org.dataone.service.types.v1.AccessPolicy; |
58 | 59 |
import org.dataone.service.types.v1.Checksum; |
59 | 60 |
import org.dataone.service.types.v1.ChecksumAlgorithmList; |
... | ... | |
884 | 885 |
* @throws IOException |
885 | 886 |
* @throws IllegalAccessException |
886 | 887 |
* @throws InstantiationException |
888 |
* @throws VersionMismatch |
|
887 | 889 |
*/ |
888 | 890 |
private void owner(String id) throws JiBXException, InvalidToken, |
889 | 891 |
ServiceFailure, NotFound, NotAuthorized, NotImplemented, |
890 | 892 |
InvalidRequest, IOException, InstantiationException, |
891 |
IllegalAccessException { |
|
893 |
IllegalAccessException, VersionMismatch {
|
|
892 | 894 |
|
893 | 895 |
Identifier pid = new Identifier(); |
894 | 896 |
pid.setValue(id); |
... | ... | |
999 | 1001 |
* @throws IOException |
1000 | 1002 |
* @throws SAXException |
1001 | 1003 |
* @throws ParserConfigurationException |
1004 |
* @throws VersionMismatch |
|
1002 | 1005 |
*/ |
1003 | 1006 |
protected void setAccess(String pid) throws JiBXException, InvalidToken, |
1004 | 1007 |
ServiceFailure, NotFound, NotAuthorized, NotImplemented, |
1005 | 1008 |
InvalidRequest, IOException, InstantiationException, |
1006 |
IllegalAccessException, ParserConfigurationException, SAXException { |
|
1009 |
IllegalAccessException, ParserConfigurationException, SAXException, VersionMismatch {
|
|
1007 | 1010 |
|
1008 | 1011 |
long serialVersion = 0L; |
1009 | 1012 |
String serialVersionStr = null; |
... | ... | |
1181 | 1184 |
* @throws InstantiationException |
1182 | 1185 |
* @throws IllegalAccessException |
1183 | 1186 |
* @throws JiBXException |
1187 |
* @throws VersionMismatch |
|
1184 | 1188 |
*/ |
1185 | 1189 |
public boolean setReplicationPolicy(String pid) throws NotImplemented, |
1186 | 1190 |
NotFound, NotAuthorized, ServiceFailure, InvalidRequest, |
1187 | 1191 |
InvalidToken, IOException, InstantiationException, |
1188 |
IllegalAccessException, JiBXException { |
|
1192 |
IllegalAccessException, JiBXException, VersionMismatch {
|
|
1189 | 1193 |
|
1190 | 1194 |
boolean result = false; |
1191 | 1195 |
ReplicationPolicy policy = null; |
... | ... | |
1340 | 1344 |
* @throws NotAuthorized |
1341 | 1345 |
* @throws InvalidRequest |
1342 | 1346 |
* @throws NotFound |
1347 |
* @throws VersionMismatch |
|
1343 | 1348 |
*/ |
1344 | 1349 |
public boolean updateReplicationMetadata(String pid) throws ServiceFailure, |
1345 | 1350 |
NotImplemented, InvalidToken, NotAuthorized, InvalidRequest, |
1346 |
NotFound { |
|
1351 |
NotFound, VersionMismatch {
|
|
1347 | 1352 |
|
1348 | 1353 |
boolean result = false; |
1349 | 1354 |
long serialVersion = 0L; |
Also available in: Unified diff
Update the CN methods to throw a VersionMismatch where the API changed (where serialVersion is a required parameter). These were previously throwing an InvalidRequest exception.
Change the exception handling for calls to Hazelcast to catch a RuntimeException (not Exception) so we don't catch exceptions that we purposefully throw.
Modify methods to allow for CN administrative access (like setRightsHolder()) by using isAdminAuthorized and the CN session subject.
In setReplicationStatus(), it's possible that a CN may try to set the status on a non-existent replica entry. Call updateReplicationMetadata() to create the new entry in this case, and then update the entry as normal.
Update CNResourceHandler to throw VersionMismatch where needed.