Project

General

Profile

« Previous | Next » 

Revision 6088

Changes in the DataONE ObjectFormat class deprecate the convert() method, and we're now using Metacat's ObjectFormatService to look up object format attributes. The following changes replace ObjectFormat.convert() with ObjectFormatService.getFormat() in several classes.

Also added a few methods to ObjectFormatService where doRefresh() calls populateObjectFormatList(), which in turn calls either getCachedList() or falls back to getListFromDisk() in the case of a CN, or will call cn.listFormats() from the D1 libclient if the Metacat installation is an MN.

Added the ObjectFormatService.objectFormatMap as a static hash used for lookups of object formats based on their canonical identifier. This is populated from the ObjectFormatService.objectFormatList.

Added deserializeObjectFormatList(InputStream) to return the ObjectFormatList from the XML serialization (from Metacat or disk).

View differences:

IdentifierManager.java
43 43
import edu.ucsb.nceas.metacat.database.DBConnection;
44 44
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
45 45
import edu.ucsb.nceas.metacat.properties.PropertyService;
46
import edu.ucsb.nceas.metacat.service.ObjectFormatService;
46 47
import edu.ucsb.nceas.metacat.shared.ServiceException;
47 48
import edu.ucsb.nceas.metacat.util.DocumentUtil;
48 49
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
1001 1002
                //cs.setAlgorithm(ChecksumAlgorithm.convert(checksumAlgorithm));
1002 1003
                oi.setChecksum(cs);
1003 1004
                
1004
                ObjectFormat oFormat = ObjectFormat.convert(format);
1005
                ObjectFormat oFormat = ObjectFormatService.getFormat(format);
1005 1006
                if(oFormat != null)
1006 1007
                {
1007 1008
                    oi.setObjectFormat(oFormat);
1008 1009
                }
1009 1010
                else
1010 1011
                { //if there is no object format, just default to text/plain
1011
                    oi.setObjectFormat(ObjectFormat.OCTET_STREAM);
1012
                    oi.setObjectFormat(ObjectFormatService.getFormat("application/octet-stream"));
1012 1013
                }
1013 1014
                                
1014 1015
                oi.setSize(size);

Also available in: Unified diff