connectors/__init__.py
changeset 717 1c23952dbde1
parent 591 3ece9ba72aaf
child 733 915be999f3f0
equal deleted inserted replaced
716:180e4a7d945c 717:1c23952dbde1
    44     
    44     
    45     if hasattr(new_module, "supported_dnssd_services"):
    45     if hasattr(new_module, "supported_dnssd_services"):
    46         for st in new_module.supported_dnssd_services:
    46         for st in new_module.supported_dnssd_services:
    47             dnssd_connectors[st] = new_module
    47             dnssd_connectors[st] = new_module
    48 
    48 
    49 def ConnectorFactory(uri, pluginsroot):
    49 def ConnectorFactory(uri, confnodesroot):
    50     """
    50     """
    51     Return a connector corresponding to the URI
    51     Return a connector corresponding to the URI
    52     or None if cannot connect to URI
    52     or None if cannot connect to URI
    53     """
    53     """
    54     servicetype = uri.split("://")[0]
    54     servicetype = uri.split("://")[0]
    55     if servicetype in connector_types:
    55     if servicetype in connector_types:
    56         # import module according to uri type
    56         # import module according to uri type
    57         connectormodule = connector_modules[servicetype]
    57         connectormodule = connector_modules[servicetype]
    58         factoryname = servicetype + "_connector_factory"
    58         factoryname = servicetype + "_connector_factory"
    59         return getattr(connectormodule, factoryname)(uri, pluginsroot)
    59         return getattr(connectormodule, factoryname)(uri, confnodesroot)
    60     elif servicetype == "LOCAL":
    60     elif servicetype == "LOCAL":
    61         runtime_port = pluginsroot.AppFrame.StartLocalRuntime(taskbaricon=True)
    61         runtime_port = confnodesroot.AppFrame.StartLocalRuntime(taskbaricon=True)
    62         return PYRO.PYRO_connector_factory(
    62         return PYRO.PYRO_connector_factory(
    63                        "PYRO://127.0.0.1:"+str(runtime_port), 
    63                        "PYRO://127.0.0.1:"+str(runtime_port), 
    64                        pluginsroot)
    64                        confnodesroot)
    65     else :
    65     else :
    66         return None    
    66         return None    
    67 
    67