Changeset 4976 for ndgCommon


Ignore:
Timestamp:
16/02/09 10:47:46 (11 years ago)
Author:
cbyrom
Message:

Implement an eXist client based on the RESTful DB interface and implementing the interfacexmldbclient interface. Also add some small
code tidy ups and fix a couple of bugs.

Location:
ndgCommon/trunk/ndg/common/src/clients
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/clients/interfacecrudclient.py

    r4918 r4976  
    8888                                  "been implemented yet") 
    8989 
    90  
    9190    def createCollections(self, collections): 
    9291        ''' 
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/eXist/crudclient.py

    r4970 r4976  
    170170            self.createCollections([collection]) 
    171171 
    172         status = self.client.storeXML(xml, collection + "/" + fileName, overwrite=1) 
     172        status = self.client.createDoc(xml, collection + "/" + fileName, overwrite=1) 
    173173        if not status: 
    174174            errorMessage = "Command to create file in eXist did not complete successfully - exiting" 
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/eXist/feedclient.py

    r4970 r4976  
    180180            browseURL = browseURL.replace('__%s__' %ndgObject.ATOM_DOC_TYPE,  
    181181                                          '__%s__' %ndgObject.BROWSE_DIF_DOC_TYPE) 
    182  
     182             
    183183        entryXML = '<?xml version="1.0" ?>\ 
    184184<entry xmlns="http://www.w3.org/2005/Atom">\ 
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/eXist/searchclient.py

    r4967 r4976  
    8888        dateRange are ignored, and a python summary object is returned  
    8989        ''' 
    90  
    9190        #select the right query according to the docType requested 
    9291        if target == self.ATOM_TARGET: 
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/eXist/xmlrpcclient.py

    r4966 r4976  
    100100            result = None 
    101101            attempt = 0 
    102             while not result: 
     102            while result is None: 
    103103                try: 
    104104                    result = self.__executeChunkedQuery(xquery, offset,  
     
    218218        @return True if successful, False otherwise 
    219219        ''' 
     220        logging.debug("Running remove operation on '%s'" %collectionPath) 
    220221        r=self.xmlrpc.removeCollection(collectionPath) 
     222        logging.debug("Remove operation completed on '%s'" %collectionPath) 
    221223        return r 
    222224 
     
    229231        @return True if successful, False otherwise 
    230232        ''' 
    231         r=self.xmlrpc.remove(docPath) 
    232         return r 
    233  
    234      
    235     def storeXML(self,xml,path,overwrite=0): 
     233        logging.debug("Running remove operation on '%s'" %docPath) 
     234        try: 
     235            r=self.xmlrpc.remove(docPath) 
     236        except xmlrpclib.Fault, f: 
     237            logging.error("Error encountered: '%s'" %f) 
     238            return False 
     239        logging.debug("Remove operation completed on '%s'" %docPath) 
     240        return r 
     241 
     242     
     243    def createDoc(self,xml,path,overwrite=0): 
    236244        '''  
    237245        Store some XML into the databse at path  
     
    242250        @return True if successful, False otherwise 
    243251        ''' 
    244         return self.xmlrpc.parse(xml,path,overwrite) 
     252        logging.debug("Running parse operation on '%s' (overwrite=%s)" %(path, overwrite)) 
     253        r = self.xmlrpc.parse(xml,path,overwrite) 
     254        logging.debug("Parse operation completed on '%s'" %path) 
     255        return r 
    245256     
    246257     
     
    254265        ''' 
    255266        try: 
    256             return self.xmlrpc.describeCollection(collectionPath) 
     267            logging.debug("Running describe collection operation on '%s'" %collectionPath) 
     268            r = self.xmlrpc.describeCollection(collectionPath) 
     269            logging.debug("Describe collection operation completed on '%s'" %collectionPath) 
     270            return r 
    257271        except xmlrpclib.Fault, f: 
    258272            if str(f).find('not found') > -1: 
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/interfacexmldbclient.py

    r4918 r4976  
    77class InterfaceXMLDBClient(object): 
    88 
    9     def runQuery(self, xquery, noResults = -1, params={}): 
     9    def runQuery(self, xquery, offset = 0, noResults = -1, params={}): 
    1010        ''' 
    1111        Execute an xquery string, and retrieve the subsequent results 
     
    7373     
    7474     
    75     def storeXML(self,xml,path,overwrite=0): 
     75    def createDoc(self,xml,path,overwrite=0): 
    7676        '''  
    7777        Store some XML into the databse at path  
Note: See TracChangeset for help on using the changeset viewer.