source: ndgCommon/trunk/ndg/common/src/clients/interfacecrudclient.py @ 5008

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/ndgCommon/trunk/ndg/common/src/clients/interfacecrudclient.py@5008
Revision 5008, 3.9 KB checked in by cbyrom, 11 years ago (diff)

Remove unused imports from interfaces.

Line 
1'''
2 Interface for clients extending search functionality to include standard CRUD
3 (create, replace, update, delete) functionality for metadata documents
4 
5 @author: C Byrom - Tessella, Feb 09
6'''
7from interfacesearchclient import InterfaceSearchClient
8
9class InterfaceCRUDClient(InterfaceSearchClient):
10
11    def isNewDoc(self, docPath):
12        '''
13        Test if a doc already exists in the XML DB
14        @param docPath: path of file to look up
15        @return: True if a new doc, False if otherwise
16        '''
17        raise NotImplementedError("This is an interface class and this method has not " + \
18                                  "been implemented yet")
19
20
21    def backupDoc(self, collection, fileName, runAsynch = True):
22        '''
23        Backup a file that exists in the XML DB
24        - NB, this really just creates a new file with the same contents in a
25        backup dir
26        @param collection: path of the collection to store the file in
27        @param fileName: name of file to add
28        @param runAsynch: if True, do the backup asynchronously in a separate thread
29        @return: path to new backup file
30        '''
31        raise NotImplementedError("This is an interface class and this method has not " + \
32                                  "been implemented yet")
33
34
35    def restoreBackup(self, docPath):
36        '''
37        Restore the backed up file - effectively recreating in the non-backup collection
38        @param docPath: path to file to backup
39        @param restoredFileName: path to newly restored file
40        '''
41        raise NotImplementedError("This is an interface class and this method has not " + \
42                                  "been implemented yet")
43
44    def createDoc(self, xml, collection, fileName):
45        '''
46        Add the input doc to the XML DB
47        @param xml: contents of xml file to create in the XML DB
48        @param collection: path of the collection to store the file in
49        @param fileName: name of file to add
50        @return: True, if file created successfully
51        '''
52        raise NotImplementedError("This is an interface class and this method has not " + \
53                                  "been implemented yet")
54
55
56    def deleteDoc(self, docPath):
57        '''
58        Delete the input file from the XML DB
59        @param docPath: path of document to delete
60        @return: True, if file deleted successfully
61        '''
62        raise NotImplementedError("This is an interface class and this method has not " + \
63                                  "been implemented yet")
64
65
66    def createOrUpdateDoc(self, xml, collection, fileName):
67        '''
68        Check if a file already exists in the XML DB; if it does, run an
69        update (which will backup the existing file), otherwise create
70        the file in eXist
71        @param xml: contents of xml file to create/update in the XML DB
72        @param collection: path of the collection to store the file in
73        @param fileName: name of file to add
74        @return name of backup file, if file needed to be backed up - or None, otherwise
75        '''
76        raise NotImplementedError("This is an interface class and this method has not " + \
77                                  "been implemented yet")
78       
79
80    def isNewCollection(self, collectionPath):
81        '''
82        Look up a collection in using XPath
83        @param collectionPath: path to collection to look up
84        @return: False if collection exists, True otherwise
85        '''
86        raise NotImplementedError("This is an interface class and this method has not " + \
87                                  "been implemented yet")
88
89    def createCollections(self, collections):
90        '''
91        Create the specified collections in eXist
92        @param collections: array of collections to create
93        @return True if successful
94        '''
95        raise NotImplementedError("This is an interface class and this method has not " + \
96                                  "been implemented yet")
Note: See TracBrowser for help on using the repository browser.