Index: /trunk/ippToPsps/jython/batch.py
===================================================================
--- /trunk/ippToPsps/jython/batch.py	(revision 33258)
+++ /trunk/ippToPsps/jython/batch.py	(revision 33259)
@@ -30,6 +30,5 @@
     def __init__(self, 
                  logger, 
-                 configPath,
-                 doc,
+                 config,
                  gpc1Db,
                  ippToPspsDb,
@@ -42,6 +41,5 @@
         self.everythingOK = False
         self.readHeader = False
-        self.configPath = configPath
-        self.doc = doc
+        self.config = config
         self.fits = fits
         self.useFullTables = useFullTables
@@ -75,10 +73,5 @@
                return
 
-        # get info from config
-        self.survey = self.doc.find("options/survey").text
-        self.pspsSurvey = self.doc.find("options/pspsSurvey").text
-        self.dvoGpc1Label = self.doc.find("dvo/gpc1Label").text
-        self.dvoLocation = self.doc.find("dvo/location").text
-        self.scratchDb = ScratchDb(logger, self.doc, self.useFullTables)
+        self.scratchDb = ScratchDb(logger, self.config, self.useFullTables)
 
         if not self.scratchDb.everythingOK: return
@@ -87,28 +80,23 @@
         self.tablesToExport = []
 
-        if self.survey != "":
-            self.surveyID = self.scratchDb.getSurveyID(self.survey)
+        if self.config.survey != "":
+            self.surveyID = self.scratchDb.getSurveyID(self.config.survey)
         else:
             self.surveyID = -1;
        
-        # get some options from the config
-        self.testMode = int(self.doc.find("options/testMode").text)
-        self.dataRelease = int(self.doc.find("metadata/dataRelease").text)
-
         # create datastore object
-        self.datastore = Datastore(self.logger, self.doc, self.ippToPspsDb)
+        self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb)
 
         # get local storage location from config
         self.batchName = Batch.getNameFromID(self.batchID)
-        self.basePath = self.doc.find("localOutPath").text
         self.subDir = Batch.getSubDir(
-                self.basePath,
+                self.config.basePath,
                 self.batchType, 
-                self.dvoGpc1Label)
+                self.config.dvoLabel)
 
         self.localOutPath = Batch.getOutputPath(
-                self.basePath,
+                self.config.basePath,
                 self.batchType, 
-                self.dvoGpc1Label,
+                self.config.dvoLabel,
                 self.batchID)
 
@@ -125,8 +113,5 @@
         self.logger.infoTitle("New " + self.batchType + " batch")
         self.logger.infoPair("Batch name", self.batchName)
-        self.logger.infoPair("Survey", self.survey)
         self.logger.infoPair("Survey ID", "%d" % self.surveyID)
-        self.logger.infoPair("Publishing to PSPS as survey", self.pspsSurvey)
-        self.logger.infoPair("DVO location", self.dvoLocation)
         self.logger.infoBool("Use full DVO tables?", self.useFullTables)
 
@@ -227,5 +212,5 @@
          if value != "NULL": return value
          else:
-             if not self.testMode: return "NULL"
+             if not self.config.test: return "NULL"
              header[key] = default
              self.logger.infoPair("Hardcoding " + key + " to", header[key])
@@ -256,5 +241,5 @@
         root.attrib['type'] = self.batchType
         root.attrib['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") 
-        if self.batchType != "IN": root.attrib['survey'] = self.pspsSurvey
+        if self.batchType != "IN": root.attrib['survey'] = self.config.pspsSurvey
         try: self.minObjID
         except: pass
@@ -287,7 +272,7 @@
         # set up filenams and paths
         tarFile = Batch.getTarFile(self.batchID)
-        tarPath = Batch.getTarPath(self.basePath, self.batchType, self.dvoGpc1Label, self.batchID)
+        tarPath = Batch.getTarPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID)
         tarballFile = Batch.getTarballFile(self.batchID)
-        tarballPath = Batch.getTarballPath(self.basePath, self.batchType, self.dvoGpc1Label, self.batchID)
+        tarballPath = Batch.getTarballPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID)
 
         # tar directory
@@ -498,5 +483,5 @@
 
         # TODO path to DVO prog hardcoded temporarily
-        cmd = "../src/dvograbber " + self.configPath + " " + self.dvoLocation
+        cmd = "../src/dvograbber " + self.config.path + " " + self.config.dvoLocation
         self.logger.infoPair("Running DVO", cmd)
         p = Popen(cmd, shell=True, stdout=PIPE)
@@ -537,5 +522,5 @@
             else:
                 self.writeBatchManifest()
-                if int(self.doc.find("options/publishToDatastore").text): 
+                if self.config.datastorePublishing: 
                     # tar and zip ready for publication to datastore
                     if self.tarAndZip():
@@ -544,5 +529,5 @@
                         Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile)
 
-                if int(self.doc.find("options/reportNulls").text): self.reportNullsInAllPspsTables(False)
+                if self.config.reportNulls: self.reportNullsInAllPspsTables(False)
 
 from datastore import Datastore
Index: /trunk/ippToPsps/jython/config.py
===================================================================
--- /trunk/ippToPsps/jython/config.py	(revision 33259)
+++ /trunk/ippToPsps/jython/config.py	(revision 33259)
@@ -0,0 +1,188 @@
+#!/usr/bin/env jython
+
+import logging
+from xml.etree.ElementTree import ElementTree, Element, tostring
+
+from pslogger import PSLogger
+
+
+'''
+A class encapsulating the ippToPsps config file
+'''
+class Config(object):
+
+
+    '''
+    Constructor
+
+    Basically reads the entire config and stores values to class variables
+    '''
+    def __init__(self, path):
+
+        self.path = path
+        self.logger = None
+
+        # this is the border (in degrees) that we place around any loading box of 
+        # PS1 pointings to ensure we pull a large enough area out of DVO
+        self.BORDER = 1.6
+        self.refresh()
+
+    def refresh(self):
+
+        try:
+            self.logger.infoPair("Reading config from", self.path)
+        except: pass
+        self.doc = ElementTree(file=self.path)
+
+        # test mode?
+        if int(self.doc.find("options/testMode").text) == 1: 
+            self.test = True
+        else:
+            self.test = False
+
+        # location for data
+        self.basePath = self.doc.find("localOutPath").text
+
+        # DVO stuff
+        self.dvoLabel = self.doc.find("dvo/gpc1Label").text
+        self.dvoLocation = self.doc.find("dvo/location").text
+
+        # other options
+        self.epoch = self.doc.find("options/epoch").text
+        self.survey = self.doc.find("options/survey").text
+        self.pspsSurvey = self.doc.find("options/pspsSurvey").text
+        self.dataRelease = int(self.doc.find("metadata/dataRelease").text)
+
+        # get RA/Dec limits, if any
+        try: self.minRa = float(self.doc.find("dvo/minRA").text)
+        except: self.minRa = 0.0
+        try: self.maxRa = float(self.doc.find("dvo/maxRA").text)
+        except: self.maxRa = 360.0
+        try: self.minDec = float(self.doc.find("dvo/minDec").text)
+        except: self.minDec = -30.0
+        try: self.maxDec = float(self.doc.find("dvo/maxDec").text)
+        except: self.maxDec = 90.0
+
+        # loading box size, if none set to default
+        try: self.boxSize = float(self.doc.find("dvo/boxSize").text)
+        except: self.boxSize = 4.0
+        self.halfBox = self.boxSize/2.0
+        self.boxSizeWithBorder = self.boxSize + (self.BORDER * 2)
+
+        # datastore stuff
+        self.datastoreProduct = self.doc.find("datastore/product").text
+        self.datastoreType = self.doc.find("datastore/type").text
+        if int(self.doc.find("options/publishToDatastore").text) == 1: 
+            self.datastorePublishing = True
+        else:
+            self.datastorePublishing = False
+
+        # forcing?
+        if int(self.doc.find("options/force").text) == 1: 
+            self.force = True
+        else:
+            self.force = False
+
+        # reporting NULLS in tables?
+        if int(self.doc.find("options/reportNulls").text) == 1: 
+            self.reportNulls = True
+        else:
+            self.reportNulls = False
+
+        # get batch types to load
+        self.batchTypes = []
+        if int(self.doc.find("options/queueP2").text) == 1: self.batchTypes.append("P2")
+        if int(self.doc.find("options/queueST").text) == 1: self.batchTypes.append("ST")
+
+        # get IDs if any are set
+        self.ids = []
+        try:
+            for element in self.doc.findall('options/ids/id'):
+                self.ids.append(int(element.text))
+        except:
+            pass
+
+    '''
+    Prints everything for this config
+    '''
+    def printAll(self):
+
+        try:
+            self.logger.infoSeparator()
+            self.logger.infoPair("Config path", self.path)
+            self.logger.infoPair("Survey", self.survey)
+            self.logger.infoPair("Publishing to PSPS as survey", self.pspsSurvey)
+            self.logger.infoPair("Loading epoch", self.epoch)
+            self.logger.infoPair("Data release", "%d" % self.dataRelease)
+            self.logger.infoBool("Test mode?", self.test)
+            self.logger.infoBool("Forcing?", self.force)
+            self.logger.infoPair("Number of ids loaded from config", "%d" % len(self.ids))
+            self.logger.infoBool("Reporting NULLS?", self.reportNulls)
+            for batchType in self.batchTypes: logger.infoPair("Queuing batch type", batchType)
+        except:
+            pass
+
+        self.printDvoInfo()
+        self.printDatastoreInfo()
+        self.printBoxCoords()
+        try: self.logger.infoSeparator()
+        except: pass
+
+
+    '''
+    Creates a logger object and returns it
+    '''
+    def getLogger(self, name, stdout=1, sendToFile=0):
+        
+        logging.setLoggerClass(PSLogger)
+        self.logger = logging.getLogger(name)
+        self.logger.setup(name, self.basePath, self.dvoLabel, stdout, sendToFile)
+
+        return self.logger
+
+    '''
+    Prints the currently set DVO info
+    '''
+    def printDvoInfo(self):
+
+        try:
+            self.logger.infoPair("DVO label", self.dvoLabel)
+            self.logger.infoPair("DVO location", self.dvoLocation)
+        except:
+            pass
+   
+    '''
+    Prints datastore info
+    '''
+    def printDatastoreInfo(self):
+
+        try:
+            self.logger.infoBool("Datastore publishing?", self.datastorePublishing)
+            if self.datastorePublishing:
+                self.logger.infoPair("Datastore type", self.datastoreProduct)
+                self.logger.infoPair("Datastore product", self.datastoreType)
+        except:
+            pass
+   
+    '''
+    Prints the currently set RA/Dec bounding box
+    '''
+    def printBoxCoords(self):
+
+        try:
+            self.logger.infoPair("RA limits", "%.1f -> %.1f" % (self.minRa, self.maxRa))
+            self.logger.infoPair("Dec limits", "%.1f -> %.1f" % (self.minDec, self.minDec))
+            self.logger.infoPair("Loading box size", "%.1f degrees" % self.boxSize)
+        except:
+            pass
+   
+
+    '''
+    Various db metadata getters
+    '''
+    def getDbName(self, dbType): return self.doc.find(dbType +"/name").text
+    def getDbHost(self, dbType): return self.doc.find(dbType +"/host").text
+    def getDbUser(self, dbType): return self.doc.find(dbType +"/user").text
+    def getDbPassword(self, dbType): return self.doc.find(dbType +"/password").text
+
+
Index: /trunk/ippToPsps/jython/czardb.py
===================================================================
--- /trunk/ippToPsps/jython/czardb.py	(revision 33258)
+++ /trunk/ippToPsps/jython/czardb.py	(revision 33259)
@@ -17,6 +17,6 @@
     Constructor
     '''
-    def __init__(self, logger, doc):
-        super(CzarDb, self).__init__(logger, doc, "czardatabase")
+    def __init__(self, logger, config):
+        super(CzarDb, self).__init__(logger, config, "czardatabase")
 
 
Index: /trunk/ippToPsps/jython/datastore.py
===================================================================
--- /trunk/ippToPsps/jython/datastore.py	(revision 33258)
+++ /trunk/ippToPsps/jython/datastore.py	(revision 33259)
@@ -19,17 +19,10 @@
 
     '''
-    def __init__(self, logger, doc, ippToPspsDb):
+    def __init__(self, logger, config, ippToPspsDb):
     
         # setup logger
         self.logger = logger
-        self.doc = doc
+        self.config = config
         self.ippToPspsDb = ippToPspsDb
