+ System.setProperty(AntConstants.WORK_DIR_PROPERTY, workDir
+ .getCanonicalPath());
+
+ // Additional properties in slc.properties file. Already set sytem
+ // properties (such as the various directories) can be resolved in
+ // placeholders.
+ if (confDir != null) {
+ Resource slcPropertiesRes = confDir
+ .createRelative("slc.properties");
+ if (slcPropertiesRes.exists()) {
+ Properties slcProperties = new Properties();
+ InputStream in = slcPropertiesRes.getInputStream();
+ try {
+ slcProperties.load(in);
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ for (String key : slcProperties.stringPropertyNames()) {
+ if (!System.getProperties().containsKey(key)) {
+ String value = SystemPropertyUtils
+ .resolvePlaceholders(slcProperties
+ .getProperty(key));
+ System.setProperty(key, value);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new SlcException("Cannot init system properties.", e);
+ }
+ }
+
+ protected ConfigurableApplicationContext createExecutionContext(
+ SlcExecution slcExecution) {
+ try {
+
+ // Find runtime definition
+ Resource runtimeRes = null;
+ String runtimeStr = slcExecution.getAttributes().get(
+ AntConstants.EXECATTR_RUNTIME);
+ if (runtimeStr == null)
+ runtimeStr = "default";
+
+ ResourceLoader rl = new DefaultResourceLoader(getClass()
+ .getClassLoader());
+ try {// tries absolute reference
+ runtimeRes = rl.getResource(runtimeStr);
+ } catch (Exception e) {
+ // silent
+ }
+ if (runtimeRes == null || !runtimeRes.exists()) {
+ if (confDir != null)
+ runtimeRes = confDir.createRelative("runtime/" + runtimeStr
+ + ".xml");
+ }