Index: trunk/ippToPsps/jython/gpc1.py
===================================================================
--- trunk/ippToPsps/jython/gpc1.py	(revision 31179)
+++ trunk/ippToPsps/jython/gpc1.py	(revision 31179)
@@ -0,0 +1,81 @@
+#!/usr/bin/env jython
+
+import re
+import sys
+import glob
+import subprocess
+import os
+
+from java.lang import *
+from java.sql import *
+from xml.etree.ElementTree import ElementTree
+
+
+'''
+Class for GPC1 database connectivity
+'''
+class Gpc1(object):
+
+    driverName="com.mysql.jdbc.Driver"
+
+    '''
+    Constructor
+
+    '''
+    def __init__(self):
+
+        # open config
+        doc = ElementTree(file="config.xml")
+
+        # set up JDBC connection
+        dbName = doc.find("gpc1database/name").text
+        dbHost = doc.find("gpc1database/host").text
+        dbUser = doc.find("gpc1database/user").text
+        dbPass = doc.find("gpc1database/password").text
+        self.url = "jdbc:mysql://"+dbHost+"/"+dbName+"?user="+dbUser+"&password="+dbPass
+        self.con = DriverManager.getConnection(self.url)
+        self.stmt = self.con.createStatement()
+
+    '''
+    Destructor
+    '''
+    def __del__(self):
+
+        print "Gpc1 destructor"
+        self.stmt.close()
+        self.con.close()
+
+
+    '''
+    Gets all cmf files for this sky_id. handles both absolute paths and neb paths
+    '''
+    def getStackStageCmfs(self, skyID):
+        sql = "SELECT path_base, num_inputs \
+               FROM staticskyResult \
+               WHERE sky_id = %d" % skyID
+        try:
+            rs = self.stmt.executeQuery(sql)
+            rs.first()
+        except:
+            print "No worky"
+
+        # get path to base dir of cmf files
+        path = rs.getString(1)
+        index = path.rfind("/")
+        path = path[0:index]
+
+       
+        # list all cmf files if a neb path
+        files = []
+        if path.startswith("neb"):
+
+            f=os.popen("neb-ls -p "+path+"/%cmf")
+            for i in f.readlines():
+                files.append(i.rstrip())
+
+        # or not a neb path
+        else:
+            files = glob.glob(path + "/*.cmf")
+
+        return files
+
