Ignore:
Timestamp:
05/05/09 14:49:17 (11 years ago)
Author:
cbyrom
Message:

Update ingest scripts for use with the OAIInfoEditor harvest
functionality - to allow config and jar file resources to be
retrieved even if not running in ingest package + allow different
harvest directory and format, compared with that of the config
file, to be specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/PostgresRecord.py

    r5167 r5248  
    55''' 
    66from xml.etree import cElementTree 
    7 import os, sys, logging, re 
     7import os, sys, logging, re, pkg_resources 
    88import csml.csml2Moles.molesReadWrite as MRW 
    99from ndg.common.src.models.ndgObject import ndgObject 
     
    1212from SpatioTemporalData import SpatioTemporalData 
    1313import keywordAdder 
     14 
     15SAXON_JAR_FILE = 'lib/saxon9.jar' 
    1416 
    1517class PostgresRecord: 
     
    184186        xqFile = "currentQuery" + xQueryType + ".xq"  
    185187        FileUtilities.createFile(xqFile, xquery) 
     188         
     189        # ensure the jar file is available - NB, this may be running from a different 
     190        # location - e.g. the OAIInfoEditor.lib.harvester - and this won't have the 
     191        # saxon file directly on its filesystem 
     192        jarFile = pkg_resources.resource_filename('OAIBatch', SAXON_JAR_FILE) 
    186193 
    187194        # Now do the transform 
    188195        os.putenv ('PATH', ':/usr/java/jdk1.5.0_03/bin:/usr/java/jdk1.5.0_03:/usr/java/jdk1.5.0_03/lib/tools.jar:/usr/local/WSClients/OAIBatch:/usr/local/exist-client/bin:/bin:/usr/bin:.') 
    189         xqCommand = "java -cp ./lib/saxon9.jar net.sf.saxon.Query " + xqFile + " !omit-xml-declaration=yes" 
     196        xqCommand = "java -cp %s net.sf.saxon.Query %s !omit-xml-declaration=yes" %(jarFile, xqFile) 
    190197        logging.debug("Running saxon command: " + xqCommand) 
    191198        pipe = os.popen(xqCommand + " 2>&1") 
Note: See TracChangeset for help on using the changeset viewer.