--- a/connectors/__init__.py Thu Feb 05 23:32:31 2015 +0100
+++ b/connectors/__init__.py Sun Feb 08 16:50:54 2015 +0100
@@ -30,9 +30,9 @@
def _GetLocalConnectorClassFactory(name):
return lambda:getattr(__import__(name,globals(),locals()), name + "_connector_factory")
-connectors = {name:_GetLocalConnectorClassFactory(name)
- for name in listdir(_base_path)
- if path.isdir(path.join(_base_path, name))
+connectors = {name:_GetLocalConnectorClassFactory(name)
+ for name in listdir(_base_path)
+ if path.isdir(path.join(_base_path, name))
and not name.startswith("__")}
def ConnectorFactory(uri, confnodesroot):
@@ -40,15 +40,23 @@
Return a connector corresponding to the URI
or None if cannot connect to URI
"""
- servicetype = uri.split("://")[0]
- if servicetype in connectors:
- # import module according to uri type
- connectorclass = connectors[servicetype]()
- elif servicetype == "LOCAL":
- from PYRO import PYRO_connector_factory as connectorclass
- runtime_port = confnodesroot.AppFrame.StartLocalRuntime(taskbaricon=True)
+ servicetype = uri.split("://")[0].upper()
+ if servicetype == "LOCAL":
+ # Local is special case
+ # pyro connection to local runtime
+ # started on demand, listening on random port
+ servicetype = "PYRO"
+ runtime_port = confnodesroot.AppFrame.StartLocalRuntime(
+ taskbaricon=True)
uri="PYRO://127.0.0.1:"+str(runtime_port)
+ elif servicetype in connectors:
+ pass
+ elif servicetype[-1]=='S' and servicetype[:-1] in connectors:
+ servicetype = servicetype[:-1]
else :
- return None
+ return None
+
+ # import module according to uri type
+ connectorclass = connectors[servicetype]()
return connectorclass(uri, confnodesroot)