git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/wps@153161 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
418586d8ee
commit
234562371c
13
pom.xml
13
pom.xml
|
@ -433,7 +433,9 @@
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>52n-wps-algorithm</artifactId>
|
<artifactId>52n-wps-algorithm</artifactId>
|
||||||
<groupId>org.n52.wps</groupId>
|
<groupId>
|
||||||
|
org.n52.wps
|
||||||
|
</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -691,6 +693,15 @@
|
||||||
<artifactId>jstl</artifactId>
|
<artifactId>jstl</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>com.thetransactioncompany</groupId>
|
<groupId>com.thetransactioncompany</groupId>
|
||||||
<artifactId>cors-filter</artifactId>
|
<artifactId>cors-filter</artifactId>
|
||||||
|
|
|
@ -92,8 +92,10 @@ public class WebProcessingService extends HttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
|
LOGGER.info("initialising WPS");
|
||||||
String dir = (String)context.application().getInitParameter(DIRECTORY_PARAM);
|
String dir = (String)context.application().getInitParameter(DIRECTORY_PARAM);
|
||||||
GcubeAlgorithmRepository.setUpdater(new AlgorithmUpdater(dir));
|
GcubeAlgorithmRepository.setUpdater(new AlgorithmUpdater(dir));
|
||||||
|
LOGGER.info("WPS initialised");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.data.analysis.wps.repository;
|
package org.gcube.data.analysis.wps.repository;
|
||||||
|
|
||||||
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
|
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
|
||||||
|
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
|
||||||
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
|
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -66,7 +67,7 @@ public final class AlgorithmUpdater {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
//TODO: change with something from configuration
|
//TODO: change with something from configuration
|
||||||
dir = Paths.get(algorithmDirectory);
|
dir = Paths.get(algorithmDirectory);
|
||||||
dir.register(watcher, ENTRY_CREATE);
|
dir.register(watcher, ENTRY_CREATE, ENTRY_MODIFY);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,7 @@ public final class AlgorithmUpdater {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void run(){
|
public void run(){
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
log.info("direcotry watcher is running");
|
||||||
// wait for key to be signaled
|
// wait for key to be signaled
|
||||||
WatchKey key;
|
WatchKey key;
|
||||||
try {
|
try {
|
||||||
|
@ -87,7 +88,7 @@ public final class AlgorithmUpdater {
|
||||||
|
|
||||||
for (WatchEvent<?> event: key.pollEvents()) {
|
for (WatchEvent<?> event: key.pollEvents()) {
|
||||||
WatchEvent.Kind<?> kind = event.kind();
|
WatchEvent.Kind<?> kind = event.kind();
|
||||||
|
log.debug("new event thrown for directory watcher");
|
||||||
// This key is registered only
|
// This key is registered only
|
||||||
// for ENTRY_CREATE events,
|
// for ENTRY_CREATE events,
|
||||||
// but an OVERFLOW event can
|
// but an OVERFLOW event can
|
||||||
|
|
Loading…
Reference in New Issue