no longer use sfa.util.storage.SimpleStorage for caching list of instantiated slices...
[sfa.git] / sfa / util / api.py
index ca2557f..0c2b78a 100644 (file)
@@ -19,8 +19,6 @@ from sfa.trust.credential import *
 from sfa.trust.certificate import *
 from sfa.util.namespace import *
 from sfa.util.sfalogging import *
-from sfa.server.registry import Registries
-from sfa.server.aggregate import Aggregates
 
 # See "2.2 Characters" in the XML specification:
 #
@@ -99,14 +97,15 @@ def import_deep(name):
 
 class BaseAPI:
 
-    def __init__(self, config = "/etc/sfa/sfa_config.py", encoding = "utf-8", methods='sfa.methods',
-
-                 peer_cert = None, interface = None, key_file = None, cert_file = None):
+    cache = None
+    def __init__(self, config = "/etc/sfa/sfa_config.py", encoding = "utf-8", 
+                 methods='sfa.methods', peer_cert = None, interface = None, 
+                 key_file = None, cert_file = None, cache = cache):
 
         self.encoding = encoding
         
         # flat list of method names
-         
         self.methods_module = methods_module = __import__(methods, fromlist=[methods])
         self.methods = methods_module.all
 
@@ -123,15 +122,18 @@ class BaseAPI:
         self.key = Keypair(filename=self.key_file)
         self.cert_file = cert_file
         self.cert = Certificate(filename=self.cert_file)
+        self.cache = cache
         self.credential = None
         self.source = None 
         self.time_format = "%Y-%m-%d %H:%M:%S"
         self.logger=get_sfa_logger()
         
         # load registries
+        from sfa.server.registry import Registries
         self.registries = Registries(self) 
 
         # load aggregates
+        from sfa.server.aggregate import Aggregates
         self.aggregates = Aggregates(self)