3 from sfa.util.xrn import Xrn, urn_to_hrn
4 from sfa.util.method import Method
5 from sfa.util.parameter import Parameter, Mixed
6 from sfa.trust.credential import Credential
7 from sfa.util.record import SfaRecord
13 @param cred credential string authorizing the caller
14 @param hrn human readable name to resolve (hrn or urn)
15 @return a list of record dictionaries or empty list
18 interfaces = ['registry']
21 Mixed(Parameter(str, "Human readable name (hrn or urn)"),
22 Parameter(list, "List of Human readable names ([hrn])")),
23 Mixed(Parameter(str, "Credential string"),
24 Parameter(list, "List of credentials)"))
29 def call(self, xrns, creds):
31 if not isinstance(xrns, types.ListType):
32 type = Xrn(xrns).get_type()
34 hrns = [urn_to_hrn(xrn)[0] for xrn in xrns]
35 #find valid credentials
36 valid_creds = self.api.auth.checkCredentials(creds, 'resolve')
39 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
40 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrns, self.name))
42 # send the call to the right manager
43 manager = self.api.get_interface_manager()
44 return manager.resolve(self.api, xrns, type)