Skip to content
Snippets Groups Projects
Commit 4c1881ae authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Merge branch 'main' into 'release'

Main

See merge request !34
parents 08b156ed 717867c4
Branches
Tags
2 merge requests!35build: New dummy version for testing the pipeline,!34Main
Pipeline #5284 passed
......@@ -15,7 +15,7 @@ variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dmaven.artifact.threads=10"
MAIN_BRANCH: "main"
RELEASE_BRANCH: "release"
CLI_PATH: "/disks/data01/wildfly/wildfly-26.1.3.Final/bin"
CLI_PATH: "/disks/data01/wildfly/wildfly-34.0.1.Final/bin"
TMP_PATH: "/home/deployer/gitlab_tmp"
DEPLOYMENT_PATH: "/home/wildfly/deployments"
ARCHIVE_PATH: "/home/wildfly/archive"
......@@ -111,7 +111,7 @@ deploy-to-staging:
stage: deploy
script:
# Authentication setup
- mkdir -p ~/.ssh
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
- chmod 600 ~/.ssh/id_dsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
......
......@@ -34,7 +34,7 @@ $ mvnw.cmd clean install
**PLEASE NOTE that this builds the package without any models. See "Adding models" below for more information**
Download and install [WildFly](https://www.wildfly.org/) == 26.1.3
Download and install [WildFly](https://www.wildfly.org/) == 34.0.1
Deploy the build from this project in Wildfly.
......
......@@ -2,112 +2,112 @@
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>RoughageNutritionModel</artifactId>
<version>1.1.12</version>
<version>1.1.13</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>AlternariaModel</artifactId>
<version>1.1.14</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>BarleyNetBlotchModel</artifactId>
<version>1.1.9</version>
<version>1.1.15</version>
</dependency>
<dependency>
<groupId>fi.luke.vips.model</groupId>
<artifactId>FinnCerealModels</artifactId>
<version>1.1.9</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>Model_LEAFBLOTCH</artifactId>
<version>1.1.9</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>NaerstadModel</artifactId>
<version>1.1.9</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>SeptoriaHumidityModel</artifactId>
<version>1.1.9</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>AppleScabModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>BremiaLactucaeModel</artifactId>
<version>1.1.8</version>
<artifactId>DeliaRadicumModel</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>DeliaRadicumModel</artifactId>
<version>1.1.8</version>
<artifactId>DeliaRadicumFloralisObservationModel</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>DeliaRadicumFloralisObservationModel</artifactId>
<version>1.1.8</version>
<artifactId>BremiaLactucaeModel</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>DOWNCASTModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>GrassDryingModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>LygusRugulipennisModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>Model_MAIZEPHENO</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>MamestraBrassicaeModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>OatFloweringModel</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>NegativePrognosisModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>PsilaRosaeObservationModel</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>OatFloweringModel</artifactId>
<version>1.1.8</version>
<artifactId>PsilaRosaeTempModel</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>PsilaRosaeTempModel</artifactId>
<version>1.1.8</version>
<artifactId>BarleyNetBlotchModel</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>SeptoriaApiicolaModel</artifactId>
<version>1.1.7</version>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
<artifactId>SeptoriaReferenceHumidityModel</artifactId>
<version>1.1.7</version>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>no.nibio.vips.model</groupId>
......
......@@ -9,7 +9,7 @@
<groupId>no.nibio</groupId>
<artifactId>VIPSCore</artifactId>
<packaging>war</packaging>
<version>2.0.14</version>
<version>3.0.0-SNAPSHOT</version>
<name>VIPSCore</name>
<url>http://maven.apache.org</url>
......@@ -32,12 +32,12 @@
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.165</version>
<version>4.8.179</version>
</dependency>
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>2.10</version>
<version>3.0</version>
</dependency>
<dependency>
......@@ -66,13 +66,7 @@
<dependency>
<groupId>no.nibio.vips</groupId>
<artifactId>VIPSCommon</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>8.0.1</version>
<type>jar</type>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
......@@ -80,11 +74,6 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
......@@ -92,16 +81,10 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
......@@ -110,9 +93,9 @@
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0.1</version>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -145,8 +128,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
......
......@@ -20,8 +20,8 @@
package no.nibio.vips.core;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
/**
......
......@@ -20,14 +20,14 @@ package no.nibio.vips.core.config;
import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.ext.ContextResolver;
import jakarta.ws.rs.ext.Provider;
import net.ipmdecisions.weather.entity.LocationWeatherData;
import no.nibio.vips.ipmdecisions.LocationWeatherDataDeserializer;
......
......@@ -18,19 +18,20 @@
package no.nibio.vips.core.service;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import no.nibio.vips.entity.ModelConfiguration;
import no.nibio.vips.entity.Result;
import no.nibio.vips.ipmdecisions.DataTransformer;
......@@ -115,7 +116,7 @@ public class ModelResourceImpl implements ModelResource{
{
retVal.append(mF.getModelInstance(key).getModelName(language));
}
catch(DuplicateModelIdException ex)
catch(DuplicateModelIdException | SecurityException | NoSuchMethodException | InvocationTargetException ex)
{
retVal.append(ex.getMessage());
}
......@@ -149,7 +150,7 @@ public class ModelResourceImpl implements ModelResource{
{
try {
retVal.append(key).append(" ").append(mF.getModelInstance(key).getModelName(language)).append("\n");
} catch (InstantiationException | IllegalAccessException | NoSuchModelException | DuplicateModelIdException ex) {
} catch (InstantiationException | IllegalAccessException | NoSuchModelException | DuplicateModelIdException | SecurityException | NoSuchMethodException | InvocationTargetException ex) {
retVal.append(key).append(" ").append(ex.getMessage()).append("\n");
Logger.getLogger(ModelResourceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
......@@ -231,7 +232,7 @@ public class ModelResourceImpl implements ModelResource{
{
sampleConfig = ModelFactory.getInstance().getModelInstance(modelId).getSampleConfig();
}
catch(NoSuchModelException | DuplicateModelIdException ex)
catch(NoSuchModelException | DuplicateModelIdException | SecurityException | NoSuchMethodException | InvocationTargetException ex)
{
sampleConfig = ex.getMessage();
}
......@@ -261,7 +262,7 @@ public class ModelResourceImpl implements ModelResource{
}
else throw new ModelExcecutionException("Model returned NULL Result");
}
catch(InstantiationException | IllegalAccessException | ConfigValidationException | ModelExcecutionException | NoSuchModelException | DuplicateModelIdException ex)
catch(InstantiationException | IllegalAccessException | ConfigValidationException | ModelExcecutionException | NoSuchModelException | DuplicateModelIdException | SecurityException | NoSuchMethodException | InvocationTargetException ex)
{
Logger.getLogger(ModelResourceImpl.class.getName()).log(Level.SEVERE, null, ex);
return Response.serverError().entity(ex.getMessage()).build();
......
......@@ -18,8 +18,7 @@
package no.nibio.vips.core.startup;
import javax.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextEvent;
import no.nibio.vips.model.factory.ModelFactory;
/**
* This class is created and method contextInitialized called when the application
......@@ -28,7 +27,7 @@ import no.nibio.vips.model.factory.ModelFactory;
* @copyright 2013 {@link http://www.nibio.no NIBIO}
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class StartupListener implements javax.servlet.ServletContextListener{
public class StartupListener implements jakarta.servlet.ServletContextListener{
/**
* Called when the application
......
......@@ -18,9 +18,6 @@
package no.nibio.vips.model.factory;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.HashSet;
......@@ -28,6 +25,9 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import no.nibio.vips.model.Model;
/**
......@@ -96,34 +96,6 @@ public class ModelFactory {
* Builds an inventory.
*/
private void init(){
/*
* Reflections API insists on using at least one package prefix. So we scan
* through all TLDs. List is compiled from
* http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
*/
String[] defaultTopDomains = {
"aero","asia","biz","cat","com","coop","info","int","jobs","mobi",
"museum","name","net","org","post","pro","tel","travel","edu","gov",
"ac","ad","ae","af","ag","ai","al","am","an","ao","aq","ar","as","at",
"au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm",
"bn","bo","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg",
"ch","ci","ck","cl","cm","cn","co","cr","cs","cu","cv","cx","cy","cz",
"dd","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et",
"eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh",
"gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm",
"hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it",
"je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky",
"kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc",
"md","me","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt",
"mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no",
"np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn",
"pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc",
"sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st",
"su","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm",
"tn","to","tp","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz",
"va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","yu","za","zm",
"zw",
};
/**
* Warning: This generates a WARNING from a filesystem/JARfile scan error
......@@ -131,19 +103,14 @@ public class ModelFactory {
* this in log files.
*/
Set<Class<? extends Model>> subTypes = new HashSet();
Set<Class<? extends Model>> subTypes = new HashSet<>();
/*for(String topDomain: defaultTopDomains)
{
reflections = new Reflections(topDomain);
subTypes.addAll(reflections.getSubTypesOf(Model.class));
}*/
boolean verboseClassGraph = System.getProperty("no.nibio.vips.core.VERBOSE_CLASSGRAPH") != null && System.getProperty("no.nibio.vips.core.VERBOSE_CLASSGRAPH").equals("true");
try (ScanResult scanResult = // Assign scanResult in try-with-resources
try (ScanResult scanResult = // Assign scanResult in try-with-resources
new ClassGraph() // Create a new ClassGraph instance
.verbose(verboseClassGraph) // If you want to enable logging to stderr
.enableClassInfo() // Scan classes, methods, fields, annotations
//.acceptPackages("com.xyz") // Scan com.xyz and subpackages
.verbose(verboseClassGraph) // If you want to enable logging to stderr
.enableClassInfo() // Scan classes, methods, fields, annotations
//.acceptPackages("no.nibio") // Scan no.nibio and subpackages
.scan()) { // Perform the scan and return a ScanResult
//ClassInfoList classInfoList =
......@@ -156,7 +123,7 @@ public class ModelFactory {
/**
* Iterates and instantiates one object for each class
*/
this.models = new HashMap();
this.models = new HashMap<>();
for(Class<? extends Model> subType : subTypes)
{
try {
......@@ -303,7 +270,10 @@ public class ModelFactory {
InstantiationException,
IllegalAccessException,
DuplicateModelIdException,
NoSuchModelException
NoSuchModelException,
SecurityException,
NoSuchMethodException,
InvocationTargetException
{
if(this.isDuplicateModelId(modelId))
{
......@@ -313,7 +283,7 @@ public class ModelFactory {
{
throw new NoSuchModelException("ERROR: No model found with id = " + modelId);
}
return this.models.get(modelId).getClass().newInstance();
return this.models.get(modelId).getClass().getDeclaredConstructor().newInstance();
}
private void addDuplicateModelId(String modelId) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment