From 627ce098b390e1b55d307d5900efc7a2bf815d5e Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Sun, 10 Jan 2016 18:51:15 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineSmartExecutor@122176 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../executor/rscripts/KnitrCompiler.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/main/java/org/gcube/dataanalysis/executor/rscripts/KnitrCompiler.java diff --git a/src/main/java/org/gcube/dataanalysis/executor/rscripts/KnitrCompiler.java b/src/main/java/org/gcube/dataanalysis/executor/rscripts/KnitrCompiler.java new file mode 100644 index 0000000..a5c9821 --- /dev/null +++ b/src/main/java/org/gcube/dataanalysis/executor/rscripts/KnitrCompiler.java @@ -0,0 +1,42 @@ +package org.gcube.dataanalysis.executor.rscripts; + +import java.io.File; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType; +import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType; +import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.PrimitiveTypes; +import org.gcube.dataanalysis.executor.rscripts.generic.GenericRScript; + +public class KnitrCompiler extends GenericRScript { + + @Override + public String getDescription() { + return "An algorithm to compile Knitr documents. Developed by IRD (reference Julien Bard, julien.barde@ird.fr)"; + } + + protected void initVariables(){ + mainScriptName="IRDTunaAtlas-master/report/knitr/compileKnitR_CNR.R"; + packageURL="http://goo.gl/T7V8LV"; + + environmentalvariables = new ArrayList(); + inputvariables.add("zipfile"); + inputvariables.add("file.inout"); + outputvariables.add("pdfresult"); + } + + @Override + protected void setInputParameters() { + inputs.add(new PrimitiveType(File.class.getName(), null, PrimitiveTypes.FILE, "zipfile", "The file containing R and the markdown (Rnw) files to compile","knitr_wfs.zip")); + inputs.add(new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, "file.inout", "The name of the R file in the zip package", "main.r")); + } + + @Override + public StatisticalType getOutput() { + output.put("pdfresult",new PrimitiveType(File.class.getName(), new File(outputValues.get("pdfresult")), PrimitiveTypes.FILE, "pdfresult", "The compiled PDF file")); + PrimitiveType o = new PrimitiveType(LinkedHashMap.class.getName(), output, PrimitiveTypes.MAP, "Output", ""); + return o; + } + +}