Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Public Attributes | Static Public Attributes
storage.client.BartenderClient Class Reference
Inheritance diagram for storage.client.BartenderClient:
Inheritance graph
[legend]
Collaboration diagram for storage.client.BartenderClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def stat
def getFile
def putFile
def delFile
def addReplica
def unlink
def unmakeCollection
def makeCollection
def makeMountpoint
 Created by Salman Toor ###.
def unmakeMountpoint
def list
def move
def modify
def reset
def call
def call_raw

Public Attributes

 ns
 urls
 https
 print_xml
 xmlnode_class
 ssl_config
 cfg
 get_trusted_dns_method
 connection_cache
 semapool

Static Public Attributes

 NS_class = arc.NS

Detailed Description

Client for the Bartender service. 

Definition at line 271 of file client.py.


Constructor & Destructor Documentation

def storage.client.BartenderClient.__init__ (   self,
  url,
  print_xml = False,
  ssl_config = {} 
)
Constructior of the client.

BartenderClient(url, print_xml = False)

url is the URL of the Bartender service
if print_xml is true this will print the SOAP messages

Definition at line 274 of file client.py.

00274 
00275     def __init__(self, url, print_xml = False, ssl_config = {}):
00276         """ Constructior of the client.
00277         
00278         BartenderClient(url, print_xml = False)
00279         
00280         url is the URL of the Bartender service
00281         if print_xml is true this will print the SOAP messages
00282         """
00283         # sets the namespace
00284         ns = self.NS_class('bar', bartender_uri)
00285         # calls the superclass' constructor
00286         Client.__init__(self, url, ns, print_xml, ssl_config = ssl_config)


Member Function Documentation

def storage.client.BartenderClient.addReplica (   self,
  requests,
  protocols 
)
Add a new replica to an existing file.

addReplica(requests, protocols)

requests is a dictionary with requestID as key and GUID as value.
protocols is a list of protocols supported by the client

returns a dictionary with requestID as key and (success, TURL, protocol) as value, where
    success is the status of the request,
    TURL is the transfer URL
    protocol is the choosen protocol
    
Example:

In: requests = {'001':'c9c82371-4773-41e4-aef3-caf7c7eaf6f8'}, protocols = ['http','byteio']
Out:
    {'001': ['done',
     'http://localhost:60000/byteio/c94a77a1-347c-430c-ae1b-02d83786fb2d',
    'byteio']}

Definition at line 441 of file client.py.

00441 
00442     def addReplica(self, requests, protocols):
00443         """ Add a new replica to an existing file.
00444         
00445         addReplica(requests, protocols)
00446         
00447         requests is a dictionary with requestID as key and GUID as value.
00448         protocols is a list of protocols supported by the client
00449         
00450         returns a dictionary with requestID as key and (success, TURL, protocol) as value, where
00451             success is the status of the request,
00452             TURL is the transfer URL
00453             protocol is the choosen protocol
00454             
00455         Example:
00456         
00457         In: requests = {'001':'c9c82371-4773-41e4-aef3-caf7c7eaf6f8'}, protocols = ['http','byteio']
00458         Out:
00459             {'001': ['done',
00460                      'http://localhost:60000/byteio/c94a77a1-347c-430c-ae1b-02d83786fb2d',
00461                     'byteio']}
00462         """
00463         tree = XMLTree(from_tree =
00464             ('bar:addReplica', [
00465                 ('bar:addReplicaRequestList', [
00466                     ('bar:putReplicaRequestElement', [
00467                         ('bar:requestID', rID),
00468                         ('bar:GUID', GUID),
00469                     ]) for rID, GUID in requests.items()
00470                 ])
00471             ] + [
00472                 ('bar:protocol', protocol) for protocol in protocols
00473             ])
00474         )
00475         self.semapool.acquire()
00476         msg = self.call(tree)
00477         self.semapool.release()
00478         xml = self.xmlnode_class(msg)
00479         return parse_node(get_data_node(xml), ['requestID', 'success', 'TURL', 'protocol'])

Here is the call graph for this function:

def arcom.client.Client.call (   self,
  tree,
  return_tree_only = False 
) [inherited]
Create a SOAP message from an XMLTree and send it to the service.

call(tree, return_tree_only = False)

tree is an XMLTree object containing the content of the request
return_tree_only indicates that we only need to put the response into an XMLTree

Definition at line 60 of file client.py.

00060 
00061     def call(self, tree, return_tree_only = False):
00062         """ Create a SOAP message from an XMLTree and send it to the service.
00063         
00064         call(tree, return_tree_only = False)
00065         
00066         tree is an XMLTree object containing the content of the request
00067         return_tree_only indicates that we only need to put the response into an XMLTree
00068         """
00069         # create a new PayloadSOAP object with the given namespace
00070         out = arc.PayloadSOAP(self.ns)
00071         # add the content of the XMLTree to the XMLNode of the SOAP object
00072         tree.add_to_node(out)
00073         if self.print_xml:
00074             msg = out.GetXML()
00075             print 'Request:'
00076             print XMLTree(out).pretty_xml(indent = '    ', prefix = '        #   ')
00077             print
00078         # call the service and get back the response, and the HTTP status
00079         resp = self.call_raw(out)
00080         if self.print_xml:
00081             print 'Response:'
00082             try:
00083                 print XMLTree(from_string = resp).pretty_xml(indent = '    ', prefix = '        #   ')
00084             except:
00085                 print resp
00086             print
00087         if return_tree_only:
00088             # wrap the response into an XMLTree and return only the tree
00089             return XMLTree(from_string = resp, forget_namespace = True).get_trees('///')[0]
00090         else:
00091             return resp

Here is the call graph for this function:

Here is the caller graph for this function:

def arcom.client.Client.call_raw (   self,
  outpayload 
) [inherited]
Send a POST request with the SOAP XML message.

call_raw(outpayload)

outpayload is an XMLNode with the SOAP message

Definition at line 99 of file client.py.

00099 
00100     def call_raw(self, outpayload):
00101         """ Send a POST request with the SOAP XML message.
00102         
00103         call_raw(outpayload)
00104         
00105         outpayload is an XMLNode with the SOAP message
00106         """
00107         tid = thread.get_ident()
00108         s = self.connection_cache.get(tid, None)
00109         if s:
00110             try:
00111                 resp, status = s.process(outpayload)
00112                 if not self._fawlty(resp, status):
00113                     return resp.GetXML()
00114             except:
00115                 pass
00116             self.connection_cache[tid] = None
00117         if len(self.urls) == 0:
00118             log.msg(arc.WARNING, 'No URLs to connect to (in %s)' % str(self.__class__.__name__))
00119             raise Exception, 'No URLs to connect'
00120         random.shuffle(self.urls)
00121         #print "available URLs", [url.fullstr() for url in self.urls]
00122         for url in self.urls:
00123             #print "trying URL", url.fullstr()
00124             try:
00125                 s = arc.ClientSOAP(self.cfg, url)
00126                 if self.get_trusted_dns_method:
00127                     dnlist = self.get_trusted_dns_method()
00128                     if dnlist:
00129                         dnlistconf = arc.DNListHandlerConfig(dnlist, 'outgoing')
00130                         # _s points to the superclass, but not the object, so it needs the object as first argument
00131                         s._s._s.AddSecHandler(s, dnlistconf, arc.TLSSec)
00132                 resp, status = s.process(outpayload)
00133                 fawlty = self._fawlty(resp, status)
00134                 if fawlty:
00135                     raise Exception, fawlty
00136                 resp = resp.GetXML()
00137                 self.connection_cache[tid] = s
00138                 return resp
00139             except:
00140                 log.msg(arc.WARNING, "ERROR connecting to", url.fullstr())
00141                 pass
00142         log.msg(arc.ERROR, "ERROR connecting to all of these:", ', '.join([url.fullstr() for url in self.urls]))
00143         raise

Here is the call graph for this function:

Here is the caller graph for this function:

def storage.client.BartenderClient.delFile (   self,
  requests 
)
Initiate deleting a file.

delFile(requests)

requests is a dictionary with requestID as key, and (LN) as value, where
LN is the Logical Name of the file to be deleted

returns a dictionary with requestID as key, and (success) as value,
where success is the state of the request 
(one of 'deleted', 'noSuchLN', 'denied)

Example:
In: {'fish': ['/cod']}
Out: {'fish': ['deleted']}

Definition at line 408 of file client.py.

00408 
00409     def delFile(self, requests):
00410         """ Initiate deleting a file.
00411         
00412         delFile(requests)
00413         
00414         requests is a dictionary with requestID as key, and (LN) as value, where
00415         LN is the Logical Name of the file to be deleted
00416         
00417         returns a dictionary with requestID as key, and (success) as value,
00418         where success is the state of the request 
00419         (one of 'deleted', 'noSuchLN', 'denied)
00420 
00421         Example:
00422         In: {'fish': ['/cod']}
00423         Out: {'fish': ['deleted']}
00424         """
00425         tree = XMLTree(from_tree =
00426             ('bar:delFile', [
00427                 ('bar:delFileRequestList', [
00428                     ('bar:delFileRequestElement', [
00429                         ('bar:requestID', requestID),
00430                         ('bar:LN', LN) 
00431                     ]) for requestID, LN in requests.items()
00432                 ])
00433             ])
00434         )
00435         self.semapool.acquire()
00436         msg = self.call(tree)
00437         self.semapool.release()
00438         xml = self.xmlnode_class(msg)
00439         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)
00440 

Here is the call graph for this function:

def storage.client.BartenderClient.getFile (   self,
  requests 
)
Initiate download of a file.

getFile(requests)

requests is a dicitonary with requestID as key and (LN, protocols) as value,
    where LN is the Logical Name
    protocols is a list of strings: the supported transfer protocols by the client
returns a dictionary with requestID as key and [success, TURL, protocol] as value, where
    success is the status of the request
    TURL is the Transfer URL
    protocol is the name of the choosen protocol
    
Example:
In: {'1':['/', ['byteio']], 'a':['/testfile', ['ftp', 'byteio']]}
Out: 
    {'1': ['is not a file', '', ''],
     'a': ['done',
   'http://localhost:60000/byteio/29563f36-e9cb-47eb-8186-0d720adcbfca',
   'byteio']}

Definition at line 329 of file client.py.

00329 
00330     def getFile(self, requests):
00331         """ Initiate download of a file.
00332         
00333         getFile(requests)
00334         
00335         requests is a dicitonary with requestID as key and (LN, protocols) as value,
00336             where LN is the Logical Name
00337             protocols is a list of strings: the supported transfer protocols by the client
00338         returns a dictionary with requestID as key and [success, TURL, protocol] as value, where
00339             success is the status of the request
00340             TURL is the Transfer URL
00341             protocol is the name of the choosen protocol
00342             
00343         Example:
00344         In: {'1':['/', ['byteio']], 'a':['/testfile', ['ftp', 'byteio']]}
00345         Out: 
00346             {'1': ['is not a file', '', ''],
00347              'a': ['done',
00348                    'http://localhost:60000/byteio/29563f36-e9cb-47eb-8186-0d720adcbfca',
00349                    'byteio']}
00350         """
00351         tree = XMLTree(from_tree =
00352             ('bar:getFile', [
00353                 ('bar:getFileRequestList', [
00354                     ('bar:getFileRequestElement', [
00355                         ('bar:requestID', rID),
00356                         ('bar:LN', LN)
00357                     ] + [
00358                         ('bar:protocol', protocol) for protocol in protocols
00359                     ]) for rID, (LN, protocols) in requests.items()
00360                 ])
00361             ])
00362         )
00363         msg = self.call(tree)
00364         xml = self.xmlnode_class(msg)
00365         return parse_node(get_data_node(xml), ['requestID', 'success', 'TURL', 'protocol'])
    

Here is the call graph for this function:

def storage.client.BartenderClient.list (   self,
  requests,
  neededMetadata = [] 
)
List the contents of a collection.

list(requests, neededMetadata = [])

requests is a dictionary with requestID as key and Logical Name as value
neededMetadata is a list of (section, property) pairs
    if neededMetadata is empty, list will return all metadata for each collection-entry
    otherwise just those values will be returnd which has a listed (section, property)
    if a property is empty means that all properties will be listed from that section
returns a dictionary with requestID as key and (entries, status) as value, where
    entries is a dictionary with the entry name as key and (GUID, metadata) as value
    status is the status of the request

Example:
In: requests = {'jim': '/', 'kirk' : '/testfile'}, neededMetadata = [('states','size'),('entry','type')]
Out: 
    {'jim': ({'coloredcollection': ('cab8d235-4afa-4e33-a85f-fde47b0240d1', {('entry', 'type'): 'collection'}),
      'newdir': ('3b200a34-0d63-4d15-9b01-3693685928bc', {('entry', 'type'): 'collection'}),
      'newfile': ('c9c82371-4773-41e4-aef3-caf7c7eaf6f8', {('entry', 'type'): 'file', ('states', 'size'): '1055'}),
      'testdir': ('4cabc8cb-599d-488c-a253-165f71d4e180', {('entry', 'type'): 'collection'}),
      'testfile': ('cf05727b-73f3-4318-8454-16eaf10f302c', {('entry', 'type'): 'file', ('states', 'size'): '11'})},
     'found'),
     'kirk': ({}, 'is a file')}

Definition at line 599 of file client.py.

00599 
00600     def list(self, requests, neededMetadata = []):
00601         """ List the contents of a collection.
00602         
00603         list(requests, neededMetadata = [])
00604         
00605         requests is a dictionary with requestID as key and Logical Name as value
00606         neededMetadata is a list of (section, property) pairs
00607             if neededMetadata is empty, list will return all metadata for each collection-entry
00608             otherwise just those values will be returnd which has a listed (section, property)
00609             if a property is empty means that all properties will be listed from that section
00610         returns a dictionary with requestID as key and (entries, status) as value, where
00611             entries is a dictionary with the entry name as key and (GUID, metadata) as value
00612             status is the status of the request
00613         
00614         Example:
00615         In: requests = {'jim': '/', 'kirk' : '/testfile'}, neededMetadata = [('states','size'),('entry','type')]
00616         Out: 
00617             {'jim': ({'coloredcollection': ('cab8d235-4afa-4e33-a85f-fde47b0240d1', {('entry', 'type'): 'collection'}),
00618                       'newdir': ('3b200a34-0d63-4d15-9b01-3693685928bc', {('entry', 'type'): 'collection'}),
00619                       'newfile': ('c9c82371-4773-41e4-aef3-caf7c7eaf6f8', {('entry', 'type'): 'file', ('states', 'size'): '1055'}),
00620                       'testdir': ('4cabc8cb-599d-488c-a253-165f71d4e180', {('entry', 'type'): 'collection'}),
00621                       'testfile': ('cf05727b-73f3-4318-8454-16eaf10f302c', {('entry', 'type'): 'file', ('states', 'size'): '11'})},
00622                      'found'),
00623              'kirk': ({}, 'is a file')}
00624         """
00625 
00626         if requests['0'] == "-deleg":
00627             delegID = self.delegateCredentials()
00628             #print delegID
00629             if delegID == 0:
00630                 return "cannot delegate Credentials, check the Env. variables"
00631             del requests['0']
00632 
00633         tree = XMLTree(from_tree =
00634             ('bar:list', [
00635                 ('bar:listRequestList', [
00636                     ('bar:listRequestElement', [
00637                         ('bar:requestID', requestID),
00638                         ('bar:LN', LN)
00639                     ]) for requestID, LN in requests.items()
00640                 ]),
00641                 ('bar:neededMetadataList', [
00642                     ('bar:neededMetadataElement', [
00643                         ('bar:section', section),
00644                         ('bar:property', property)
00645                     ]) for section, property in neededMetadata
00646                 ])
00647             ])
00648         )
00649         msg = self.call(tree)
00650         xml = self.xmlnode_class(msg)
00651         elements = parse_node(get_data_node(xml),
00652             ['requestID', 'entries', 'status'], string = False)
00653         return dict([
00654             (   str(requestID), 
00655                 (dict([(str(name), (str(GUID), parse_metadata(metadataList))) for name, (GUID, metadataList) in
00656                     parse_node(entries, ['name', 'GUID', 'metadataList'], string = False).items()]),
00657                 str(status))
00658             ) for requestID, (entries, status) in elements.items()
00659         ])

Here is the call graph for this function:

def storage.client.BartenderClient.makeCollection (   self,
  requests 
)
Create a new collection.

makeCollection(requests)

requests is a dictionary with requestID as key and (LN, metadata) as value, where
    LN is the Logical Name
    metadata is the metadata of the new collection, a dictionary with (section, property) as key
returns a dictionary with requestID as key and the state of the request as value

In: {'b5':['/coloredcollection', {('metadata','color') : 'light blue'}]}
Out: {'b5': 'done'}

Definition at line 517 of file client.py.

00517 
00518     def makeCollection(self, requests):
00519         """ Create a new collection.
00520         
00521         makeCollection(requests)
00522 
00523         requests is a dictionary with requestID as key and (LN, metadata) as value, where
00524             LN is the Logical Name
00525             metadata is the metadata of the new collection, a dictionary with (section, property) as key
00526         returns a dictionary with requestID as key and the state of the request as value
00527         
00528         In: {'b5':['/coloredcollection', {('metadata','color') : 'light blue'}]}
00529         Out: {'b5': 'done'}
00530         """
00531         tree = XMLTree(from_tree =
00532             ('bar:makeCollection', [
00533                 ('bar:makeCollectionRequestList', [
00534                     ('bar:makeCollectionRequestElement', [
00535                         ('bar:requestID', rID),
00536                         ('bar:LN', LN),
00537                         ('bar:metadataList', create_metadata(metadata, 'bar'))
00538                     ]) for rID, (LN, metadata) in requests.items()
00539                 ])
00540             ])
00541         )
00542         self.semapool.acquire()
00543         msg = self.call(tree)
00544         self.semapool.release()
00545         xml = self.xmlnode_class(msg)
00546         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)

Here is the call graph for this function:

def storage.client.BartenderClient.makeMountpoint (   self,
  requests 
)

Created by Salman Toor ###.

Create a new Mountpoint.

makeMountpoint(requests)

requests is a dictionary with requestID as key and (LN, metadata) as value, where
    LN is the Logical Name
    metadata is the metadata of the new collection, a dictionary with (section, property) as key
returns a dictionary with requestID as key and the state of the request as value

In: {'b5':['/coloredcollection', {('metadata','color') : 'light blue'}]}
Out: {'b5': 'done'}

Definition at line 548 of file client.py.

00548 
00549     def makeMountpoint(self, requests):
00550         """ Create a new Mountpoint.
00551         
00552         makeMountpoint(requests)
00553 
00554         requests is a dictionary with requestID as key and (LN, metadata) as value, where
00555             LN is the Logical Name
00556             metadata is the metadata of the new collection, a dictionary with (section, property) as key
00557         returns a dictionary with requestID as key and the state of the request as value
00558         
00559         In: {'b5':['/coloredcollection', {('metadata','color') : 'light blue'}]}
00560         Out: {'b5': 'done'}
00561         """
00562         tree = XMLTree(from_tree =
00563             ('bar:makeMountpoint', [
00564                 ('bar:makeMountpointRequestList', [
00565                     ('bar:makeMountpointRequestElement', [
00566                         ('bar:requestID', rID),
00567                         ('bar:LN', LN),
00568                         ('bar:URL', URL),
00569                         ('bar:metadataList', create_metadata(metadata, 'bar'))
00570                     ]) for rID, (LN,metadata,URL) in requests.items()
00571                 ])
00572             ])
00573         )
00574 
00575         self.semapool.acquire()
00576         msg = self.call(tree)
00577         self.semapool.release()
00578         xml = self.xmlnode_class(msg)
00579         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)
        

Here is the call graph for this function:

def storage.client.BartenderClient.modify (   self,
  requests 
)

Definition at line 693 of file client.py.

00693 
00694     def modify(self, requests):
00695         tree = XMLTree(from_tree =
00696             ('bar:modify', [
00697                 ('bar:modifyRequestList', [
00698                     ('bar:modifyRequestElement', [
00699                         ('bar:changeID', changeID),
00700                         ('bar:LN', LN),
00701                         ('bar:changeType', changeType),
00702                         ('bar:section', section),
00703                         ('bar:property', property),
00704                         ('bar:value', value)
00705                     ]) for changeID, (LN, changeType, section, property, value) in requests.items()
00706                 ])
00707             ])
00708         )
00709         self.semapool.acquire()
00710         response = self.call(tree)
00711         self.semapool.release()
00712         node = self.xmlnode_class(response)
00713         return parse_node(get_data_node(node), ['changeID', 'success'], True)

Here is the call graph for this function:

def storage.client.BartenderClient.move (   self,
  requests 
)
Move a file or collection within the global namespace.

move(requests)

requests is a dictionary with requestID as key, and (sourceLN, targetLN, preserveOriginal) as value, where
    sourceLN is the source Logical Name
    targetLN is the target Logical Name
    preserverOriginal is True if we want to create a hardlink
returns a dictionary with requestID as key and status as value

Example:
In: {'shoo':['/testfile','/newname',False]}
Out: {'shoo': ['moved']}

Definition at line 660 of file client.py.

00660 
00661     def move(self, requests):
00662         """ Move a file or collection within the global namespace.
00663         
00664         move(requests)
00665         
00666         requests is a dictionary with requestID as key, and (sourceLN, targetLN, preserveOriginal) as value, where
00667             sourceLN is the source Logical Name
00668             targetLN is the target Logical Name
00669             preserverOriginal is True if we want to create a hardlink
00670         returns a dictionary with requestID as key and status as value
00671         
00672         Example:
00673         In: {'shoo':['/testfile','/newname',False]}
00674         Out: {'shoo': ['moved']}
00675         """
00676         tree = XMLTree(from_tree =
00677             ('bar:move', [
00678                 ('bar:moveRequestList', [
00679                     ('bar:moveRequestElement', [
00680                         ('bar:requestID', requestID),
00681                         ('bar:sourceLN', sourceLN),
00682                         ('bar:targetLN', targetLN),
00683                         ('bar:preserveOriginal', preserveOriginal and true or false)
00684                     ]) for requestID, (sourceLN, targetLN, preserveOriginal) in requests.items()
00685                 ])
00686             ])
00687         )
00688         self.semapool.acquire()
00689         msg = self.call(tree)
00690         self.semapool.release()
00691         xml = self.xmlnode_class(msg)
00692         return parse_node(get_data_node(xml), ['requestID', 'status'], single = False)

Here is the call graph for this function:

def storage.client.BartenderClient.putFile (   self,
  requests 
)
Initiate uploading a file.

putFile(requests)

requests is a dictionary with requestID as key, and (LN, metadata, protocols) as value, where
    LN is the Logical Name
    metadata is a dictionary with (section,property) as key, it contains the metadata of the new file
    protocols is a list of protocols supported by the client
returns a dictionary with requestID as key, and (success, TURL, protocol) as value, where
    success is the state of the request
    TURL is the transfer URL
    protocol is the name of the choosen protocol
    
Example:
In: {'qwe': ['/newfile',
    {('states', 'size') : 1055, ('states', 'checksum') : 'none', ('states', 'checksumType') : 'none'},
    ['byteio']]}
Out: 
    {'qwe': ['done',
     'http://localhost:60000/byteio/d42f0993-79a8-4bba-bd86-84324367c65f',
     'byteio']}

Definition at line 366 of file client.py.

00366 
00367     def putFile(self, requests):
00368         """ Initiate uploading a file.
00369         
00370         putFile(requests)
00371         
00372         requests is a dictionary with requestID as key, and (LN, metadata, protocols) as value, where
00373             LN is the Logical Name
00374             metadata is a dictionary with (section,property) as key, it contains the metadata of the new file
00375             protocols is a list of protocols supported by the client
00376         returns a dictionary with requestID as key, and (success, TURL, protocol) as value, where
00377             success is the state of the request
00378             TURL is the transfer URL
00379             protocol is the name of the choosen protocol
00380             
00381         Example:
00382         In: {'qwe': ['/newfile',
00383                     {('states', 'size') : 1055, ('states', 'checksum') : 'none', ('states', 'checksumType') : 'none'},
00384                     ['byteio']]}
00385         Out: 
00386             {'qwe': ['done',
00387                      'http://localhost:60000/byteio/d42f0993-79a8-4bba-bd86-84324367c65f',
00388                      'byteio']}
00389         """
00390         tree = XMLTree(from_tree =
00391             ('bar:putFile', [
00392                 ('bar:putFileRequestList', [
00393                     ('bar:putFileRequestElement', [
00394                         ('bar:requestID', rID),
00395                         ('bar:LN', LN),
00396                         ('bar:metadataList', create_metadata(metadata, 'bar')),
00397                     ] + [
00398                         ('bar:protocol', protocol) for protocol in protocols
00399                     ]) for rID, (LN, metadata, protocols) in requests.items()
00400                 ])
00401             ])
00402         )
00403         self.semapool.acquire()
00404         msg = self.call(tree)
00405         self.semapool.release()
00406         xml = self.xmlnode_class(msg)
00407         return parse_node(get_data_node(xml), ['requestID', 'success', 'TURL', 'protocol'])

Here is the call graph for this function:

def arcom.client.Client.reset (   self) [inherited]

Definition at line 56 of file client.py.

00056 
00057     def reset(self):
00058         tid = thread.get_ident()
00059         self.connection_cache[tid] = None

def storage.client.BartenderClient.stat (   self,
  requests 
)
Get metadata of a file or collection

stat(requests)

requests is a dictionary where requestIDs are the keys, and Logical Names are the values.
this method returns a dictionary for each requestID which contains all the metadata with (section, dictionary) as the key

e.g.

In: {'frodo':'/', 'sam':'/testfile'}
Out:
 
    {'frodo': {('entry', 'type'): 'collection',
       ('entries', 'testdir'): '4cabc8cb-599d-488c-a253-165f71d4e180',
       ('entries', 'testfile'): 'cf05727b-73f3-4318-8454-16eaf10f302c',
       ('states', 'closed'): '0'},
     'sam': {('entry', 'type'): 'file',
     ('locations', 'http://localhost:60000/Shepherd 00d6388c-42df-441c-8d9f-bd78c2c51667'): 'alive',
     ('locations', 'http://localhost:60000/Shepherd 51c9b49a-1472-4389-90d2-0f18b960fe29'): 'alive',
     ('states', 'checksum'): '0927c28a393e8834aa7b838ad8a69400',
     ('states', 'checksumType'): 'md5',
     ('states', 'neededReplicas'): '5',
     ('states', 'size'): '11'}}

Definition at line 287 of file client.py.

00287 
00288     def stat(self, requests):
00289         """ Get metadata of a file or collection
00290         
00291         stat(requests)
00292         
00293         requests is a dictionary where requestIDs are the keys, and Logical Names are the values.
00294         this method returns a dictionary for each requestID which contains all the metadata with (section, dictionary) as the key
00295         
00296         e.g.
00297         
00298         In: {'frodo':'/', 'sam':'/testfile'}
00299         Out:
00300  
00301             {'frodo': {('entry', 'type'): 'collection',
00302                        ('entries', 'testdir'): '4cabc8cb-599d-488c-a253-165f71d4e180',
00303                        ('entries', 'testfile'): 'cf05727b-73f3-4318-8454-16eaf10f302c',
00304                        ('states', 'closed'): '0'},
00305              'sam': {('entry', 'type'): 'file',
00306                      ('locations', 'http://localhost:60000/Shepherd 00d6388c-42df-441c-8d9f-bd78c2c51667'): 'alive',
00307                      ('locations', 'http://localhost:60000/Shepherd 51c9b49a-1472-4389-90d2-0f18b960fe29'): 'alive',
00308                      ('states', 'checksum'): '0927c28a393e8834aa7b838ad8a69400',
00309                      ('states', 'checksumType'): 'md5',
00310                      ('states', 'neededReplicas'): '5',
00311                      ('states', 'size'): '11'}}
00312         """
00313         tree = XMLTree(from_tree =
00314             ('bar:stat', [
00315                 ('bar:statRequestList', [
00316                     ('bar:statRequestElement', [
00317                         ('bar:requestID', requestID),
00318                         ('bar:LN', LN) 
00319                     ]) for requestID, LN in requests.items()
00320                 ])
00321             ])
00322         )
00323         msg = self.call(tree)
00324         xml = self.xmlnode_class(msg)
00325         elements = parse_node(get_data_node(xml),
00326             ['requestID', 'metadataList'], single = True, string = False)
00327         return dict([(str(requestID), parse_metadata(metadataList))
00328             for requestID, metadataList in elements.items()])

