mvn -e -B archetype:generate -DarchetypeGroupId=uk.ac.ncl.cs.instantsoap \
-DarchetypeArtifactId=archetype-r-tool -DarchetypeVersion="1.0-SNAPSHOT" \
-DarchetypeRepository="http://metagenome.ncl.ac.uk/fluxions/repo-snapshot" \
-DgroupId=uk.ac.test -DartifactId=my_new_r_tool
The basic skeleton generates a service which produces the mean for a data frame in R.
Firstly find the file averageR.r . It should be in the directory my_new_r_tool/src/main/resources/uk/ac/test unless you have changed either the artifactId or the groupId in the last section . It should look like this:
process <-
function (values)
{
return ( mean( values ) )
}
Secondly, you need a Java source file. Essentially, this is fairly dumb. It just provides metadata about the service. In this case, it's called RAverageProcessor.java . You can find this is the directory my_new_r_tool/src/main/java/uk/ac/test .
package uk.ac.test;
import org.bjv2.util.serviceprovider.SpiProvider;
import uk.ac.ncl.cs.instantsoap.r.RDataFrameProcessor;
import uk.ac.ncl.cs.instantsoap.wsapi.MetaData;
import static uk.ac.ncl.cs.instantsoap.wsapi.Wsapi.metaData;
/**
* Calculates means for an input data frame
*
*/
@SpiProvider
public class RAverageProcessor extends RDataFrameProcessor
{
public String getRScriptName()
{
return "averageR.r";
}
// These are informational methods which are uncovered in the WSDL
// interface of the service.
public MetaData describeApplication()
{
return metaData( "average", "Calculates the mean for an R data frame" );
}
public MetaData getInput()
{
return metaData( "messageIn", "An R data frame to be averaged" );
}
public MetaData getOutputs()
{
return metaData( "output", "An R data frame with average values" );
}
}