import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.ProjectHelper;\r
import org.apache.tools.ant.helper.ProjectHelper2;\r
+import org.argeo.slc.core.SlcException;\r
\r
/** Run regular Ant script (that is, not SLC instrumented) */\r
public class AntRunner {\r
}\r
} catch (Throwable e) {\r
exception = e;\r
- throw new SlcAntException("Could not run Ant script " + buildFile,\r
- e);\r
+ throw new SlcException("Could not run Ant script " + buildFile, e);\r
} finally {\r
p.fireBuildFinished(exception);\r
}\r
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.helper.ProjectHelper2;
import org.apache.tools.ant.listener.CommonsLoggingListener;
+import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.process.SlcExecution;
import org.argeo.slc.core.structure.SimpleSElement;
import org.argeo.slc.core.structure.StructureRegistry;
}
}
} catch (Exception e) {
- throw new SlcAntException("Cannot init system properties.", e);
+ throw new SlcException("Cannot init system properties.", e);
}
}
ctx.refresh();
return ctx;
} catch (Exception e) {
- throw new SlcAntException(
+ throw new SlcException(
"Cannot create SLC execution application context.", e);
}
}
String scriptStr = slcExecution.getAttributes().get(
SlcAntConstants.EXECATTR_ANT_FILE);
if (scriptStr == null)
- throw new SlcAntException("No Ant script provided");
+ throw new SlcException("No Ant script provided");
return scriptStr;
}
defs.load(in);
in.close();
} catch (IOException e) {
- throw new SlcAntException("Cannot load task definitions", e);
+ throw new SlcException("Cannot load task definitions", e);
}
return defs;
}
projectHelper);
projectHelper.parse(project, script.getURL());
} catch (Exception e) {
- throw new SlcAntException("Could not parse project for script "
+ throw new SlcException("Could not parse project for script "
+ scriptRelativePath, e);
}
}
} catch (Throwable e) {
exception = e;
- throw new SlcAntException("SLC Ant execution failed", exception);
+ throw new SlcException("SLC Ant execution failed", exception);
} finally {
p.fireBuildFinished(exception);
}
*/
public static final String SLC_TYPEDEFS_RESOURCE_PATH = "/org/argeo/slc/ant/typedefs.properties";
public static final String REF_SLC_EXECUTION = "slcExecution";
-
+
// SLC EXECUTION
public static final String EXECTYPE_ANT = "org.apache.tools.ant";
public static final String EXECTYPE_SLC_ANT = "org.argeo.slc.ant";
public final static String EXECATTR_RUNTIME = "slc.runtime";
public final static String EXECATTR_ANT_FILE = "ant.file";
public final static String EXECATTR_ANT_TARGETS = "ant.targets";
-
+
// PROPERTIES
/** Property for the root dir (SLC root property file). */
public final static String ROOT_DIR_PROPERTY = "slc.rootDir";
// LOG4J
public final static String MDC_ANT_PROJECT = "slc.ant.project";
-
+
}
+++ /dev/null
-package org.argeo.slc.ant;\r
-\r
-import org.argeo.slc.core.SlcException;\r
-\r
-/** Base for all SLC Ant exceptions. */\r
-public class SlcAntException extends SlcException {\r
- static final long serialVersionUID = 1l;\r
-\r
- /** Constructor. */\r
- public SlcAntException(String message) {\r
- super(message);\r
- }\r
-\r
- /** Constructor. */\r
- public SlcAntException(String message, Throwable cause) {\r
- super(message, cause);\r
- }\r
-\r
-}\r
.getReference(SlcAntConstants.REF_SLC_EXECUTION);\r
\r
if (slcExecution == null)\r
- throw new SlcAntException("No SLC Execution registered.");\r
+ throw new SlcException("No SLC Execution registered.");\r
return slcExecution;\r
}\r
\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.types.DataType;\r
import org.argeo.slc.ant.SlcAntConstants;\r
-import org.argeo.slc.ant.SlcAntException;\r
import org.argeo.slc.core.SlcException;\r
import org.springframework.beans.BeanWrapper;\r
import org.springframework.beans.BeanWrapperImpl;\r
if (bean != null) {\r
beanInstance = (T) getContext().getBean(bean);\r
if (beanInstance == null)\r
- throw new SlcAntException(\r
- "No object found for Spring bean " + bean);\r
+ throw new SlcException("No object found for Spring bean "\r
+ + bean);\r
} else if (antref != null) {\r
beanInstance = (T) getProject().getReference(antref);\r
if (beanInstance == null)\r
- throw new SlcAntException(\r
- "No object found for Ant reference " + antref);\r
+ throw new SlcException("No object found for Ant reference "\r
+ + antref);\r
} else {\r
- throw new SlcAntException(\r
+ throw new SlcException(\r
"Don't know how to retrieve bean instance");\r
}\r
\r
BeanWrapper wrapper = new BeanWrapperImpl(obj);\r
for (OverrideArg override : overrides) {\r
if (override.getName() == null) {\r
- throw new SlcAntException(\r
+ throw new SlcException(\r
"The name of the property to override has to be set.");\r
}\r
\r
\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Target;\r
-\r
import org.argeo.slc.ant.SlcAntConstants;\r
-import org.argeo.slc.ant.SlcAntException;\r
-import org.argeo.slc.ant.spring.SpringArg;\r
import org.argeo.slc.ant.spring.AbstractSpringTask;\r
+import org.argeo.slc.ant.spring.SpringArg;\r
+import org.argeo.slc.core.SlcException;\r
import org.argeo.slc.core.structure.SimpleSElement;\r
import org.argeo.slc.core.structure.StructureAware;\r
import org.argeo.slc.core.structure.StructureElement;\r
/** Create a reference to an external structure element. */\r
public StructureElementArg createStructureElement() {\r
if (structureElementArg != null)\r
- throw new SlcAntException("Arg already set.");\r
+ throw new SlcException("Arg already set.");\r
structureElementArg = new StructureElementArg();\r
return structureElementArg;\r
}\r
try {\r
testRun = (WritableTestRun) getContext().getBean(testRunBeanT);\r
if (log.isTraceEnabled())\r
- log.trace("Load test run bean from bean name " + testRunBeanT);\r
+ log.trace("Load test run bean from bean name "\r
+ + testRunBeanT);\r
} catch (BeansException e) {\r
// silent, will try defaults\r
}\r
import org.argeo.slc.ant.AntExecutionContext;
import org.argeo.slc.ant.AntSlcApplication;
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.SlcExecutionOutput;
try {
p.load(in);
} catch (IOException e) {
- throw new SlcAntException("Cannot read SLC root file", e);
+ throw new SlcException("Cannot read SLC root file", e);
}
return p;
}