etc/modules/sample-bundle/src/main/jbossas-init-script | 3 etc/modules/sample-bundle/src/main/rhq-bundle.xml | 9 etc/modules/sample-bundle/src/main/scripts/build.xml | 7 modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java | 233 +++++----- modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java | 11 modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java | 6 modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java | 26 - modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java | 77 ++- 8 files changed, 233 insertions(+), 139 deletions(-)
New commits: commit 56dae8a4278fc1a36a865dbdee87552d16ccf130 Author: Ian P. Springer <ips@jetengine.(none)> Date: Fri May 28 14:04:24 2010 -0400
rhq AntMain now executes stop+(install|upgrade)+start phases if rhq.deploy.phase prop is not specified on command line; system-service type now supports start and stop phase and ensures MD5s are calculated for init script and config file; other misc fixes and improvements (cherry picked from commit f877b026411bb0ee5f8f4ebd0f0c85aa593916c0)
diff --git a/etc/modules/sample-bundle/src/main/jbossas-init-script b/etc/modules/sample-bundle/src/main/jbossas-init-script index 218616f..58eb98e 100755 --- a/etc/modules/sample-bundle/src/main/jbossas-init-script +++ b/etc/modules/sample-bundle/src/main/jbossas-init-script @@ -2,7 +2,8 @@ # # jbossas - This shell script takes care of starting and stopping # a JBoss Application Server (AS) instance on a Red Hat -# Linux system. +# Linux system. It can be run as a system service (init +# script) and/or run manually. # # chkconfig: 345 84 16 # description: JBoss AS server diff --git a/etc/modules/sample-bundle/src/main/rhq-bundle.xml b/etc/modules/sample-bundle/src/main/rhq-bundle.xml index 7ed429a..8bfec17 100644 --- a/etc/modules/sample-bundle/src/main/rhq-bundle.xml +++ b/etc/modules/sample-bundle/src/main/rhq-bundle.xml @@ -23,7 +23,8 @@ required="true" type="integer"/>
- <rhq:deployment name="appserver" preinstallTarget="appserver-preinstall"> + <rhq:deployment-unit name="appserver" + preinstallTarget="appserver-preinstall" postinstallTarget="appserver-postinstall"> <rhq:system-service name="jbossas-petstore" scriptFile="jbossas-init-script" configFile="jbossas-init-config" overwriteScript="true" startLevels="3,4,5" startPriority="80" stopPriority="20"/> @@ -39,7 +40,7 @@ <include name="server/default/work/**"/> </rhq:fileset> </rhq:ignore> - </rhq:deployment> + </rhq:deployment-unit>
</rhq:bundle>
@@ -49,4 +50,8 @@ <echo>Installing Java Petstore App Server to ${rhq.deploy.dir}...</echo> </target>
+ <target name="appserver-postinstall"> + <echo>Done installing Java Petstore App Server to ${rhq.deploy.dir}.</echo> + </target> + </project> diff --git a/etc/modules/sample-bundle/src/main/scripts/build.xml b/etc/modules/sample-bundle/src/main/scripts/build.xml index c3dcd85..f182518 100644 --- a/etc/modules/sample-bundle/src/main/scripts/build.xml +++ b/etc/modules/sample-bundle/src/main/scripts/build.xml @@ -9,8 +9,9 @@ <!-- download JBossAS 6.0 dist from sourceforge and unzip it --> <property name="tmp.dir" location="${java.io.tmpdir}/${user.name}"/> <echo>tmp.dir="${tmp.dir}"</echo> - <mkdir dir="${tmp.dir}"/> - <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M2/jboss-6...." + <mkdir dir="${tmp.dir}"/> + + <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M3/jboss-as-distribution-6.0.0.20100429-M3.zip" dest="${tmp.dir}/jbossas.zip" usetimestamp="true"/> <property name="jboss.home" location="target/jbossas-petstore"/> @@ -18,7 +19,7 @@ <mkdir dir="${jboss.home}"/> <unzip src="${tmp.dir}/jbossas.zip" dest="${jboss.home}"> <mapper> - <globmapper from="jboss-6.0.0.20100216-M2/*" to="*"/> + <globmapper from="jboss-6.0.0.20100429-M3/*" to="*"/> </mapper> </unzip>
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java index 34177b0..5acea7e 100644 --- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java +++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java @@ -38,6 +38,7 @@ import org.apache.tools.ant.input.InputHandler; import org.apache.tools.ant.util.ClasspathUtils; import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.ProxySetup; +import org.rhq.core.util.updater.DeploymentsMetadata;
/** * Command line entry point into RHQ Ant. This class is entered @@ -606,134 +607,158 @@ public class AntMain implements org.apache.tools.ant.launch.AntMain { * @exception BuildException if the build fails */ private void runBuild(ClassLoader coreLoader) throws BuildException { - if (!readyToRun) { return; }
- // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields. - final Project project = new BundleAntProject(); - project.setCoreLoader(coreLoader); - - Throwable error = null; - - try { - addBuildListeners(project); - addInputHandler(project); - - PrintStream savedErr = System.err; - PrintStream savedOut = System.out; - InputStream savedIn = System.in; - - // use a system manager that prevents from System.exit() - SecurityManager oldsm = null; - oldsm = System.getSecurityManager(); - - //SecurityManager can not be installed here for backwards - //compatibility reasons (PD). Needs to be loaded prior to - //ant class if we are going to implement it. - //System.setSecurityManager(new NoExitSecurityManager()); + // RHQ + DeploymentPhase[] lifecycle = getLifecycle(); + for (DeploymentPhase phase : lifecycle) { + System.out.println("***** Executing " + phase + " phase *****..."); + // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields. + Project project = new BundleAntProject(); + Throwable error = null; try { - if (allowInput) { - project.setDefaultInputStream(System.in); + initProject(project, coreLoader, phase); + if (projectHelp) { + printDescription(project); + printTargets(project, msgOutputLevel > Project.MSG_INFO); + } else { + // make sure that we have a target to execute + // TODO: For RHQ, we actually might want to enforce that they do NOT specify a target and just always + // execute the "" target. + if (targets.isEmpty()) { + if (project.getDefaultTarget() != null) { + targets.addElement(project.getDefaultTarget()); + } + } + project.executeTargets(targets); } - System.setIn(new DemuxInputStream(project)); - System.setOut(new PrintStream(new DemuxOutputStream(project, false))); - System.setErr(new PrintStream(new DemuxOutputStream(project, true))); - - + } catch (RuntimeException exc) { + error = exc; + throw exc; + } catch (Error e) { + error = e; + throw e; + } finally { if (!projectHelp) { - project.fireBuildStarted(); - } - - // set the thread priorities - if (threadPriority != null) { try { - project.log("Setting Ant's thread priority to " - + threadPriority, Project.MSG_VERBOSE); - Thread.currentThread().setPriority(threadPriority.intValue()); - } catch (SecurityException swallowed) { - //we cannot set the priority here. - project.log("A security manager refused to set the -nice value"); + project.fireBuildFinished(error); + } catch (Throwable t) { + // yes, I know it is bad style to catch Throwable, + // but if we don't, we lose valuable information + System.err.println("Caught an exception while logging the" + + " end of the build. Exception was:"); + t.printStackTrace(); + if (error != null) { + System.err.println("There has been an error prior to" + + " that:"); + error.printStackTrace(); + } + throw new BuildException(t); } + } else if (error != null) { + project.log(error.toString(), Project.MSG_ERR); } + } + } + }
+ private DeploymentPhase[] getLifecycle() { + String deployDirString = definedProps.getProperty(DeployPropertyNames.DEPLOY_DIR); + File deployDir = new File(deployDirString); + DeploymentsMetadata deployMetadata = new DeploymentsMetadata(deployDir); + boolean isRedeploy = deployMetadata.isManaged();
- project.init(); + DeploymentPhase[] lifecycle; + String phaseString = definedProps.getProperty(DeployPropertyNames.DEPLOY_PHASE); + if (phaseString == null) { + lifecycle = (isRedeploy) ? DeploymentPhase.REDEPLOY_LIFECYCLE : DeploymentPhase.DEPLOY_LIFECYCLE; + } else { + DeploymentPhase phase = DeploymentPhase.valueOf(phaseString.toUpperCase()); + lifecycle = new DeploymentPhase[] {phase}; + } + return lifecycle; + }
- // set user-define properties - Enumeration e = definedProps.keys(); - while (e.hasMoreElements()) { - String arg = (String) e.nextElement(); - String value = (String) definedProps.get(arg); - project.setUserProperty(arg, value); - } + private void initProject(Project project, ClassLoader coreLoader, DeploymentPhase phase) { + project.setCoreLoader(coreLoader); + project.setProperty(DeployPropertyNames.DEPLOY_PHASE, phase.name());
- project.setUserProperty(MagicNames.ANT_FILE, - buildFile.getAbsolutePath()); - project.setUserProperty(MagicNames.ANT_FILE_TYPE, - MagicNames.ANT_FILE_TYPE_FILE); + addBuildListeners(project); + addInputHandler(project);
- project.setKeepGoingMode(keepGoingMode); - if (proxy) { - //proxy setup if enabled - ProxySetup proxySetup = new ProxySetup(project); - proxySetup.enableProxies(); - } + PrintStream savedErr = System.err; + PrintStream savedOut = System.out; + InputStream savedIn = System.in;
- ProjectHelper.configureProject(project, buildFile); + // use a system manager that prevents from System.exit() + SecurityManager oldsm = null; + oldsm = System.getSecurityManager();
- if (projectHelp) { - printDescription(project); - printTargets(project, msgOutputLevel > Project.MSG_INFO); - return; - } + //SecurityManager can not be installed here for backwards + //compatibility reasons (PD). Needs to be loaded prior to + //ant class if we are going to implement it. + //System.setSecurityManager(new NoExitSecurityManager()); + try { + if (allowInput) { + project.setDefaultInputStream(System.in); + } + System.setIn(new DemuxInputStream(project)); + System.setOut(new PrintStream(new DemuxOutputStream(project, false))); + System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
- // make sure that we have a target to execute - if (targets.size() == 0) { - if (project.getDefaultTarget() != null) { - targets.addElement(project.getDefaultTarget()); - } - }
- project.executeTargets(targets); - } finally { - // put back the original security manager - //The following will never eval to true. (PD) - if (oldsm != null) { - System.setSecurityManager(oldsm); + if (!projectHelp) { + project.fireBuildStarted(); + } + + // set the thread priorities + if (threadPriority != null) { + try { + project.log("Setting Ant's thread priority to " + + threadPriority, Project.MSG_VERBOSE); + Thread.currentThread().setPriority(threadPriority.intValue()); + } catch (SecurityException swallowed) { + //we cannot set the priority here. + project.log("A security manager refused to set the -nice value"); } + } + + + project.init(); + + // set user-define properties + Enumeration e = definedProps.keys(); + while (e.hasMoreElements()) { + String arg = (String) e.nextElement(); + String value = (String) definedProps.get(arg); + project.setUserProperty(arg, value); + } + + project.setUserProperty(MagicNames.ANT_FILE, + buildFile.getAbsolutePath()); + project.setUserProperty(MagicNames.ANT_FILE_TYPE, + MagicNames.ANT_FILE_TYPE_FILE);
- System.setOut(savedOut); - System.setErr(savedErr); - System.setIn(savedIn); + project.setKeepGoingMode(keepGoingMode); + if (proxy) { + //proxy setup if enabled + ProxySetup proxySetup = new ProxySetup(project); + proxySetup.enableProxies(); } - } catch (RuntimeException exc) { - error = exc; - throw exc; - } catch (Error e) { - error = e; - throw e; + + ProjectHelper.configureProject(project, buildFile); } finally { - if (!projectHelp) { - try { - project.fireBuildFinished(error); - } catch (Throwable t) { - // yes, I know it is bad style to catch Throwable, - // but if we don't, we lose valuable information - System.err.println("Caught an exception while logging the" - + " end of the build. Exception was:"); - t.printStackTrace(); - if (error != null) { - System.err.println("There has been an error prior to" - + " that:"); - error.printStackTrace(); - } - throw new BuildException(t); - } - } else if (error != null) { - project.log(error.toString(), Project.MSG_ERR); + // put back the original security manager + //The following will never eval to true. (PD) + if (oldsm != null) { + System.setSecurityManager(oldsm); } + + System.setOut(savedOut); + System.setErr(savedErr); + System.setIn(savedIn); } }
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java index 4f87ab6..67c6fcd 100644 --- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java +++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java @@ -2,7 +2,7 @@ package org.rhq.bundle.ant;
/** * A bundle deployment phase. One or more tasks are associated with each phase. The phases are executed as part of - * three user-initiated actions: + * three user-initiated lifecycles: * * Deploy: INSTALL,START * Redeploy: STOP,UPGRADE,START @@ -17,6 +17,15 @@ public enum DeploymentPhase { UPGRADE, UNINSTALL;
+ public static final DeploymentPhase[] DEPLOY_LIFECYCLE = + new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.INSTALL, DeploymentPhase.START}; + + public static final DeploymentPhase[] REDEPLOY_LIFECYCLE = + new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UPGRADE, DeploymentPhase.START}; + + public static final DeploymentPhase[] UNDEPLOY_LIFECYCLE = + new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UNINSTALL}; + @Override public String toString() { return name().toLowerCase(); diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java index 8e3c066..88bb491 100644 --- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java +++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java @@ -52,6 +52,7 @@ public class BundleTask extends AbstractBundleTask { super.maybeConfigure();
validateAttributes(); + // TODO: Figure out why the Ant parse() method is not initializing the child Type objects. //validateTypes();
getProject().setBundleName(this.name); @@ -60,8 +61,7 @@ public class BundleTask extends AbstractBundleTask { }
/** - * The RHQ Ant launcher will ensure that the following Ant project properties are defined prior to this method being - * invoked: + * The following Ant project properties must be defined with valid values prior to this method being invoked: * * rhq.deploy.id - the {@link org.rhq.core.domain.bundle.BundleDeployment deployment}'s unique id * (e.g. "10001") @@ -72,7 +72,7 @@ public class BundleTask extends AbstractBundleTask { * If the bundle recipe is being executed from the command line, the user must supply these properties, along * with any input properties required by the bundle recipe. * - * @throws BuildException + * @throws BuildException if an error occurs */ @Override public void execute() throws BuildException { diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java index df72add..699bbf7 100644 --- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java +++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java @@ -20,6 +20,7 @@ package org.rhq.bundle.ant.type; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Target; +import org.rhq.bundle.ant.DeployPropertyNames; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.PropertySimple; import org.rhq.core.system.SystemInfoFactory; @@ -69,8 +70,15 @@ public class DeploymentUnitType extends AbstractBundleType { getProject().getBundleVersion(), getProject().getBundleDescription()); File deployDir = getProject().getDeployDir(); TemplateEngine templateEngine = createTemplateEngine(); + if (this.systemService != null) { + this.files.put(this.systemService.getScriptFile(), this.systemService.getScriptDestFile()); + if (this.systemService.getConfigFile() != null) { + this.files.put(this.systemService.getConfigFile(), this.systemService.getConfigDestFile()); + this.rawFilesToReplace.add(this.systemService.getConfigFile()); + } + } if (this.files.isEmpty() && this.archives.isEmpty()) { - throw new BuildException("You must specify at least one file to deploy via nested rhq:file and/or rhq:archive elements."); + throw new BuildException("You must specify at least one file to deploy via nested rhq:file, rhq:archive, and/or rhq:system-service elements."); } if (!this.files.isEmpty()) { log("Deploying files " + this.files + "...", Project.MSG_VERBOSE); @@ -113,11 +121,15 @@ public class DeploymentUnitType extends AbstractBundleType { }
public void start() throws BuildException { - + if (this.systemService != null) { + this.systemService.start(); + } }
public void stop() throws BuildException { - + if (this.systemService != null) { + this.systemService.stop(); + } }
public void upgrade(boolean revert, boolean clean) throws BuildException { @@ -125,7 +137,9 @@ public class DeploymentUnitType extends AbstractBundleType { }
public void uninstall() throws BuildException { - // TODO + if (this.systemService != null) { + this.systemService.uninstall(); + } }
public String getName() { @@ -173,6 +187,7 @@ public class DeploymentUnitType extends AbstractBundleType { throw new IllegalStateException("A deployment can only have one system-service child element."); } this.systemService = systemService; + this.systemService.init(); }
public void addConfigured(FileType file) { @@ -207,6 +222,9 @@ public class DeploymentUnitType extends AbstractBundleType { for (PropertySimple prop : config.getSimpleProperties().values()) { templateEngine.getTokens().put(prop.getName(), prop.getStringValue()); } + // And add the special rhq.deploy.dir prop. + templateEngine.getTokens().put(DeployPropertyNames.DEPLOY_DIR, + getProject().getProperty(DeployPropertyNames.DEPLOY_DIR)); return templateEngine; } } \ No newline at end of file diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java index f3ef36c..3e3c1ee 100644 --- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java +++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java @@ -11,7 +11,8 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * * You should have received a copy of the GNU General Public License + * + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -73,47 +74,72 @@ public class SystemServiceType extends AbstractBundleType { private Set<Character> startLevelChars; private Set<Character> stopLevelChars;
- public void install() throws BuildException { + private File scriptDestFile; + private File configDestFile; + + public void init() throws BuildException { if (!OS_NAME.equals("Linux") || !REDHAT_RELEASE_FILE.exists() ) { throw new BuildException("The system-service element is only supported on Red Hat Linux systems."); } validateAttributes();
+ this.scriptDestFile = new File(getInitDir(), this.name); + this.configDestFile = new File(getSysConfigDir(), this.name); + } + + public void install() throws BuildException { // Install the config file if one was provided (e.g. /etc/sysconfig/named). if (this.configFile != null) { - File sysconfigDir = new File(this.root, SYSCONFIG_DIR.getPath().substring(1)); + File sysconfigDir = getSysConfigDir(); if (!sysconfigDir.exists()) { sysconfigDir.mkdirs(); } if (!sysconfigDir.canWrite()) { throw new BuildException(sysconfigDir + " directory is not writeable."); } - File configDestFile = new File(sysconfigDir, this.name); - copyFile(this.configFile, configDestFile, this.overwriteConfig); - setPermissions(configDestFile, "644"); + // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata + // (i.e. MD5) can be calculated and saved. + //copyFile(this.configFile, this.configDestFile, this.overwriteConfig); + setPermissions(this.configDestFile, "644"); }
// Install the script itself (e.g. /etc/init.d/named). - File initDir = new File(this.root, INIT_DIR.getPath().substring(1)); + File initDir = getInitDir(); if (!initDir.exists()) { initDir.mkdirs(); } if (!initDir.canWrite()) { throw new BuildException(initDir + " directory is not writeable."); } - File scriptDestFile = new File(initDir, this.name); - getProject().log("Installing service script " + scriptDestFile + "..."); - copyFile(this.scriptFile, scriptDestFile, this.overwriteScript); - setPermissions(scriptDestFile, "755"); + getProject().log("Installing service script " + this.scriptDestFile + "..."); + // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata + // (i.e. MD5) can be calculated and saved. + //copyFile(this.scriptFile, scriptDestFile, this.overwriteScript); + setPermissions(this.scriptDestFile, "755");
// Create the symlinks in the rcX.d dirs (e.g. /etc/rc3.d/S24named -> ../init.d/named) - createScriptSymlinks(scriptDestFile, this.startPriority, this.startLevelChars, 'S'); - createScriptSymlinks(scriptDestFile, this.stopPriority, this.stopLevelChars, 'K'); + createScriptSymlinks(this.scriptDestFile, this.startPriority, this.startLevelChars, 'S'); + createScriptSymlinks(this.scriptDestFile, this.stopPriority, this.stopLevelChars, 'K'); + } + + private File getInitDir() { + return new File(this.root, INIT_DIR.getPath().substring(1)); + } + + public File getScriptDestFile() { + return this.scriptDestFile; + } + + private File getSysConfigDir() { + return new File(this.root, SYSCONFIG_DIR.getPath().substring(1)); + } + + public File getConfigDestFile() { + return this.configDestFile; }
public void start() throws BuildException { - File initDir = new File(this.root, INIT_DIR.getPath().substring(1)); - File scriptFile = new File(initDir, this.name); + File scriptFile = getScriptDestFile(); String[] commandLine = {scriptFile.getAbsolutePath(), "start"}; try { executeCommand(commandLine); @@ -124,8 +150,7 @@ public class SystemServiceType extends AbstractBundleType { }
public void stop() throws BuildException { - File initDir = new File(this.root, INIT_DIR.getPath().substring(1)); - File scriptFile = new File(initDir, this.name); + File scriptFile = getScriptDestFile(); String[] commandLine = {scriptFile.getAbsolutePath(), "stop"}; try { executeCommand(commandLine); @@ -151,16 +176,26 @@ public class SystemServiceType extends AbstractBundleType { return scriptFile; }
- public void setScriptFile(File scriptFile) { - this.scriptFile = scriptFile; + public void setScriptFile(String scriptFile) { + File file = new File(scriptFile); + if (file.isAbsolute()) { + throw new BuildException("Path specified by 'scriptFile' attribute (" + scriptFile + + ") is not relative - it must be a relative path, relative to the Ant basedir."); + } + this.scriptFile = getProject().resolveFile(scriptFile); }
public File getConfigFile() { return configFile; }
- public void setConfigFile(File configFile) { - this.configFile = configFile; + public void setConfigFile(String configFile) { + File file = new File(configFile); + if (file.isAbsolute()) { + throw new BuildException("Path specified by 'configFile' attribute (" + configFile + + ") is not relative - it must be a relative path, relative to the Ant basedir."); + } + this.configFile = getProject().resolveFile(configFile); }
public boolean isOverwriteScript() {
rhq-commits@lists.fedorahosted.org