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
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
<groupId>no.nibio.vips.model.</groupId>
<artifactId>VIPSCoreManager</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<version>2022.1</version>
<name>VIPSCoreManager</name>
<url>http://maven.apache.org</url>
......@@ -14,48 +14,48 @@
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>8.0</version>
<version>8.0.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.6.3.Final</version>
<version>3.15.3.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.11.3</version>
<version>2.13.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.11.3</version>
<version>2.13.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.11.3</version>
<version>2.13.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>no.nibio.vips.common</groupId>
<artifactId>VIPSCommon</artifactId>
<version>1.0-SNAPSHOT</version>
<version>2022.1</version>
</dependency>
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>1.7.1</version>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.6.3.Final</version>
<version>5.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -66,7 +66,7 @@
<dependency>
<groupId>com.bedatadriven</groupId>
<artifactId>jackson-datatype-jts</artifactId>
<version>2.2</version>
<version>2.4</version>
</dependency>
</dependencies>
......@@ -75,16 +75,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>3.3.1</version>
<configuration>
<tags>
<tag>
......
......@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
......@@ -45,10 +46,10 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import no.nibio.vips.core.service.ModelResource;
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.VIPSCoreCredentials;
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.ModelRunRequest;
import no.nibio.vips.ipmdecisions.IPMDecisionsModelConfiguration;
......@@ -74,6 +75,8 @@ public class ManagerResourceImpl implements ManagerResource{
@Context
HttpServletRequest servletRequest;
@EJB
private UserController userController;
private InputStream getStaticFileAsInputStream(ServletContext servletContext, String filePath)
{
......@@ -282,7 +285,7 @@ public class ManagerResourceImpl implements ManagerResource{
Map<String,String> loginInfo = new HashMap<>();
loginInfo.put("username", (String)input.get("username"));
loginInfo.put("password", (String)input.get("password"));
VIPSCoreCredentials credentials = ControllerGetter.getUserController().getVIPSCoreCredentials(loginInfo);
VIPSCoreCredentials credentials = userController.getVIPSCoreCredentials(loginInfo);
if(credentials == null)
{
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Not accepted!").build());
......@@ -307,7 +310,7 @@ public class ManagerResourceImpl implements ManagerResource{
@Override
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();
}
......@@ -328,7 +331,7 @@ public class ManagerResourceImpl implements ManagerResource{
try
{
// First, we authenticate
VIPSCoreCredentials credentials = ControllerGetter.getUserController().getVIPSCoreCredentials(request.getLoginInfo());
VIPSCoreCredentials credentials = userController.getVIPSCoreCredentials(request.getLoginInfo());
if(credentials == null)
{
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).entity("Credentials not accepted").build());
......@@ -354,7 +357,7 @@ public class ManagerResourceImpl implements ManagerResource{
{
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();
......@@ -383,13 +386,13 @@ public class ManagerResourceImpl implements ManagerResource{
// Log it
Integer substrEnd = Math.min(2047, res.length());
log.setMessage(res.substring(0,substrEnd));
ControllerGetter.getUserController().storeModelUsageLog(log);
userController.storeModelUsageLog(log);
// Send exception
throw new WebApplicationException(Response.status(resp.getStatus()).entity(res).build());
}
else
{
ControllerGetter.getUserController().storeModelUsageLog(log);
userController.storeModelUsageLog(log);
// Assuming that String is the quickest way of forwarding this
String resultAsString = resp.readEntity(String.class);
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