Revision 6982
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java | ||
---|---|---|
172 | 172 |
ObjectFormatIdentifier fmtid = null; |
173 | 173 |
|
174 | 174 |
// set the object format, fall back to defaults |
175 |
try { |
|
176 |
fmtid = ObjectFormatCache.getInstance().getFormat(doctype).getFormatId(); |
|
177 |
} catch (NotFound nfe) { |
|
178 |
// format is not registered, use default |
|
179 |
if (doctype.trim().equals("BIN")) { |
|
180 |
fmtid = ObjectFormatCache.getInstance().getFormat("application/octet-stream").getFormatId(); |
|
181 |
} else { |
|
175 |
if (doctype.trim().equals("BIN")) { |
|
176 |
// we don't know much about this file (yet) |
|
177 |
fmtid = ObjectFormatCache.getInstance().getFormat("application/octet-stream").getFormatId(); |
|
178 |
} else { |
|
179 |
try { |
|
180 |
// do we know the given format? |
|
181 |
fmtid = ObjectFormatCache.getInstance().getFormat(doctype).getFormatId(); |
|
182 |
} catch (NotFound nfe) { |
|
183 |
// format is not registered, use default |
|
182 | 184 |
fmtid = ObjectFormatCache.getInstance().getFormat("text/plain").getFormatId(); |
183 | 185 |
} |
184 | 186 |
} |
... | ... | |
325 | 327 |
String dataDocMimeType = distMetadata.mimeType; |
326 | 328 |
// default to binary |
327 | 329 |
if (dataDocMimeType == null) { |
328 |
dataDocMimeType = ObjectFormatCache.getInstance() |
|
329 |
.getFormat("application/octet-stream") |
|
330 |
.getFormatId().getValue(); |
|
330 |
dataDocMimeType = "application/octet-stream"; |
|
331 | 331 |
} |
332 | 332 |
|
333 | 333 |
// process the data |
... | ... | |
448 | 448 |
|
449 | 449 |
// set object format for the data file |
450 | 450 |
logMetacat.debug("Updating system metadata for " + dataGuid.getValue() + " to " + dataDocMimeType); |
451 |
ObjectFormatIdentifier fmt = null; |
|
451 | 452 |
try { |
452 |
ObjectFormatIdentifier fmt = |
|
453 |
ObjectFormatCache.getInstance().getFormat(dataDocMimeType).getFormatId(); |
|
454 |
dataSysMeta.setFormatId(fmt); |
|
453 |
fmt = ObjectFormatCache.getInstance().getFormat(dataDocMimeType).getFormatId(); |
|
455 | 454 |
} catch (NotFound nfe) { |
456 | 455 |
logMetacat.debug("Couldn't find format identifier for: " |
457 | 456 |
+ dataDocMimeType |
458 | 457 |
+ ". Setting it to application/octet-stream."); |
459 |
ObjectFormatIdentifier newFmtid = new ObjectFormatIdentifier();
|
|
460 |
newFmtid.setValue("application/octet-stream");
|
|
458 |
fmt = new ObjectFormatIdentifier();
|
|
459 |
fmt.setValue("application/octet-stream");
|
|
461 | 460 |
} |
462 |
|
|
461 |
dataSysMeta.setFormatId(fmt); |
|
462 |
|
|
463 | 463 |
// update the values |
464 | 464 |
HazelcastService.getInstance().getSystemMetadataMap().put(dataSysMeta.getIdentifier(), dataSysMeta); |
465 | 465 |
|
Also available in: Unified diff
handle "BIN" objects so as to avoid repeated calls to lookup the non-existent ObjectFormat