Unverified Commit e783cd5c authored by User expired's avatar User expired
Browse files

fixed minor issues regarding JAI

parent dc1a6886
Upcoming version:
-----------------
- fixed minor issues regarding JAI (Nikolaus Krismer)
- added logging of mean isochrones to console (Nikolaus Krismer)
- calling algorithms clear method explicitly to free memory earlier (Nikolaus Krismer)
- added support for multiple remote repositories (as fallbacks) (Nikolaus Krismer)
......
......@@ -83,12 +83,13 @@ gradle.taskGraph.whenReady {taskGraph ->
repositories {
mavenCentral()
jcenter()
maven {
// repo for latest version of jai-core (javax.media.jai:com.springsource.javax.media.jai.core:+)
// repo for latest version of jai-core
// also see https://issues.gradle.org/browse/GRADLE-2395
url 'https://repo.gradle.org/gradle/plugins-releases'
}
// An alternative to the above would be jcenter (not mavenCentral) to use jai-core (within geotools)
// jcenter()
maven {
// repo for latest version of geotools
url 'http://download.osgeo.org/webdav/geotools'
......@@ -157,7 +158,8 @@ dependencies {
compile "com.google.code.findbugs:annotations:${versionFindbugs}"
compile "com.tngtech.java:config-builder:${versionConfigBuilder}"
compile ("it.geosolutions:geoserver-manager:${versionGeoserverManager}") { exclude module: 'jcl-over-slf4j' }
compile "javax.media.jai:com.springsource.javax.media.jai.core:${versionJAI}"
compile "javax.media:jai-core:${versionJAI}"
// or: compile "javax.media.jai:com.springsource.javax.media.jai.core:${versionJAI}"
compile "org.apache.commons:commons-jcs-core:${versionCommonsJCS}"
compile "org.apache.commons:commons-math3:${versionCommonsMath}"
compile "org.apache.logging.log4j:log4j-api:${versionLog4j}"
......
......@@ -150,11 +150,15 @@ class AbstractJsonApi {
final String fName = (separateDirs) ? (tStampStr + extension) : (tStampStr + "_" + filename + extension);
final File resultFile = new File(resultDir, fName);
final String absName = resultFile.getAbsolutePath();
try {
resultFile.createNewFile();
} catch (final IOException e) {
LOGGER.trace("Can not create trace file \"{}\"", absName);
return;
if (!resultFile.exists()) {
try {
if (resultFile.createNewFile()) {
LOGGER.trace("Successfully created file \"{}\"", absName);
}
} catch (final IOException e) {
LOGGER.trace("Can not create trace file \"{}\"", absName);
return;
}
}
try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resultFile, false), StandardCharsets.UTF_8))) {
......
package at.uibk.dbis.isomap.web.resolver;
import at.uibk.dbis.isomap.service.IService;
import at.uibk.dbis.isomap.service.IService.Action;
import at.uibk.dbis.isomap.service.dto.IRequest;
import at.uibk.dbis.isomap.service.dto.IResponse;
import at.uibk.dbis.isomap.web.IllegalRequestException;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.Charset;
import java.util.Objects;
import java.util.Set;
......@@ -17,7 +13,17 @@ import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import at.uibk.dbis.isomap.service.IService;
import at.uibk.dbis.isomap.service.IService.Action;
import at.uibk.dbis.isomap.service.dto.IRequest;
import at.uibk.dbis.isomap.service.dto.IResponse;
import at.uibk.dbis.isomap.web.IllegalRequestException;
public final class ServiceResolver<S extends IService<T, U>, T extends IRequest, U extends IResponse> {
private static final Logger LOGGER = LogManager.getLogger(ServiceResolver.class);
private static final Charset CONTENT_CHARSET = Charset.forName("UTF-8");
private final Action action;
private S service;
......@@ -44,10 +50,14 @@ public final class ServiceResolver<S extends IService<T, U>, T extends IRequest,
final Class<S> serviceClass = (Class<S>) action.getServiceClass();
try {
service = serviceClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
final Constructor<S> c = serviceClass.getConstructor();
service = c.newInstance();
} catch (final NoSuchMethodException e) {
LOGGER.fatal("Can not resolve service for action \"{}\", since default constructor for service class could not be found!", action.toString());
service = null;
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.fatal("Can not create service object for action \"{}\"!", action.toString());
LOGGER.trace(e);
}
if (service == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment