diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1119f4eb90a39da2d0e1580e1377fc39f11ad0b4..5fea75d9258a6063a2e3677a793e2085a3541b62 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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" diff --git a/README.md b/README.md index 1e3fbebcf2b57e208efaff4ca8b8ea78226ba005..65c1c0b5cae4bd4cce64bc38976df6e7a9739e4c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/models.xml b/models.xml index 60f57c35dcbe9d157b34cfdad4c7a2449eba3b1b..45ec129b0884d1efe81915e8bbcbb80534cbb78a 100644 --- a/models.xml +++ b/models.xml @@ -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> diff --git a/pom.xml b/pom.xml index 427812b073711a6df2e9d3344cda4d63e1d9e0c0..0a7ad709eb2d403a95b00ab7c6991b6534f9b296 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <groupId>no.nibio</groupId> <artifactId>VIPSCore</artifactId> <packaging>war</packaging> - <version>2.0.15-SNAPSHOT</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> diff --git a/src/main/java/no/nibio/vips/core/VIPSCoreApplication.java b/src/main/java/no/nibio/vips/core/VIPSCoreApplication.java index 52f93d819f72e2923c3eadb005b727137d57d0b6..7e141f8c64d0495715090ec1299d14fdc7eaa2ab 100755 --- a/src/main/java/no/nibio/vips/core/VIPSCoreApplication.java +++ b/src/main/java/no/nibio/vips/core/VIPSCoreApplication.java @@ -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; /** diff --git a/src/main/java/no/nibio/vips/core/config/JacksonConfig.java b/src/main/java/no/nibio/vips/core/config/JacksonConfig.java index ce4eb98517711dcaaa3ed71a5220627f76d3a38d..9e136d4ad282c847e985e75b6b932318149d8569 100755 --- a/src/main/java/no/nibio/vips/core/config/JacksonConfig.java +++ b/src/main/java/no/nibio/vips/core/config/JacksonConfig.java @@ -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; diff --git a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java index 257b3b8bd13d9c36b86482c3225e16d4ef0f0124..969307326fd47ba826d1a050967606d28a8179dc 100755 --- a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java +++ b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java @@ -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(); diff --git a/src/main/java/no/nibio/vips/core/startup/StartupListener.java b/src/main/java/no/nibio/vips/core/startup/StartupListener.java index a4dcfd1fde4a4ff171d1cd806587e99b739867b5..badb23779c430f94bc4fe8e648a6eec666e7208d 100755 --- a/src/main/java/no/nibio/vips/core/startup/StartupListener.java +++ b/src/main/java/no/nibio/vips/core/startup/StartupListener.java @@ -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 diff --git a/src/main/java/no/nibio/vips/model/factory/ModelFactory.java b/src/main/java/no/nibio/vips/model/factory/ModelFactory.java index c49e78217d44b1ef6a0b1df2ece4fd5d65674170..635339f6797026a497f6ffb61fd48046e23c220f 100755 --- a/src/main/java/no/nibio/vips/model/factory/ModelFactory.java +++ b/src/main/java/no/nibio/vips/model/factory/ModelFactory.java @@ -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) {