Back to index

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

List of all members.

Public Member Functions

def __init__
def stat
def delFile
def getFile
def addReplica
def putFile
def unlink
def unmakeCollection
def makeCollection
def unmakeMountpoint
 Created by Salman Toor.
def makeMountpoint
def list
 


def move
def modify
def DelegateCredentialsInit
def UpdateCredentials
def removeCredentials
def RegistrationCollector
def GetAdditionalLocalInformation
def GetLocalInformation
def process

Public Attributes

 service_name
 proxy_store
 bartender
 delegSOAP
 ssl_config
 state
 request_config
 ns

Detailed Description

Definition at line 902 of file bartender.py.


Constructor & Destructor Documentation

Definition at line 904 of file bartender.py.

00904 
00905     def __init__(self, cfg):
00906         self.service_name = 'Bartender'
00907         #bar_request_names is the list of the names of the provided methods
00908         bar_request_names = ['stat','makeMountpoint','unmakeMountpoint', 'unmakeCollection', 'makeCollection', 'list', 'move', 'putFile', 'getFile', 'addReplica', 'delFile', 'modify', 'unlink', 'removeCredentials']
00909         # bartender_uri is the URI of the Bartender service namespace, and 'bar' is the prefix we want to use for this namespace
00910         bar_request_type = {'request_names' : bar_request_names,
00911             'namespace_prefix': 'bar', 'namespace_uri': bartender_uri} 
00912         # deleg_request_names contains the methods for delegation
00913         deleg_request_names = ['DelegateCredentialsInit', 'UpdateCredentials']
00914         # 'deleg' is the prefix for the delegation
00915         deleg_request_type = {'request_names' : deleg_request_names,
00916             'namespace_prefix': 'deleg', 'namespace_uri': 'http://www.nordugrid.org/schemas/delegation'}
00917         request_config = [deleg_request_type, bar_request_type]
00918         # call the Service's constructor
00919         Service.__init__(self, request_config, cfg, start_service = False)
00920         # get the path to proxy store
00921         self.proxy_store = str(cfg.Get('ProxyStore'))
00922         try:
00923             if not os.path.exists(self.proxy_store):
00924                 os.mkdir(self.proxy_store)
00925             log.msg(arc.VERBOSE, 'Proxy store:', self.proxy_store)
00926         except:
00927             self.proxy_store = ''
00928         if not self.proxy_store:
00929             log.msg(arc.ERROR, 'The directory for storing proxies is not available. Proxy delegation disabled.')
00930         self.bartender = Bartender(cfg, self.ssl_config, self.state)
        

Member Function Documentation

Definition at line 1071 of file bartender.py.

01071 
01072     def addReplica(self, inpayload):
01073         # incoming SOAP message example:
01074         #
01075         #   <soap-env:Body>
01076         #       <bar:addReplica>
01077         #           <bar:addReplicaRequestList>
01078         #               <bar:putReplicaRequestElement>
01079         #                   <bar:requestID>0</bar:requestID>
01080         #                   <bar:GUID>cf05727b-73f3-4318-8454-16eaf10f302c</bar:GUID>
01081         #               </bar:putReplicaRequestElement>
01082         #           </bar:addReplicaRequestList>
01083         #           <bar:protocol>byteio</bar:protocol>
01084         #       </bar:addReplica>
01085         #   </soap-env:Body>
01086         #
01087         # outgoing SOAP message example:
01088         #
01089         #   <soap-env:Envelope>
01090         #       <soap-env:Body>
01091         #           <bar:addReplicaResponse>
01092         #               <bar:addReplicaResponseList>
01093         #                   <bar:addReplicaResponseElement>
01094         #                       <bar:requestID>0</bar:requestID>
01095         #                       <bar:success>done</bar:success>
01096         #                       <bar:TURL>http://localhost:60000/byteio/f568be18-26ae-4925-ae0c-68fe023ef1a5</bar:TURL>
01097         #                       <bar:protocol>byteio</bar:protocol>
01098         #                   </bar:addReplicaResponseElement>
01099         #               </bar:addReplicaResponseList>
01100         #           </bar:addReplicaResponse>
01101         #       </soap-env:Body>
01102         #   </soap-env:Envelope>
01103         
01104         # get the list of supported protocols
01105         protocols = [str(node) for node in inpayload.XPathLookup('//bar:protocol', self.ns)]
01106         # get the GUID of each request
01107         request_nodes = get_child_nodes(inpayload.Child().Get('addReplicaRequestList'))
01108         requests = dict([(str(request_node.Get('requestID')), str(request_node.Get('GUID')))
01109                 for request_node in request_nodes])
01110         response = self.bartender.addReplica(inpayload.auth, requests, protocols)
01111         return create_response('bar:addReplica',
01112             ['bar:requestID', 'bar:success', 'bar:TURL', 'bar:protocol'], response, self._new_soap_payload())
    

Here is the call graph for this function:

Definition at line 1425 of file bartender.py.

01425 
01426     def DelegateCredentialsInit(self,inpayload):
01427         ns = arc.NS('delegation','http://www.nordugrid.org/schemas/delegation')
01428         outpayload = arc.PayloadSOAP(ns)
01429         if self.proxy_store:
01430             #print inpayload.GetXML()
01431             # Delegation Credentials(NEED TO FIX IT)  
01432             self.delegSOAP = arc.DelegationContainerSOAP()
01433             self.delegSOAP.DelegateCredentialsInit(inpayload,outpayload)
01434             #print "\n outpayload"
01435             #print outpayload.GetXML()
01436         return outpayload
        

Definition at line 987 of file bartender.py.

00987 
00988     def delFile(self, inpayload):
00989         # incoming SOAP message example:
00990         #
00991         #   <bar:delFile>
00992         #       <bar:delFileRequestList>
00993         #           <bar:delFileRequestElement>
00994         #               <bar:requestID>0</bar:requestID>
00995         #               <bar:LN>/</bar:LN>
00996         #           </bar:delFileRequestElement>
00997         #       </bar:delFileRequestList>
00998         #   </bar:delFile>
00999         #
01000         # outgoing SOAP message example:
01001         #
01002         #   <soap-env:Envelope>
01003         #       <soap-env:Body>
01004         #           <bar:delFileResponse>
01005         #               <bar:delFileResponseList>
01006         #                   <bar:delFileResponseElement>
01007         #                       <bar:requestID>0</bar:requestID>
01008         #                       <bar:success>deleted</bar:success>
01009         #                   </bar:delFileResponseElement>
01010         #               </bar:delFileResponseList>
01011         #           </bar:delFileResponse>
01012         #       </soap-env:Body>
01013         #   </soap-env:Envelope>
01014 
01015         request_nodes = get_child_nodes(inpayload.Child().Child())
01016         # get the requestID and LN of each request and create a dictionary where the requestID is the key and the LN is the value
01017         requests = dict([
01018             (str(request_node.Get('requestID')), str(request_node.Get('LN')))
01019                 for request_node in request_nodes
01020         ])
01021         response = self.bartender.delFile(inpayload.auth, requests)
01022         return create_response('bar:delFile',
01023             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single=True)
01024 

Here is the call graph for this function:

Definition at line 1497 of file bartender.py.

01497 
01498     def GetAdditionalLocalInformation(self, service_node):
01499         service_node.NewChild('Type').Set(bartender_servicetype)

Here is the caller graph for this function:

Definition at line 1025 of file bartender.py.

01025 
01026     def getFile(self, inpayload):
01027         # incoming SOAP message example:
01028         #
01029         #   <soap-env:Body>
01030         #       <bar:getFile>
01031         #           <bar:getFileRequestList>
01032         #               <bar:getFileRequestElement>
01033         #                   <bar:requestID>0</bar:requestID>
01034         #                   <bar:LN>/testfile</bar:LN>
01035         #                   <bar:protocol>byteio</bar:protocol>
01036         #               </bar:getFileRequestElement>
01037         #           </bar:getFileRequestList>
01038         #       </bar:getFile>
01039         #   </soap-env:Body>
01040         #
01041         # outgoing SOAP message example:
01042         #
01043         #   <soap-env:Envelope>
01044         #       <soap-env:Body>
01045         #           <bar:getFileResponse>
01046         #               <bar:getFileResponseList>
01047         #                   <bar:getFileResponseElement>
01048         #                       <bar:requestID>0</bar:requestID>
01049         #                       <bar:success>done</bar:success>
01050         #                       <bar:TURL>http://localhost:60000/byteio/12d86ba3-99d5-408e-91d1-35f7c47774e4</bar:TURL>
01051         #                       <bar:protocol>byteio</bar:protocol>
01052         #                   </bar:getFileResponseElement>
01053         #               </bar:getFileResponseList>
01054         #           </bar:getFileResponse>
01055         #       </soap-env:Body>
01056         #   </soap-env:Envelope>
01057 
01058         request_nodes = get_child_nodes(inpayload.Child().Child())
01059         requests = dict([
01060             (
01061                 str(request_node.Get('requestID')), 
01062                 ( # get the LN and all the protocols for each request and put them in a list
01063                     str(request_node.Get('LN')),
01064                     [str(node) for node in request_node.XPathLookup('//bar:protocol', self.ns)]
01065                 )
01066             ) for request_node in request_nodes
01067         ])
01068         response = self.bartender.getFile(inpayload.auth, requests)
01069         return create_response('bar:getFile',
01070             ['bar:requestID', 'bar:success', 'bar:TURL', 'bar:protocol'], response, self._new_soap_payload())
    

Here is the call graph for this function:

def arcom.service.Service.GetLocalInformation (   self) [inherited]

Definition at line 162 of file service.py.

00162 
00163     def GetLocalInformation(self):
00164         ns = arc.NS({'':'http://schemas.ogf.org/glue/2008/05/spec_2.0_d41_r01'})
00165         info = arc.XMLNode(ns,'Domains')
00166         service_node = info.NewChild('AdminDomain').NewChild('Services').NewChild('Service')
00167         endpoint_node = service_node.NewChild('Endpoint')
00168         endpoint_node.NewChild('HealthState').Set('ok')
00169         if self.state.running:
00170             serving_state = 'production'
00171         else:
00172             serving_state = 'closed'
00173         endpoint_node.NewChild('ServingState').Set(serving_state)
00174         try:
00175             self.GetAdditionalLocalInformation(service_node)
00176         except:
00177             pass
00178         return info
    

Here is the call graph for this function:

Here is the caller graph for this function:

def storage.bartender.bartender.BartenderService.list (   self,
  inpayload 
)

Definition at line 1304 of file bartender.py.

01304 
01305     def list(self, inpayload):
01306         # incoming SOAP message example:
01307         #
01308         #   <soap-env:Body>
01309         #       <bar:list>
01310         #           <bar:listRequestList>
01311         #               <bar:listRequestElement>
01312         #                   <bar:requestID>0</bar:requestID>
01313         #                   <bar:LN>/</bar:LN>
01314         #               </bar:listRequestElement>
01315         #           </bar:listRequestList>
01316         #           <bar:neededMetadataList>
01317         #               <bar:neededMetadataElement>
01318         #                   <bar:section>entry</bar:section>
01319         #                   <bar:property></bar:property>
01320         #               </bar:neededMetadataElement>
01321         #           </bar:neededMetadataList>
01322         #       </bar:list>
01323         #   </soap-env:Body>
01324         #
01325         # outgoing SOAP message example:
01326         #
01327         #   <soap-env:Envelope>
01328         #       <soap-env:Body>
01329         #           <bar:listResponse>
01330         #               <bar:listResponseList>
01331         #                   <bar:listResponseElement>
01332         #                       <bar:requestID>0</bar:requestID>
01333         #                       <bar:entries>
01334         #                           <bar:entry>
01335         #                               <bar:name>testfile</bar:name>
01336         #                               <bar:GUID>cf05727b-73f3-4318-8454-16eaf10f302c</bar:GUID>
01337         #                               <bar:metadataList>
01338         #                                   <bar:metadata>
01339         #                                       <bar:section>entry</bar:section>
01340         #                                       <bar:property>type</bar:property>
01341         #                                       <bar:value>file</bar:value>
01342         #                                   </bar:metadata>
01343         #                               </bar:metadataList>
01344         #                           </bar:entry>
01345         #                           <bar:entry>
01346         #                               <bar:name>testdir</bar:name>
01347         #                               <bar:GUID>4cabc8cb-599d-488c-a253-165f71d4e180</bar:GUID>
01348         #                               <bar:metadataList>
01349         #                                   <bar:metadata>
01350         #                                       <bar:section>entry</bar:section>
01351         #                                       <bar:property>type</bar:property>
01352         #                                       <bar:value>collection</bar:value>
01353         #                                   </bar:metadata>
01354         #                               </bar:metadataList>
01355         #                           </bar:entry>
01356         #                       </bar:entries>
01357         #                       <bar:status>found</bar:status>
01358         #                   </bar:listResponseElement>
01359         #               </bar:listResponseList>
01360         #           </bar:listResponse>
01361         #       </soap-env:Body>
01362         #   </soap-env:Envelope>
01363         
01364         requests = parse_node(inpayload.Child().Get('listRequestList'),
01365             ['requestID', 'LN'], single = False)
01366         neededMetadata = [
01367             node_to_data(node, ['section', 'property'], single = True)
01368                 for node in get_child_nodes(inpayload.Child().Get('neededMetadataList'))
01369         ]
01370         response0 = self.bartender.list(inpayload.auth, requests, neededMetadata)
01371         response = dict([
01372             (requestID,
01373             ([('bar:entry', [
01374                 ('bar:name', name),
01375                 ('bar:GUID', GUID),
01376                 ('bar:metadataList', create_metadata(metadata))
01377             ]) for name, (GUID, metadata) in entries.items()],
01378             status)
01379         ) for requestID, (entries, status) in response0.items()])
01380         return create_response('bar:list',
01381             ['bar:requestID', 'bar:entries', 'bar:status'], response, self._new_soap_payload())

Here is the call graph for this function:

Definition at line 1196 of file bartender.py.

01196 
01197     def makeCollection(self, inpayload):
01198         # incoming SOAP message example:
01199         # 
01200         #   <soap-env:Body>
01201         #       <bar:makeCollection>
01202         #           <bar:makeCollectionRequestList>
01203         #               <bar:makeCollectionRequestElement>
01204         #                   <bar:requestID>0</bar:requestID>
01205         #                   <bar:LN>/testdir</bar:LN>
01206         #                   <bar:metadataList>
01207         #                       <bar:metadata>
01208         #                           <bar:section>states</bar:section>
01209         #                           <bar:property>closed</bar:property>
01210         #                           <bar:value>no</bar:value>
01211         #                       </bar:metadata>
01212         #                   </bar:metadataList>
01213         #               </bar:makeCollectionRequestElement>
01214         #           </bar:makeCollectionRequestList>
01215         #       </bar:makeCollection>
01216         #   </soap-env:Body>
01217         #
01218         # outgoing SOAP message example
01219         #
01220         #   <soap-env:Envelope>
01221         #       <soap-env:Body>
01222         #           <bar:makeCollectionResponse>
01223         #               <bar:makeCollectionResponseList>
01224         #                   <bar:makeCollectionResponseElement>
01225         #                       <bar:requestID>0</bar:requestID>
01226         #                       <bar:success>done</bar:success>
01227         #                   </bar:makeCollectionResponseElement>
01228         #               </bar:makeCollectionResponseList>
01229         #           </bar:makeCollectionResponse>
01230         #       </soap-env:Body>
01231         #   </soap-env:Envelope>
01232 
01233         request_nodes = get_child_nodes(inpayload.Child().Child())
01234         requests = dict([
01235             (str(request_node.Get('requestID')), 
01236                 (str(request_node.Get('LN')), parse_metadata(request_node.Get('metadataList')))
01237             ) for request_node in request_nodes
01238         ])
01239         response = self.bartender.makeCollection(inpayload.auth, requests)
01240         return create_response('bar:makeCollection',
01241             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

Definition at line 1255 of file bartender.py.

01255 
01256     def makeMountpoint(self, inpayload):
01257         # incoming SOAP message example:
01258         # 
01259         #   <soap-env:Body>
01260         #       <bar:makeMountpoint>
01261         #           <bar:makeMountpointRequestList>
01262         #               <bar:makeMountpointRequestElement>
01263         #                   <bar:requestID>0</bar:requestID>
01264         #                   <bar:LN>/testdir</bar:LN>
01265         #                   <bar:URL>URL</bar:URL>
01266         #                   <bar:metadataList>
01267         #                       <bar:metadata>
01268         #                           <bar:section>any</bar:section>
01269         #                           <bar:property>additional</bar:property>
01270         #                           <bar:value>metadata</bar:value>
01271         #                       </bar:metadata>
01272         #                   </bar:metadataList>
01273         #               </bar:makeMountpointRequestElement>
01274         #           </bar:makeMountpointRequestList>
01275         #       </bar:makeMountpoint>
01276         #   </soap-env:Body>
01277         #
01278         # outgoing SOAP message example
01279         #
01280         #   <soap-env:Envelope>
01281         #       <soap-env:Body>
01282         #           <bar:makeMountpointResponse>
01283         #               <bar:makeMountpointResponseList>
01284         #                   <bar:makeMountpointResponseElement>
01285         #                       <bar:requestID>0</bar:requestID>
01286         #                       <bar:success>done</bar:success>
01287         #                   </bar:makeMountpointResponseElement>
01288         #               </bar:makeMountpointResponseList>
01289         #           </bar:makeMountpointResponse>
01290         #       </soap-env:Body>
01291         #   </soap-env:Envelope>
01292 
01293         request_nodes = get_child_nodes(inpayload.Child().Child())
01294         requests = dict([
01295             (str(request_node.Get('requestID')),
01296                 (str(request_node.Get('LN')), parse_metadata(request_node.Get('metadataList')), str(request_node.Get('URL')))
01297             ) for request_node in request_nodes
01298         ])
01299         response = self.bartender.makeMountpoint(inpayload.auth, requests)
01300         return create_response('bar:makeMountpoint',
01301             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single = True)
        

Here is the call graph for this function:

def storage.bartender.bartender.BartenderService.modify (   self,
  inpayload 
)

Definition at line 1418 of file bartender.py.

01418 
01419     def modify(self, inpayload):
01420         requests = parse_node(inpayload.Child().Child(), ['bar:changeID',
01421             'bar:LN', 'bar:changeType', 'bar:section', 'bar:property', 'bar:value'])
01422         response = self.bartender.modify(inpayload.auth, requests)
01423         return create_response('bar:modify', ['bar:changeID', 'bar:success'],
01424             response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

def storage.bartender.bartender.BartenderService.move (   self,
  inpayload 
)

Definition at line 1382 of file bartender.py.

01382 
01383     def move(self, inpayload):
01384         # incoming SOAP message example:
01385         #   <soap-env:Body>
01386         #       <bar:move>
01387         #           <bar:moveRequestList>
01388         #               <bar:moveRequestElement>
01389         #                   <bar:requestID>0</bar:requestID>
01390         #                   <bar:sourceLN>/testfile2</bar:sourceLN>
01391         #                   <bar:targetLN>/testdir/</bar:targetLN>
01392         #                   <bar:preserveOriginal>0</bar:preserveOriginal>
01393         #               </bar:moveRequestElement>
01394         #           </bar:moveRequestList>
01395         #       </bar:move>
01396         #   </soap-env:Body>
01397         #
01398         # outgoing SOAP message example:
01399         #
01400         #   <soap-env:Envelope>
01401         #       <soap-env:Body>
01402         #           <bar:moveResponse>
01403         #               <bar:moveResponseList>
01404         #                   <bar:moveResponseElement>
01405         #                       <bar:requestID>0</bar:requestID>
01406         #                       <bar:status>moved</bar:status>
01407         #                   </bar:moveResponseElement>
01408         #               </bar:moveResponseList>
01409         #           </bar:moveResponse>
01410         #       </soap-env:Body>
01411         #   </soap-env:Envelope>
01412 
01413         requests = parse_node(inpayload.Child().Child(),
01414             ['requestID', 'sourceLN', 'targetLN', 'preserveOriginal'])
01415         response = self.bartender.move(inpayload.auth, requests)
01416         return create_response('bar:move',
01417             ['bar:requestID', 'bar:status'], response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

def arcom.service.Service.process (   self,
  inmsg,
  outmsg 
) [inherited]
Method to process incoming message and create outgoing one. 

Definition at line 179 of file service.py.

00179 
00180     def process(self, inmsg, outmsg):
00181         """ Method to process incoming message and create outgoing one. """
00182         # gets the payload from the incoming message
00183         inpayload = inmsg.Payload()
00184         try:
00185             # the first child of the payload should be the name of the request
00186             request_node = inpayload.Child()
00187             # get the namespace of the request node
00188             request_namespace = request_node.Namespace()
00189             matched_request_types = [request_type for request_type in self.request_config if request_type['namespace_uri'] == request_namespace]
00190             if len(matched_request_types) == 0:
00191                 # check if it is a LIDI request:
00192                 if request_namespace == wsrf_rp_uri:
00193                     outpayload = arc.PayloadSOAP(arc.NS({'wsrf-rp':wsrf_rp_uri}))
00194                     outpayload.NewChild('wsrf-rp:GetResourcePropertyDocumentResponse').NewChild(self.GetLocalInformation())
00195                     outmsg.Payload(outpayload)
00196                     return arc.MCC_Status(arc.STATUS_OK)
00197                 raise Exception, 'wrong namespace. expected: %s' % ', '.join([request_type['namespace_uri'] for request_type in self.request_config])
00198             current_request_type = matched_request_types[0]
00199             # get the name of the request without the namespace prefix
00200             request_name = request_node.Name()
00201             if request_name not in current_request_type['request_names']:
00202                 # if the name of the request is not in the list of supported request names
00203                 raise Exception, 'wrong request (%s)' % request_name
00204             log.msg(arc.VERBOSE,'%(sn)s.%(rn)s called' % {'sn':self.service_name, 'rn':request_name})
00205             if not self.state.running:
00206                 outpayload = arc.PayloadSOAP(self.ns, True)
00207                 fault = outpayload.Fault()
00208                 fault.Reason('%s service is inactive (not initialized yet or shutting down)' % self.service_name) 
00209                 outmsg.Payload(outpayload)
00210                 return arc.MCC_Status(arc.STATUS_OK)
00211             # if the request name is in the supported names,
00212             # then this class should have a method with this name
00213             # the 'getattr' method returns this method
00214             # which then we could call with the incoming payload
00215             # and which will return the response payload
00216             log.msg(arc.DEBUG, inpayload.GetXML())
00217             outpayload = self._call_request(request_name, inmsg)
00218             # sets the payload of the outgoing message
00219             outmsg.Payload(outpayload)
00220             # return with the STATUS_OK status
00221             return arc.MCC_Status(arc.STATUS_OK)
00222         except:
00223             # if there is any exception, print it
00224             msg = log.msg()
00225             outpayload = arc.PayloadSOAP(self.ns, True)
00226             fault = outpayload.Fault()
00227             fault.Reason('%s service raised a %s' % (self.service_name, msg))
00228             outmsg.Payload(outpayload)
00229             return arc.MCC_Status(arc.STATUS_OK)

Here is the call graph for this function:

Definition at line 1113 of file bartender.py.

01113 
01114     def putFile(self, inpayload):
01115         # incoming SOAP message example:
01116         #
01117         #   <soap-env:Body>
01118         #       <bar:putFile>
01119         #           <bar:putFileRequestList>
01120         #               <bar:putFileRequestElement>
01121         #                   <bar:requestID>0</bar:requestID>
01122         #                   <bar:LN>/testfile2</bar:LN>
01123         #                   <bar:metadataList>
01124         #                       <bar:metadata>
01125         #                           <bar:section>states</bar:section>
01126         #                           <bar:property>neededReplicas</bar:property>
01127         #                           <bar:value>2</bar:value>
01128         #                       </bar:metadata>
01129         #                       <bar:metadata>
01130         #                           <bar:section>states</bar:section>
01131         #                           <bar:property>size</bar:property>
01132         #                           <bar:value>11</bar:value>
01133         #                       </bar:metadata>
01134         #                   </bar:metadataList>
01135         #                   <bar:protocol>byteio</bar:protocol>
01136         #               </bar:putFileRequestElement>
01137         #           </bar:putFileRequestList>
01138         #       </bar:putFile>
01139         #   </soap-env:Body>
01140         #
01141         # outgoing SOAP message example:
01142         #
01143         #   <soap-env:Envelope>
01144         #       <soap-env:Body>
01145         #           <bar:putFileResponse>
01146         #               <bar:putFileResponseList>
01147         #                   <bar:putFileResponseElement>
01148         #                       <bar:requestID>0</bar:requestID>
01149         #                       <bar:success>done</bar:success>
01150         #                       <bar:TURL>http://localhost:60000/byteio/b8f2987b-a718-47b3-82bb-e838470b7e00</bar:TURL>
01151         #                       <bar:protocol>byteio</bar:protocol>
01152         #                   </bar:putFileResponseElement>
01153         #               </bar:putFileResponseList>
01154         #           </bar:putFileResponse>
01155         #       </soap-env:Body>
01156         #   </soap-env:Envelope>
01157 
01158         request_nodes = get_child_nodes(inpayload.Child().Child())
01159         requests = dict([
01160             (
01161                 str(request_node.Get('requestID')), 
01162                 (
01163                     str(request_node.Get('LN')),
01164                     parse_metadata(request_node.Get('metadataList')),
01165                     [str(node) for node in request_node.XPathLookup('//bar:protocol', self.ns)]
01166                 )
01167             ) for request_node in request_nodes
01168         ])
01169         response = self.bartender.putFile(inpayload.auth, requests)
01170         return create_response('bar:putFile',
01171             ['bar:requestID', 'bar:success', 'bar:TURL', 'bar:protocol'], response, self._new_soap_payload())

Here is the call graph for this function:

Definition at line 1490 of file bartender.py.

01490 
01491     def RegistrationCollector(self, doc):
01492         regentry = arc.XMLNode('<RegEntry />')
01493         regentry.NewChild('SrcAdv').NewChild('Type').Set(bartender_servicetype)
01494         #Place the document into the doc attribute
01495         doc.Replace(regentry)
01496         return True

Definition at line 1462 of file bartender.py.

01462 
01463     def removeCredentials(self, inpayload):
01464         response = {}
01465         if self.proxy_store:
01466             log.msg(arc.INFO, 'ID: '+inpayload.auth.get_identity())
01467             message = ''
01468             if (os.path.isdir(self.proxy_store)):
01469                 log.msg(arc.VERBOSE, 'ProxyStore: %s',self.proxy_store)
01470                 filePath = self.proxy_store+'/'+base64.b64encode(inpayload.auth.get_identity())+'.proxy'
01471                 if (os.path.isfile(filePath)):    
01472                     os.system('rm '+filePath)
01473                     message = 'Credential removed successfully'
01474                     status = 'successful' 
01475                 else:
01476                     message =  'cannot access proxy file: '+filePath
01477                     status = 'failed'
01478             else:
01479                 message = 'cannot access proxy_store, Check the configuration file (service.xml)\n Need to have a <ProxyStore>'
01480                 status = 'failed'
01481         else: 
01482             message = 'cannot access proxy_store, Check the configuration file (service.xml)\n Need to have a <ProxyStore>'                
01483             status = 'failed'
01484         #print message
01485         response['message'] = message
01486         response['status'] = status
01487         log.msg(arc.VERBOSE, 'removeCredentials: %s', message)
01488         log.msg(arc.VERBOSE, 'removeCredentials: %s', status)  
01489         return create_response('bar:removeCredentials', ['bar:message','bar:status'],response, self._new_soap_payload(), single = True) 

Here is the call graph for this function:

def storage.bartender.bartender.BartenderService.stat (   self,
  inpayload 
)

Definition at line 931 of file bartender.py.

00931 
00932     def stat(self, inpayload):
00933         # incoming SOAP message example:
00934         #
00935         #   <bar:stat>
00936         #       <bar:statRequestList>
00937         #           <bar:statRequestElement>
00938         #               <bar:requestID>0</bar:requestID>
00939         #               <bar:LN>/</bar:LN>
00940         #           </bar:statRequestElement>
00941         #       </bar:statRequestList>
00942         #   </bar:stat>
00943         #
00944         # outgoing SOAP message example:
00945         #
00946         #   <bar:statResponse>
00947         #       <bar:statResponseList>
00948         #           <bar:statResponseElement>
00949         #              <bar:requestID>0</bar:requestID>
00950         #               <bar:metadataList>
00951         #                   <bar:metadata>
00952         #                       <bar:section>states</bar:section>
00953         #                       <bar:property>closed</bar:property>
00954         #                       <bar:value>0</bar:value>
00955         #                   </bar:metadata>
00956         #                   <bar:metadata>
00957         #                       <bar:section>entries</bar:section>
00958         #                       <bar:property>testfile</bar:property>
00959         #                       <bar:value>cf05727b-73f3-4318-8454-16eaf10f302c</bar:value>
00960         #                   </bar:metadata>
00961         #                   <bar:metadata>
00962         #                       <bar:section>entry</bar:section>
00963         #                       <bar:property>type</bar:property>
00964         #                       <bar:value>collection</bar:value>
00965         #                   </bar:metadata>
00966         #               </bar:metadataList>
00967         #           </bar:statResponseElement>
00968         #       </bar:statResponseList>
00969         #   </bar:statResponse>
00970 
00971         # get all the requests
00972         request_nodes = get_child_nodes(inpayload.Child().Child())
00973         # get the requestID and LN of each request and create a dictionary where the requestID is the key and the LN is the value
00974         requests = dict([(
00975             str(request_node.Get('requestID')),
00976             [str(request_node.Get('LN'))]
00977             ) for request_node in request_nodes
00978         ])
00979         # call the Bartender class
00980         response = self.bartender.stat(inpayload.auth, requests)
00981         # create the metadata XML structure of each request
00982         for requestID, metadata in response.items():
00983             response[requestID] = create_metadata(metadata, 'bar')
00984         # create the response message with the requestID and the metadata for each request
00985         return create_response('bar:stat',
00986             ['bar:requestID', 'bar:metadataList'], response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

def storage.bartender.bartender.BartenderService.unlink (   self,
  inpayload 
)
docstring for unlink

Definition at line 1172 of file bartender.py.

01172 
01173     def unlink(self, inpayload):
01174         """docstring for unlink"""
01175         request_nodes = get_child_nodes(inpayload.Child().Child())
01176         requests = dict([(
01177                 str(request_node.Get('requestID')),
01178                 [str(request_node.Get('LN'))]
01179             ) for request_node in request_nodes
01180         ])
01181         response = self.bartender.unlink(inpayload.auth, requests)
01182         return create_response('bar:unlink',
01183             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single = True)
01184     

Here is the call graph for this function:

Definition at line 1185 of file bartender.py.

01185 
01186     def unmakeCollection(self, inpayload):
01187         request_nodes = get_child_nodes(inpayload.Child().Child())
01188         requests = dict([(
01189                 str(request_node.Get('requestID')),
01190                 [str(request_node.Get('LN'))]
01191             ) for request_node in request_nodes
01192         ])
01193         response = self.bartender.unmakeCollection(inpayload.auth, requests)
01194         return create_response('bar:unmakeCollection',
01195             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

Created by Salman Toor.

Definition at line 1244 of file bartender.py.

01244 
01245     def unmakeMountpoint(self, inpayload):
01246         request_nodes = get_child_nodes(inpayload.Child().Child())
01247         requests = dict([(
01248                 str(request_node.Get('requestID')),
01249                 [str(request_node.Get('LN'))]
01250             ) for request_node in request_nodes
01251         ])
01252         response = self.bartender.unmakeMountpoint(inpayload.auth, requests)
01253         return create_response('bar:unmakeMountpoint',
01254             ['bar:requestID', 'bar:success'], response, self._new_soap_payload(), single = True)

Here is the call graph for this function:

Definition at line 1437 of file bartender.py.

01437 
01438     def UpdateCredentials(self,inpayload):
01439         #print inpayload.GetXML()
01440         ns = arc.NS('delegation','http://www.nordugrid.org/schemas/delegation')
01441         outpayload = arc.PayloadSOAP(ns)
01442         credAndid = self.delegSOAP.UpdateCredentials(inpayload,outpayload)
01443         #print credAndid
01444         if credAndid[0] == True:
01445             #print "\n ---Delegated Credentials--- "
01446             #print credAndid[1]
01447             log.msg(arc.INFO,'Delegation status: ', credAndid[0])
01448             if (os.path.isdir(self.proxy_store)):
01449                 #print "ProxyStore: "+self.proxy_store 
01450                 filePath = self.proxy_store+'/'+base64.b64encode(inpayload.auth.get_identity())+'.proxy'
01451                 log.msg(arc.VERBOSE,'creating proxy file : ', filePath)
01452                 proxyfile = open(filePath, 'w') 
01453                 proxyfile.write(credAndid[1])
01454                 proxyfile.close()
01455                 log.msg(arc.VERBOSE,'created successfully, ID: %s',credAndid[2]) 
01456                 os.system('chmod 600 '+filePath)
01457             else:
01458                 log.msg(arc.VERBOSE,'cannot access proxy_store, Check the configuration file (service.xml)\n Need to have a <ProxyStore>')
01459         else:
01460             log.msg(arc.INFO,'Delegation failed: ')
01461         return outpayload
        

Member Data Documentation

Definition at line 929 of file bartender.py.

Definition at line 1431 of file bartender.py.

Definition at line 92 of file service.py.

Definition at line 920 of file bartender.py.

Definition at line 91 of file service.py.

Reimplemented from arcom.service.Service.

Definition at line 905 of file bartender.py.

Definition at line 47 of file service.py.

Definition at line 49 of file service.py.


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