Revision 5670
Added by berkley over 13 years ago
CrudService.java | ||
---|---|---|
1065 | 1065 |
NotAuthorized, NotFound, InvalidRequest, NotImplemented |
1066 | 1066 |
{ |
1067 | 1067 |
logCrud.info("getChecksum"); |
1068 |
if(checksumAlgorithm == null) |
|
1068 |
SystemMetadata sm = getSystemMetadata(token, guid); |
|
1069 |
Checksum cs = sm.getChecksum(); |
|
1070 |
if(cs.getAlgorithm().toString().equals(checksumAlgorithm)) |
|
1069 | 1071 |
{ |
1070 |
checksumAlgorithm = "MD5";
|
|
1072 |
return cs;
|
|
1071 | 1073 |
} |
1072 |
InputStream docStream = get(token, guid); |
|
1073 |
String checksum; |
|
1074 |
try |
|
1074 |
else |
|
1075 | 1075 |
{ |
1076 |
checksum = checksum(docStream, checksumAlgorithm); |
|
1076 |
if(checksumAlgorithm == null) |
|
1077 |
{ |
|
1078 |
checksumAlgorithm = "MD5"; |
|
1079 |
} |
|
1080 |
InputStream docStream = get(token, guid); |
|
1081 |
String checksum; |
|
1082 |
try |
|
1083 |
{ |
|
1084 |
checksum = checksum(docStream, checksumAlgorithm); |
|
1085 |
} |
|
1086 |
catch(Exception e) |
|
1087 |
{ |
|
1088 |
throw new ServiceFailure("1410", "Error getting checksum: " + e.getMessage()); |
|
1089 |
} |
|
1090 |
Checksum c = new Checksum(); |
|
1091 |
c.setAlgorithm(ChecksumAlgorithm.convert(checksumAlgorithm)); |
|
1092 |
c.setValue(checksum); |
|
1093 |
return c; |
|
1077 | 1094 |
} |
1078 |
catch(Exception e) |
|
1079 |
{ |
|
1080 |
throw new ServiceFailure("1410", "Error getting checksum: " + e.getMessage()); |
|
1081 |
} |
|
1082 |
Checksum c = new Checksum(); |
|
1083 |
c.setAlgorithm(ChecksumAlgorithm.convert(checksumAlgorithm)); |
|
1084 |
c.setValue(checksum); |
|
1085 |
return c; |
|
1086 | 1095 |
} |
1087 | 1096 |
|
1088 | 1097 |
/** |
Also available in: Unified diff
got getChecksum working. working on delete now. all tests in d1clienttest now pass