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