Merge branch 'workerErrorHandling' into develop
This commit is contained in:
commit
14fc1c6d30
src/main/java/se/su/dsv/scipro/json
@ -1,8 +1,10 @@
|
|||||||
package se.su.dsv.scipro.json;
|
package se.su.dsv.scipro.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for delegated callback handling of response-strings.
|
* Interface for delegated callback handling of response-strings.
|
||||||
*/
|
*/
|
||||||
public interface IResponseHandler {
|
public interface IResponseHandler {
|
||||||
public void handleResponse(final String response,final RemoteLookupOptions options);
|
public void handleResponse(final String response,final RemoteLookupOptions options) throws IOException;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import se.su.dsv.scipro.ApplicationSettings;
|
|||||||
*
|
*
|
||||||
* @author Dan Kjellman <dan-kjel@dsv.su.se>
|
* @author Dan Kjellman <dan-kjel@dsv.su.se>
|
||||||
*/
|
*/
|
||||||
//TODO Make sure this worker successfully fails when it should
|
|
||||||
@Component
|
@Component
|
||||||
public class ImportWorkerLookup {
|
public class ImportWorkerLookup {
|
||||||
public static final String USERS = "users";
|
public static final String USERS = "users";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package se.su.dsv.scipro.json;
|
package se.su.dsv.scipro.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
@ -34,7 +35,7 @@ public class ImportWorkerResponseHandler extends JsonResponseHandler {
|
|||||||
*
|
*
|
||||||
* @param response the json string
|
* @param response the json string
|
||||||
*/
|
*/
|
||||||
public void handleResponse(final String response, final RemoteLookupOptions options) {
|
public void handleResponse(final String response, final RemoteLookupOptions options) throws IOException {
|
||||||
JsonCompleteGetContainer completeContainer = null;
|
JsonCompleteGetContainer completeContainer = null;
|
||||||
try{
|
try{
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
@ -43,7 +44,7 @@ public class ImportWorkerResponseHandler extends JsonResponseHandler {
|
|||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.FATAL, "Gson error when creating objects from json \n" + e.getMessage());
|
logger.log(Level.FATAL, "Gson error when creating objects from json \n" + e.getMessage());
|
||||||
return;
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
int createdUsers = 0;
|
int createdUsers = 0;
|
||||||
int changedUsers = 0;
|
int changedUsers = 0;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
package se.su.dsv.scipro.json;
|
package se.su.dsv.scipro.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import se.su.dsv.scipro.ApplicationSettings;
|
import se.su.dsv.scipro.ApplicationSettings;
|
||||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
|
||||||
@ -465,7 +463,7 @@ abstract class JsonResponseHandler implements IResponseHandler {
|
|||||||
/*
|
/*
|
||||||
* Force subclasses to handle the response
|
* Force subclasses to handle the response
|
||||||
*/
|
*/
|
||||||
public abstract void handleResponse(final String response, final RemoteLookupOptions options);
|
public abstract void handleResponse(final String response, final RemoteLookupOptions options) throws IOException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Getters for logging
|
* Getters for logging
|
||||||
|
Loading…
x
Reference in New Issue
Block a user