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

Everything patched/upgraded except Flywaydb

parent 3e486d9b
Branches
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<groupId>no.nibio.vips.model.</groupId> <groupId>no.nibio.vips.model.</groupId>
<artifactId>VIPSCoreManager</artifactId> <artifactId>VIPSCoreManager</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>1.0-SNAPSHOT</version> <version>2022.1</version>
<name>VIPSCoreManager</name> <name>VIPSCoreManager</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
...@@ -14,48 +14,48 @@ ...@@ -14,48 +14,48 @@
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId> <artifactId>javaee-web-api</artifactId>
<version>8.0</version> <version>8.0.1</version>
<type>jar</type> <type>jar</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId> <artifactId>resteasy-jaxrs</artifactId>
<version>3.6.3.Final</version> <version>3.15.3.Final</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.11.3</version> <version>2.13.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.11.3</version> <version>2.13.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
<version>2.11.3</version> <version>2.13.1</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>no.nibio.vips.common</groupId> <groupId>no.nibio.vips.common</groupId>
<artifactId>VIPSCommon</artifactId> <artifactId>VIPSCommon</artifactId>
<version>1.0-SNAPSHOT</version> <version>2022.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.thetransactioncompany</groupId> <groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId> <artifactId>cors-filter</artifactId>
<version>1.7.1</version> <version>2.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId> <artifactId>resteasy-client</artifactId>
<version>3.6.3.Final</version> <version>5.0.1.Final</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<dependency> <dependency>
<groupId>com.bedatadriven</groupId> <groupId>com.bedatadriven</groupId>
<artifactId>jackson-datatype-jts</artifactId> <artifactId>jackson-datatype-jts</artifactId>
<version>2.2</version> <version>2.4</version>
</dependency> </dependency>
</dependencies> </dependencies>
...@@ -75,16 +75,16 @@ ...@@ -75,16 +75,16 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version> <version>3.8.1</version>
<configuration> <configuration>
<source>10</source> <source>11</source>
<target>10</target> <target>11</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> <version>3.3.1</version>
<configuration> <configuration>
<tags> <tags>
<tag> <tag>
......
...@@ -29,6 +29,7 @@ import java.util.List; ...@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
...@@ -45,10 +46,10 @@ import javax.ws.rs.core.Context; ...@@ -45,10 +46,10 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import no.nibio.vips.core.service.ModelResource; import no.nibio.vips.core.service.ModelResource;
import no.nibio.vips.coremanager.config.JacksonConfig; import no.nibio.vips.coremanager.config.JacksonConfig;
import no.nibio.vips.coremanager.session.ControllerGetter;
import no.nibio.vips.coremanager.entity.ModelUsageLog; import no.nibio.vips.coremanager.entity.ModelUsageLog;
import no.nibio.vips.coremanager.entity.VIPSCoreCredentials; import no.nibio.vips.coremanager.entity.VIPSCoreCredentials;
import no.nibio.vips.coremanager.entity.VipsCoreUser; import no.nibio.vips.coremanager.entity.VipsCoreUser;
import no.nibio.vips.coremanager.session.UserController;
import no.nibio.vips.entity.ModelConfiguration; import no.nibio.vips.entity.ModelConfiguration;
import no.nibio.vips.entity.ModelRunRequest; import no.nibio.vips.entity.ModelRunRequest;
import no.nibio.vips.ipmdecisions.IPMDecisionsModelConfiguration; import no.nibio.vips.ipmdecisions.IPMDecisionsModelConfiguration;
...@@ -74,6 +75,8 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -74,6 +75,8 @@ public class ManagerResourceImpl implements ManagerResource{
@Context @Context
HttpServletRequest servletRequest; HttpServletRequest servletRequest;
@EJB
private UserController userController;
private InputStream getStaticFileAsInputStream(ServletContext servletContext, String filePath) private InputStream getStaticFileAsInputStream(ServletContext servletContext, String filePath)
{ {
...@@ -282,7 +285,7 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -282,7 +285,7 @@ public class ManagerResourceImpl implements ManagerResource{
Map<String,String> loginInfo = new HashMap<>(); Map<String,String> loginInfo = new HashMap<>();
loginInfo.put("username", (String)input.get("username")); loginInfo.put("username", (String)input.get("username"));
loginInfo.put("password", (String)input.get("password")); loginInfo.put("password", (String)input.get("password"));
VIPSCoreCredentials credentials = ControllerGetter.getUserController().getVIPSCoreCredentials(loginInfo); VIPSCoreCredentials credentials = userController.getVIPSCoreCredentials(loginInfo);
if(credentials == null) if(credentials == null)
{ {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Not accepted!").build()); throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Not accepted!").build());
...@@ -307,7 +310,7 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -307,7 +310,7 @@ public class ManagerResourceImpl implements ManagerResource{
@Override @Override
public Response getUsersForOrganization(@PathParam("organizationId") Integer organizationId) public Response getUsersForOrganization(@PathParam("organizationId") Integer organizationId)
{ {
List<VipsCoreUser> users = ControllerGetter.getUserController().getVipsCoreUserForOrganization(organizationId); List<VipsCoreUser> users = userController.getVipsCoreUserForOrganization(organizationId);
return Response.ok().entity(users).build(); return Response.ok().entity(users).build();
} }
...@@ -328,7 +331,7 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -328,7 +331,7 @@ public class ManagerResourceImpl implements ManagerResource{
try try
{ {
// First, we authenticate // First, we authenticate
VIPSCoreCredentials credentials = ControllerGetter.getUserController().getVIPSCoreCredentials(request.getLoginInfo()); VIPSCoreCredentials credentials = userController.getVIPSCoreCredentials(request.getLoginInfo());
if(credentials == null) if(credentials == null)
{ {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Credentials not accepted").build()); throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Credentials not accepted").build());
...@@ -354,7 +357,7 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -354,7 +357,7 @@ public class ManagerResourceImpl implements ManagerResource{
{ {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Invalid IP address").build()); throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Invalid IP address").build());
} }
user = ControllerGetter.getUserController().getVipsCoreUser(request.getVipsCoreUserId()); user = userController.getVipsCoreUser(request.getVipsCoreUserId());
} }
ModelUsageLog log = new ModelUsageLog(); ModelUsageLog log = new ModelUsageLog();
...@@ -383,13 +386,13 @@ public class ManagerResourceImpl implements ManagerResource{ ...@@ -383,13 +386,13 @@ public class ManagerResourceImpl implements ManagerResource{
// Log it // Log it
Integer substrEnd = Math.min(2047, res.length()); Integer substrEnd = Math.min(2047, res.length());
log.setMessage(res.substring(0,substrEnd)); log.setMessage(res.substring(0,substrEnd));
ControllerGetter.getUserController().storeModelUsageLog(log); userController.storeModelUsageLog(log);
// Send exception // Send exception
throw new WebApplicationException(Response.status(resp.getStatus()).entity(res).build()); throw new WebApplicationException(Response.status(resp.getStatus()).entity(res).build());
} }
else else
{ {
ControllerGetter.getUserController().storeModelUsageLog(log); userController.storeModelUsageLog(log);
// Assuming that String is the quickest way of forwarding this // Assuming that String is the quickest way of forwarding this
String resultAsString = resp.readEntity(String.class); String resultAsString = resp.readEntity(String.class);
return Response.ok().entity(resultAsString).build(); return Response.ok().entity(resultAsString).build();
......
/*
* Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
*
* This file is part of VIPSCoreManager.
* VIPSCoreManager is free software: you can redistribute it and/or modify
* it under the terms of the NIBIO Open Source License as published by
* NIBIO, either version 1 of the License, or (at your option) any
* later version.
*
* VIPSCoreManager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* NIBIO Open Source License for more details.
*
* You should have received a copy of the NIBIO Open Source License
* along with VIPSCoreManager. If not, see <http://www.nibio.no/licenses/>.
*
*/
package no.nibio.vips.coremanager.session;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* @copyright 2013 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class ControllerGetter {
private static final String JNDI_PATH = "java:global/VIPSCoreManager-1.0-SNAPSHOT/";
public static UserController getUserController()
{
try
{
InitialContext ic = new InitialContext();
UserController retVal = (UserController) ic.lookup(ControllerGetter.getJndiPath(UserController.class));
return retVal;
}catch(NamingException ne)
{
System.out.println("Kunne ikke finne " + UserController.class.getSimpleName());
return null;
}
}
private static String getJndiPath(Class obj)
{
String retVal = ControllerGetter.JNDI_PATH + obj.getSimpleName();
//System.out.println("JNDI-path=" + retVal);
return retVal;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment