Skip to content

Commit

Permalink
Upgrade to tommee 9, move to jakarta namespace, add deprecated aristo…
Browse files Browse the repository at this point in the history
… theme to primefaces, remove incompatible commons-fileupload, upgrade required dependencies.
  • Loading branch information
meier-rene committed Oct 18, 2024
1 parent 2183a4d commit 56b72d7
Show file tree
Hide file tree
Showing 27 changed files with 184 additions and 147 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,43 @@ name: Docker Image

on:
push:
branches: [ master ]
branches:
- 'master'
- 'dev'
tags:
- 'v*'

jobs:
docker:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ipbhalle/metfragweb
tags: |
# tag event
type=ref,event=tag
# set latest tag for main branch and tags
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
# set dev tag for dev branch
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev'}}
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: ipbhalle/metfragweb:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ipbhalle/metfragweb:latest
cache-to: type=inline
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LocalDatabasesFolderForWeb = /vol/file_databases' > /MetFragRelaunched/MetFragWe
RUN mvn -Dhttps.protocols=TLSv1.2 -f MetFragRelaunched clean package -pl MetFragLib -pl MetFragWeb -am -DskipTests


FROM tomee:8.0.15
FROM tomee:9

RUN set -eux; \
apt-get update; \
Expand Down
4 changes: 0 additions & 4 deletions MetFragLib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public static MetFragGlobalSettings readSettings(java.io.File parameterFile, Log
* check whether the current parameter has already been defined
*/
if (setParameters.contains(tmp[0].trim())) {
logger.error(tmp[0].trim() + " was already defined in the parameter file.");
if (logger != null)
logger.error(tmp[0].trim() + " was already defined in the parameter file.");
parameterFileReader.close();
throw new Exception();
}
Expand All @@ -181,7 +182,8 @@ public static MetFragGlobalSettings readSettings(java.io.File parameterFile, Log
settings.set(tmp[0].trim(), ParameterDataTypes.getParameter(valueString.trim(), tmp[0].trim()));
}
catch(Exception e) {
logger.error("Error in parameter file at \"" + line + " \"");
if (logger != null)
logger.error("Error in parameter file at \"" + line + " \"");
parameterFileReader.close();
throw new Exception("Error in parameter file at \"" + line + " \"");
}
Expand Down
16 changes: 11 additions & 5 deletions MetFragWeb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<version>1.9.13</version>
<configuration>
<container>
<containerId>tomee8x</containerId>
<containerId>tomee9x</containerId>
</container>
<deployables>
<deployable>
Expand Down Expand Up @@ -54,13 +54,14 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>commons-fileupload</groupId>-->
<!-- <artifactId>commons-fileupload</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
Expand All @@ -74,5 +75,10 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>aristo</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.Comparator;
import java.util.Hashtable;

import javax.faces.model.SelectItem;
import javax.faces.model.SelectItemGroup;
import jakarta.faces.model.SelectItem;
import jakarta.faces.model.SelectItemGroup;

import de.ipbhalle.metfraglib.parameter.ClassNames;
import de.ipbhalle.metfraglib.parameter.Constants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.util.HashMap;
import java.util.List;

import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import javax.servlet.ServletContext;
import jakarta.faces.context.FacesContext;
import jakarta.faces.model.SelectItem;
import jakarta.servlet.ServletContext;

import org.apache.log4j.Level;
import org.primefaces.model.chart.AxisType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import java.io.IOException;
import java.util.Random;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import jakarta.faces.bean.ManagedBean;
import jakarta.faces.bean.SessionScoped;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.ActionEvent;
import javax.imageio.ImageIO;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.openscience.cdk.exception.CDKException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package de.ipbhalle.metfragweb.controller;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import jakarta.annotation.PostConstruct;
import jakarta.faces.bean.ManagedBean;
import jakarta.faces.bean.RequestScoped;
import jakarta.faces.context.FacesContext;

import de.ipbhalle.metfraglib.parameter.Constants;
import de.ipbhalle.metfraglib.parameter.VariableNames;
import de.ipbhalle.metfragweb.datatype.Parameter;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import org.primefaces.PrimeFaces;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
import java.net.UnknownHostException;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import jakarta.annotation.PostConstruct;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.bean.ManagedBean;
import jakarta.faces.bean.SessionScoped;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.ActionEvent;
import jakarta.faces.model.SelectItem;
import javax.imageio.ImageIO;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.apache.commons.mail.EmailAttachment;
Expand All @@ -31,6 +31,7 @@
import org.primefaces.event.organigram.OrganigramNodeSelectEvent;
import org.primefaces.model.OrganigramNode;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.LineChartModel;
import org.primefaces.model.chart.LineChartSeries;
Expand Down Expand Up @@ -276,7 +277,7 @@ public void parametersUploadListener(org.primefaces.event.FileUploadEvent event)
/*
* database search settings
*/
public java.util.List<javax.faces.model.SelectItem> getAvailableDatabases() {
public java.util.List<jakarta.faces.model.SelectItem> getAvailableDatabases() {
return this.beanSettingsContainer.getAvailableParameters().getDatabases();
}

Expand Down Expand Up @@ -907,7 +908,7 @@ public void setExcludedElements(String excludedFilterElements) {
}

//SMARTS inclusion
public java.util.List<javax.faces.model.SelectItem> getAvailableSubstructureSmarts() {
public java.util.List<jakarta.faces.model.SelectItem> getAvailableSubstructureSmarts() {
return this.beanSettingsContainer.getAvailableParameters().getSubstructureSmarts();
}

Expand Down Expand Up @@ -1069,7 +1070,7 @@ public void setSelectedInformationSmarts(String selectedSmarts) {
this.beanSettingsContainer.setSelectedInformationSmarts(selectedSmarts);
}

public java.util.List<javax.faces.model.SelectItem> getAvailableSubstructureInformationSmarts() {
public java.util.List<jakarta.faces.model.SelectItem> getAvailableSubstructureInformationSmarts() {
return this.beanSettingsContainer.getAvailableParameters().getSubstructureInformationSmarts();
}

Expand Down Expand Up @@ -1813,11 +1814,11 @@ private boolean checkScoreSettings() {
/*
* fragmenter settings
*/
public java.util.List<javax.faces.model.SelectItem> getPrecursorModes() {
public java.util.List<jakarta.faces.model.SelectItem> getPrecursorModes() {
return this.beanSettingsContainer.getAvailableParameters().getPrecursorModes();
}

public java.util.List<javax.faces.model.SelectItem> getTreeDepths() {
public java.util.List<jakarta.faces.model.SelectItem> getTreeDepths() {
return this.beanSettingsContainer.getAvailableParameters().getTreeDepths();
}

Expand Down Expand Up @@ -2013,7 +2014,7 @@ public org.primefaces.model.StreamedContent getDownloadParameters() {
try {
resource = this.beanSettingsContainer.getUserOutputDataHandler().getDownloadParameters(this.errorMessages, pathToProperties);
} catch(Exception e) {
resource = new org.primefaces.model.DefaultStreamedContent(System.in, "application/zip", "MetFragWeb_Parameters.zip");
resource = DefaultStreamedContent.builder().contentType("application/zip").name("MetFragWeb_Parameters.zip").stream(() -> System.in).build();
}
return resource;
}
Expand Down Expand Up @@ -2702,7 +2703,7 @@ public void closeScoresView() {
* @return
*/
public org.primefaces.model.StreamedContent generateCandidateDownloadFile() {
org.primefaces.model.StreamedContent resource = new org.primefaces.model.DefaultStreamedContent(System.in, "application/vnd.ms-excel", "MetFragWeb_Candidate.xls" );
org.primefaces.model.StreamedContent resource = DefaultStreamedContent.builder().contentType("application/vnd.ms-excel").name("MetFragWeb_Candidate.xls").stream(() -> System.in).build();
try {
resource = this.beanSettingsContainer.getUserOutputDataHandler().generatedCandidateDownloadFile(this.currentScoreCandidate, this.beanSettingsContainer.getMetFragSettings());
} catch (Exception e1) {
Expand Down Expand Up @@ -3005,7 +3006,7 @@ public void viewExpiredListener() {
System.out.println("session expired " + this.beanSettingsContainer.getRootSessionFolder());
FacesContext fc = FacesContext.getCurrentInstance();
java.util.Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
javax.faces.application.NavigationHandler nav =
jakarta.faces.application.NavigationHandler nav =
fc.getApplication().getNavigationHandler();
// Push some useful stuff to the request scope for
// use in the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.io.Serializable;

import javax.faces.model.SelectItem;
import jakarta.faces.model.SelectItem;

public class AvailableScore extends SelectItem implements Serializable, Comparable<AvailableScore> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

import javax.faces.model.SelectItem;
import jakarta.faces.model.SelectItem;

import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.LineChartModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.util.HashMap;
import java.util.Map;

import javax.faces.application.Resource;
import javax.faces.context.FacesContext;
import jakarta.faces.application.Resource;
import jakarta.faces.context.FacesContext;

public class DownloadResource extends Resource implements java.io.Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import java.util.Iterator;
import java.util.Map;

import javax.faces.FacesException;
import javax.faces.application.NavigationHandler;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
import jakarta.faces.FacesException;
import jakarta.faces.application.NavigationHandler;
import jakarta.faces.application.ViewExpiredException;
import jakarta.faces.context.ExceptionHandler;
import jakarta.faces.context.ExceptionHandlerWrapper;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.ExceptionQueuedEvent;
import jakarta.faces.event.ExceptionQueuedEventContext;

import org.primefaces.PrimeFaces;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.ipbhalle.metfragweb.exception;

import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;
import jakarta.faces.context.ExceptionHandler;
import jakarta.faces.context.ExceptionHandlerFactory;
import de.ipbhalle.metfragweb.exception.ViewExpiredExceptionExceptionHandler;

public class ViewExpiredExceptionExceptionHandlerFactory extends ExceptionHandlerFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.io.IOException;
import java.util.ArrayList;

import javax.faces.model.SelectItem;
import jakarta.faces.model.SelectItem;
import javax.imageio.ImageIO;

import org.apache.commons.io.FileUtils;
Expand Down
Loading

0 comments on commit 56b72d7

Please sign in to comment.