source: TI01-discovery-Ingest/trunk/v4.3.0/ingestAutomation-upgrade/OAIBatch/DatasetBasicParameters.py @ 7186

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery-Ingest/trunk/v4.3.0/ingestAutomation-upgrade/OAIBatch/DatasetBasicParameters.py@7186
Revision 7186, 1.5 KB checked in by sdonegan, 9 years ago (diff)

Adding files from v4.2.0 tag to form basis for v4.3.0 version

Line 
1#!/usr/bin/env python
2'''
3Class representing basic parameters extracted from the input file. 
4SJD Feb 24th 2009
5
6-updated to reflect inclusion of updated DIF and MDIP in ndgCommon - SJD 210509
7'''
8#from DIF import DIF
9#from MDIP import MDIP
10from ndg.common.src.models.DIF import DIF
11from ndg.common.src.models.MDIP import MDIP
12import os,sys, logging
13
14class DatasetBasicParameters:
15   
16    '''
17    Class representing extracted parameters from the input file
18    @param filename: Name of the original_document_file   
19    '''
20   
21    def __init__(self, filename,format):
22       
23        logging.info("Retrieving identifier for metadata record " + filename + " in format: " + format)
24        xml=file(filename).read()
25               
26        self._datacentre_format = format
27       
28        #If ingesting DIF
29        if self._datacentre_format == "DIF":
30            d=DIF(xml)
31            self.datasetID=d.entryID
32            self.datasetName = d.datasetTitle
33            self.datacentreName = d.datacentreName
34            self.metadataCreationDate=d.metadataCreationDate
35           
36        #If ingesting MDIP           
37        elif self._datacentre_format == "MDIP":
38            d=MDIP(xml)           
39            self.datasetID=d.id
40            self.datasetName = d.datasetTitle
41            self.datacentreName = d.datacentreName
42            self.metadataCreationDate=d.metadataCreationDate
43           
44        else:
45            raise TypeError, "Only handles DIF or MDIP here."
Note: See TracBrowser for help on using the repository browser.