Index: trunk/ippToPsps/jython/ipptopsps.py
===================================================================
--- trunk/ippToPsps/jython/ipptopsps.py	(revision 33790)
+++ trunk/ippToPsps/jython/ipptopsps.py	(revision 35097)
@@ -1,3 +1,4 @@
 #!/usr/bin/env jython
+# EAM : config -> skychunk DONE
 
 import signal
@@ -9,4 +10,5 @@
 
 from config import Config
+from skychunk import Skychunk
 from pslogger import PSLogger
 from ipptopspsdb import IppToPspsDb
@@ -23,12 +25,13 @@
     def __init__(self, argv, logToStdout=1, logToFile=0):
 
-        # are the arsg ok? all programs require a config name
+        # set up config object (global config information, also parse command-line options, eg -test / -t)
+        self.config = Config()
+
+        # are the args ok? all programs require a config name
         if len(sys.argv) < 2: 
             self.printUsage()
             self.exitProgram("Wrong args")
-            
+
         # some class constants
-        self.PROGNAME = sys.argv[0]
-        CONFIGNAME = sys.argv[1]
         self.HOST = socket.gethostname()
         self.PID = os.getpid()
@@ -38,18 +41,12 @@
         self.SECONDS = None
 
-        self.createNewConfig = False
-        self.rotateConfigs = False
-        # a new config?
-        if CONFIGNAME == "edit": self.createNewConfig = True
-        # should we rotate configs for this program?
-        elif CONFIGNAME == "all": self.rotateConfigs = True
+        self.logger = self.config.getLogger(self.HOST, self.PID, logToStdout, logToFile)
 
-        # set up config object
-        self.config = Config(self.PROGNAME, CONFIGNAME)
-        self.logger = self.config.getLogger(self.HOST, self.PID, logToStdout, logToFile)
+        # argv[1] -> self.skychunk.name
+        self.skychunk = Skychunk(self.logger)
 
         # create connection to databases database
         try:
-            self.ippToPspsDb = IppToPspsDb(self.logger, self.config)
+            self.ippToPspsDb = IppToPspsDb(self.logger, self.config, self.skychunk)
         except:
             self.exitProgram("Could not connect to ipptopsps Db")
@@ -63,8 +60,8 @@
         # title for log
         self.logger.infoSeparator()
-        self.logger.infoTitle("ippToPsps '" + self.PROGNAME + "' started")
+        self.logger.infoTitle("ippToPsps '" + self.config.programName + "' started")
         self.logger.infoPair("Host", self.HOST)
         self.logger.infoPair("PID", "%d" % self.PID)
-        self.logger.infoPair("Config", self.config.name)
+        self.logger.infoPair("Skychunk", self.skychunk.name)
 
     '''
@@ -104,5 +101,5 @@
 
         # write message to log or stdout if no logger set up
-        msg = sys.argv[0] + " <configName|all|edit> " + extra
+        msg = sys.argv[0] + " <skychunkName|all|edit> " + extra
         try:
             self.logger.errorPair("Usage:", msg)
@@ -111,46 +108,46 @@
 
     '''
-    Refreshes the config then recreates objects with new settings
+    Refreshes the skychunk then recreates objects with new settings
     '''
-    def refreshConfig(self):
+    def refreshSkychunk(self):
 
-        # new config?
-        if self.createNewConfig: 
-            self.ippToPspsDb.editConfig()
-            self.ippToPspsDb.setConfigForThisClient(self.config.name, self.HOST, self.PID)
-            self.createNewConfig = False
+        # new skychunk?
+        if self.skychunk.createNewSkychunk: 
+            self.ippToPspsDb.editSkychunk()
+            self.ippToPspsDb.setSkychunkForThisClient(self.skychunk.name, self.HOST, self.PID)
+            self.skychunk.createNewSkychunk = False
 
-        # if we are rotating configs, then look for next active one in list
-        if self.rotateConfigs:
-            self.ippToPspsDb.getConfigForThisClient(self.HOST, self.PID)
-            configs = self.ippToPspsDb.getActiveConfigList()
+        # if we are rotating skychunks, then look for next active one in list
+        if self.skychunk.rotateSkychunks:
+            self.ippToPspsDb.getSkychunkForThisClient(self.HOST, self.PID)
+            skychunks = self.ippToPspsDb.getActiveSkychunkList()
              
             i = 1
-            for config in configs:
-               if config == self.config.name: break
+            for skychunk in skychunks:
+               if skychunk == self.skychunk.name: break
                i += 1
 
-            if i >= len(configs): newConfig = configs[0]
-            else: newConfig = configs[i]
+            if i >= len(skychunks): newSkychunk = skychunks[0]
+            else: newSkychunk = skychunks[i]
 
-            self.ippToPspsDb.setConfigForThisClient(newConfig, self.HOST, self.PID)
+            self.ippToPspsDb.setSkychunkForThisClient(newSkychunk, self.HOST, self.PID)
 
-        return self.ippToPspsDb.readConfig(self.HOST, self.PID)
+        return self.ippToPspsDb.readSkychunk(self.HOST, self.PID)
 
     '''
-    All implementing subclasses (programs) should call this method once in a while to see if it should be paused or killed, otherwise this updates the clients table with current time and reloads the config data
+    All implementing subclasses (programs) should call this method once in a while to see if it should be paused or killed, otherwise this updates the clients table with current time and reloads the skychunk data
     '''
     def checkClientStatus(self):
 
-        self.ippToPspsDb.updateClient(self.PROGNAME, self.HOST, self.PID)
+        self.ippToPspsDb.updateClient(self.config.programName, self.HOST, self.PID)
 
         if self.ippToPspsDb.isKilled(self.HOST, self.PID): 
             self.exitProgram("killed via Db")
        
-        # this loop pauses the process if we have no config or we have set it to pause
+        # this loop pauses the process if we have no skychunk or we have set it to pause
         firstTimeIn = True
-        while not self.refreshConfig() or self.ippToPspsDb.isPaused(self.HOST, self.PID):
+        while not self.refreshSkychunk() or self.ippToPspsDb.isPaused(self.HOST, self.PID):
 
-            self.ippToPspsDb.updateClient(self.PROGNAME, self.HOST, self.PID)
+            self.ippToPspsDb.updateClient(self.config.programName, self.HOST, self.PID)
             if self.ippToPspsDb.isKilled(self.HOST, self.PID): 
                 self.exitProgram("killed while paused")
@@ -175,5 +172,5 @@
         # write message to log or stdout if no logger set up
         try:
-            self.logger.infoPair(self.PROGNAME + " exited", exitReason)
+            self.logger.infoPair(self.config.programName + " exited", exitReason)
         except: 
             print "*** Program exited: " + exitReason
@@ -186,4 +183,2 @@
 
         sys.exit(0)
-   
-
