Index: /trunk/ippToPsps/jython/datastore.py
===================================================================
--- /trunk/ippToPsps/jython/datastore.py	(revision 31226)
+++ /trunk/ippToPsps/jython/datastore.py	(revision 31226)
@@ -0,0 +1,53 @@
+#!/usr/bin/env jython
+
+from subprocess import call, PIPE, Popen
+import tempfile
+import logging
+from xml.etree.ElementTree import ElementTree, Element, tostring
+
+
+'''
+Class encapsulating the IPP datastore
+'''
+class Datastore(object):
+
+    '''
+        Constructor
+
+    '''
+    def __init__(self, logger):
+    
+        # setup logger
+        self.logger = logger
+        self.logger.debug("Datastore constructor")
+
+        # open config
+        doc = ElementTree(file="config.xml")
+        self.product = doc.find("datastore/product").text
+        self.type = doc.find("datastore/type").text
+
+        self.logger.debug("Publishing to '" + self.product + "' product")
+
+
+    '''
+    Publishes an item to the datastore
+    '''
+    def publish(self, name, path, file, fileType):
+
+        tempFile = tempfile.NamedTemporaryFile(mode='w+b')
+        tempFile.write(file + "|||" + fileType)
+        tempFile.seek(0)
+
+        # build dsreg command command
+        command  = "dsreg --add " + name + "\
+                    --copy --datapath " + path + "\
+                    --type " + self.type + "\
+                    --product " + self.product + "\
+                    --list " + tempFile.name
+
+        p = Popen(command, shell=True, stdout=PIPE)
+        p.wait()
+       
+        #TODO check success print "Return from dsreg: " + p.stdout.read()
+
+        tempFile.close()
