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

As far as we got for now. MAJOR issues with JSONB replacing Jackson still unresolved!

parent 46dcf1e2
No related branches found
No related tags found
2 merge requests!17Develop,!12Ny server 2019
...@@ -25,5 +25,6 @@ Any value defined here will override the pom.xml file value but is only applicab ...@@ -25,5 +25,6 @@ Any value defined here will override the pom.xml file value but is only applicab
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/> <org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language> <org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
<netbeans.compile.on.save>none</netbeans.compile.on.save> <netbeans.compile.on.save>none</netbeans.compile.on.save>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>WildFly</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
</properties> </properties>
</project-shared-configuration> </project-shared-configuration>
...@@ -75,13 +75,13 @@ ...@@ -75,13 +75,13 @@
<dependency> <dependency>
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId> <artifactId>resteasy-jaxrs</artifactId>
<version>3.0.9.Final</version> <version>3.6.3.Final</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId> <artifactId>resteasy-client</artifactId>
<version>3.0.9.Final</version> <version>3.6.3.Final</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -140,19 +140,19 @@ ...@@ -140,19 +140,19 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.7.4</version> <version>2.9.8</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.7.4</version> <version>2.9.8</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-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.7.4</version> <version>2.9.8</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
...@@ -180,20 +180,20 @@ ...@@ -180,20 +180,20 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId> <groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId> <artifactId>jackson-dataformat-csv</artifactId>
<version>2.6.2</version> <version>2.9.8</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId> <artifactId>javaee-web-api</artifactId>
<version>7.0</version> <version>8.0</version>
<type>jar</type> <type>jar</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-api</artifactId> <artifactId>javaee-api</artifactId>
<version>7.0</version> <version>8.0</version>
<type>jar</type> <type>jar</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
......
...@@ -56,6 +56,7 @@ public class VIPSLogicApplication extends Application ...@@ -56,6 +56,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.service.ObservationService.class); resources.add(no.nibio.vips.logic.service.ObservationService.class);
resources.add(no.nibio.vips.logic.service.ModelFormService.class); resources.add(no.nibio.vips.logic.service.ModelFormService.class);
resources.add(no.nibio.vips.logic.service.JacksonConfig.class); resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
//resources.add(no.nibio.vips.logic.service.JSONBConfig.class);
//resources.add(no.nibio.vips.coremanager.service.ManagerResourceImpl.class); //resources.add(no.nibio.vips.coremanager.service.ManagerResourceImpl.class);
} }
...@@ -70,6 +71,7 @@ public class VIPSLogicApplication extends Application ...@@ -70,6 +71,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.modules.barleynetblotch.BarleyNetBlotchModelService.class); resources.add(no.nibio.vips.logic.modules.barleynetblotch.BarleyNetBlotchModelService.class);
resources.add(no.nibio.vips.logic.modules.roughage.RoughageService.class); resources.add(no.nibio.vips.logic.modules.roughage.RoughageService.class);
resources.add(no.nibio.vips.logic.modules.wheatleafblotch.WheatLeafBlotchModelService.class); resources.add(no.nibio.vips.logic.modules.wheatleafblotch.WheatLeafBlotchModelService.class);
resources.add(no.nibio.vips.logic.service.JSONBConfig.class);
resources.add(no.nibio.vips.logic.service.JacksonConfig.class); resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
resources.add(no.nibio.vips.logic.service.LogicService.class); resources.add(no.nibio.vips.logic.service.LogicService.class);
resources.add(no.nibio.vips.logic.service.ModelFormService.class); resources.add(no.nibio.vips.logic.service.ModelFormService.class);
......
...@@ -600,6 +600,7 @@ public class ForecastBean { ...@@ -600,6 +600,7 @@ public class ForecastBean {
Response resp = this.getManagerResource().runModel(config.getModelId(), request); Response resp = this.getManagerResource().runModel(config.getModelId(), request);
if(resp.getStatus() == Response.Status.OK.getStatusCode()) if(resp.getStatus() == Response.Status.OK.getStatusCode())
{ {
//System.out.println(resp.readEntity(String.class));
List<Result> results = (List<Result>) resp.readEntity(new GenericType<List<Result>>(){}); List<Result> results = (List<Result>) resp.readEntity(new GenericType<List<Result>>(){});
//System.out.println("ForecastConfigId=" + forecastConfiguration.getForecastConfigurationId() + ", resultsize=" + results.size()); //System.out.println("ForecastConfigId=" + forecastConfiguration.getForecastConfigurationId() + ", resultsize=" + results.size());
// We delete all former results before we store the new ones // We delete all former results before we store the new ones
......
...@@ -20,20 +20,16 @@ ...@@ -20,20 +20,16 @@
package no.nibio.vips.logic.messaging; package no.nibio.vips.logic.messaging;
import java.io.Serializable; import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/** /**
* @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a> * @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
......
/*
* Copyright (c) 2015 NIBIO <http://www.nibio.no/>.
*
* This file is part of VIPSLogic.
* VIPSLogic 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.
*
* VIPSLogic 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 VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
*
*/
package no.nibio.vips.logic.service;
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.json.bind.JsonbConfig;
import javax.json.bind.annotation.JsonbDateFormat;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Add this to no.nibio.vips.logic.VIPSLogicApplication if you want all
* dates to be serialized as ISO formatted date strings
* @copyright 2018 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
@Provider
@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
public class JSONBConfig implements ContextResolver<javax.json.bind.Jsonb>
{
//private final ObjectMapper objectMapper;
private final Jsonb jsonB;
private Logger log;
public JSONBConfig() throws Exception
{
log = Logger.getLogger(JacksonConfig.class.getName());
log.log(Level.INFO,"Created JSONBConfig");
//System.out.println("This is what you should expect");
JsonbConfig config = new JsonbConfig();
config.setProperty(JsonbConfig.DATE_FORMAT, JsonbDateFormat.DEFAULT_FORMAT);
jsonB = JsonbBuilder.create(config);
}
@Override
public Jsonb getContext(Class objectType)
{
log.log(Level.INFO,"Retrieved Objectmapper "+objectType.toGenericString());
return jsonB;
}
}
\ No newline at end of file
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
package no.nibio.vips.logic.service; package no.nibio.vips.logic.service;
import com.bedatadriven.jackson.datatype.jts.JtsModule; import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import java.text.SimpleDateFormat;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
...@@ -45,6 +48,8 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> ...@@ -45,6 +48,8 @@ public class JacksonConfig implements ContextResolver<ObjectMapper>
{ {
objectMapper = new ObjectMapper().configure( objectMapper = new ObjectMapper().configure(
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"));
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.registerModule(new JtsModule()); objectMapper.registerModule(new JtsModule());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment