62 def ConnectorFactory(uri, confnodesroot): |
62 def ConnectorFactory(uri, confnodesroot): |
63 """ |
63 """ |
64 Return a connector corresponding to the URI |
64 Return a connector corresponding to the URI |
65 or None if cannot connect to URI |
65 or None if cannot connect to URI |
66 """ |
66 """ |
67 servicetype = uri.split("://")[0].upper() |
67 scheme = uri.split("://")[0].upper() |
68 if servicetype == "LOCAL": |
68 if scheme == "LOCAL": |
69 # Local is special case |
69 # Local is special case |
70 # pyro connection to local runtime |
70 # pyro connection to local runtime |
71 # started on demand, listening on random port |
71 # started on demand, listening on random port |
72 servicetype = "PYRO" |
72 scheme = "PYRO" |
73 runtime_port = confnodesroot.AppFrame.StartLocalRuntime( |
73 runtime_port = confnodesroot.AppFrame.StartLocalRuntime( |
74 taskbaricon=True) |
74 taskbaricon=True) |
75 uri = "PYROLOC://127.0.0.1:" + str(runtime_port) |
75 uri = "PYROLOC://127.0.0.1:" + str(runtime_port) |
76 elif servicetype in connectors: |
76 elif scheme in connectors: |
77 pass |
77 pass |
78 elif servicetype[-1] == 'S' and servicetype[:-1] in connectors: |
78 elif scheme[-1] == 'S' and scheme[:-1] in connectors: |
79 servicetype = servicetype[:-1] |
79 scheme = scheme[:-1] |
80 else: |
80 else: |
81 return None |
81 return None |
82 |
82 |
83 # import module according to uri type |
83 # import module according to uri type |
84 connectorclass = connectors[servicetype]() |
|
85 return connectorclass(uri, confnodesroot) |
84 return connectorclass(uri, confnodesroot) |
|
85 connectorclass = connectors[scheme]() |
86 |
86 |
87 |
87 |
88 def EditorClassFromScheme(scheme): |
88 def EditorClassFromScheme(scheme): |
89 _Import_Dialogs() |
89 _Import_Dialogs() |
90 return per_URI_connectors.get(scheme, None) |
90 return per_URI_connectors.get(scheme, None) |