equal
deleted
inserted
replaced
34 |
34 |
35 |
35 |
36 def _GetLocalConnectorClassFactory(name): |
36 def _GetLocalConnectorClassFactory(name): |
37 return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory") |
37 return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory") |
38 |
38 |
|
39 |
39 def _GetLocalConnectorClassDialog(name): |
40 def _GetLocalConnectorClassDialog(name): |
40 return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), name + "_connector_dialog") |
41 return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), name + "_connector_dialog") |
|
42 |
41 |
43 |
42 def _GetLocalConnectorURITypes(name): |
44 def _GetLocalConnectorURITypes(name): |
43 return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), "URITypes", None) |
45 return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), "URITypes", None) |
44 |
46 |
45 |
47 |
48 for name in listdir(_base_path) |
50 for name in listdir(_base_path) |
49 if (path.isdir(path.join(_base_path, name)) and |
51 if (path.isdir(path.join(_base_path, name)) and |
50 not name.startswith("__"))} |
52 not name.startswith("__"))} |
51 |
53 |
52 connectors_dialog = {name: |
54 connectors_dialog = {name: |
53 {"function":_GetLocalConnectorClassDialog(name), "URITypes": _GetLocalConnectorURITypes(name)} |
55 {"function": _GetLocalConnectorClassDialog(name), "URITypes": _GetLocalConnectorURITypes(name)} |
54 for name in listdir(_base_path) |
56 for name in listdir(_base_path) |
55 if (path.isdir(path.join(_base_path, name)) and |
57 if (path.isdir(path.join(_base_path, name)) and |
56 not name.startswith("__"))} |
58 not name.startswith("__"))} |
57 |
59 |
58 |
60 |
79 |
81 |
80 # import module according to uri type |
82 # import module according to uri type |
81 connectorclass = connectors[servicetype]() |
83 connectorclass = connectors[servicetype]() |
82 return connectorclass(uri, confnodesroot) |
84 return connectorclass(uri, confnodesroot) |
83 |
85 |
|
86 |
84 def ConnectorDialog(conn_type, confnodesroot): |
87 def ConnectorDialog(conn_type, confnodesroot): |
85 if conn_type not in connectors_dialog: |
88 if conn_type not in connectors_dialog: |
86 return None |
89 return None |
87 |
90 |
88 connectorclass = connectors_dialog[conn_type]["function"]() |
91 connectorclass = connectors_dialog[conn_type]["function"]() |
89 return connectorclass(confnodesroot) |
92 return connectorclass(confnodesroot) |
|
93 |
90 |
94 |
91 def GetConnectorFromURI(uri): |
95 def GetConnectorFromURI(uri): |
92 typeOfConnector = None |
96 typeOfConnector = None |
93 for conn_type in connectors_dialog: |
97 for conn_type in connectors_dialog: |
94 connectorTypes = connectors_dialog[conn_type]["URITypes"]() |
98 connectorTypes = connectors_dialog[conn_type]["URITypes"]() |