merging with geni-api branch
[sfa.git] / sfa / methods / ResolveGENI.py
diff --git a/sfa/methods/ResolveGENI.py b/sfa/methods/ResolveGENI.py
new file mode 100644 (file)
index 0000000..83b6c39
--- /dev/null
@@ -0,0 +1,30 @@
+from sfa.util.faults import *
+from sfa.util.namespace import *
+from sfa.util.method import Method
+from sfa.util.parameter import Parameter
+from sfa.trust.credential import Credential
+
+class ResolveGENI(Method):
+    """
+    Lookup a URN and return information about the corresponding object.
+    @param urn
+    
+    """
+    interfaces = ['registry']
+    accepts = [
+        Parameter(str, "URN"),
+        Parameter(type([str]), "List of credentials"),
+        ]
+    returns = Parameter(bool, "Success or Failure")
+
+    def call(self, xrn):
+
+        manager_base = 'sfa.managers'
+
+        if self.api.interface in ['registry']:
+            mgr_type = self.api.config.SFA_REGISTRY_TYPE
+            manager_module = manager_base + ".registry_manager_%s" % mgr_type
+            manager = __import__(manager_module, fromlist=[manager_base])
+            return manager.Resolve(self.api, xrn, '')
+               
+        return {}
\ No newline at end of file