Revision 6960
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java | ||
---|---|---|
49 | 49 |
import org.apache.log4j.Logger; |
50 | 50 |
import org.apache.wicket.protocol.http.MockHttpServletRequest; |
51 | 51 |
import org.dataone.client.ObjectFormatCache; |
52 |
import org.dataone.eml.DataoneEMLParser; |
|
53 |
import org.dataone.eml.EMLDocument; |
|
54 |
import org.dataone.eml.EMLDocument.DistributionMetadata; |
|
52 | 55 |
import org.dataone.ore.ResourceMapFactory; |
53 | 56 |
import org.dataone.service.exceptions.BaseException; |
54 | 57 |
import org.dataone.service.exceptions.InvalidRequest; |
... | ... | |
69 | 72 |
import org.dataone.service.types.v1.util.ChecksumUtil; |
70 | 73 |
import org.dataone.service.util.DateTimeMarshaller; |
71 | 74 |
import org.dspace.foresite.ResourceMap; |
72 |
import org.ecoinformatics.datamanager.DataManager; |
|
73 |
import org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface; |
|
74 |
import org.ecoinformatics.datamanager.parser.DataPackage; |
|
75 | 75 |
import org.jibx.runtime.JiBXException; |
76 | 76 |
import org.xml.sax.SAXException; |
77 | 77 |
|
... | ... | |
86 | 86 |
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlException; |
87 | 87 |
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException; |
88 | 88 |
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService; |
89 |
import edu.ucsb.nceas.metacat.dataquery.MetacatDatabaseConnectionPoolFactory; |
|
90 | 89 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
91 | 90 |
import edu.ucsb.nceas.metacat.replication.ReplicationService; |
92 | 91 |
import edu.ucsb.nceas.metacat.shared.AccessException; |
... | ... | |
323 | 322 |
|
324 | 323 |
try { |
325 | 324 |
inputStream = MetacatHandler.read(localId); |
326 |
DatabaseConnectionPoolInterface connectionPool = |
|
327 |
MetacatDatabaseConnectionPoolFactory.getDatabaseConnectionPoolInterface(); |
|
328 |
DataManager dataManager = |
|
329 |
DataManager.getInstance(connectionPool, connectionPool.getDBAdapterName()); |
|
330 |
DataPackage dataPackage = dataManager.parseMetadata(inputStream); |
|
331 |
|
|
325 |
|
|
326 |
DataoneEMLParser emlParser = DataoneEMLParser.getInstance(); |
|
327 |
EMLDocument emlDocument = emlParser.parseDocument(inputStream); |
|
328 |
|
|
332 | 329 |
// iterate through the data objects in the EML doc and add sysmeta |
333 | 330 |
logMetacat.debug("In createSystemMetadata() the number of data " |
334 | 331 |
+ "entities is: " |
335 |
+ dataPackage.getEntityNumber());
|
|
332 |
+ emlDocument.distributionMetadata);
|
|
336 | 333 |
|
337 | 334 |
// for generating the ORE map |
338 | 335 |
Map<Identifier, List<Identifier>> idMap = new HashMap<Identifier, List<Identifier>>(); |
339 | 336 |
List<Identifier> dataIds = new ArrayList<Identifier>(); |
340 | 337 |
|
341 | 338 |
// iterate through data objects described by the EML |
342 |
if (dataPackage.getEntityList() != null) {
|
|
343 |
for (int j = 0; j < dataPackage.getEntityList().length; j++) {
|
|
339 |
if (emlDocument.distributionMetadata != null) {
|
|
340 |
for (int j = 0; j < emlDocument.distributionMetadata.size(); j++) {
|
|
344 | 341 |
|
345 |
String dataDocUrl = dataPackage.getEntityList()[j].getURL(); |
|
346 |
String dataDocMimeType = dataPackage.getEntityList()[j].getDataFormat(); |
|
342 |
DistributionMetadata distMetadata = emlDocument.distributionMetadata.elementAt(j); |
|
343 |
String dataDocUrl = distMetadata.url; |
|
344 |
String dataDocMimeType = distMetadata.mimeType; |
|
347 | 345 |
// default to binary |
348 | 346 |
if (dataDocMimeType == null) { |
349 | 347 |
dataDocMimeType = ObjectFormatCache.getInstance() |
Also available in: Unified diff
remove DML for parsing -- the D1 EML parser still uses DOM, so this may not be too big of a perfromance improvement