|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.vremanagement.deployer.impl.operators.ant.AntRunner
public class AntRunner
This class is designed to programmatically invoke Ant targets
1. initialize a new Project by calling "init"
2. invoke the deployment by running the deploy* Ant Target and feeding Ant with the following properties:
- gar.name/jar.name
- package.source.dir
- package.name
- package.file
You'll need ant-launcher.jar ant.jar to compile.
Example :
try {
//init
init("/home/me/build.xml","/home/me/");
//properties
HashMap m = new HashMap();
m.put("event", "test");
m.put("subject", "sujet java 3");
m.put("message", "message java 3");
setProperties(m, false);
//run
runTarget("test");
} catch (Exception e) { e.printStackTrace(); }
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
AntRunner()
Creates a new Ant runner |
|
| Method Summary | |
|---|---|
void |
init(String _buildFile,
String _baseDir)
Initializes a new Ant Project. |
void |
runScript()
Executes an external scripts |
void |
runTarget(String _target)
Runs the given Target. |
void |
setProperties(Map _properties,
boolean _overridable)
Sets the project's properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public AntRunner()
| Method Detail |
|---|
public void init(String _buildFile,
String _baseDir)
throws AntInterfaceException
_buildFile - The build File to use. If none is provided, it
will be defaulted to "build.xml"._baseDir - The project's base directory. If none is provided,
will be defaulted to "." (the current directory).
AntInterfaceException - if the initialization fails
public void setProperties(Map _properties,
boolean _overridable)
throws AntInterfaceException
_properties - A map containing the properties' name/value
couples_overridable - If set, the provided properties values may be
overriden by the config file's values
AntInterfaceException - if the project is null or the properties are null
public void runTarget(String _target)
throws AntInterfaceException
_target - The name of the target to run. If null, the
project's default target will be used.
AntInterfaceException - if an error occurs during the execution
public void runScript()
throws AntInterfaceException
AntInterfaceException - if an error occurs during the execution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||