Skip to content

Commit

Permalink
add configuration property for process description caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Nüst committed Apr 24, 2014
1 parent d495fe9 commit eb98ce8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
Expand Up @@ -280,6 +280,13 @@ public boolean removeAlgorithm(Object processID) {

@Override
public ProcessDescriptionType getProcessDescription(String processID) {
if ( !this.rConfig.getCacheDescriptions()) {
LOGGER.debug("Process description cache disabled, creating new process and returning its description for id {}",
processID);
GenericRProcess process = new GenericRProcess(processID);
return process.getDescription();
}

if ( !this.algorithmDescriptionMap.containsKey(processID)) {
LOGGER.debug("Creating new process to get the description for " + processID);
GenericRProcess process = new GenericRProcess(processID);
Expand Down
Expand Up @@ -31,7 +31,7 @@

public enum RWPSConfigVariables {

SCRIPT_DIR, RESOURCE_DIR, ALGORITHM_PROPERTY_NAME, ENABLE_BATCH_START, RSERVE_HOST, RSERVE_PORT, RSERVE_USER, RSERVE_PASSWORD, R_DATATYPE_CONFIG, R_WORK_DIR_STRATEGY, R_WORK_DIR_NAME;
SCRIPT_DIR, RESOURCE_DIR, ALGORITHM_PROPERTY_NAME, ENABLE_BATCH_START, RSERVE_HOST, RSERVE_PORT, RSERVE_USER, RSERVE_PASSWORD, R_DATATYPE_CONFIG, R_WORK_DIR_STRATEGY, R_WORK_DIR_NAME, R_CACHE_DESCRIPTIONS;

public String toString() {
switch (this) {
Expand All @@ -57,6 +57,8 @@ public String toString() {
return "R_RservePassword";
case R_DATATYPE_CONFIG:
return "R_datatypeConfig";
case R_CACHE_DESCRIPTIONS:
return "R_cacheDescriptions";
default:
return "NO STRING REPRESENTATION DEFINED FOR ENUM CONSTANT!";
}
Expand Down
5 changes: 5 additions & 0 deletions 52n-wps-r/src/main/java/org/n52/wps/server/r/R_Config.java
Expand Up @@ -479,4 +479,9 @@ public URL getProcessDescriptionURL(String processWKN) {
return null;
}
}

public boolean getCacheDescriptions() {
String s = getConfigVariable(RWPSConfigVariables.R_CACHE_DESCRIPTIONS);
return Boolean.valueOf(s);
}
}
4 changes: 4 additions & 0 deletions 52n-wps-webapp/src/main/webapp/R/scripts/demo_meuse-rdata.R
Expand Up @@ -5,10 +5,14 @@

# wps.off;
filename <- "meuse"
setwd(tempdir())
cat("wd: ", getwd(), "\n")
# wps.on;

library(sp)
data(meuse)
data(meuse.grid)
data(meuse.riv)

summary(meuse)
summary(meuse.grid)
Expand Down
Expand Up @@ -498,6 +498,7 @@
<Property name="R_RserveUser" active="false">NA</Property>
<Property name="R_RservePassword" active="false">NA</Property>
<Property name="R_scriptDirectory" active="true">R/scripts</Property>
<Property name="R_cacheDescriptions" active="true">true</Property>
<Property name="Algorithm" active="true">org.n52.wps.server.r.test.calculator</Property>
</Repository>
<Repository name="LocalAlgorithmRepository"
Expand Down

0 comments on commit eb98ce8

Please sign in to comment.