]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/lib/linux/ScriptCall.java
1 package org
.argeo
.slc
.lib
.linux
;
3 import java
.util
.ArrayList
;
6 import org
.apache
.commons
.io
.FilenameUtils
;
7 import org
.argeo
.slc
.SlcException
;
8 import org
.argeo
.slc
.core
.execution
.tasks
.SystemCall
;
9 import org
.springframework
.beans
.factory
.InitializingBean
;
10 import org
.springframework
.core
.io
.Resource
;
12 public class ScriptCall
extends SystemCall
implements InitializingBean
{
13 private Resource script
;
14 private List
<Object
> scriptArgs
= new ArrayList
<Object
>();
16 public void afterPropertiesSet() throws Exception
{
18 for (Object obj
: scriptArgs
) {
24 protected void initInterpreter() {
25 String ext
= FilenameUtils
.getExtension(script
.getFilename());
27 arg("/bin/sh").arg("-s");
28 else if ("pl".equals(ext
))
29 arg("/usr/bin/perl").arg("/dev/stdin");
30 else if ("py".equals(ext
))
31 arg("/usr/bin/python").arg("-");
33 throw new SlcException("Cannot initialize script intepreter for "
37 public void setScript(Resource script
) {
41 public void setScriptArgs(List
<Object
> scriptArgs
) {
42 this.scriptArgs
= scriptArgs
;