-        self.logger.debug("Datastore constructor")
-
-        # open config
-        self.product = doc.find("datastore/product").text
-        self.type = doc.find("datastore/type").text
-
-        self.logger.debug("Using product: '" + self.product + "' and type: '" + self.type + "'")
 
     '''
@@ -49,6 +42,6 @@
         command  = "dsreg --add " + name + "\
                     --link --datapath " + path + "\
-                    --type " + self.type + "\
-                    --product " + self.product + "\
+                    --type " + self.config.datastoreType + "\
+                    --product " + self.config.datastoreProduct + "\
                     --list " + tempFile.name
 
@@ -82,5 +75,5 @@
                    --del " + name + " \
                    --rm \
-                   --product " + self.product
+                   --product " + self.config.datastoreProduct
 
         p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
Index: /trunk/ippToPsps/jython/detectionbatch.py
===================================================================
--- /trunk/ippToPsps/jython/detectionbatch.py	(revision 33258)
+++ /trunk/ippToPsps/jython/detectionbatch.py	(revision 33259)
@@ -33,6 +33,5 @@
     def __init__(self, 
                  logger,
-                 configPath,
-                 configDoc,
+                 config,
                  gpc1Db,
                  ippToPspsDb,
@@ -43,6 +42,5 @@
        super(DetectionBatch, self).__init__(
                logger,
-               configPath,
-               configDoc,
+               config,
                gpc1Db,
                ippToPspsDb,
@@ -75,5 +73,5 @@
 
        # if test mode
-       if self.testMode:
+       if self.config.test:
            self.startX = 3
            self.endX = 4
@@ -221,5 +219,5 @@
         self.scratchDb.updateFilterID("FrameMeta", self.filter)
         self.scratchDb.updateAllRows("FrameMeta", "calibModNum", str(self.calibModNum))
-        self.scratchDb.updateAllRows("FrameMeta", "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows("FrameMeta", "dataRelease", str(self.config.dataRelease))
 
     '''
@@ -368,5 +366,5 @@
         self.scratchDb.updateFilterID(tableName, self.filter)
         self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
-        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
         if 'NASTRO' in header: self.totalNumPhotoRef = self.totalNumPhotoRef + int(header['NASTRO'])
         self.scratchDb.replaceNullsInThisColumn(tableName, "polyOrder", "0")
@@ -455,5 +453,5 @@
                , '" + self.dateStr + "' \
                , 0 \
-               , " + str(self.dataRelease) + "\
+               , " + str(self.config.dataRelease) + "\
                FROM " + ippTableName
         self.scratchDb.execute(sql)
@@ -499,5 +497,5 @@
         self.scratchDb.execute(sql)
 
-        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
 
     '''
@@ -528,5 +526,5 @@
 
         self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
-        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease))
 
 
@@ -752,5 +750,5 @@
     def importIppTables(self, filter=""):
 
-       if self.testMode: regex = "XY33.psf"
+       if self.config.test: regex = "XY33.psf"
        else : regex = ".*.psf"
   
Index: /trunk/ippToPsps/jython/dvo.py
===================================================================
--- /trunk/ippToPsps/jython/dvo.py	(revision 33258)
+++ /trunk/ippToPsps/jython/dvo.py	(revision 33259)
@@ -16,5 +16,4 @@
 from java.lang import *
 from java.sql import *
-from xml.etree.ElementTree import ElementTree, Element, tostring
 
 
@@ -35,17 +34,16 @@
 
     '''
-    def __init__(self, logger, doc):
+    def __init__(self, logger, config):
 
         # set up logging
         self.logger = logger
-        self.doc = doc
+        self.config = config
         self.logger.infoSeparator()
-        self.dvoLocation = self.doc.find("dvo/location").text
 
         # create database object
-        self.scratchDb = ScratchDb(logger, self.doc, 1)
+        self.scratchDb = ScratchDb(logger, self.config, 1)
 
         # or decide if we are using the right DVO
-        self.correctDvo = self.scratchDb.isCorrectDvo(self.dvoLocation)
+        self.correctDvo = self.scratchDb.isCorrectDvo(self.config.dvoLocation)
 
         # set up empty lists
@@ -57,7 +55,8 @@
 
         if not self.correctDvo:
-            response = raw_input("* Wrong DVO is use. Do you want to reset and use '" + self.dvoLocation + "' instead (y/n)? ")
+            print "*******************************************************************************"
+            response = raw_input("**** Wrong DVO in use. Do you want to reset and use '" + self.config.dvoLocation + "' instead (y/n)? ")
             if response == "y":
-                response = raw_input("* Are you ABSOLUTELY sure you want to do this? (y/n)? ")
+                response = raw_input("**** Are you ABSOLUTELY sure you want to do this? (y/n)? ")
                 if response == "y":
                     self.resetAllTables()
@@ -101,5 +100,5 @@
 
         # check if we have up-to-date version
-        path = self.dvoLocation + "/Images.dat"
+        path = self.config.dvoLocation + "/Images.dat"
         if self.scratchDb.alreadyImportedThisDvoTable(path): 
             self.logger.infoPair("DVO Images.dat file", "up-to-date")
@@ -156,5 +155,5 @@
         if not self.correctDvo: return
 
-        path =  self.dvoLocation + "/SkyTable.fits"
+        path =  self.config.dvoLocation + "/SkyTable.fits"
         if self.scratchDb.alreadyImportedThisDvoTable(path): 
             self.logger.infoPair("DVO SkyTable.fits file", "up-to-date")        
@@ -173,5 +172,5 @@
         
         self.scratchDb.setImportedThisDvoTable(path)
-        self.logger.infoPair("Finished importing SkyTable at", self.dvoLocation)
+        self.logger.infoPair("Finished importing SkyTable at", self.config.dvoLocation)
 
     '''
@@ -181,4 +180,5 @@
 
         halfSide = side/2.0
+        print "%f %f %f" % (ra, dec, side)
         self.setSkyArea(ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)
     
@@ -208,5 +208,5 @@
 
         # reset all lists
-        allRegions = self.scratchDb.getDvoRegionsForThisBox(minRa, maxRa, minDec, maxDec)
+        allRegions = self.scratchDb.getDvoRegions(minRa, maxRa, minDec, maxDec)
         allIngestedRegions = self.scratchDb.getIngestedDvoRegions()
         self.regionsToIngest = []
@@ -219,6 +219,6 @@
         for region in allRegions:
 
-           cpmPath = self.dvoLocation + "/" + region + ".cpm"
-           cptPath = self.dvoLocation + "/" + region + ".cpt"
+           cpmPath = self.config.dvoLocation + "/" + region + ".cpm"
+           cptPath = self.config.dvoLocation + "/" + region + ".cpt"
 
            # check for existence of cpm and cpt files
@@ -262,5 +262,5 @@
         # go no further if we've already partly ingested a different DVO
         if not self.correctDvo:
-            self.logger.infoPair("Wrong DVO in use", self.dvoLocation)
+            self.logger.infoPair("Wrong DVO in use", self.config.dvoLocation)
             return
 
@@ -327,6 +327,6 @@
 
             # get combined size of cpm and cpt files
-            size = size + self.getDiskSize(self.dvoLocation + "/" + region + ".cpm")
-            size = size + self.getDiskSize(self.dvoLocation + "/" + region + ".cpt")
+            size = size + self.getDiskSize(self.config.dvoLocation + "/" + region + ".cpm")
+            size = size + self.getDiskSize(self.config.dvoLocation + "/" + region + ".cpt")
 
         return size
@@ -357,6 +357,6 @@
         for region in self.regionsToIngest:
 
-           cpmPath = self.dvoLocation + "/" + region + ".cpm"
-           cptPath = self.dvoLocation + "/" + region + ".cpt"
+           cpmPath = self.config.dvoLocation + "/" + region + ".cpm"
+           cptPath = self.config.dvoLocation + "/" + region + ".cpt"
 
            cpmTableName = self.scratchDb.getDbFriendlyTableName(region + ".cpm")
Index: /trunk/ippToPsps/jython/fits.py
===================================================================
--- /trunk/ippToPsps/jython/fits.py	(revision 33258)
+++ /trunk/ippToPsps/jython/fits.py	(revision 33259)
@@ -15,12 +15,11 @@
 
     '''
-    def __init__(self, logger, doc, originalPath):
+    def __init__(self, logger, config, originalPath):
 
        # set class variables
        self.originalPath = originalPath
        self.logger = logger
-       self.doc = doc
+       self.config = config
        self.header = None
-       self.localDir = self.doc.find("localOutPath").text
 
        # does this file even exist?
@@ -31,5 +30,5 @@
        # ok, we have a file, now copy it locally to save on NFS overhead
        self.logger.debugPair("FITS file", self.originalPath)
-       #self.localCopyPath = self.localDir + "/temp.fits"
+       #self.localCopyPath = self.config.basePath + "/temp.fits"
        #shutil.copy2(self.originalPath, self.localCopyPath)
 
Index: /trunk/ippToPsps/jython/gpc1db.py
===================================================================
--- /trunk/ippToPsps/jython/gpc1db.py	(revision 33258)
+++ /trunk/ippToPsps/jython/gpc1db.py	(revision 33259)
@@ -20,6 +20,6 @@
     Constructor
     '''
-    def __init__(self, logger, doc):
-        super(Gpc1Db, self).__init__(logger, doc, "gpc1database")
+    def __init__(self, logger, config):
+        super(Gpc1Db, self).__init__(logger, config, "gpc1database")
 
     '''
@@ -227,5 +227,5 @@
         if len(files) < 1: return None
 
-        return Fits(self.logger, self.doc, files[0]) # TODO just returning first file - check
+        return Fits(self.logger, self.config, files[0]) # TODO just returning first file - check
 
 
@@ -304,5 +304,5 @@
 
                     # if we get here, then the cmf is readable, now check the stack_id
-                    fits = Fits(self.logger, self.doc, path)
+                    fits = Fits(self.logger, self.config, path)
                     if fits.getPrimaryHeaderValue("STK_ID") == str(stackID):
                         # we have the right file!
Index: /trunk/ippToPsps/jython/initbatch.py
===================================================================
--- /trunk/ippToPsps/jython/initbatch.py	(revision 33258)
+++ /trunk/ippToPsps/jython/initbatch.py	(revision 33259)
@@ -27,12 +27,10 @@
     def __init__(self, 
             logger, 
-            configPath,
-            configDoc,
+            config,
             gpc1Db, 
             ippToPspsDb,
             batchID):
        super(InitBatch, self).__init__(logger, 
-               configPath, 
-               configDoc, 
+               config,
                gpc1Db, 
                ippToPspsDb, 
Index: /trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 33258)
+++ /trunk/ippToPsps/jython/ipptopspsdb.py	(revision 33259)
@@ -17,6 +17,6 @@
     Constructor
     '''
-    def __init__(self, logger, doc):
-        super(IppToPspsDb, self).__init__(logger, doc, "ipptopspsdatabase")
+    def __init__(self, logger, config):
+        super(IppToPspsDb, self).__init__(logger, config, "ipptopspsdatabase")
 
         self.MAX_FAILS = 5
@@ -590,12 +590,12 @@
     Creates a new batch. This is done with a locked table in order that no two clients can start work on the same item
     '''
-    def createNewBatch(self, batchType, stageID, survey, epoch, dvoDb, datastoreProduct, force):
+    def createNewBatch(self, batchType, stageID, config):
 
         batchID = -1;
 
-        if force or \
-            (not self.alreadyProcessed(batchType, stageID, epoch, dvoDb) \
-            and not self.processingNow(batchType, stageID, epoch, dvoDb) \
-            and not self.consistentlyFailed(batchType, stageID, epoch, dvoDb)): 
+        if config.force or \
+            (not self.alreadyProcessed(batchType, stageID, config.epoch, config.dvoLabel) \
+            and not self.processingNow(batchType, stageID, config.epoch, config.dvoLabel) \
+            and not self.consistentlyFailed(batchType, stageID, config.epoch, config.dvoLabel)): 
 
             sql = "INSERT INTO batch ( \
@@ -608,7 +608,7 @@
                        '" + batchType + "', \
                        " + str(stageID) + ", \
-                       '" + survey + "', \
-                       '" + dvoDb + "', \
-                       '" + datastoreProduct + "' \
+                       '" + config.survey + "', \
+                       '" + config.dvoLabel + "', \
+                       '" + config.datastoreProduct + "' \
                        )"
 
Index: /trunk/ippToPsps/jython/load.py
===================================================================
--- /trunk/ippToPsps/jython/load.py	(revision 33258)
+++ /trunk/ippToPsps/jython/load.py	(revision 33259)
@@ -10,6 +10,6 @@
 import socket
 import logging.config
-from xml.etree.ElementTree import ElementTree, Element, tostring
-
+
+from config import Config
 from pslogger import PSLogger
 from gpc1db import Gpc1Db
