X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.agent%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcli%2FDefaultSlcRuntime.java;h=e3ce331529a4af7e53490f7ccc9fabf4e14495cb;hb=5ac335634ca09f980e452051dd41bc1ce1ea8c16;hp=74b383eeff0173a0ee0fe44ce0e959824cf271eb;hpb=a26a4e7277526fe17e13652362821ac2a1fc273a;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/DefaultSlcRuntime.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/DefaultSlcRuntime.java index 74b383eef..e3ce33152 100644 --- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/DefaultSlcRuntime.java +++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/DefaultSlcRuntime.java @@ -27,8 +27,9 @@ public class DefaultSlcRuntime { public final static String SLC_ROOT_FILE_NAME = "slcRoot.properties"; - public SlcExecutionContext executeScript(Resource script, - Properties properties, Map references) { + public SlcExecutionContext executeScript(String runtimeStr, + Resource script, String targets, Properties properties, + Map references) { Resource slcRootFile = findSlcRootFile(script); String scriptRelativePath = SpringUtils.extractRelativePath(SpringUtils @@ -36,8 +37,13 @@ public class DefaultSlcRuntime { SlcExecution slcExecution = createSlcExecution(); slcExecution.setStatus(SlcExecution.STATUS_RUNNING); + slcExecution.getAttributes().put(SlcAntConstants.EXECATTR_RUNTIME, + runtimeStr); slcExecution.getAttributes().put(SlcAntConstants.EXECATTR_ANT_FILE, scriptRelativePath); + if (targets != null) + slcExecution.getAttributes().put( + SlcAntConstants.EXECATTR_ANT_TARGETS, targets); AntSlcApplication application = getApplication(slcRootFile); return application.execute(slcExecution, properties, references); @@ -121,24 +127,6 @@ public class DefaultSlcRuntime { } finally { IOUtils.closeQuietly(inRootFile); } - - // Properties from the conf dir files - // Properties properties = new Properties(); - // StringTokenizer st = new StringTokenizer(rootProps.getProperty( - // PROPERTY_FILE_NAMES_PROPERTY, "slc.properties"), ","); - // while (st.hasMoreTokens()) { - // String fileName = st.nextToken(); - // properties.putAll(loadFile(confDir.getAbsolutePath() - // + File.separator + fileName)); - // } - // - // for (Object o : properties.keySet()) { - // String key = o.toString(); - // if (all.getProperty(key) == null) {// not already set - // all.setProperty(key, properties.getProperty(key)); - // } - // } - // } /** @@ -160,27 +148,11 @@ public class DefaultSlcRuntime { } else { return findSlcRootFile(SpringUtils.getParent(currDir)); } - // int indx = currPath.lastIndexOf('/',currPath.length()-1); - } } catch (IOException e) { throw new SlcException("Problem when looking in SLC root file in " + currDir, e); } - - // for (File file : dir.listFiles()) { - // if (!file.isDirectory() - // && file.getName().equals(SLC_ROOT_FILE_NAME)) { - // return file; - // } - // } - // - // File parentDir = dir.getParentFile(); - // if (parentDir == null) { - // return null;// stop condition: not found - // } else { - // return findSlcRootFile(parentDir); - // } } /** Loads the content of a file as Properties. */ @@ -193,12 +165,4 @@ public class DefaultSlcRuntime { } return p; } - - // private Resource getParentOfFile(Resource file) { - // try { - // return file.createRelative("."); - // } catch (IOException e) { - // throw new SlcException("Cannot get parent for resource " + file, e); - // } - // } }