Skip to content

Commit

Permalink
Resolves #226 "Transition from javax to jakarta" (#227)
Browse files Browse the repository at this point in the history
* Upgrade Spring 4 to Spring 5 (5.3.30)
Upgrade Hibernate to 5.6 (5.6.15)
Upgrade HSQLDB to 2.7.2

* Use correct Maven coordinates for Hibernate
Remove C3P0 connection pool used in tests

* Fix deprecations (language migration)

* PostgreSQL Upgrade to 42.6.0

* Upgrade JGraphT  to 1.5.2

* Move to log4j2

* Remove unused trove4j library

* Remove unused jfreechart

* Remove unused dependency towards apache ant

* Remove dependency towards javax.mail

* Remove deprecated mail logger, fix compile issues

* Fork from ant bzip2 to avoid direct dependency to build tool

* Compiler fixes + dependency upgrades

* Fork of ant tools to avoid build tools as dependency

* Fix compile issues from trove removal

* Rename log4j config

* Move JWPL to jakarta.* namespace targeting EE 9.1 (Hibernate 6.1.7, JPA 3.0)

* Bumps version to 2.x to indicate a major change (javax -> jakarta)

* adds the possibility to use MariaDB JDBC driver as alternative to proprietary MySQL connector
switches to recommended collation format on modern mysql/mariadb DBMS environments: utf8mb4_bin
sets mysql-connector-java driver to 'runtime' scope, as it should not be compiled against those classes

* Remove Statistics* as these classes were used to connect to bender and compute some stuff. Won't work anyway anymore.

* Remove unused file

* Fix PerformanceIT

* Log4J2 configs

* Add "jwpl-*" prefix

* Remove provided scope in dependency management
Fix scope of log4j2 dependencies in parser module

* Refactor Boolean.XY -> true/false

* Move to commons-compress and remove forked ant code

* Fix refactoring issue regarding hbm2ddl.auto

* Introduce fastutil-core to avoid object-based arrays / maps in version dumpers

---------

Co-authored-by: Martin Wiesner <[email protected]>
  • Loading branch information
rzo1 and mawiesne authored Oct 19, 2023
1 parent fbf0b49 commit c6ba1a6
Show file tree
Hide file tree
Showing 57 changed files with 746 additions and 1,464 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Build with Maven
run: mvn -V clean test --no-transfer-progress
run: mvn -V clean package --no-transfer-progress
Binary file not shown.
80 changes: 34 additions & 46 deletions de.tudarmstadt.ukp.wikipedia.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>de.tudarmstadt.ukp.wikipedia</groupId>
<artifactId>de.tudarmstadt.ukp.wikipedia</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<properties>
Expand All @@ -37,12 +37,12 @@

<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-jdk1.5</artifactId>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
</dependency>
<dependency>
<groupId>de.fau.cs.osr.utils</groupId>
Expand All @@ -61,8 +61,19 @@
<artifactId>swc-parser-lazy</artifactId>
</dependency>
<dependency>
<groupId>org.sweble.wikitext</groupId>
<artifactId>swc-engine</artifactId>
<groupId>de.tudarmstadt.ukp.wikipedia</groupId>
<artifactId>jwpl-swc-engine-shade</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.sweble.wikitext</groupId>
<artifactId>swc-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.sweble.wikitext</groupId>
<artifactId>swc-parser-lazy</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.neovisionaries</groupId>
Expand All @@ -77,16 +88,16 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>

<!-- JUnit dependencies -->
<dependency>
Expand All @@ -102,43 +113,20 @@

<!-- Used in Integration Tests only -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<!-- Activate if your machine has access to UKP MySQL DB resources at UKP in Darmstadt-->
<id>mysql-ukp</id>
<properties>
<database.host>bender.ukp.informatik.tu-darmstadt.de</database.host>
<database.name>wikiapi_en</database.name>
<database.user>student</database.user>
<database.password>student</database.password>
<!-- The original values used at UKP -->
<performance.pages.retrieved>4000</performance.pages.retrieved>
<performance.cycles.maxi>5</performance.cycles.maxi>
<performance.cycles.page>50</performance.cycles.page>
</properties>
</profile>
<profile>
<!-- Activate if your machine has access to MySQL DB resources at HHN in Heilbronn -->
<id>mysql-hhn</id>
<!-- Activate if your machine has access to MariaDB DB resources at HHN in Heilbronn -->
<id>test-it-perf-mariadb-hhn</id>
<properties>
<database.host>tulum-data.gecko.hs-heilbronn.de</database.host>
<database.name>wikiapi_de_jwpl_IT_test</database.name>
<!-- Use SSH Port forwarding to access database @ HHN -->
<database.host>localhost</database.host>
<database.name>wikiapi_simple_20090119</database.name>
<database.user>student</database.user>
<database.password>student</database.password>
<!-- Adjusted value to reduce stress level at HHN CI servers -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ private static DatabaseConfiguration obtainITDBConfiguration(Properties configur
String user = configuration.getProperty("database.user");
String password = configuration.getProperty("database.password");
// String host, String database, String user, String password, Language language
return new DatabaseConfiguration(host, name, user, password, Language.english);
return new DatabaseConfiguration(
"org.mariadb.jdbc.Driver",
"jdbc:mariadb://" + host + "/" + name + "?serverTimezone=Europe/Berlin&autoReconnect=true&useSSL=false",
host, name, user, password, Language.english);
}

private static Properties loadConfiguration() {
Expand Down
58 changes: 0 additions & 58 deletions de.tudarmstadt.ukp.wikipedia.api/src/it/resources/log4j.xml

This file was deleted.

39 changes: 39 additions & 0 deletions de.tudarmstadt.ukp.wikipedia.api/src/it/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Technische Universität Darmstadt under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The Technische Universität Darmstadt
licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>

<Loggers>
<Logger name="de.tudarmstadt.ukp.wikipedia.api.PerformanceTest" level="DEBUG">
<AppenderRef ref="STDOUT"/>
</Logger>

<Logger name="de.tudarmstadt.ukp.wikipedia.api.PerformanceIT" level="DEBUG">
<AppenderRef ref="STDOUT"/>
</Logger>

<Root level="WARN">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
*/
package de.tudarmstadt.ukp.wikipedia.api;

import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;

import org.hibernate.LockMode;
import org.hibernate.Session;
import org.hibernate.type.LongType;
import org.hibernate.type.StringType;

import de.tudarmstadt.ukp.wikipedia.api.exception.WikiApiException;
import de.tudarmstadt.ukp.wikipedia.api.exception.WikiPageNotFoundException;
import de.tudarmstadt.ukp.wikipedia.api.exception.WikiTitleParsingException;
import de.tudarmstadt.ukp.wikipedia.api.hibernate.CategoryDAO;
import org.hibernate.type.StandardBasicTypes;

public class Category implements WikiConstants {

Expand Down Expand Up @@ -114,7 +112,7 @@ private void createCategory(Title title) throws WikiPageNotFoundException {
query += Wikipedia.SQL_COLLATION;
}
returnValue = session.createNativeQuery(query)
.setParameter("name", name, StringType.INSTANCE)
.setParameter("name", name, StandardBasicTypes.STRING)
.uniqueResult();
session.getTransaction().commit();

Expand Down Expand Up @@ -181,20 +179,20 @@ public Set<Category> getParents() {
* @return The number of parents of this category.
*/
public int getNumberOfParents() {
BigInteger nrOfInlinks = new BigInteger("0");
int nrOfInlinks = 0;

long id = this.__getId();
Session session = this.wiki.__getHibernateSession();
session.beginTransaction();
Object returnValue = session.createNativeQuery("select count(inLinks) from category_inlinks where id = :id")
.setParameter("id", id, LongType.INSTANCE)
.setParameter("id", id, StandardBasicTypes.LONG)
.uniqueResult();
session.getTransaction().commit();

if (returnValue != null) {
nrOfInlinks = (BigInteger) returnValue;
nrOfInlinks = ((Long) returnValue).intValue();
}
return nrOfInlinks.intValue();
return nrOfInlinks;
}

/**
Expand Down Expand Up @@ -231,20 +229,20 @@ public Set<Category> getChildren() {
* @return The number of children of this category.
*/
public int getNumberOfChildren() {
BigInteger nrOfOutlinks = new BigInteger("0");
int nrOfOutlinks = 0;

long id = this.__getId();
Session session = this.wiki.__getHibernateSession();
session.beginTransaction();
Object returnValue = session.createNativeQuery("select count(outLinks) from category_outlinks where id = :id")
.setParameter("id", id, LongType.INSTANCE)
.setParameter("id", id, StandardBasicTypes.LONG)
.uniqueResult();
session.getTransaction().commit();

if (returnValue != null) {
nrOfOutlinks = (BigInteger) returnValue;
nrOfOutlinks = ((Long) returnValue).intValue();
}
return nrOfOutlinks.intValue();
return nrOfOutlinks;
}

/**
Expand Down Expand Up @@ -304,20 +302,20 @@ public Set<Integer> getArticleIds() {
* @return The number of pages.
*/
public int getNumberOfPages() {
BigInteger nrOfPages = new BigInteger("0");
int nrOfPages = 0;

long id = this.__getId();
Session session = this.wiki.__getHibernateSession();
session.beginTransaction();
Object returnValue = session.createNativeQuery("select count(pages) from category_pages where id = :id")
.setParameter("id", id, LongType.INSTANCE)
.setParameter("id", id, StandardBasicTypes.LONG)
.uniqueResult();
session.getTransaction().commit();

if (returnValue != null) {
nrOfPages = (BigInteger) returnValue;
nrOfPages = ((Long) returnValue).intValue();
}
return nrOfPages.intValue();
return nrOfPages;
}

/**
Expand Down
Loading

0 comments on commit c6ba1a6

Please sign in to comment.