@@ -28,5 +28,5 @@
 def publishAnyUnpublishedBatches(batchType):
 
-    batchIDs = ippToPspsDb.getProcessedButFailedDatastoreBatchIDs(EPOCH, DVOGPC1LABEL, batchType)
+    batchIDs = ippToPspsDb.getProcessedButFailedDatastoreBatchIDs(config.epoch, config.dvoLabel, batchType)
     logger.infoPair("%s batches" % batchType, "%d" % len(batchIDs))
 
@@ -34,5 +34,5 @@
 
         batchName = Batch.getNameFromID(batchID)
-        subDir = Batch.getSubDir(BASEPATH, batchType, DVOGPC1LABEL)
+        subDir = Batch.getSubDir(config.basePath, batchType, config.dvoLabel)
         tarballFile = Batch.getTarballFile(batchID)
         logger.infoPair("Batch name", batchName)
@@ -48,12 +48,5 @@
     logger.infoPair("Box center and size", "%f/%f/%f" %(ra, dec, boxsize))
 
-    allIDs = []
-
-    # see if there are any IDs listed in the config
-    try:
-        for element in configDoc.findall('options/ids/id'):
-            allIDs.append(int(element.text))
-    except:
-        logger.errorPair("Problem loading IDs from config under", "options/ids/id") 
+    allIDs = config.ids
 
     if len(allIDs) > 0:
@@ -63,5 +56,5 @@
 
         allIDs = gpc1Db.getIDsInThisDVODbForThisStageInThisBox(
-                DVOGPC1LABEL, 
+                config.dvoLabel, 
                 batchType, 
                 ra, 
@@ -71,11 +64,11 @@
         logger.infoPair("All %s items in DVO" % batchType, "%d" % len(allIDs))
 
-    # if in FORCE mode, then queue full list
-    if FORCE: ids = allIDs
-
-    # if not in TEST mode, then only queue un-processed items
+    # if in force mode, then queue full list
+    if config.force: ids = allIDs
+
+    # if not in test mode, then only queue un-processed items
     else:
-        processedIDs = ippToPspsDb.getProcessedIDs(batchType, EPOCH, DVOGPC1LABEL)
-        consistaentlyFailedIDs = ippToPspsDb.getConsistentlyFailedIDs(batchType, EPOCH, DVOGPC1LABEL)
+        processedIDs = ippToPspsDb.getProcessedIDs(batchType, config.epoch, config.dvoLabel)
+        consistaentlyFailedIDs = ippToPspsDb.getConsistentlyFailedIDs(batchType, config.epoch, config.dvoLabel)
         ids = list(set(allIDs) - set(processedIDs) - set(consistaentlyFailedIDs))
         logger.infoPair("Processed items", "%d" % len(processedIDs))
@@ -97,12 +90,5 @@
     for id in ids:
 
-        batchID = ippToPspsDb.createNewBatch(
-                batchType,
-                id,
-                SURVEY,
-                EPOCH,
-                DVOGPC1LABEL,
-                datastore.product,
-                FORCE)
+        batchID = ippToPspsDb.createNewBatch(batchType, id, config)
         
         if batchID < 0: continue;
@@ -112,6 +98,5 @@
         if batchType == "P2":
             batch = DetectionBatch(logger,
-                    CONFIG,
-                    configDoc,
+                    config,
                     gpc1Db,
                     ippToPspsDb,
@@ -121,6 +106,5 @@
         elif batchType == "ST":
             batch = StackBatch(logger,
-                    CONFIG,
-                    configDoc,
+                    config,
                     gpc1Db,
                     ippToPspsDb,
@@ -135,6 +119,6 @@
         logger.infoSeparator()
 
-        # if in TEST mode, then quit after one batch
-        if TEST: break
+        # if in test mode, then quit after one batch
+        if config.test: break
 
     ippToPspsDb.unlockTables()
@@ -143,5 +127,5 @@
 Start of program.
 '''
-if len(sys.argv) > 1: CONFIG = sys.argv[1]
+if len(sys.argv) > 1: CONFIGPATH = sys.argv[1]
 else:
     print "** Usage: " + sys.argv[0] + " <configPath> [init]"
@@ -154,24 +138,13 @@
 
 # open config file
-configDoc = ElementTree(file=CONFIG)
-TEST = int(configDoc.find("options/testMode").text)
-
-# set up logging
-logging.setLoggerClass(PSLogger)
-logger = logging.getLogger("ippToPspsLog")
-
-# get hostnamee and PID for unique log naming
-HOST = socket.gethostname()
-PID = os.getpid()
-
-# if in test mode, print log to screen, otherwise, only to file
-#logger.setup(configDoc, "ippToPsps", TEST, not TEST, HOST, PID) TODO put back
-logger.setup(configDoc, "ippToPsps")
+config = Config(CONFIGPATH)
+#logger = config.getLogger("load", 0, 1)
+logger = config.getLogger("load")
 
 # create various objects
-dvo = Dvo(logger, configDoc)
-gpc1Db = Gpc1Db(logger, configDoc)
-ippToPspsDb = IppToPspsDb(logger, configDoc)
-datastore = Datastore(logger, configDoc, ippToPspsDb)
+dvo = Dvo(logger, config)
+gpc1Db = Gpc1Db(logger, config)
+ippToPspsDb = IppToPspsDb(logger, config)
+datastore = Datastore(logger, config, ippToPspsDb)
 
 # check we connected ok
@@ -181,35 +154,12 @@
 # get values from the configutaion file
 POLLPERIOD = 600
-DVOGPC1LABEL = configDoc.find("dvo/gpc1Label").text
-FORCE = int(configDoc.find("options/force").text)
-EPOCH = configDoc.find("options/epoch").text
-PUBLISH = int(configDoc.find("options/publishToDatastore").text)
-BASEPATH = configDoc.find("localOutPath").text
-SURVEY = configDoc.find("options/survey").text
-
-# get batch types from config
-batchTypes = []
-if int(configDoc.find("options/queueP2").text) == 1: batchTypes.append("P2")
-if int(configDoc.find("options/queueST").text) == 1: batchTypes.append("ST")
-
-# get equatorial coord limits, if any
-try: MINRA = float(configDoc.find("dvo/minRA").text)
-except: MINRA = 0.0
-try: MAXRA = float(configDoc.find("dvo/maxRA").text)
-except: MAXRA = 360.0
-try: MINDEC = float(configDoc.find("dvo/minDec").text)
-except: MINDEC = -30.0 
-try: MAXDEC = float(configDoc.find("dvo/maxDec").text)
-except: MAXDEC = 90.0
-try: BOXSIZE = float(configDoc.find("dvo/boxSize").text)
-except: BOXSIZE = 4.0
-
-# prompt user: FORCE and PUBLISH is a dangerous combination
-if FORCE and PUBLISH and not QUEUE_IN:
+
+# prompt user: force and publishing is a dangerous combination
+if config.force and config.datastorePublishing and not QUEUE_IN:
    response = raw_input("\n*** Are you sure you want to publish data with the 'force' option enabled (y/n)? ")
    if response != "y": sys.exit(1)
 
-# prompt user: TEST and PUBLISH is a dangerous combination
-if TEST and PUBLISH and not QUEUE_IN:
+# prompt user: test and publishing is a dangerous combination
+if config.test and config.datastorePublishing and not QUEUE_IN:
    response = raw_input("\n*** Are you sure you want to publish data with the 'testMode' option enabled (y/n)? ")
    if response != "y": sys.exit(1)
@@ -218,24 +168,10 @@
 logger.infoSeparator()
 logger.infoTitle("ippToPsps loading started")
-logger.infoPair("Configuration file", CONFIG)
-logger.infoPair("Loading epoch", EPOCH)
-logger.infoPair("DVO gpc1 label", DVOGPC1LABEL)
-for batchType in batchTypes: logger.infoPair("Queuing batch type", batchType)
-logger.infoBool("Forcing?", FORCE)
-logger.infoBool("Test mode?", TEST)
-logger.infoBool("Publishing?", PUBLISH)
 
 # if an IN batch is requested, create and quit
 if QUEUE_IN:
-   batchID = ippToPspsDb.createNewBatch(
-             "IN",
-             0,
-             SURVEY,
-             EPOCH,
-             DVOGPC1LABEL,
-             datastore.product,
-             1)
+   batchID = ippToPspsDb.createNewBatch("IN", 0, config)
    if batchID > 0:
-       batch = InitBatch(logger, CONFIG, configDoc, gpc1Db, ippToPspsDb, batchID)
+       batch = InitBatch(logger, config, gpc1Db, ippToPspsDb, batchID)
        batch.run()
 
@@ -251,23 +187,23 @@
 
 '''
-BORDER = 1.60
-HALFBOX = BOXSIZE/2.0
-BOXSIZEWITHBORDER = BOXSIZE + (BORDER * 2)
 
 # this outer while loop simply waits a few minutes then starts queuing againas more stuff may appear in DVO over time
 while True:
 
+    config.refresh()
+    config.printAll()
+
     # starting positions
-    ra = MINRA + HALFBOX
-    dec = MINDEC + HALFBOX
+    ra = config.minRa + config.halfBox
+    dec = config.minDec + config.halfBox
 
     # queue up batches that are processed but not loaded to datastore
     logger.infoTitle("Previous failed datastore loads")
-    for batchType in batchTypes: publishAnyUnpublishedBatches(batchType)
-
-    # loop through full range of RA/Dec queueing stuff in boxes of size BOXSIZE
-    while ra <= MAXRA:
-
-       while dec <= MAXDEC:
+    for batchType in config.batchTypes: publishAnyUnpublishedBatches(batchType)
+
+    # loop through full range of RA/Dec queueing stuff in boxes of size config.boxSize
+    while ra <= config.maxRa:
+
+       while dec <= config.maxDec:
 
            # for each batch type
@@ -275,6 +211,7 @@
            # - check if we should pre-load DVO region
            # - process the items
-           for batchType in batchTypes: 
-               ids = queueItemsInBox(batchType, ra, dec, BOXSIZE)
+           for batchType in config.batchTypes: 
+
+               ids = queueItemsInBox(batchType, ra, dec, config.boxSize)
 
                if len(ids) < 1: 
@@ -282,5 +219,5 @@
                    continue
 
-               dvo.setSkyAreaAsBox(ra, dec, BOXSIZEWITHBORDER)
+               dvo.setSkyAreaAsBox(ra, dec, config.boxSizeWithBorder)
                dvo.printSummary()
 
@@ -291,5 +228,5 @@
 
                # do we pre-ingest stuff from DVO?
-               if smfsPerGB > 40:
+               if smfsPerGB > 0:
                    if not dvo.sync():
                        logger.errorPair("Could not sync DVO with MySQL", "skipping")
@@ -301,14 +238,15 @@
                logger.infoBool("Using pre-ingested DVO data?", useFullTables)
                processTheseItems(batchType, ids, useFullTables)
-
-               # in the TEST mode, we quit after submitting one batch
-               if TEST: break
-
-           dec = dec + BOXSIZE
-           if TEST: break
-
-       dec = MINDEC + HALFBOX
-       ra = ra + BOXSIZE
-       if TEST: break
+               sys.exit(1)
+               
+               # in the test mode, we quit after submitting one batch
+               if config.test: break
+
+           dec = dec + config.boxSize
+           if config.test: break
+
+       dec = config.minDec + config.halfBox
+       ra = ra + config.boxSize
+       if config.test: break
 
     # wait for the POLLPERIOD before checking for new ids
Index: /trunk/ippToPsps/jython/metrics.py
===================================================================
--- /trunk/ippToPsps/jython/metrics.py	(revision 33258)
+++ /trunk/ippToPsps/jython/metrics.py	(revision 33259)
@@ -9,4 +9,5 @@
 from xml.etree.ElementTree import ElementTree, Element, tostring
 
+from config import Config
 from pslogger import PSLogger
 from ipptopspsdb import IppToPspsDb
@@ -19,5 +20,5 @@
 def plotMe(batchType, file):
 
-    OUTPUTFILE = "plots/" + DVOLABEL + "_" + batchType + ".png"
+    OUTPUTFILE = "plots/" + config.dvoLabel + "_" + batchType + ".png"
     f=os.popen('gnuplot', 'w')
 
@@ -29,5 +30,5 @@
     print >> f, "set term " + TERM + "; \
               set output \"" + OUTPUTFILE + "\"; \
-              set title \"ippToPsps : " + batchType + " loading for " + DVOLABEL + "\"; \
+              set title \"ippToPsps : " + batchType + " loading for " + config.dvoLabel + "\"; \
               set boxwidth; \
               set xtic rotate by -90 scale 0; \
@@ -54,8 +55,5 @@
 
     # get a master list of IDs in DVO for this batch type
-    if MINRA and MAXRA and MINDEC and MAXDEC:
-        allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType, MINRA, MAXRA, MINDEC, MAXDEC)
-    else:
-        allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOLABEL, batchType)
+    allIDs = gpc1Db.getIDsInThisDVODbForThisStage(config.dvoLabel, batchType, config.minRa, config.maxRa, config.minDec, config.maxDec)
     prevList = allIDs
     numEverything = len(allIDs)
@@ -69,6 +67,6 @@
 
        # get lists. Use unions with prev list to make sure the right stuff is included
-       success = list(set(ippToPspsDb.getStageIDs(batchType, EPOCH, DVOLABEL, stage, 1)) & set(prevList)) 
-       fail = list(set(ippToPspsDb.getStageIDs(batchType, EPOCH, DVOLABEL, stage, -1)) & set(prevList) - set(success))
+       success = list(set(ippToPspsDb.getStageIDs(batchType, config.epoch, config.dvoLabel, stage, 1)) & set(prevList)) 
+       fail = list(set(ippToPspsDb.getStageIDs(batchType, config.epoch, config.dvoLabel, stage, -1)) & set(prevList) - set(success))
        pending = list(set(prevList) - set(success) - set(fail))
 
@@ -87,10 +85,10 @@
        print >> DATFILE, stage, numSuccess, numFail, numPending
 
-       czarDb.insertStats(stage, DVOLABEL, batchType, numPending, numSuccess, numFail)
+       czarDb.insertStats(stage, config.dvoLabel, batchType, numPending, numSuccess, numFail)
 
        if stage == 'processed': numPendingProcessed = numPending
 
     sys.stdout.write("|\n")
-    plotMe(batchType, tempFilename)
+    #plotMe(batchType, tempFilename)
     DATFILE.close()
 
@@ -111,13 +109,13 @@
 def printStats(batchType):
 
-    rate = ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "1 HOUR") / 1.0 
+    rate = ippToPspsDb.countBatchesInLastPeriod(batchType, config.epoch, config.dvoLabel, "1 HOUR") / 1.0 
 
     logger.info("| %2s | %16.1f | %13d | %17.1f | %16d | %14s |" % 
             (batchType,
              rate,
-             ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "24 HOUR"),
-             ippToPspsDb.countBatchesInLastPeriod(batchType, EPOCH, DVOLABEL, "1 WEEK") / 7.0, 
-             ippToPspsDb.getTotalDetectionsPublished(batchType, EPOCH, DVOLABEL),
-             ippToPspsDb.getTimeOfLastBatchPublished(batchType, EPOCH, DVOLABEL)))
+             ippToPspsDb.countBatchesInLastPeriod(batchType, config.epoch, config.dvoLabel, "24 HOUR"),
+             ippToPspsDb.countBatchesInLastPeriod(batchType, config.epoch, config.dvoLabel, "1 WEEK") / 7.0, 
+             ippToPspsDb.getTotalDetectionsPublished(batchType, config.epoch, config.dvoLabel),
+             ippToPspsDb.getTimeOfLastBatchPublished(batchType, config.epoch, config.dvoLabel)))
 
     return rate
@@ -126,5 +124,5 @@
 Start of program.
 '''
-if len(sys.argv) > 1: CONFIG  = sys.argv[1]
+if len(sys.argv) > 1: CONFIGPATH  = sys.argv[1]
 else:
     print "** Usage: " + sys.argv[0] + " <configPath> [hours]"
@@ -137,20 +135,10 @@
     SECONDS = None
 
-
-
-# open config file
-configDoc = ElementTree(file=CONFIG)
-
-logging.setLoggerClass(PSLogger)
-logger = logging.getLogger("metrics")
-logger.setup(configDoc, "metrics")
-
-# create database objects
-ippToPspsDb = IppToPspsDb(logger, configDoc)
-czarDb = CzarDb(logger, configDoc)
-gpc1Db = Gpc1Db(logger, configDoc)
-
-DVOLABEL = configDoc.find("dvo/gpc1Label").text
-EPOCH = configDoc.find("options/epoch").text
+# create objects
+config = Config(CONFIGPATH)
+logger = config.getLogger("metrics")
+ippToPspsDb = IppToPspsDb(logger, config)
+czarDb = CzarDb(logger, config)
+gpc1Db = Gpc1Db(logger, config)
 
 while True:
@@ -159,21 +147,7 @@
     now = datetime.datetime.now()
     logger.infoPair("Time now", now.strftime("%Y-%m-%d %H:%M:%S"))
-    logger.infoPair("Loading epoch", EPOCH)
-    logger.infoPair("DVO label", DVOLABEL)
-
-    # get equatorial coord constraints, if any
-    try:
-        MINRA = float(configDoc.find("dvo/minRA").text)
-        MAXRA = float(configDoc.find("dvo/maxRA").text)
-        MINDEC = float(configDoc.find("dvo/minDec").text)
-        MAXDEC = float(configDoc.find("dvo/maxDec").text)
-    except:
-        MINRA = 0.0
-        MAXRA = 360.0
-        MINDEC = -30.0
-        MAXDEC = 90.0
-
-    logger.infoPair("RA limits", "%.1f to %.1f" % (MINRA, MAXRA))
-    logger.infoPair("Dec limits", "%.1f to %.1f" % (MINDEC, MAXDEC))
+    logger.infoPair("Loading epoch", config.epoch)
+    logger.infoPair("DVO label", config.dvoLabel)
+    config.printBoxCoords()
 
     logger.info("+----+------------------+---------------+-------------------+------------------+----------------+")
Index: /trunk/ippToPsps/jython/mysql.py
===================================================================
--- /trunk/ippToPsps/jython/mysql.py	(revision 33258)
+++ /trunk/ippToPsps/jython/mysql.py	(revision 33259)
@@ -21,16 +21,16 @@
 
     '''
-    def __init__(self, logger, doc, dbType):
+    def __init__(self, logger, config, dbType):
 
         # set up logging
         self.logger = logger
-        self.doc = doc
+        self.config = config
         self.logger.debug("MySql class constructor")
 
         # open config and grab database parameters
-        self.dbName = self.doc.find(dbType +"/name").text
-        self.dbHost = self.doc.find(dbType +"/host").text
-        self.dbUser = self.doc.find(dbType +"/user").text
-        self.dbPass = self.doc.find(dbType +"/password").text
+        self.dbName = config.getDbName(dbType)
+        self.dbHost = config.getDbHost(dbType)
+        self.dbUser = config.getDbUser(dbType)
+        self.dbPass = config.getDbPassword(dbType)
 
         # set up JDBC connection
@@ -80,5 +80,5 @@
         connectionID = self.getLastConnectionID()
         if connectionID == self.connectionID:
-            self.logger.error("NOT going to kill THIS connection ID")
+            self.logger.debug("NOT going to kill THIS connection ID")
             return
 
Index: /trunk/ippToPsps/jython/pslogger.py
===================================================================
--- /trunk/ippToPsps/jython/pslogger.py	(revision 33258)
+++ /trunk/ippToPsps/jython/pslogger.py	(revision 33259)
@@ -7,7 +7,8 @@
 
    '''
-   Sets up logging using values from the ippToPsps config file
+   Sets up logging using provided values and this process hostname and PID if sending to file
+   This will default to stout and no file output
    '''
-   def setup(self, doc, name, stdout=1, sendToFile=0, host="host", pid=1234):
+   def setup(self, name, basePath, dvoLabel, stdout=1, sendToFile=0):
 
        formatter = logging.Formatter('%(asctime)s | %(levelname)7s | %(message)s', '%Y-%m-%d %H:%M:%S')
@@ -15,8 +16,12 @@
 
        if sendToFile:
-           PATH = doc.find("localOutPath").text + "/log"
+
+           HOST = socket.gethostname()
+           PID = os.getpid()
+
+           # generate path
+           PATH = basePath + "/log"
            if not os.path.exists(PATH): os.makedirs(PATH)
-           DVOLABEL = doc.find("dvo/gpc1Label").text
-           FULLPATH = PATH + "/" + name + "_" + DVOLABEL + "_" + host + "_" + str(pid) + ".log"
+           FULLPATH = PATH + "/" + name + "_" + dvoLabel + "_" + HOST + "_" + str(PID) + ".log"
 
            # opens file to be appended
Index: /trunk/ippToPsps/jython/scratchdb.py
===================================================================
--- /trunk/ippToPsps/jython/scratchdb.py	(revision 33258)
+++ /trunk/ippToPsps/jython/scratchdb.py	(revision 33259)
@@ -19,6 +19,6 @@
     Constructor
     '''
-    def __init__(self, logger, doc, useFull=0):
-        super(ScratchDb, self).__init__(logger, doc, "localdatabase")
+    def __init__(self, logger, config, useFull=0):
+        super(ScratchDb, self).__init__(logger, config, "localdatabase")
 
         if useFull:
@@ -484,9 +484,23 @@
 
     '''
-    Gets a list of PSPS image IDs for this stack ID
-    '''
-    def getDvoRegionsForThisBox(self, minRa, maxRa, minDec, maxDec):
+    Gets a list of DVO regions that overlap with the defined box
+    '''
+    def getDvoRegions(self, minRa, maxRa, minDec, maxDec):
 
         self.logger.debug("Querying DVO SkyTable for FITS files in this region")
+
+        regions = []
+        self.getDvoRegionsForThisBox(regions, minRa, maxRa, minDec, maxDec)
+
+        # deal with 0/360 boundary
+        if minRa < 0: self.getDvoRegionsForThisBox(regions, minRa + 360, 361 ,minDec, maxDec)
+        if maxRa > 360: self.getDvoRegionsForThisBox(regions, 0, maxRa - 360 ,minDec, maxDec)
+
+        return regions
+
+    '''
+    Gets a list of DVO regions that overlap with the defined box
+    '''
+    def getDvoRegionsForThisBox(self, regions, minRa, maxRa, minDec, maxDec):
 
         sql = "SELECT name FROM " + self.dvoSkyTable + " \
@@ -498,13 +512,8 @@
         try:
             rs = self.executeQuery(sql)
-        except:
-            self.logger.exception("Can't query for imageIDs")
-
-        files = []
-        while (rs.next()):
-            files.append(rs.getString(1))
-        rs.close()
-
-        return files
-
-
+            while (rs.next()): regions.append(rs.getString(1))
+            rs.close()
+        except:
+            self.logger.exception("Can't query for DVO regions")
+
+
Index: /trunk/ippToPsps/jython/stackbatch.py
===================================================================
--- /trunk/ippToPsps/jython/stackbatch.py	(revision 33258)
+++ /trunk/ippToPsps/jython/stackbatch.py	(revision 33259)
@@ -30,6 +30,5 @@
     def __init__(self, 
                  logger, 
-                 configPath,
-                 configDoc,
+                 config,
                  gpc1Db,
                  ippToPspsDb,
@@ -40,6 +39,5 @@
        super(StackBatch, self).__init__(
                logger,
-               configPath,
-               configDoc,
+               config,
                gpc1Db,
                ippToPspsDb,
@@ -47,5 +45,5 @@
                batchID,
                "ST", 
-               gpc1Db.getStackStageCmf(configDoc.find("dvo/gpc1Label").text, stackID),
+               gpc1Db.getStackStageCmf(config.dvoLabel, stackID),
                useFullTables)
 
@@ -307,5 +305,5 @@
         self.scratchDb.updateAllRows("StackMeta", "surveyID", str(self.surveyID))
         self.scratchDb.updateFilterID("StackMeta", self.filter)
-        self.scratchDb.updateAllRows("StackMeta", "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows("StackMeta", "dataRelease", str(self.config.dataRelease))
         self.updateStackTypeID("StackMeta")
 
@@ -403,5 +401,5 @@
         self.scratchDb.updateAllRows("StackDetection", "surveyID", str(self.surveyID))
         self.scratchDb.updateFilterID("StackDetection", self.filter)
-        self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.config.dataRelease))
         self.scratchDb.updateAllRows("StackDetection", "primaryF", "0")
         self.scratchDb.updateAllRows("StackDetection", "activeFlag", "0")
@@ -467,5 +465,5 @@
         self.scratchDb.updateAllRows("StackApFlx", "surveyID", str(self.surveyID))
         self.scratchDb.updateFilterID("StackApFlx", self.filter)
-        self.scratchDb.updateAllRows("StackApFlx", "dataRelease", str(self.dataRelease))
+        self.scratchDb.updateAllRows("StackApFlx", "dataRelease", str(self.config.dataRelease))
         self.scratchDb.updateAllRows("StackApFlx", "primaryF", "0")
         self.scratchDb.updateAllRows("StackApFlx", "activeFlag", "0")
