c6e52726d5a5dd7223fc0937f50b7c740323852d
[sfa.git] / sfa / methods / ResolveGENI.py
1 from sfa.util.faults import *
2 from sfa.util.method import Method
3 from sfa.util.parameter import Parameter
4 from sfa.trust.credential import Credential
5
6 class ResolveGENI(Method):
7     """
8     Lookup a URN and return information about the corresponding object.
9     @param urn
10     """
11
12     interfaces = ['registry']
13     accepts = [
14         Parameter(str, "URN"),
15         Parameter(type([str]), "List of credentials"),
16         ]
17     returns = Parameter(bool, "Success or Failure")
18
19     def call(self, xrn):
20
21         manager_base = 'sfa.managers'
22
23         if self.api.interface in ['registry']:
24             mgr_type = self.api.config.SFA_REGISTRY_TYPE
25             manager_module = manager_base + ".registry_manager_%s" % mgr_type
26             manager = __import__(manager_module, fromlist=[manager_base])
27             return manager.Resolve(self.api, xrn, '')
28                
29         return {}