Package Ganga :: Package Utility :: Package external :: Package ARDAMDClient :: Module mdinterface
[hide private]
[frames] | no frames]

Source Code for Module Ganga.Utility.external.ARDAMDClient.mdinterface

  1  ################################################################################ 
  2  # Ganga Project. http://cern.ch/ganga 
  3  # 
  4  # $Id: mdinterface.py,v 1.1 2008-07-17 16:41:02 moscicki Exp $ 
  5  ################################################################################ 
  6   
7 -class CommandException(Exception):
8 """ Raised when the command failed to execute on the server. 9 This is not a fatal error, the connection is not necessarily 10 broken after this exception is raised. 11 """
12 - def __init__(self, errorCode, msg):
13 self.errorCode = errorCode 14 self.msg = msg
15 16
17 - def __str__(self):
18 return repr(self.errorCode) + ' - ' + repr(self.msg)
19 20
21 -class MDInterface:
22 - def eot(self):
23 print "Please implement eot"
24 25
26 - def getattr(self, file, attributes):
27 print "Please implement getattr"
28 29
30 - def getEntry(self):
31 print "Please implement getEntry"
32 33
34 - def setAttr(self, file, keys, values):
35 print "Please implement setAttr"
36 37
38 - def addEntry(self, file, keys, values):
39 print "Please implement addEntry"
40 41
42 - def addEntries(self, entries):
43 print "Please implement addEntries"
44 45
46 - def addAttr(self, file, name, t):
47 print "Please implement addAttr"
48 49
50 - def removeAttr(self, file, name):
51 print "Please implement removeAttr"
52 53
54 - def clearAttr(self, file, name):
55 print "Please implement clearAttr"
56 57
58 - def listEntries(self, pattern):
59 print "Please implement listEntries"
60 61
62 - def pwd(self):
63 print "Please implement pwd"
64 65
66 - def listAttr(self, file):
67 print "Please implement listAttr"
68 69
70 - def createDir(self, dir):
71 print "Please implement createDir"
72 73
74 - def removeDir(self, dir):
75 print "Please implement removeDir"
76 77
78 - def rm(self, path):
79 print "Please implement rm"
80 81
82 - def selectAttr(self, attributes, query):
83 print "Please implement selectAttr"
84 85
86 - def getSelectAttrEntry(self):
87 print "Please implement getSelectAttrEntry"
88 89
90 - def updateAttr(self, pattern, updateExpr, condition):
91 print "Please implement updateAttr"
92 93
94 - def upload(self, collection, attributes):
95 print "Please implement upload"
96 97
98 - def put(self, file, values):
99 print "Please implement put"
100 101
102 - def abort(self):
103 print "Please implement abort"
104 105
106 - def commit(self):
107 print "Please implement commit"
108 109
110 - def sequenceCreate(self, name, directory, increment=1, start=1):
111 print "Please implement sequenceCreate"
112 113
114 - def sequenceNext(self, name):
115 print "Please implement sequenceNext"
116 117
118 - def sequenceRemove(self, name):
119 print "Please implement sequenceRemove"
120 121
122 - def splitUpdateClause(self, clause):
123 #skip leading white space 124 i = 0 125 while i<len(clause) and (clause[i] == ' ' or clause[i] == '\t'): 126 i = i +1 127 clause=clause[i:] 128 escaped = False 129 quoted = False 130 i = 0 131 while i < len(clause): 132 if clause[i] == "'" and not escaped: 133 quoted = not quoted 134 if clause[i] == '/': 135 escaped = not escaped 136 if (clause[i] == ' ' or clause[i] == '/t') and not quoted: 137 break 138 i = i + 1 139 if i==0 or i>=len(clause)-1: 140 raise CommandException(3, "Invalid update statement") 141 var = clause[0:i] 142 exp = clause[i+1:] 143 i1 = exp.find("'") 144 i2 = exp.rfind("'") 145 if i1==0 and i2 == len(exp)-1: 146 exp = exp[i1+1:i2] 147 i1 = var.find("'") 148 i2 = var.rfind("'") 149 if i1==0 and i2 == len(var)-1: 150 var = var[i1+1:i2] 151 return var, exp
152