Here is the call graph for this function:

def storage.client.BartenderClient.unlink (   self,
  requests 
)
docstring for unlink

Definition at line 480 of file client.py.

00480 
00481     def unlink(self, requests):
00482         """docstring for unlink"""
00483         tree = XMLTree(from_tree =
00484             ('bar:unlink', [
00485                 ('bar:unlinkRequestList', [
00486                     ('bar:unlinkRequestElement', [
00487                         ('bar:requestID', rID),
00488                         ('bar:LN', LN),
00489                     ]) for rID, LN in requests.items()
00490                 ])
00491             ])
00492         )
00493         self.semapool.acquire()
00494         msg = self.call(tree)
00495         self.semapool.release()
00496         xml = self.xmlnode_class(msg)
00497         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)
00498     

Here is the call graph for this function:

def storage.client.BartenderClient.unmakeCollection (   self,
  requests 
)
docstring for unmakeCollection

Definition at line 499 of file client.py.

00499 
00500     def unmakeCollection(self, requests):
00501         """docstring for unmakeCollection"""
00502         tree = XMLTree(from_tree =
00503             ('bar:unmakeCollection', [
00504                 ('bar:unmakeCollectionRequestList', [
00505                     ('bar:unmakeCollectionRequestElement', [
00506                         ('bar:requestID', rID),
00507                         ('bar:LN', LN),
00508                     ]) for rID, LN in requests.items()
00509                 ])
00510             ])
00511         )
00512         self.semapool.acquire()
00513         msg = self.call(tree)
00514         self.semapool.release()
00515         xml = self.xmlnode_class(msg)
00516         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)

Here is the call graph for this function:

def storage.client.BartenderClient.unmakeMountpoint (   self,
  requests 
)
docstring for unmakeMountpoint

Definition at line 580 of file client.py.

00580 
00581     def unmakeMountpoint(self, requests):
00582         """docstring for unmakeMountpoint"""
00583         tree = XMLTree(from_tree =
00584             ('bar:unmakeMountpoint', [
00585                 ('bar:unmakeMountpointRequestList', [
00586                     ('bar:unmakeMountpointRequestElement', [
00587                         ('bar:requestID', rID),
00588                         ('bar:LN', LN),
00589                     ]) for rID, LN in requests.items()
00590                 ])
00591             ])
00592         )
00593         self.semapool.acquire()
00594         msg = self.call(tree)
00595         self.semapool.release()
00596         xml = self.xmlnode_class(msg)
00597         return parse_node(get_data_node(xml), ['requestID', 'success'], single = True)
00598         ###    ###

Here is the call graph for this function:


Member Data Documentation

Definition at line 34 of file client.py.

Definition at line 36 of file client.py.

Definition at line 35 of file client.py.

Definition at line 30 of file client.py.

Definition at line 24 of file client.py.

arcom.client.Client.NS_class = arc.NS [static, inherited]

Definition at line 13 of file client.py.

Definition at line 31 of file client.py.

Definition at line 38 of file client.py.

Definition at line 33 of file client.py.

Definition at line 29 of file client.py.

Definition at line 32 of file client.py.


The documentation for this class was generated from the following file: