Skip to content

Commit

Permalink
Add Hibernate Dialect 6 to the drivers package (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
eresende-nuodb authored Sep 7, 2023
1 parent f4e5bbe commit f5225ef
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions client/pkg/hibernate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class HibernatePackage(Package):
"""Add the NuoDB Hibernate 5 client."""
"""Add the NuoDB Hibernate 5 and 6 client."""

__PKGNAME = 'hibernate'

Expand All @@ -21,15 +21,22 @@ class HibernatePackage(Package):

def __init__(self):
super(HibernatePackage, self).__init__(self.__PKGNAME)
self._hib = None
self._hib5 = None
self._hib6 = None

self.staged = [Stage(name='hibernate5',
title='Hibernate5 Driver',
requirements='Java 8 or 11',
bundle=Bundles.DRIVERS,
package=self.__PKGNAME),
Stage(name='hibernate6',
title='Hibernate6 Driver',
requirements='Java 11',
bundle=Bundles.DRIVERS,
package=self.__PKGNAME)]

self.stage = self.staged[0]
self.stage5 = self.staged[0]
self.stage6 = self.staged[1]

def download(self):
# Hibernate is complicated because both versions 3 and 5 are released
Expand All @@ -40,25 +47,36 @@ def download(self):
# Find the newest hib5 version
for ver in mvn.metadata.find('versioning/versions'):
if ver.text.endswith('hib5'):
self.stage.version = ver.text
self.stage5.version = ver.text
elif ver.text.endswith('hib6'):
self.stage6.version = ver.text

self._hib = Artifact(self.name, 'nuodb-hibernate-hib5.jar',
self._hib5 = Artifact(self.name, 'nuodb-hibernate-hib5.jar',
'{}/{}/{}'.format(mvn.baseurl,
self.stage5.version,
self.__JAR.format(self.stage5.version)))
self._hib6 = Artifact(self.name, 'nuodb-hibernate-hib6.jar',
'{}/{}/{}'.format(mvn.baseurl,
self.stage.version,
self.__JAR.format(self.stage.version)))
self.stage6.version,
self.__JAR.format(self.stage6.version)))

# We only download the actual jar files
self._hib.update()
self._hib5.update()
self._hib6.update()

def unpack(self):
rmdir(self.pkgroot)
mkdir(self.pkgroot)
copy(self._hib.path, os.path.join(self.pkgroot, 'nuodb-hibernate-hib5.jar'))
copy(self._hib5.path, os.path.join(self.pkgroot, 'nuodb-hibernate-hib5.jar'))
copy(self._hib6.path, os.path.join(self.pkgroot, 'nuodb-hibernate-hib6.jar'))
savefile(os.path.join(self.pkgroot, 'LICENSE.txt'), self.getlicense('3BSD'))

def install(self):
self.stage.stage('jar', ['nuodb-hibernate-hib5.jar'])
self.stage.stage('doc', ['LICENSE.txt'])
self.stage5.stage('jar', ['nuodb-hibernate-hib5.jar'])
self.stage5.stage('doc', ['LICENSE.txt'])

self.stage6.stage('jar', ['nuodb-hibernate-hib6.jar'])
self.stage6.stage('doc', ['LICENSE.txt'])


# Create and register this package
Expand Down

0 comments on commit f5225ef

Please sign in to comment.