This commit is contained in:
Lucio Lelii 2017-09-18 09:56:38 +00:00
parent 418586d8ee
commit 234562371c
3 changed files with 18 additions and 4 deletions

13
pom.xml
View File

@ -433,7 +433,9 @@
<exclusions>
<exclusion>
<artifactId>52n-wps-algorithm</artifactId>
<groupId>org.n52.wps</groupId>
<groupId>
org.n52.wps
</groupId>
</exclusion>
</exclusions>
</dependency>
@ -691,6 +693,15 @@
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>

View File

@ -92,8 +92,10 @@ public class WebProcessingService extends HttpServlet {
@Override
public void init() throws ServletException {
LOGGER.info("initialising WPS");
String dir = (String)context.application().getInitParameter(DIRECTORY_PARAM);
GcubeAlgorithmRepository.setUpdater(new AlgorithmUpdater(dir));
LOGGER.info("WPS initialised");
}
/**

View File

@ -1,6 +1,7 @@
package org.gcube.data.analysis.wps.repository;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
import java.io.IOException;
@ -66,7 +67,7 @@ public final class AlgorithmUpdater {
this.loader = loader;
//TODO: change with something from configuration
dir = Paths.get(algorithmDirectory);
dir.register(watcher, ENTRY_CREATE);
dir.register(watcher, ENTRY_CREATE, ENTRY_MODIFY);
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -75,7 +76,7 @@ public final class AlgorithmUpdater {
@SuppressWarnings("unchecked")
public void run(){
for (;;) {
log.info("direcotry watcher is running");
// wait for key to be signaled
WatchKey key;
try {
@ -87,7 +88,7 @@ public final class AlgorithmUpdater {
for (WatchEvent<?> event: key.pollEvents()) {
WatchEvent.Kind<?> kind = event.kind();
log.debug("new event thrown for directory watcher");
// This key is registered only
// for ENTRY_CREATE events,
// but an OVERFLOW event can