Revision 6091
Added by Chris Jones almost 13 years ago
MetacatHandler.java | ||
---|---|---|
1 |
/**ml
|
|
1 |
/** |
|
2 | 2 |
* '$RCSfile$' |
3 | 3 |
* Copyright: 2010 Regents of the University of California and the |
4 | 4 |
* National Center for Ecological Analysis and Synthesis |
... | ... | |
42 | 42 |
import edu.ucsb.nceas.metacat.event.MetacatEventService; |
43 | 43 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
44 | 44 |
import edu.ucsb.nceas.metacat.replication.ForceReplicationHandler; |
45 |
import edu.ucsb.nceas.metacat.service.ObjectFormatService; |
|
46 | 45 |
import edu.ucsb.nceas.metacat.service.SessionService; |
47 | 46 |
import edu.ucsb.nceas.metacat.service.XMLSchemaService; |
48 | 47 |
import edu.ucsb.nceas.metacat.shared.HandlerException; |
... | ... | |
3631 | 3630 |
|
3632 | 3631 |
//set the default object format |
3633 | 3632 |
String doctype = (String) docInfo.get("doctype"); |
3634 |
ObjectFormat format = ObjectFormatService.getFormat(doctype);
|
|
3633 |
ObjectFormat format = ObjectFormat.convert(doctype);
|
|
3635 | 3634 |
if (format == null) { |
3636 | 3635 |
if (doctype.trim().equals("BIN")) { |
3637 |
format = ObjectFormatService.getFormat("application/octet-stream");
|
|
3636 |
format = ObjectFormat.OCTET_STREAM;
|
|
3638 | 3637 |
} else { |
3639 |
format = ObjectFormatService.getFormat("text/plain");
|
|
3638 |
format = ObjectFormat.convert("text/plain");
|
|
3640 | 3639 |
} |
3641 | 3640 |
} |
3642 | 3641 |
sysMeta.setObjectFormat(format); |
... | ... | |
3645 | 3644 |
|
3646 | 3645 |
// further parse EML documents to get data object format, |
3647 | 3646 |
// describes and describedBy information |
3648 |
if ( format == ObjectFormatService.getFormat("eml://ecoinformatics.org/eml/2.0.0") ||
|
|
3649 |
format == ObjectFormatService.getFormat("eml://ecoinformatics.org/eml/2.0.1") ||
|
|
3650 |
format == ObjectFormatService.getFormat("eml://ecoinformatics.org/eml/2.1.0")) {
|
|
3647 |
if ( format == ObjectFormat.EML_2_0_0 ||
|
|
3648 |
format == ObjectFormat.EML_2_0_1 ||
|
|
3649 |
format == ObjectFormat.EML_2_1_0 ) {
|
|
3651 | 3650 |
|
3652 | 3651 |
try { |
3653 | 3652 |
DataoneEMLParser emlParser = DataoneEMLParser.getInstance(); |
... | ... | |
3664 | 3663 |
emlDocument.distributionMetadata.elementAt(j); |
3665 | 3664 |
String dataDocUrl = distMetadata.url; |
3666 | 3665 |
String dataDocMimeType = ""; |
3667 |
|
|
3668 | 3666 |
if (distMetadata.mimeType == null) { |
3669 |
|
|
3670 |
dataDocMimeType = |
|
3671 |
ObjectFormatService.getFormat("application/octet-stream").toString(); |
|
3672 |
|
|
3667 |
dataDocMimeType = ObjectFormat.OCTET_STREAM.name(); |
|
3673 | 3668 |
} else { |
3674 |
|
|
3675 |
dataDocMimeType = distMetadata.mimeType; |
|
3676 |
|
|
3669 |
dataDocMimeType = distMetadata.mimeType; |
|
3677 | 3670 |
} |
3678 | 3671 |
String dataDocLocalId = ""; |
3679 | 3672 |
String dataSysMetaId = ""; |
... | ... | |
3704 | 3697 |
logMetacat.debug("Setting describedBy for " + dataDocId.getValue() + |
3705 | 3698 |
" to " + identifier.getValue()); |
3706 | 3699 |
dataSysMeta.addDescribedBy(identifier); |
3707 |
ObjectFormat f = ObjectFormatService.getFormat(dataDocMimeType);
|
|
3700 |
ObjectFormat f = ObjectFormat.convert(dataDocMimeType);
|
|
3708 | 3701 |
if (f == null) { |
3709 |
f = ObjectFormatService.getFormat("application/octet-stream");
|
|
3702 |
f = ObjectFormat.OCTET_STREAM;
|
|
3710 | 3703 |
} |
3711 | 3704 |
dataSysMeta.setObjectFormat(f); |
3712 | 3705 |
dataSysMetaId = insertOrUpdateSystemMetadata( |
... | ... | |
3728 | 3721 |
|
3729 | 3722 |
logMetacat.debug("Setting mimeType for " + |
3730 | 3723 |
dataDocId.getValue() + " to " + dataDocMimeType); |
3731 |
|
|
3732 |
ObjectFormat f = ObjectFormatService.getFormat(dataDocMimeType); |
|
3733 |
|
|
3724 |
ObjectFormat f = ObjectFormat.convert(dataDocMimeType); |
|
3734 | 3725 |
if (f == null) { |
3735 |
f = ObjectFormatService.getFormat("application/octet-stream");
|
|
3726 |
f = ObjectFormat.OCTET_STREAM;
|
|
3736 | 3727 |
} |
3737 | 3728 |
dataSysMeta.setObjectFormat(f); |
3738 | 3729 |
|
Also available in: Unified diff
In order to sync up with DataONE 0.6.1 changes, I'm backing out ObjectFormatService changes temporarily in Metacat. Most functionality will be rolled back in using the DataONE 0.6.2 tag, but some methods in ObjectFormatService (such as getListFromDisk()) will be moved into d1_libclient_java.