예제 #1
0
 def makeWorkingFolders(self, processInfo):
         global TMPSPACE
         # /make working folder
         tmpPath=TMPSPACE+"/workfolder_%s" % processInfo.num
         processInfo.addLog("  working folder:%s\n" % (tmpPath))
         if not os.path.exists(tmpPath):
             self.logger.info("  will make working folder:%s" % tmpPath)
             os.makedirs(tmpPath)
             processInfo.addLog("  working folder created:%s\n" % (tmpPath))
         processInfo.workFolder=tmpPath
예제 #2
0
 def output_eoSip(self, processInfo, basePath, pathRules):
         global debug,logger
         processInfo.addLog("write EoSip, base path:%s" % path)
         self.logger.info("write EoSip, base path:%s" % path)
예제 #3
0
 def makeBrowses(self,processInfo):
         global debug,logger
         processInfo.addLog("make browses")
         self.logger.info("make browses")
예제 #4
0
 def extractMetadata(self,met,processInfo):
         global debug,logger
         processInfo.addLog("extract metadata")
         self.logger.info("extract metadata")
예제 #5
0
 def prepareProducts(self,processInfo):
         global debug,logger
         processInfo.addLog("prepare product in:%s" % (processInfo.workFolder))
         self.logger.info("prepare product");
예제 #6
0
 def verifySourceProduct(self, processInfo):
         global debug,logger
         processInfo.addLog("verifying product:%s" % (processInfo.srcPath))
         self.logger.info("verifying product");
예제 #7
0
 def createDestinationProduct(self, processInfo):
         processInfo.addLog("create dest product")
         self.logger.info("create dest product") 
예제 #8
0
 def createSourceProduct(self, processInfo):
         processInfo.addLog("create src product")
         self.logger.info("create srcproduct")
예제 #9
0
        def doOneProduct(self, processInfo):
                global OUTPUT_EO_SIP_PATTERN, OUTSPACE
                
                self.verifySourceProduct(processInfo)
                # create work folder
                workfolder=self.makeWorkingFolders(processInfo)
                # instanciate source product
                self.createSourceProduct(processInfo)
                # prepare it: move/decompress it in work folder
                self.prepareProducts(processInfo)
                # create empty metadata
                met=metadata.Metadata(mission_metadatas)
                if self.debug!=0:
                        print "\n###  initial metadata dump:\n%s" % met.toString()
                #
                self.extractMetadata(met, processInfo)
                if self.debug!=0:
                        print "\n###  final metadata dump:\n%s" % met.toString()

                # instanciate destination product
                self.createDestinationProduct(processInfo)

                # set metadata
                processInfo.destProduct.setMetadata(met)
                processInfo.destProduct.setXmlMappingMetadata(xmlMappingMetadata, xmlMappingBrowse)

                # build product name
                patternName = OUTPUT_EO_SIP_PATTERN
                processInfo.destProduct.buildProductNames(patternName, definitions_EoSip.getDefinition('PRODUCT_EXT'))
                self.logger.info("  Eo-Sip product name:%s"  % processInfo.destProduct.productShortName)
                processInfo.addLog("  Eo-Sip product name:%s"  % processInfo.destProduct.productShortName)

                # make Eo-Sip tmp folder
                processInfo.eosipTmpFolder = processInfo.workFolder + "/" + processInfo.destProduct.productShortName
                if not os.path.exists(processInfo.eosipTmpFolder):
                        self.logger.info("  will make tmpEosipFolder:%s" % processInfo.eosipTmpFolder)
                        processInfo.addLog("  will make tmpEosipFolder:%s" % processInfo.eosipTmpFolder)
                        os.makedirs(processInfo.eosipTmpFolder)

                # make browse file
                self.makeBrowses(processInfo)

                # make report files
                # SIP report
                tmp=processInfo.destProduct.buildSipReportFile()
                processInfo.addLog("  Sip report file built:%s" %  (tmp))
                self.logger.info("  Sip report file built:%s" %  (tmp))

                # browse reports
                tmp=processInfo.destProduct.buildBrowsesReportFile()
                n=0
                for item in tmp:
                    processInfo.addLog("  Browse[%d] report file built:%s\n" %  (n, item))
                    self.logger.info("  Browse[%d] report file built:%s" %  (n, item))
                    n=n+1

                # metadata report
                tmp=processInfo.destProduct.buildProductReportFile()
                processInfo.addLog("  Product report file built:%s" % tmp)
                self.logger.info("  Product report file built:%s" % tmp)

                #
                processInfo.destProduct.info()
                
                # output Eo-Sip product
                self.output_eoSip(processInfo, OUTSPACE, OUTPUT_RELATIVE_PATH_TREES)
                #processInfo.destProduct.writeToFolder(OUTSPACE)
                #processInfo.addLog("  Eo-Sip product writen in folder:%s\n" %  (OUTSPACE))
                #self.logger.info("  Eo-Sip product writen in folder:%s\n" %  (OUTSPACE))

                
                print "\n\n\n\nLog:%s\n" % processInfo.prodLog