From: Mathieu Baudier
Date: Sat, 21 Jun 2008 18:14:17 +0000 (+0000)
Subject: Remove old runtime
X-Git-Tag: argeo-slc-2.1.7~2765
X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=8912b1cdb0b73547d70d2a2729ea075751f37f35;p=gpl%2Fargeo-slc.git
Remove old runtime
git-svn-id: https://svn.argeo.org/slc/trunk@1277 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc
---
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java
deleted file mode 100644
index 476384cd2..000000000
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.argeo.slc.ant;
-
-import java.io.File;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-import org.apache.tools.ant.listener.CommonsLoggingListener;
-import org.argeo.slc.core.structure.StructurePath;
-import org.argeo.slc.core.structure.StructureRegistry;
-
-/** Utilities to manipulate the structure registry in SLC Ant. */
-public class AntRegistryUtil {
- private static Log log = LogFactory.getLog(AntRegistryUtil.class);
-
- /** Reads a structure registry from an Ant file without executing it. */
- public static StructureRegistry readRegistry(File antFile) {
- if (log.isDebugEnabled())
- log.debug("Reads registry for Ant file " + antFile);
- Project p = new Project();
- p.setUserProperty("ant.file", antFile.getAbsolutePath());
- p.setBaseDir(antFile.getParentFile());
- p.init();
- ProjectHelper helper = new SlcProjectHelper();
- p.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
- helper.parse(p, antFile);
-
- StructureRegistry registry = (StructureRegistry) p
- .getReference(SlcAntConstants.REF_STRUCTURE_REGISTRY);
- registry.setMode(StructureRegistry.READ);
-
- p.executeTarget(p.getDefaultTarget());
- return registry;
- }
-
- /** Executes only the active paths of the Ant file. */
- public static Project runActive(File antFile,
- List activePaths) {
- if (log.isDebugEnabled())
- log.debug("Runs the " + activePaths.size()
- + " provided active paths of Ant file " + antFile);
- Project p = new Project();
- p.setUserProperty("ant.file", antFile.getAbsolutePath());
- p.setBaseDir(antFile.getParentFile());
- p.init();
- ProjectHelper helper = new SlcProjectHelper();
- p.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
- helper.parse(p, antFile);
-
- StructureRegistry registry = (StructureRegistry) p
- .getReference(SlcAntConstants.REF_STRUCTURE_REGISTRY);
- registry.setMode(StructureRegistry.ACTIVE);
- registry.setActivePaths(activePaths);
-
- runProject(p, null);
- return p;
- }
-
- /** Executes all paths of the provided target of the Ant file. */
- public static Project runAll(File antFile, String target) {
- if (log.isDebugEnabled())
- log.debug("Runs all paths of Ant file " + antFile);
- Project p = new Project();
- p.setUserProperty("ant.file", antFile.getAbsolutePath());
- p.setBaseDir(antFile.getParentFile());
- p.init();
- ProjectHelper helper = new SlcProjectHelper();
- p.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
- helper.parse(p, antFile);
-
- runProject(p, target);
- return p;
- }
-
- /** Executes all paths of the provided target of the Ant URL. */
- public static Project runAll(URL url, String target, Properties properties) {
- if (log.isDebugEnabled())
- log.debug("Runs all paths of Ant URL " + url);
- Project p = new Project();
- p.setUserProperty("ant.file", url.toString());
- // p.setBaseDir(url.toString());
- p.addBuildListener(new CommonsLoggingListener());
- p.init();
- ProjectHelper helper = new SlcProjectHelper();
- p.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
- helper.parse(p, url);
-
- if (properties != null) {
- for (Map.Entry
- *
- *
- * Any property can be defined in the conf files defined in the SLC root
- * properties file (see above). SLC expects some which will have defaults but
- * can be overriden there. By convention they should be defined in the
- * slc.properties file, while application specific properties should be
- * defined in other conf files. This allows for a clean spearation between SLC
- * and the applications built on top of it:
- *
- *
- *
- *
Property
- *
Description
- *
Default
- *
- *
- *
slc.applicationContext
- *
Path to the root Spring application context file used by SLC Ant.
- *
${slc.confDir}/applicationContext.xml
- *
- *
- *
slc.defaultTestRun
- *
Name of the {@link WritableTestRun} Spring bean that the
- * slc.test task will use by default. This can be overridden when
- * calling the task from Ant.
- *
defaultTestRun
- *
- *
- *
- */
-public class SlcAntConfig {
- // SLC ROOT PROPERTIES
- /** Property for the root file (SLC root property file). */
- public final static String ROOT_FILE_PROPERTY = "slc.rootFile";
- /**
- * Comma-separated list of property file names to load from the conf dir and
- * add to project user properties
- */
- public final static String PROPERTY_FILE_NAMES_PROPERTY = "slc.propertyFileNames";
-
- // SLC CONF PROPERTIES
- /** Path to the root Spring application context */
- public static String APPLICATION_CONTEXT_PROPERTY = "slc.applicationContext";
- // SLC LOCAL PROPERTIES
- /** Property for the dir label (SLC local property file). */
- public static String DIR_LABEL_PROPERTY = "slc.dirLabel";
-
- private String slcRootFileName = "slcRoot.properties";
- private String slcLocalFileName = "slcLocal.properties";
-
- /**
- * Retrieves or infers all properties and set them as project user
- * properties. All these properties will be set as project properties if
- * they had not been set as project properties before (like by
- * overriding through the standard Ant mechanisms).
- *
- * @param project
- * the Ant Project being run.
- * @return whether the project could be initialized for SLC usage (e.g.
- * presence of an SLC root file)
- */
- public boolean initProject(Project project) {
- File projectBaseDir = project.getBaseDir();
- File slcRootFile = findSlcRootFile(projectBaseDir);
- if (slcRootFile == null) {
- return false;
- }
-
- // pass the project properties through the System properties
- System.getProperties().putAll((Map, ?>) project.getUserProperties());
- Properties all = new Properties();
- all.putAll(System.getProperties());
- prepareAllProperties(slcRootFile, all);
-
- Log log = LogFactory.getLog(this.getClass());
- for (Object o : all.keySet()) {
- String key = o.toString();
- // System.out.println(key+"="+all.getProperty(key));
- if (project.getUserProperty(key) == null) {// not already set
- // if (log.isDebugEnabled())
- // log.debug(key + "=" + all.getProperty(key));
- project.setUserProperty(key, all.getProperty(key));
- }
- }
- return true;
- }
-
- /**
- * Retrieves or infers all required properties.
- *
- * @param slcRootFile
- * the location of the SLC root file
- *
- * @return the prepared properties. Note that it also contains the System
- * and Ant properties which had previously been set.
- */
- public void prepareAllProperties(File slcRootFile, Properties all) {
- try {
- final String fileUrlPrefix = "";
-
- all.put(ROOT_FILE_PROPERTY, slcRootFile.getCanonicalPath());
- // Remove basedir property in order to avoid conflict with Maven
- if (all.containsKey("basedir"))
- all.remove("basedir");
-
- Properties rootProps = loadFile(slcRootFile.getCanonicalPath());
-
- final File confDir;
- final File workDir;
- // Root dir
- final File rootDir = slcRootFile.getParentFile();
- all.setProperty(SlcAntConstants.ROOT_DIR_PROPERTY, fileUrlPrefix
- + rootDir.getCanonicalPath());
-
- // Conf dir
- if (all.getProperty(SlcAntConstants.CONF_DIR_PROPERTY) == null) {
- confDir = new File(rootProps.getProperty(SlcAntConstants.CONF_DIR_PROPERTY,
- rootDir.getAbsolutePath() + "/../conf"))
- .getCanonicalFile();
- all.setProperty(SlcAntConstants.CONF_DIR_PROPERTY, fileUrlPrefix
- + confDir.getAbsolutePath());
- } else {
- confDir = new File(all.getProperty(SlcAntConstants.CONF_DIR_PROPERTY))
- .getCanonicalFile();
- }
-
- // Work dir
- if (all.getProperty(SlcAntConstants.WORK_DIR_PROPERTY) == null) {
- workDir = new File(rootProps.getProperty(SlcAntConstants.WORK_DIR_PROPERTY,
- rootDir.getAbsolutePath() + "/../work"))
- .getCanonicalFile();
- all.setProperty(SlcAntConstants.WORK_DIR_PROPERTY, fileUrlPrefix
- + workDir.getAbsolutePath());
- } else {
- workDir = new File(all.getProperty(SlcAntConstants.WORK_DIR_PROPERTY))
- .getCanonicalFile();
- }
-
- // 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));
- }
- }
-
- // Default application context
- if (all.getProperty(APPLICATION_CONTEXT_PROPERTY) == null) {
- all.setProperty(APPLICATION_CONTEXT_PROPERTY, confDir
- .getAbsolutePath()
- + "/applicationContext.xml");
- }
- // Default test run
- if (all.getProperty(SlcAntConstants.DEFAULT_TEST_RUN_PROPERTY) == null) {
- all.setProperty(SlcAntConstants.DEFAULT_TEST_RUN_PROPERTY, "defaultTestRun");
- }
-
- // Default log4j
- if (all.getProperty("log4j.configuration") == null) {
- System.setProperty("log4j.configuration", confDir
- .getCanonicalPath()
- + File.separator + "log4j.properties");
- // TODO: fix dependency to log4j
- Log4jConfigurer.initLogging(confDir.getCanonicalPath()
- + File.separator + "log4j.properties");
- }
- } catch (Exception e) {
- throw new SlcAntException("Unexpected exception while configuring",
- e);
- }
- }
-
- /** Loads the content of a file as Properties. */
- private Properties loadFile(String path) {
- Properties p = new Properties();
- try {
- FileInputStream in = new FileInputStream(path);
- p.load(in);
- in.close();
- } catch (IOException e) {
- throw new SlcAntException("Cannot read SLC root file", e);
- }
- return p;
- }
-
- /**
- * Looks for a file named {@link #getSlcLocalFileName()} in the directory,
- * loads it as properties file and return the value of the property
- * {@link #DIR_LABEL_PROPERTY}.
- */
- public String getDescriptionForDir(File dir) {
- String description = dir.getName();
- File slcLocal = new File(dir.getPath() + File.separator
- + getSlcLocalFileName());
- if (slcLocal.exists()) {
- Properties properties = loadFile(slcLocal.getAbsolutePath());
- description = properties.getProperty(
- SlcAntConfig.DIR_LABEL_PROPERTY, description);
- }
- return description;
- }
-
- /**
- * Recursively scans directories downwards until it find a file names as
- * defined by {@link #getSlcRootFileName()}.
- */
- public File findSlcRootFile(File dir) {
- for (File file : dir.listFiles()) {
- if (!file.isDirectory()
- && file.getName().equals(getSlcRootFileName())) {
- return file;
- }
- }
-
- File parentDir = dir.getParentFile();
- if (parentDir == null) {
- return null;// stop condition: not found
- } else {
- return findSlcRootFile(parentDir);
- }
- }
-
- /**
- * Gets the file name of the file marking the root directory, default being
- * slcRoot.properties.
- */
- public String getSlcRootFileName() {
- return slcRootFileName;
- }
-
- /** Sets the file name of the file marking the root directory. */
- public void setSlcRootFileName(String slcRootFileName) {
- this.slcRootFileName = slcRootFileName;
- }
-
- /**
- * Gets the file name of the file containing directory specific properties,
- * default being slcLocal.properties.
- */
- public String getSlcLocalFileName() {
- return slcLocalFileName;
- }
-
- /** Sets the file name of the file containing directory specific properties. */
- public void setSlcLocalFileName(String slcLocalFileName) {
- this.slcLocalFileName = slcLocalFileName;
- }
-
-}
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcExecutionBuildListener.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcExecutionBuildListener.java
index 2b9400e4b..da682ba6f 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcExecutionBuildListener.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcExecutionBuildListener.java
@@ -5,9 +5,7 @@ import java.util.Vector;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
import org.apache.log4j.MDC;
-import org.apache.log4j.Priority;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;
@@ -16,7 +14,6 @@ import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.process.SlcExecution;
import org.argeo.slc.core.process.SlcExecutionNotifier;
import org.argeo.slc.core.process.SlcExecutionStep;
-import org.argeo.slc.ws.process.WebServiceSlcExecutionNotifier;
public class SlcExecutionBuildListener extends AppenderSkeleton implements
BuildListener {
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcProjectHelper.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcProjectHelper.java
deleted file mode 100644
index 227148189..000000000
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcProjectHelper.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package org.argeo.slc.ant;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
-import java.util.Vector;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.helper.ProjectHelper2;
-import org.argeo.slc.core.process.SlcExecution;
-import org.argeo.slc.core.structure.DefaultSRegistry;
-import org.argeo.slc.core.structure.SimpleSElement;
-import org.argeo.slc.core.structure.StructureRegistry;
-import org.argeo.slc.core.structure.tree.TreeSPath;
-import org.springframework.beans.factory.ListableBeanFactory;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-/**
- * Custom implementation of an Ant ProjectHelper binding a Spring
- * application context and a structure registry with the Ant project.
- */
-public class SlcProjectHelper extends ProjectHelper2 {
- private static Log log;
-
- protected SlcAntConfig slcAntConfig = null;
-
- @Override
- public void parse(Project project, Object source) throws BuildException {
-
- if (source instanceof File) {
- File sourceFile = (File) source;
- // Reset basedir property, in order to avoid base dir override when
- // running in Maven
- project.setProperty("basedir", sourceFile.getParentFile()
- .getAbsolutePath());
- }
-
- if (slcAntConfig != null) {
- // Config already initialized (probably import), only parse
- super.parse(project, source);
- return;
- }
-
- // Initialize config
- slcAntConfig = new SlcAntConfig();
-
- if (!slcAntConfig.initProject(project)) {
- // not SLC compatible, do normal Ant
- super.parse(project, source);
- return;
- }
-
- if (log == null) {
- // log4j is initialized only now
- log = LogFactory.getLog(SlcProjectHelper.class);
- }
-
- if (log.isDebugEnabled())
- log.debug("SLC properties are set, starting initialization for "
- + source + " (projectHelper=" + this + ")");
-
- beforeParsing(project);
-
- // Calls the underlying implementation to do the actual work
- super.parse(project, source);
-
- afterParsing(project);
- }
-
- /**
- * Performs operations after config initialization and before Ant file
- * parsing. Performed only once when the main project file is parsed. Should
- * be called by overriding methods.
- */
- protected void beforeParsing(Project project) {
- // Init Spring application context
- initSpringContext(project);
-
- // Init structure registry
- DefaultSRegistry registry = new DefaultSRegistry();
- project.addReference(SlcAntConstants.REF_STRUCTURE_REGISTRY, registry);
- }
-
- /**
- * Performs operations after parsing of the main file. Called only once (not
- * for imports).
- */
- protected void afterParsing(Project project) {
- // Creates structure root
- registerProjectAndParents(project, slcAntConfig);
- addCustomTaskAndTypes(project);
- }
-
- /** Creates the tree-based structure for this project. */
- private void registerProjectAndParents(Project project,
- SlcAntConfig slcAntConfig) {
- StructureRegistry registry = (StructureRegistry) project
- .getReference(SlcAntConstants.REF_STRUCTURE_REGISTRY);
- File rootDir = new File(project
- .getUserProperty(SlcAntConstants.ROOT_DIR_PROPERTY))
- .getAbsoluteFile();
- File baseDir = project.getBaseDir().getAbsoluteFile();
- List dirs = new Vector();
- File currentDir = baseDir;
- do {
- dirs.add(currentDir);
- currentDir = currentDir.getParentFile();
- if (log.isTraceEnabled())
- log.trace("List " + currentDir);
- } while (!currentDir.equals(rootDir.getParentFile()));
-
- // first path is root dir (because of previous algorithm)
- TreeSPath currPath = TreeSPath.createRootPath(rootDir.getName());
- for (int i = dirs.size() - 1; i >= 0; i--) {
- File dir = dirs.get(i);
-
- // retrieves description for this path
- final String description;
- if (i == 0) {// project itself
- description = project.getDescription() != null
- && !project.getDescription().equals("") ? project
- .getDescription() : project.getName() != null ? project
- .getName() : slcAntConfig.getDescriptionForDir(dir);
- } else {
- description = slcAntConfig.getDescriptionForDir(dir);
- if (log.isTraceEnabled())
- log.trace("Dir desc " + i + "/" + dirs.size() + ": "
- + description);
- }
- SimpleSElement element = new SimpleSElement(description);
-
- // creates and register path
- if (!dir.equals(rootDir)) {// already set
- currPath = currPath.createChild(dir.getName());
- }
- registry.register(currPath, element);
- }
- project.addReference(SlcAntConstants.REF_PROJECT_PATH, currPath);
- }
-
- /** Gets the path of a project (root). */
- // private static TreeSPath getProjectPath(Project project) {
- // return (TreeSPath) project.getReference(REF_PROJECT_PATH);
- // }
- /** Initializes the Spring application context. */
- private void initSpringContext(Project project) {
- System.getProperties().putAll((Map, ?>) project.getProperties());
- String acPath = project
- .getUserProperty(SlcAntConfig.APPLICATION_CONTEXT_PROPERTY);
- if (log.isDebugEnabled())
- log.debug("Loading Spring application context from " + acPath);
- // FIXME: workaround to the removal of leading '/' by Spring
- // use URL instead?
- AbstractApplicationContext context = new FileSystemXmlApplicationContext(
- '/' + acPath);
- context.registerShutdownHook();
- project.addReference(SlcAntConstants.REF_ROOT_CONTEXT, context);
-
- createAndRegisterSlcExecution(project);
- // Add build listeners declared in Spring context
- // Map listeners = context.getBeansOfType(
- // BuildListener.class, false, true);
- // for (BuildListener listener : listeners.values()) {
- // project.addBuildListener(listener);
- // }
- }
-
- /** Loads the SLC specific Ant tasks. */
- protected static void addCustomTaskAndTypes(Project project) {
- Properties taskdefs = getDefs(project, SlcAntConstants.SLC_TASKDEFS_RESOURCE_PATH);
- for (Object o : taskdefs.keySet()) {
- String name = o.toString();
- try {
- project.addTaskDefinition(name, Class.forName(taskdefs
- .getProperty(name)));
- } catch (ClassNotFoundException e) {
- log.error("Unknown class for task " + name, e);
- }
- }
- Properties typedefs = getDefs(project, SlcAntConstants.SLC_TYPEDEFS_RESOURCE_PATH);
- for (Object o : typedefs.keySet()) {
- String name = o.toString();
- try {
- project.addDataTypeDefinition(name, Class.forName(typedefs
- .getProperty(name)));
- } catch (ClassNotFoundException e) {
- log.error("Unknown class for type " + name, e);
- }
- }
- }
-
- private static Properties getDefs(Project project, String path) {
- Properties defs = new Properties();
- try {
- InputStream in = project.getClass().getResourceAsStream(path);
- defs.load(in);
- in.close();
- } catch (IOException e) {
- throw new SlcAntException("Cannot load task definitions", e);
- }
- return defs;
- }
-
- protected static void createAndRegisterSlcExecution(Project project) {
- SlcExecution slcExecution = new SlcExecution();
- slcExecution.setUuid(UUID.randomUUID().toString());
- try {
- slcExecution.setHost(InetAddress.getLocalHost().getHostName());
- } catch (UnknownHostException e) {
- slcExecution.setHost(SlcExecution.UNKOWN_HOST);
- }
-
- if (project.getReference(SlcAntConstants.REF_ROOT_CONTEXT) != null) {
- slcExecution.setType(SlcAntConstants.EXECTYPE_SLC_ANT);
- } else {
- slcExecution.setType(SlcAntConstants.EXECTYPE_ANT);
- }
-
- slcExecution.setUser(System.getProperty("user.name"));
- slcExecution.setStatus(SlcExecution.STATUS_RUNNING);
- slcExecution.getAttributes().put("ant.file",
- project.getProperty("ant.file"));
-
- project.addReference(SlcAntConstants.REF_SLC_EXECUTION,
- slcExecution);
-
- // Add build listeners declared in Spring context
- Map listeners = ((ListableBeanFactory) project
- .getReference(SlcAntConstants.REF_ROOT_CONTEXT)).getBeansOfType(
- ProjectRelatedBuildListener.class, false, true);
- for (ProjectRelatedBuildListener listener : listeners.values()) {
- listener.init(project);
- project.addBuildListener(listener);
- }
-
- }
-}
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/deploy/SlcDeployTask.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/deploy/SlcDeployTask.java
index 8e6fc63b1..e6d42db9a 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/deploy/SlcDeployTask.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/deploy/SlcDeployTask.java
@@ -3,7 +3,6 @@ package org.argeo.slc.ant.deploy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.BuildException;
-import org.argeo.slc.ant.SlcAntConfig;
import org.argeo.slc.ant.spring.SpringArg;
import org.argeo.slc.ant.structure.SAwareTask;
import org.argeo.slc.core.build.Distribution;
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
index 651ccad7b..e5ccab51a 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
@@ -3,7 +3,6 @@ package org.argeo.slc.ant.test;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.BuildException;
-import org.argeo.slc.ant.SlcAntConfig;
import org.argeo.slc.ant.SlcAntConstants;
import org.argeo.slc.ant.spring.SpringArg;
import org.argeo.slc.ant.structure.SAwareTask;
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java
index efe4ca73e..22050b4e8 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java
@@ -2,10 +2,8 @@ package org.argeo.slc.ant.unit;
import junit.framework.TestCase;
-import org.apache.tools.ant.launch.AntMain;
import org.argeo.slc.ant.AntExecutionContext;
import org.argeo.slc.cli.DefaultSlcRuntime;
-import org.argeo.slc.runtime.SlcExecutionContext;
import org.argeo.slc.runtime.SlcExecutionOutput;
public abstract class SlcAntAppliTestCase extends TestCase implements
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 fcf272464..adae463c2 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
@@ -18,7 +18,6 @@ import org.argeo.slc.ant.SlcAntConstants;
import org.argeo.slc.ant.SlcAntException;
import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.process.SlcExecution;
-import org.argeo.slc.runtime.SlcExecutionContext;
import org.argeo.slc.runtime.SlcExecutionOutput;
import org.argeo.slc.spring.SpringUtils;
import org.springframework.core.io.DefaultResourceLoader;
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/SlcMain.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/SlcMain.java
index dfbd7053c..10636f3d4 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/SlcMain.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/SlcMain.java
@@ -1,6 +1,5 @@
package org.argeo.slc.cli;
-import java.io.File;
import java.util.Properties;
import org.apache.commons.cli.CommandLine;
@@ -15,9 +14,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.slc.core.SlcException;
import org.argeo.slc.logging.Log4jUtils;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.core.io.Resource;
public class SlcMain {
public enum Mode {
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/maven/MavenDeployEnvironment.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/maven/MavenDeployEnvironment.java
index ebe06ea82..223eb300f 100644
--- a/org.argeo.slc.agent/src/main/java/org/argeo/slc/maven/MavenDeployEnvironment.java
+++ b/org.argeo.slc.agent/src/main/java/org/argeo/slc/maven/MavenDeployEnvironment.java
@@ -8,7 +8,7 @@ import java.util.UUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.ant.AntRegistryUtil;
+import org.argeo.slc.ant.AntRunner;
import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.deploy.DeployEnvironment;
@@ -52,9 +52,9 @@ public class MavenDeployEnvironment implements DeployEnvironment {
"org/argeo/slc/support/deploy/ant/build.xml");
if (type == null || type.equals("zip")) {
- AntRegistryUtil.runAll(antUrl, "deployZip", props);
+ new AntRunner(antUrl, "deployZip", props).run();
} else if (type.equals("tar.gz")) {
- AntRegistryUtil.runAll(antUrl, "deployTarGz", props);
+ new AntRunner(antUrl, "deployTarGz", props).run();
} else {
throw new SlcException("Unknow package type " + type);
}
diff --git a/org.argeo.slc.agent/src/main/resources/META-INF/services/org.apache.tools.ant.ProjectHelper b/org.argeo.slc.agent/src/main/resources/META-INF/services/org.apache.tools.ant.ProjectHelper
deleted file mode 100644
index 1c222d5e1..000000000
--- a/org.argeo.slc.agent/src/main/resources/META-INF/services/org.apache.tools.ant.ProjectHelper
+++ /dev/null
@@ -1 +0,0 @@
-org.argeo.slc.ant.SlcProjectHelper
\ No newline at end of file
diff --git a/org.argeo.slc.agent/src/test/java/org/argeo/slc/ws/SlcAntWsIntegrationTest.java b/org.argeo.slc.agent/src/test/java/org/argeo/slc/ws/SlcAntWsIntegrationTest.java
index 7b3d662f7..ab80744af 100644
--- a/org.argeo.slc.agent/src/test/java/org/argeo/slc/ws/SlcAntWsIntegrationTest.java
+++ b/org.argeo.slc.agent/src/test/java/org/argeo/slc/ws/SlcAntWsIntegrationTest.java
@@ -1,25 +1,22 @@
package org.argeo.slc.ws;
-import java.net.URL;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import org.argeo.slc.ant.AntRunner;
import org.argeo.slc.unit.AbstractSpringTestCase;
public class SlcAntWsIntegrationTest extends AbstractSpringTestCase {
private Log log = LogFactory.getLog(getClass());
public void testSimpleRun() {
+ fail("Adapt to new runtime");
// AntRegistryUtil.runAll(getClass().getResource(
// "/org/argeo/slc/ant/build.xml"), "test", null);
- URL url = getClass().getResource("/org/argeo/slc/ant/build.xml");
- log.info("Run Ant file from URL: " + url);
- AntRunner antRunner = new AntRunner(getContext(), url, "test");
-
- antRunner.run();
+ // URL url = getClass().getResource("/org/argeo/slc/ant/build.xml");
+ // log.info("Run Ant file from URL: " + url);
+ // AntRunner antRunner = new AntRunner(getContext(), url, "test");
+ //
+ // antRunner.run();
}
}