diff --git a/source/gContactOOo/description.xml b/source/gContactOOo/description.xml index e451db8e..4e9a9a14 100644 --- a/source/gContactOOo/description.xml +++ b/source/gContactOOo/description.xml @@ -28,7 +28,7 @@ xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + diff --git a/source/gContactOOo/package.properties b/source/gContactOOo/package.properties index 2e111d3d..561c5608 100644 --- a/source/gContactOOo/package.properties +++ b/source/gContactOOo/package.properties @@ -1,3 +1,3 @@ #Written by the OOEclipseIntegration -#Sun Jan 14 17:37:37 CET 2024 -contents=Drivers.xcu, META-INF, META-INF/manifest.xml, OAuth2OOo.xcu, Options.xcs, Options.xcu, OptionsDialog.xcu, description, description/desc_en.txt, description/desc_fr.txt, description.xml, gContactOOo, gContactOOo/DialogStrings_en_US.default, gContactOOo/DialogStrings_en_US.properties, gContactOOo/DialogStrings_fr_FR.properties, gContactOOo/LogDialog.xdl, gContactOOo/LogWindow.xdl, gContactOOo/OptionsDialog.xdl, gContactOOo/OptionsDialog_en_US.default, gContactOOo/OptionsDialog_en_US.properties, gContactOOo/OptionsDialog_fr_FR.properties, gContactOOo/dialog.xlb, gContactOOo/gContactOOo.svg, hsqldb, hsqldb/Columns.csv, hsqldb/Properties.csv, hsqldb/PropertyType.csv, hsqldb/Resources.csv, hsqldb/TableColumn.csv, hsqldb/Tables.csv, hsqldb/Types.csv, registration, registration/PrivacyPolicy_en.md, registration/PrivacyPolicy_fr.md, registration/TermsOfUse_en.md, registration/TermsOfUse_fr.md, requirements.txt, resource, resource/Driver_en_US.default, resource/Driver_en_US.properties, resource/Driver_fr_FR.properties, resource/Logger_en_US.default, resource/Logger_en_US.properties, resource/Logger_fr_FR.properties, resource/Replicator_en_US.default, resource/Replicator_en_US.properties, resource/Replicator_fr_FR.properties, resource/dbqueries_en_US.default, resource/dbqueries_en_US.properties, resource/dbqueries_fr_FR.properties, resource/dbtool_en_US.default, resource/dbtool_en_US.properties, resource/dbtool_fr_FR.properties, service, service/pythonpath, service/pythonpath/_distutils_hack, service/pythonpath/decorator-5.1.1.dist-info, service/pythonpath/gcontact, service/pythonpath/gcontact/card, service/pythonpath/gcontact/dbtool, service/pythonpath/gcontact/jdbcdriver, service/pythonpath/gcontact/logger, service/pythonpath/gcontact/logger/dialog, service/pythonpath/gcontact/oauth2, service/pythonpath/gcontact/options, service/pythonpath/gcontact/unolib, service/pythonpath/gcontact/unotool, service/pythonpath/ijson, service/pythonpath/ijson/backends, service/pythonpath/ijson-3.2.3.dist-info, service/pythonpath/packaging, service/pythonpath/packaging-23.2.dist-info, service/pythonpath/pkg_resources, service/pythonpath/pkg_resources/_vendor, service/pythonpath/pkg_resources/_vendor/importlib_resources, service/pythonpath/pkg_resources/_vendor/jaraco, service/pythonpath/pkg_resources/_vendor/jaraco/text, service/pythonpath/pkg_resources/_vendor/more_itertools, service/pythonpath/pkg_resources/_vendor/packaging, service/pythonpath/pkg_resources/_vendor/platformdirs, service/pythonpath/pkg_resources/extern, service/pythonpath/setuptools, service/pythonpath/setuptools/_distutils, service/pythonpath/setuptools/_distutils/command, service/pythonpath/setuptools/_vendor, service/pythonpath/setuptools/_vendor/importlib_metadata, service/pythonpath/setuptools/_vendor/importlib_resources, service/pythonpath/setuptools/_vendor/jaraco, service/pythonpath/setuptools/_vendor/jaraco/text, service/pythonpath/setuptools/_vendor/more_itertools, service/pythonpath/setuptools/_vendor/packaging, service/pythonpath/setuptools/_vendor/tomli, service/pythonpath/setuptools/command, service/pythonpath/setuptools/config, service/pythonpath/setuptools/config/_validate_pyproject, service/pythonpath/setuptools/extern, service/pythonpath/setuptools-69.0.3.dist-info, service/pythonpath/six-1.16.0.dist-info, service/pythonpath/validators, service/pythonpath/validators/i18n, service/pythonpath/validators-0.22.0.dist-info +#Sat Jan 20 00:56:17 CET 2024 +contents=Drivers.xcu, META-INF, META-INF/manifest.xml, OAuth2OOo.xcu, Options.xcs, Options.xcu, OptionsDialog.xcu, description, description/desc_en.txt, description/desc_fr.txt, description.xml, gContactOOo, gContactOOo/DialogStrings_en_US.default, gContactOOo/DialogStrings_en_US.properties, gContactOOo/DialogStrings_fr_FR.properties, gContactOOo/LogDialog.xdl, gContactOOo/LogWindow.xdl, gContactOOo/OptionsDialog.xdl, gContactOOo/OptionsDialog_en_US.default, gContactOOo/OptionsDialog_en_US.properties, gContactOOo/OptionsDialog_fr_FR.properties, gContactOOo/dialog.xlb, gContactOOo/gContactOOo.svg, hsqldb, hsqldb/Columns.csv, hsqldb/Properties.csv, hsqldb/PropertyType.csv, hsqldb/Resources.csv, hsqldb/TableColumn.csv, hsqldb/Tables.csv, hsqldb/Types.csv, registration, registration/PrivacyPolicy_en.md, registration/PrivacyPolicy_fr.md, registration/TermsOfUse_en.md, registration/TermsOfUse_fr.md, requirements.txt, resource, resource/Driver_en_US.default, resource/Driver_en_US.properties, resource/Driver_fr_FR.properties, resource/Logger_en_US.default, resource/Logger_en_US.properties, resource/Logger_fr_FR.properties, resource/Replicator_en_US.default, resource/Replicator_en_US.properties, resource/Replicator_fr_FR.properties, resource/dbqueries_en_US.default, resource/dbqueries_en_US.properties, resource/dbqueries_fr_FR.properties, resource/dbtool_en_US.default, resource/dbtool_en_US.properties, resource/dbtool_fr_FR.properties, service/pythonpath/_distutils_hack, service/pythonpath/dateutil, service/pythonpath/dateutil/parser, service/pythonpath/dateutil/tz, service/pythonpath/dateutil/zoneinfo, service/pythonpath/dateutil-2.8.2.dist-info, service/pythonpath/decorator-5.1.1.dist-info, service/pythonpath/gcontact, service/pythonpath/gcontact/card, service/pythonpath/gcontact/dbtool, service/pythonpath/gcontact/jdbcdriver, service/pythonpath/gcontact/logger, service/pythonpath/gcontact/logger/dialog, service/pythonpath/gcontact/oauth2, service/pythonpath/gcontact/options, service/pythonpath/gcontact/unolib, service/pythonpath/gcontact/unotool, service/pythonpath/ijson, service/pythonpath/ijson/backends, service/pythonpath/ijson-3.2.3.dist-info, service/pythonpath/packaging, service/pythonpath/packaging-23.2.dist-info, service/pythonpath/pkg_resources, service/pythonpath/pkg_resources/_vendor, service/pythonpath/pkg_resources/_vendor/importlib_resources, service/pythonpath/pkg_resources/_vendor/jaraco, service/pythonpath/pkg_resources/_vendor/jaraco/text, service/pythonpath/pkg_resources/_vendor/more_itertools, service/pythonpath/pkg_resources/_vendor/packaging, service/pythonpath/pkg_resources/_vendor/platformdirs, service/pythonpath/pkg_resources/extern, service/pythonpath/setuptools, service/pythonpath/setuptools/_distutils, service/pythonpath/setuptools/_distutils/command, service/pythonpath/setuptools/_vendor, service/pythonpath/setuptools/_vendor/importlib_metadata, service/pythonpath/setuptools/_vendor/importlib_resources, service/pythonpath/setuptools/_vendor/jaraco, service/pythonpath/setuptools/_vendor/jaraco/text, service/pythonpath/setuptools/_vendor/more_itertools, service/pythonpath/setuptools/_vendor/packaging, service/pythonpath/setuptools/_vendor/tomli, service/pythonpath/setuptools/command, service/pythonpath/setuptools/config, service/pythonpath/setuptools/config/_validate_pyproject, service/pythonpath/setuptools/extern, service/pythonpath/setuptools-69.0.3.dist-info, service/pythonpath/six-1.16.0.dist-info, service/pythonpath/validators, service/pythonpath/validators/i18n, service/pythonpath/validators-0.22.0.dist-info diff --git a/source/gContactOOo/requirements.txt b/source/gContactOOo/requirements.txt index a3238940..31f7e97d 100644 --- a/source/gContactOOo/requirements.txt +++ b/source/gContactOOo/requirements.txt @@ -1,3 +1,4 @@ +dateutil>=2.8.2 decorator>=5.1.1 ijson>=3.2.3 packaging>=23.2 diff --git a/source/gContactOOo/service/Driver.py b/source/gContactOOo/service/Driver.py index 5581af7c..9a18a8a0 100644 --- a/source/gContactOOo/service/Driver.py +++ b/source/gContactOOo/service/Driver.py @@ -42,33 +42,16 @@ from com.sun.star.sdbcx import XDataDefinitionSupplier from com.sun.star.sdbcx import XDropCatalog -from gcontact import DataBase - -from gcontact import DataSource - -from gcontact import checkVersion -from gcontact import getConnectionUrl +from gcontact import getDataSource from gcontact import getDriverPropertyInfos -from gcontact import getExtensionVersion from gcontact import getLogger -from gcontact import getOAuth2Version -from gcontact import getSqlException - -from gcontact import g_oauth2ext -from gcontact import g_oauth2ver +from gcontact import getLogException -from gcontact import g_jdbcext -from gcontact import g_jdbcid -from gcontact import g_jdbcver - -from gcontact import g_extension from gcontact import g_identifier from gcontact import g_protocol from gcontact import g_scheme from gcontact import g_host -from gcontact import g_folder from gcontact import g_defaultlog -from gcontact import g_version import validators import traceback @@ -89,7 +72,7 @@ def __init__(self, ctx): self._ctx = ctx self._supportedProtocol = g_protocol self._logger = getLogger(ctx, g_defaultlog) - self._logger.logprb(INFO, 'Driver', '__init__()', 101) + self._logger.logprb(INFO, 'Driver', '__init__()', 1101) __datasource = None @@ -108,30 +91,28 @@ def getDataDefinitionByConnection(self, connection): return connection def getDataDefinitionByURL(self, url, infos): connection = self.connect(url, infos) - return self.getDataDefinitionByConnection(connection) + return connection # XDriver def connect(self, url, infos): try: - self._logger.logprb(INFO, 'Driver', 'connect()', 111, url) + self._logger.logprb(INFO, cls, mtd, 1111, url) protocols = url.strip().split(':') if len(protocols) != 4 or not all(protocols): - self._logSqlException(1101, url) - raise self._getSqlException(112, 1101, url) + raise getLogException(self._logger, self, 1000, 1112, cls, mtd, url) username = protocols[3] password = '' if not validators.email(username): - self._logSqlException(1102, username) - raise self._getSqlException(113, 1102, username) + raise getLogException(self._logger, self, 1001, 1114, cls, mtd) connection = self.DataSource.getConnection(self, g_scheme, g_host, username, password) version = self.DataSource.DataBase.Version name = connection.getMetaData().getUserName() - self._logger.logprb(INFO, 'Driver', 'connect()', 114, version, name) + self._logger.logprb(INFO, cls, mtd, 1115, version, name) return connection except SQLException as e: raise e except Exception as e: - self._logger.logprb(SEVERE, 'Driver', 'connect()', 115, e, traceback.format_exc()) + self._logger.logprb(SEVERE, cls, mtd, 1116, e, traceback.format_exc()) def acceptsURL(self, url): accept = url.startswith(self._supportedProtocol) @@ -162,43 +143,8 @@ def getSupportedServiceNames(self): # Private getter methods def _getDataSource(self): - oauth2 = getOAuth2Version(self._ctx) - driver = getExtensionVersion(self._ctx, g_jdbcid) - if oauth2 is None: - self._logSqlException(501, g_oauth2ext, ' ', g_extension) - raise self._getSqlException(1003, 501, g_oauth2ext, '\n', g_extension) - elif not checkVersion(oauth2, g_oauth2ver): - self._logSqlException(502, oauth2, g_oauth2ext, ' ', g_oauth2ver) - raise self._getSqlException(1003, 502, oauth2, g_oauth2ext, '\n', g_oauth2ver) - elif driver is None: - self._logSqlException(501, g_jdbcext, ' ', g_extension) - raise self._getSqlException(1003, 501, g_jdbcext, '\n', g_extension) - elif not checkVersion(driver, g_jdbcver): - self._logSqlException(502, driver, g_jdbcext, ' ', g_jdbcver) - raise self._getSqlException(1003, 502, driver, g_jdbcext, '\n', g_jdbcver) - else: - path = g_folder + '/' + g_host - url = getConnectionUrl(self._ctx, path) - try: - database = DataBase(self._ctx, url) - except SQLException as e: - self._logSqlException(503, url, ' ', e.Message) - raise self._getSqlException(1005, 503, url, '\n', e.Message) - else: - if not database.isUptoDate(): - self._logSqlException(504, database.Version, ' ', g_version) - raise self._getSqlException(1005, 504, database.Version, '\n', g_version) - else: - return DataSource(self._ctx, database) - return None - - def _logSqlException(self, code, *args): - self._logger.logprb(SEVERE, 'Driver', 'connect()', code, *args) - - def _getSqlException(self, state, code, *args): - state = self._logger.resolveString(state) - msg = self._logger.resolveString(code, *args) - return getSqlException(state, code, msg, self) + cls, mtd = 'Driver', '_getDataSource()' + return getDataSource(self._ctx, self._logger, self, cls, mtd) g_ImplementationHelper.addImplementation(Driver, diff --git a/source/gContactOOo/service/OptionsHandler.py b/source/gContactOOo/service/OptionsHandler.py index 64c4e168..01164446 100644 --- a/source/gContactOOo/service/OptionsHandler.py +++ b/source/gContactOOo/service/OptionsHandler.py @@ -77,7 +77,7 @@ def callHandlerMethod(self, window, event, method): handled = True return handled except Exception as e: - self._logger.logprb(SEVERE, 'OptionsHandler', 'callHandlerMethod()', 141, e, traceback.format_exc()) + self._logger.logprb(SEVERE, 'OptionsHandler', 'callHandlerMethod()', 101, e, traceback.format_exc()) def getSupportedMethodNames(self): return ('external_event', diff --git a/source/gContactOOo/service/pythonpath/dateutil b/source/gContactOOo/service/pythonpath/dateutil new file mode 120000 index 00000000..ebe17531 --- /dev/null +++ b/source/gContactOOo/service/pythonpath/dateutil @@ -0,0 +1 @@ +../../../../uno/lib/python/dateutil \ No newline at end of file diff --git a/source/gContactOOo/service/pythonpath/dateutil-2.8.2.dist-info b/source/gContactOOo/service/pythonpath/dateutil-2.8.2.dist-info new file mode 120000 index 00000000..ad72a332 --- /dev/null +++ b/source/gContactOOo/service/pythonpath/dateutil-2.8.2.dist-info @@ -0,0 +1 @@ +../../../../uno/lib/python/dateutil-2.8.2.dist-info \ No newline at end of file diff --git a/source/gContactOOo/service/pythonpath/gcontact/drvtool.py b/source/gContactOOo/service/pythonpath/gcontact/drvtool.py new file mode 120000 index 00000000..a710a8e8 --- /dev/null +++ b/source/gContactOOo/service/pythonpath/gcontact/drvtool.py @@ -0,0 +1 @@ +../../../../../uno/lib/uno/card/drvtool.py \ No newline at end of file diff --git a/uno/lib/uno/card/__init__.py b/uno/lib/uno/card/__init__.py index bc9c5794..bd92aa0c 100644 --- a/uno/lib/uno/card/__init__.py +++ b/uno/lib/uno/card/__init__.py @@ -40,8 +40,9 @@ # FIXME Import necessary exclusively for vCardOOo from .unotool import getUrl +from .configuration import g_defaultlog +from .configuration import g_host from .configuration import g_identifier from .configuration import g_protocol -from .configuration import g_defaultlog from .configuration import g_scheme