Revision 9833
Added by Jing Tao over 7 years ago
CNResourceHandler.java | ||
---|---|---|
41 | 41 |
import org.apache.commons.io.IOUtils; |
42 | 42 |
import org.apache.log4j.Logger; |
43 | 43 |
import org.dataone.client.v2.formats.ObjectFormatInfo; |
44 |
import org.dataone.exceptions.MarshallingException; |
|
44 | 45 |
import org.dataone.service.exceptions.BaseException; |
45 | 46 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
46 | 47 |
import org.dataone.service.exceptions.InsufficientResources; |
... | ... | |
78 | 79 |
import org.dataone.service.util.EncodingUtilities; |
79 | 80 |
import org.dataone.service.util.ExceptionHandler; |
80 | 81 |
import org.dataone.service.util.TypeMarshaller; |
81 |
import org.jibx.runtime.JiBXException; |
|
82 | 82 |
import org.xml.sax.SAXException; |
83 | 83 |
|
84 | 84 |
import edu.ucsb.nceas.metacat.common.query.stream.ContentTypeInputStream; |
... | ... | |
480 | 480 |
* @throws ServiceFailure |
481 | 481 |
* @throws InvalidToken |
482 | 482 |
* @throws IOException |
483 |
* @throws JiBXException
|
|
483 |
* @throws MarshallingException
|
|
484 | 484 |
*/ |
485 | 485 |
private void checksum(String guid) throws InvalidToken, ServiceFailure, |
486 | 486 |
NotAuthorized, NotFound, InvalidRequest, NotImplemented, |
487 |
JiBXException, IOException {
|
|
487 |
MarshallingException, IOException {
|
|
488 | 488 |
Identifier guidid = new Identifier(); |
489 | 489 |
guidid.setValue(guid); |
490 | 490 |
logMetacat.debug("getting checksum for object " + guid); |
... | ... | |
510 | 510 |
* @throws ServiceFailure |
511 | 511 |
* @throws InvalidToken |
512 | 512 |
* @throws IOException |
513 |
* @throws JiBXException
|
|
513 |
* @throws MarshallingException
|
|
514 | 514 |
*/ |
515 | 515 |
private void getLog() throws InvalidToken, ServiceFailure, NotAuthorized, |
516 |
InvalidRequest, NotImplemented, IOException, JiBXException {
|
|
516 |
InvalidRequest, NotImplemented, IOException, MarshallingException {
|
|
517 | 517 |
|
518 | 518 |
Date fromDate = null; |
519 | 519 |
Date toDate = null; |
... | ... | |
628 | 628 |
* @throws ServiceFailure |
629 | 629 |
* @throws InvalidToken |
630 | 630 |
* @throws IOException |
631 |
* @throws JiBXException
|
|
631 |
* @throws MarshallingException
|
|
632 | 632 |
*/ |
633 | 633 |
protected void getSystemMetadataObject(String guid) throws InvalidToken, |
634 | 634 |
ServiceFailure, NotAuthorized, NotFound, InvalidRequest, |
635 |
NotImplemented, IOException, JiBXException {
|
|
635 |
NotImplemented, IOException, MarshallingException {
|
|
636 | 636 |
|
637 | 637 |
Identifier id = new Identifier(); |
638 | 638 |
id.setValue(guid); |
... | ... | |
658 | 658 |
* @throws InvalidRequest |
659 | 659 |
* @throws ServiceFailure |
660 | 660 |
* @throws IdentifierNotUnique |
661 |
* @throws JiBXException
|
|
661 |
* @throws MarshallingException
|
|
662 | 662 |
* @throws NotImplemented |
663 | 663 |
* @throws InvalidSystemMetadata |
664 | 664 |
* @throws InsufficientResources |
... | ... | |
670 | 670 |
* @throws InstantiationException |
671 | 671 |
*/ |
672 | 672 |
protected void putObject(String action) throws ServiceFailure, |
673 |
InvalidRequest, IdentifierNotUnique, JiBXException, InvalidToken,
|
|
673 |
InvalidRequest, IdentifierNotUnique, MarshallingException, InvalidToken,
|
|
674 | 674 |
NotAuthorized, UnsupportedType, InsufficientResources, |
675 | 675 |
InvalidSystemMetadata, NotImplemented, IOException, |
676 | 676 |
InstantiationException, IllegalAccessException { |
... | ... | |
723 | 723 |
* @throws ServiceFailure |
724 | 724 |
* @throws InvalidRequest |
725 | 725 |
* @throws IOException |
726 |
* @throws JiBXException
|
|
726 |
* @throws MarshallingException
|
|
727 | 727 |
*/ |
728 | 728 |
private void listFormats() throws InvalidRequest, ServiceFailure, NotFound, |
729 |
InsufficientResources, NotImplemented, IOException, JiBXException {
|
|
729 |
InsufficientResources, NotImplemented, IOException, MarshallingException {
|
|
730 | 730 |
logMetacat.debug("Entering listFormats()"); |
731 | 731 |
|
732 | 732 |
ObjectFormatList objectFormatList = CNodeService.getInstance(request) |
... | ... | |
751 | 751 |
} |
752 | 752 |
|
753 | 753 |
private void listChecksumAlgorithms() throws IOException, ServiceFailure, |
754 |
NotImplemented, JiBXException {
|
|
754 |
NotImplemented, MarshallingException {
|
|
755 | 755 |
logMetacat.debug("Entering listFormats()"); |
756 | 756 |
|
757 | 757 |
ChecksumAlgorithmList result = CNodeService.getInstance(request).listChecksumAlgorithms(); |
... | ... | |
814 | 814 |
* @throws NotAuthorized |
815 | 815 |
* @throws ServiceFailure |
816 | 816 |
* @throws InvalidToken |
817 |
* @throws JiBXException
|
|
817 |
* @throws MarshallingException
|
|
818 | 818 |
*/ |
819 |
private void deleteObject(String pid) throws IOException, InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InvalidRequest, JiBXException
|
|
819 |
private void deleteObject(String pid) throws IOException, InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InvalidRequest, MarshallingException
|
|
820 | 820 |
{ |
821 | 821 |
|
822 | 822 |
OutputStream out = response.getOutputStream(); |
... | ... | |
841 | 841 |
* @throws NotFound |
842 | 842 |
* @throws NotImplemented |
843 | 843 |
* @throws IOException |
844 |
* @throws JiBXException
|
|
844 |
* @throws MarshallingException
|
|
845 | 845 |
*/ |
846 |
private void archive(String pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, IOException, JiBXException {
|
|
846 |
private void archive(String pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, IOException, MarshallingException {
|
|
847 | 847 |
|
848 | 848 |
OutputStream out = response.getOutputStream(); |
849 | 849 |
response.setStatus(200); |
... | ... | |
870 | 870 |
* @throws ServiceFailure |
871 | 871 |
* @throws InvalidRequest |
872 | 872 |
* @throws IOException |
873 |
* @throws JiBXException
|
|
873 |
* @throws MarshallingException
|
|
874 | 874 |
*/ |
875 | 875 |
private void getFormat(String fmtidStr) throws InvalidRequest, |
876 | 876 |
ServiceFailure, NotFound, InsufficientResources, NotImplemented, |
877 |
IOException, JiBXException {
|
|
877 |
IOException, MarshallingException {
|
|
878 | 878 |
logMetacat.debug("Entering listFormats()"); |
879 | 879 |
|
880 | 880 |
ObjectFormatIdentifier fmtid = new ObjectFormatIdentifier(); |
... | ... | |
900 | 900 |
* @throws NotImplemented |
901 | 901 |
* @throws InvalidRequest |
902 | 902 |
* @throws ServiceFailure |
903 |
* @throws JiBXException
|
|
903 |
* @throws MarshallingException
|
|
904 | 904 |
* @throws IOException |
905 | 905 |
* @throws IllegalAccessException |
906 | 906 |
* @throws InstantiationException |
... | ... | |
910 | 910 |
*/ |
911 | 911 |
private void addFormat(String formatIdStr) |
912 | 912 |
throws NotImplemented, ServiceFailure, InvalidRequest, InstantiationException, |
913 |
IllegalAccessException, IOException, JiBXException, NotFound, NotAuthorized, InvalidToken {
|
|
913 |
IllegalAccessException, IOException, MarshallingException, NotFound, NotAuthorized, InvalidToken {
|
|
914 | 914 |
|
915 | 915 |
logMetacat.debug("addFormat: " + formatIdStr); |
916 | 916 |
|
... | ... | |
999 | 999 |
logMetacat.debug(msg); |
1000 | 1000 |
throw new ServiceFailure("4210", msg); |
1001 | 1001 |
|
1002 |
} catch (JiBXException e) {
|
|
1002 |
} catch (MarshallingException e) {
|
|
1003 | 1003 |
String msg = "Couldn't marshall the identifier to the response output stream: " + |
1004 | 1004 |
e.getMessage(); |
1005 | 1005 |
logMetacat.debug(msg); |
... | ... | |
1018 | 1018 |
* @throws NotFound |
1019 | 1019 |
* @throws NotImplemented |
1020 | 1020 |
* @throws IOException |
1021 |
* @throws JiBXException
|
|
1021 |
* @throws MarshallingException
|
|
1022 | 1022 |
*/ |
1023 | 1023 |
private void resolve(String id) throws InvalidRequest, InvalidToken, |
1024 | 1024 |
ServiceFailure, NotAuthorized, NotFound, NotImplemented, |
1025 |
IOException, JiBXException {
|
|
1025 |
IOException, MarshallingException {
|
|
1026 | 1026 |
Identifier pid = new Identifier(); |
1027 | 1027 |
pid.setValue(id); |
1028 | 1028 |
ObjectLocationList locationList = CNodeService.getInstance(request) |
... | ... | |
1132 | 1132 |
logMetacat.debug(msg); |
1133 | 1133 |
throw new ServiceFailure("4490", msg); |
1134 | 1134 |
|
1135 |
} catch (JiBXException e) {
|
|
1135 |
} catch (MarshallingException e) {
|
|
1136 | 1136 |
String msg = "Couldn't marshall the identifier to the response output stream: " + |
1137 | 1137 |
e.getMessage(); |
1138 | 1138 |
logMetacat.debug(msg); |
... | ... | |
1171 | 1171 |
* |
1172 | 1172 |
* @param pid |
1173 | 1173 |
* identifier for System Metadata entry |
1174 |
* @throws JiBXException
|
|
1174 |
* @throws MarshallingException
|
|
1175 | 1175 |
* @throws FileUploadException |
1176 | 1176 |
* @throws IOException |
1177 | 1177 |
* @throws InvalidRequest |
... | ... | |
1184 | 1184 |
*/ |
1185 | 1185 |
protected void registerSystemMetadata() |
1186 | 1186 |
throws ServiceFailure, InvalidRequest, IOException, |
1187 |
FileUploadException, JiBXException, NotImplemented, NotAuthorized,
|
|
1187 |
FileUploadException, MarshallingException, NotImplemented, NotAuthorized,
|
|
1188 | 1188 |
InvalidSystemMetadata, InstantiationException, |
1189 | 1189 |
IllegalAccessException { |
1190 | 1190 |
|
... | ... | |
1217 | 1217 |
/** |
1218 | 1218 |
* set the access perms on a document |
1219 | 1219 |
* |
1220 |
* @throws JiBXException
|
|
1220 |
* @throws MarshallingException
|
|
1221 | 1221 |
* @throws InvalidRequest |
1222 | 1222 |
* @throws NotImplemented |
1223 | 1223 |
* @throws NotAuthorized |
... | ... | |
1231 | 1231 |
* @throws ParserConfigurationException |
1232 | 1232 |
* @throws VersionMismatch |
1233 | 1233 |
*/ |
1234 |
protected void setAccess(String pid) throws JiBXException, InvalidToken,
|
|
1234 |
protected void setAccess(String pid) throws MarshallingException, InvalidToken,
|
|
1235 | 1235 |
ServiceFailure, NotFound, NotAuthorized, NotImplemented, |
1236 | 1236 |
InvalidRequest, IOException, InstantiationException, |
1237 | 1237 |
IllegalAccessException, ParserConfigurationException, SAXException, VersionMismatch { |
... | ... | |
1278 | 1278 |
* @throws InvalidToken |
1279 | 1279 |
* @throws NotFound |
1280 | 1280 |
* @throws IOException |
1281 |
* @throws JiBXException
|
|
1281 |
* @throws MarshallingException
|
|
1282 | 1282 |
* @throws Exception |
1283 | 1283 |
*/ |
1284 | 1284 |
private void listObjects() throws InvalidToken, ServiceFailure, |
1285 | 1285 |
NotAuthorized, InvalidRequest, NotImplemented, NotFound, |
1286 |
IOException, JiBXException {
|
|
1286 |
IOException, MarshallingException {
|
|
1287 | 1287 |
|
1288 | 1288 |
Date startTime = null; |
1289 | 1289 |
Date endTime = null; |
... | ... | |
1427 | 1427 |
* @throws IOException |
1428 | 1428 |
* @throws InstantiationException |
1429 | 1429 |
* @throws IllegalAccessException |
1430 |
* @throws JiBXException
|
|
1430 |
* @throws MarshallingException
|
|
1431 | 1431 |
* @throws VersionMismatch |
1432 | 1432 |
*/ |
1433 | 1433 |
public boolean setReplicationPolicy(String pid) throws NotImplemented, |
1434 | 1434 |
NotFound, NotAuthorized, ServiceFailure, InvalidRequest, |
1435 | 1435 |
InvalidToken, IOException, InstantiationException, |
1436 |
IllegalAccessException, JiBXException, VersionMismatch {
|
|
1436 |
IllegalAccessException, MarshallingException, VersionMismatch {
|
|
1437 | 1437 |
|
1438 | 1438 |
boolean result = false; |
1439 | 1439 |
long serialVersion = 0L; |
... | ... | |
1659 | 1659 |
* @throws NotAuthorized |
1660 | 1660 |
* @throws InvalidRequest |
1661 | 1661 |
* @throws NotFound |
1662 |
* @throws JiBXException
|
|
1662 |
* @throws MarshallingException
|
|
1663 | 1663 |
* @throws IllegalAccessException |
1664 | 1664 |
* @throws InstantiationException |
1665 | 1665 |
* @throws IOException |
... | ... | |
1765 | 1765 |
* @throws InvalidRequest |
1766 | 1766 |
* @throws NotFound |
1767 | 1767 |
* @throws VersionMismatch |
1768 |
* @throws JiBXException
|
|
1768 |
* @throws MarshallingException
|
|
1769 | 1769 |
* @throws IOException |
1770 | 1770 |
* @throws IllegalAccessException |
1771 | 1771 |
* @throws InstantiationException |
1772 | 1772 |
*/ |
1773 | 1773 |
public boolean updateReplicationMetadata(String pid) throws ServiceFailure, |
1774 | 1774 |
NotImplemented, InvalidToken, NotAuthorized, InvalidRequest, |
1775 |
NotFound, VersionMismatch, InstantiationException, IllegalAccessException, IOException, JiBXException {
|
|
1775 |
NotFound, VersionMismatch, InstantiationException, IllegalAccessException, IOException, MarshallingException {
|
|
1776 | 1776 |
|
1777 | 1777 |
boolean result = false; |
1778 | 1778 |
long serialVersion = 0L; |
... | ... | |
1811 | 1811 |
* @throws InstantiationException |
1812 | 1812 |
* @throws IllegalAccessException |
1813 | 1813 |
* @throws IOException |
1814 |
* @throws JiBXException
|
|
1814 |
* @throws MarshallingException
|
|
1815 | 1815 |
* @throws NotImplemented |
1816 | 1816 |
* @throws NotAuthorized |
1817 | 1817 |
* @throws InvalidSystemMetadata |
1818 | 1818 |
* @throws InvalidToken |
1819 | 1819 |
*/ |
1820 | 1820 |
protected void updateSystemMetadata() throws ServiceFailure, InvalidRequest, InstantiationException, |
1821 |
IllegalAccessException, IOException, JiBXException, NotImplemented, NotAuthorized, InvalidSystemMetadata, InvalidToken {
|
|
1821 |
IllegalAccessException, IOException, MarshallingException, NotImplemented, NotAuthorized, InvalidSystemMetadata, InvalidToken {
|
|
1822 | 1822 |
// Read the incoming data from its Mime Multipart encoding |
1823 | 1823 |
Map<String, File> files = collectMultipartFiles(); |
1824 | 1824 |
|
Also available in: Unified diff
Replaced the JiBXException by MarshallingException.