Skip to content

Commit

Permalink
new version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
prrvchr committed Jan 20, 2024
1 parent 822d1f8 commit 27530e9
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 70 deletions.
2 changes: 1 addition & 1 deletion source/gContactOOo/description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<version value="1.1.0"/>
<version value="1.1.1"/>
<identifier value="io.github.prrvchr.gContactOOo"/>
<platform value="all"/>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions source/gContactOOo/package.properties
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions source/gContactOOo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dateutil>=2.8.2
decorator>=5.1.1
ijson>=3.2.3
packaging>=23.2
Expand Down
76 changes: 11 additions & 65 deletions source/gContactOOo/service/Driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion source/gContactOOo/service/OptionsHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions source/gContactOOo/service/pythonpath/dateutil
1 change: 1 addition & 0 deletions source/gContactOOo/service/pythonpath/gcontact/drvtool.py
3 changes: 2 additions & 1 deletion uno/lib/uno/card/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 27530e9

Please sign in to comment.