Browse Source

This commit eliminates all (but one) use of Project.createTask("some name") from the codebase. It also sets up all created tasks using the new Task.bindToOwner call.

I'm tempted to retrofit Task.bindToOwner back to the 1.6.x codebase, for the benefit of third party tasks; same for the extra constructors for exec and java. Thoughts?


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277700 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
38e8c82493
26 changed files with 80 additions and 76 deletions
  1. +17
    -0
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  2. +2
    -5
      src/main/org/apache/tools/ant/taskdefs/CallTarget.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  4. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
  5. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/SignJar.java
  6. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/SubAnt.java
  7. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  8. +4
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
  9. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
  10. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  11. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  12. +5
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  13. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  14. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  15. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
  16. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java
  17. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
  19. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
  20. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
  21. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
  22. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java
  23. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java
  24. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
  25. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  26. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java

+ 17
- 0
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -108,6 +108,23 @@ public class Ant extends Task {
/** whether the target attribute was specified **/ /** whether the target attribute was specified **/
private boolean targetAttributeSet = false; private boolean targetAttributeSet = false;


/**
* simple constructor
*/
public Ant() {
}

/**
* create a task bound to its creator
* @param owner owning task
*/
public Ant(Task owner) {
bindToOwner(owner);
}




/** /**
* If true, pass all properties to the new Ant project. * If true, pass all properties to the new Ant project.
* Defaults to true. * Defaults to true.


+ 2
- 5
src/main/org/apache/tools/ant/taskdefs/CallTarget.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2004 The Apache Software Foundation
* Copyright 2000-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -80,10 +80,7 @@ public class CallTarget extends Task {
* configuring it by calling its own init method. * configuring it by calling its own init method.
*/ */
public void init() { public void init() {
callee = (Ant) getProject().createTask("ant");
callee.setOwningTarget(getOwningTarget());
callee.setTaskName(getTaskName());
callee.setLocation(getLocation());
callee = new Ant(this);
callee.init(); callee.init();
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000,2002,2004 The Apache Software Foundation
* Copyright 2000,2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -354,7 +354,7 @@ public class GenerateKey extends Task {
} }


log("Generating Key for " + alias); log("Generating Key for " + alias);
final ExecTask cmd = (ExecTask) getProject().createTask("exec");
final ExecTask cmd = new ExecTask(this);
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("keytool")); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("keytool"));
Commandline.Argument arg = cmd.createArg(); Commandline.Argument arg = cmd.createArg();
arg.setLine(sb.toString()); arg.setLine(sb.toString());


+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/LoadProperties.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2004 The Apache Software Foundation
* Copyright 2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -216,9 +216,8 @@ public class LoadProperties extends Task {
final Properties props = new Properties(); final Properties props = new Properties();
props.load(tis); props.load(tis);


Property propertyTask =
(Property) getProject().createTask("property");
propertyTask.setTaskName(getTaskName());
Property propertyTask = new Property();
propertyTask.bindToOwner(this);
propertyTask.addProperties(props); propertyTask.addProperties(props);
} }




+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -269,8 +269,7 @@ public class SignJar extends Task {
} }


long lastModified = jarSource.lastModified(); long lastModified = jarSource.lastModified();
final ExecTask cmd = new ExecTask();
cmd.setProject(getProject());
final ExecTask cmd = new ExecTask(this);
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("jarsigner")); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("jarsigner"));


if (maxMemory != null) { if (maxMemory != null) {


+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/SubAnt.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation
* Copyright 2003-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -478,9 +478,7 @@ public class SubAnt
* references necessary to run the sub-build. * references necessary to run the sub-build.
*/ */
private Ant createAntTask(File directory) { private Ant createAntTask(File directory) {
Ant antTask = (Ant) getProject().createTask("ant");
antTask.setOwningTarget(getOwningTarget());
antTask.setTaskName(getTaskName());
Ant antTask = new Ant(this);
antTask.init(); antTask.init();
if (subTarget != null && subTarget.length() > 0) { if (subTarget != null && subTarget.length() > 0) {
antTask.setTarget(subTarget); antTask.setTarget(subTarget);


+ 1
- 5
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java View File

@@ -122,11 +122,7 @@ public class Cab extends MatchingTask {
* it appears in the logs to be the same task as this one. * it appears in the logs to be the same task as this one.
*/ */
protected ExecTask createExec() throws BuildException { protected ExecTask createExec() throws BuildException {
ExecTask exec = (ExecTask) getProject().createTask("exec");
exec.setOwningTarget(this.getOwningTarget());
exec.setTaskName(this.getTaskName());
exec.setDescription(this.getDescription());

ExecTask exec = new ExecTask(this);
return exec; return exec;
} }




+ 4
- 5
src/main/org/apache/tools/ant/taskdefs/optional/IContract.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -522,7 +522,8 @@ public class IContract extends MatchingTask {
// Prepare the directories for iContract. iContract will make // Prepare the directories for iContract. iContract will make
// them if they don't exist, but for some reason I don't know, // them if they don't exist, but for some reason I don't know,
// it will complain about the REP files afterwards // it will complain about the REP files afterwards
Mkdir mkdir = (Mkdir) getProject().createTask("mkdir");
Mkdir mkdir = new Mkdir();
mkdir.bindToOwner(this);


mkdir.setDir(instrumentDir); mkdir.setDir(instrumentDir);
mkdir.execute(); mkdir.execute();
@@ -590,9 +591,7 @@ public class IContract extends MatchingTask {
buildDir.getAbsolutePath())); buildDir.getAbsolutePath()));


// Create a forked java process // Create a forked java process
Java iContract = (Java) getProject().createTask("java");

iContract.setTaskName(getTaskName());
Java iContract = new Java(this);
iContract.setFork(true); iContract.setFork(true);
iContract.setClassname("com.reliablesystems.iContract.Tool"); iContract.setClassname("com.reliablesystems.iContract.Tool");
iContract.setClasspath(iContractClasspath); iContract.setClasspath(iContractClasspath);


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000,2002,2004 The Apache Software Foundation
* Copyright 2000,2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -121,7 +121,8 @@ public class RenameExtensions extends MatchingTask {
log("using the same patterns on <fileset> as you\'ve used here", log("using the same patterns on <fileset> as you\'ve used here",
Project.MSG_INFO); Project.MSG_INFO);


Move move = (Move) getProject().createTask("move");
Move move = new Move();
move.bindToOwner(this);
move.setOwningTarget(getOwningTarget()); move.setOwningTarget(getOwningTarget());
move.setTaskName(getTaskName()); move.setTaskName(getTaskName());
move.setLocation(getLocation()); move.setLocation(getLocation());


+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2004 The Apache Software Foundation
* Copyright 2000-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -144,17 +144,15 @@ public abstract class ClearCase extends Task {
*/ */
protected String runS(Commandline cmdline) { protected String runS(Commandline cmdline) {
String outV = "opts.cc.runS.output" + pcnt++; String outV = "opts.cc.runS.output" + pcnt++;
Project aProj = getProject();
ExecTask exe = (ExecTask) aProj.createTask("exec");
ExecTask exe = new ExecTask(this);
Commandline.Argument arg = exe.createArg(); Commandline.Argument arg = exe.createArg();


exe.setExecutable(cmdline.getExecutable()); exe.setExecutable(cmdline.getExecutable());
arg.setLine(Commandline.toString(cmdline.getArguments())); arg.setLine(Commandline.toString(cmdline.getArguments()));
exe.setOutputproperty(outV); exe.setOutputproperty(outV);
exe.execute(); exe.execute();
// System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV ));


return aProj.getProperty(outV);
return getProject().getProperty(outV);
} }
/** /**
* If true, command will throw an exception on failure. * If true, command will throw an exception on failure.


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -281,8 +281,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
private void verifyBorlandJarV5(File sourceJar) { private void verifyBorlandJarV5(File sourceJar) {
log("verify BES " + sourceJar, Project.MSG_INFO); log("verify BES " + sourceJar, Project.MSG_INFO);
try { try {
org.apache.tools.ant.taskdefs.ExecTask execTask = null;
execTask = (ExecTask) getTask().getProject().createTask("exec");
ExecTask execTask = null;
execTask = new ExecTask(getTask());
execTask.setDir(new File(".")); execTask.setDir(new File("."));
execTask.setExecutable("iastool"); execTask.setExecutable("iastool");
//classpath //classpath
@@ -319,7 +319,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
String args = verifyArgs; String args = verifyArgs;
args += " " + sourceJar.getPath(); args += " " + sourceJar.getPath();


javaTask = (Java) getTask().getProject().createTask("java");
javaTask = new Java(getTask());
javaTask.setTaskName("verify"); javaTask.setTaskName("verify");
javaTask.setClassname(VERIFY); javaTask.setClassname(VERIFY);
Commandline.Argument arguments = javaTask.createArg(); Commandline.Argument arguments = javaTask.createArg();


+ 5
- 7
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -170,8 +170,8 @@ public class BorlandGenerateClient extends Task {


log("mode : java"); log("mode : java");


org.apache.tools.ant.taskdefs.Java execTask = null;
execTask = (Java) getProject().createTask("java");
Java execTask = null;
execTask = new Java(this);


execTask.setDir(new File(".")); execTask.setDir(new File("."));
execTask.setClassname("com.inprise.server.commandline.EJBUtilities"); execTask.setClassname("com.inprise.server.commandline.EJBUtilities");
@@ -221,8 +221,7 @@ public class BorlandGenerateClient extends Task {


log("mode : fork " + BorlandDeploymentTool.BAS, Project.MSG_DEBUG); log("mode : fork " + BorlandDeploymentTool.BAS, Project.MSG_DEBUG);


org.apache.tools.ant.taskdefs.ExecTask execTask = null;
execTask = (ExecTask) getProject().createTask("exec");
ExecTask execTask = new ExecTask(this);


execTask.setDir(new File(".")); execTask.setDir(new File("."));
execTask.setExecutable("iastool"); execTask.setExecutable("iastool");
@@ -254,8 +253,7 @@ public class BorlandGenerateClient extends Task {
protected void executeForkV5() throws BuildException { protected void executeForkV5() throws BuildException {
try { try {
log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG); log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG);
org.apache.tools.ant.taskdefs.ExecTask execTask = null;
execTask = (ExecTask) getProject().createTask("exec");
ExecTask execTask = new ExecTask(this);


execTask.setDir(new File(".")); execTask.setDir(new File("."));




+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2004 The Apache Software Foundation
* Copyright 2000-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.File; import java.io.File;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -86,9 +87,8 @@ public class DDCreator extends MatchingTask {
} }


String systemClassPath = System.getProperty("java.class.path"); String systemClassPath = System.getProperty("java.class.path");
String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath);
Java ddCreatorTask = (Java) getProject().createTask("java");
ddCreatorTask.setTaskName(getTaskName());
String execClassPath = Project.translatePath(systemClassPath + ":" + classpath);
Java ddCreatorTask = new Java(this);
ddCreatorTask.setFork(true); ddCreatorTask.setFork(true);
ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper");
Commandline.Argument arguments = ddCreatorTask.createArg(); Commandline.Argument arguments = ddCreatorTask.createArg();


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000,2002,2004 The Apache Software Foundation
* Copyright 2000,2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.File; import java.io.File;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -93,15 +94,14 @@ public class Ejbc extends MatchingTask {


String systemClassPath = System.getProperty("java.class.path"); String systemClassPath = System.getProperty("java.class.path");
String execClassPath String execClassPath
= getProject().translatePath(systemClassPath + ":" + classpath
= Project.translatePath(systemClassPath + ":" + classpath
+ ":" + generatedFilesDirectory); + ":" + generatedFilesDirectory);
// get all the files in the descriptor directory // get all the files in the descriptor directory
DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory);


String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();


Java helperTask = (Java) getProject().createTask("java");
helperTask.setTaskName(getTaskName());
Java helperTask = new Java(this);
helperTask.setFork(true); helperTask.setFork(true);
helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper"); helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper");
String args = ""; String args = "";


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2004 The Apache Software Foundation
* Copyright 2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -520,7 +520,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
return; return;
} }


genicTask = (Java) getTask().getProject().createTask("java");
genicTask = new Java(getTask());
genicTask.setTaskName("genic"); genicTask.setTaskName("genic");
genicTask.setFork(true); genicTask.setFork(true);




+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2002,2004 The Apache Software Foundation
* Copyright 2000-2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -192,7 +192,7 @@ public class WLRun extends Task {
+ "to start the server"); + "to start the server");
} }


Java weblogicServer = (Java) getProject().createTask("java");
Java weblogicServer = new Java(this);
weblogicServer.setTaskName(getTaskName()); weblogicServer.setTaskName(getTaskName());
weblogicServer.setFork(true); weblogicServer.setFork(true);
weblogicServer.setDir(weblogicSystemHome); weblogicServer.setDir(weblogicSystemHome);
@@ -247,8 +247,7 @@ public class WLRun extends Task {
} }
} }


Java weblogicServer = (Java) getProject().createTask("java");
weblogicServer.setTaskName(getTaskName());
Java weblogicServer = new Java(this);
weblogicServer.setFork(true); weblogicServer.setFork(true);
weblogicServer.setClassname(weblogicMainClass); weblogicServer.setClassname(weblogicMainClass);




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2002,2004 The Apache Software Foundation
* Copyright 2000-2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class WLStop extends Task {
throw new BuildException("The url of the weblogic server must be provided."); throw new BuildException("The url of the weblogic server must be provided.");
} }


Java weblogicAdmin = (Java) getProject().createTask("java");
Java weblogicAdmin = new Java(this);
weblogicAdmin.setFork(true); weblogicAdmin.setFork(true);
weblogicAdmin.setClassname("weblogic.Admin"); weblogicAdmin.setClassname("weblogic.Admin");
String args; String args;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java View File

@@ -511,7 +511,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
String ejbcClassName = ejbcClass; String ejbcClassName = ejbcClass;


try { try {
javaTask = (Java) getTask().getProject().createTask("java");
javaTask = new Java(getTask());
javaTask.setTaskName("ejbc"); javaTask.setTaskName("ejbc");


javaTask.createJvmarg().setLine(additionalJvmArgs); javaTask.createJvmarg().setLine(additionalJvmArgs);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java View File

@@ -541,7 +541,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {
private void buildWebsphereJar(File sourceJar, File destJar) { private void buildWebsphereJar(File sourceJar, File destJar) {
try { try {
if (ejbdeploy) { if (ejbdeploy) {
Java javaTask = (Java) getTask().getProject().createTask("java");
Java javaTask = new Java(getTask());
// Set the JvmArgs // Set the JvmArgs
javaTask.createJvmarg().setValue("-Xms64m"); javaTask.createJvmarg().setValue("-Xms64m");
javaTask.createJvmarg().setValue("-Xmx128m"); javaTask.createJvmarg().setValue("-Xmx128m");


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2004 The Apache Software Foundation
* Copyright 2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -69,7 +69,8 @@ public class AntResolver implements ExtensionResolver {
final Project project) throws BuildException { final Project project) throws BuildException {
validate(); validate();


final Ant ant = (Ant) project.createTask("ant");
final Ant ant = new Ant();
ant.setProject(project);
ant.setInheritAll(false); ant.setInheritAll(false);
ant.setAntfile(antfile.getName()); ant.setAntfile(antfile.getName());




+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002,2004 The Apache Software Foundation
* Copyright 2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -71,7 +71,8 @@ public class URLResolver implements ExtensionResolver {


final File file = getDest(); final File file = getDest();


final Get get = (Get) project.createTask("get");
final Get get = new Get();
get.setProject(project);
get.setDest(file); get.setDest(file);
get.setSrc(url); get.setSrc(url);
get.execute(); get.execute();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002,2004 The Apache Software Foundation
* Copyright 2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool {
*/ */
public void setTask(ServerDeploy task) { public void setTask(ServerDeploy task) {
super.setTask(task); super.setTask(task);
java = (Java) task.getProject().createTask("java");
java = new Java(task);
} }


/** /**


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002,2004 The Apache Software Foundation
* Copyright 2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool
* @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
*/ */
public void deploy() { public void deploy() {
Java java = (Java) getTask().getProject().createTask("java");
Java java = new Java(getTask());
java.setFork(true); java.setFork(true);
java.setFailonerror(true); java.setFailonerror(true);
java.setClasspath(getClasspath()); java.setClasspath(getClasspath());


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000,2002-2004 The Apache Software Foundation
* Copyright 2000,2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -132,7 +132,7 @@ public class WLJspc extends MatchingTask {
// Therefore, takes loads of time // Therefore, takes loads of time
// Can pass directories at a time (*.jsp) but easily runs out of // Can pass directories at a time (*.jsp) but easily runs out of
// memory on hefty dirs (even on a Sun) // memory on hefty dirs (even on a Sun)
Java helperTask = (Java) getProject().createTask("java");
Java helperTask = new Java(this);
helperTask.setFork(true); helperTask.setFork(true);
helperTask.setClassname("weblogic.jspc"); helperTask.setClassname("weblogic.jspc");
helperTask.setTaskName(getTaskName()); helperTask.setTaskName(getTaskName());


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class JasperC extends DefaultJspCompilerAdapter {
try { try {
// Create an instance of the compiler, redirecting output to // Create an instance of the compiler, redirecting output to
// the project log // the project log
Java java = (Java) (getProject().createTask("java"));
Java java = new Java(owner);
Path p = getClasspath(); Path p = getClasspath();
if (getJspc().getClasspath() != null) { if (getJspc().getClasspath() != null) {
getProject().log("using user supplied classpath: " + p, getProject().log("using user supplied classpath: " + p,


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java View File

@@ -1504,7 +1504,8 @@ public class FTP
} }
// delegate the deletion of the local temp file to the delete task // delegate the deletion of the local temp file to the delete task
// because of race conditions occuring on Windows // because of race conditions occuring on Windows
Delete mydelete = (Delete) getProject().createTask("delete");
Delete mydelete = new Delete();
mydelete.bindToOwner(this);
mydelete.setFile(tempFile.getCanonicalFile()); mydelete.setFile(tempFile.getCanonicalFile());
mydelete.execute(); mydelete.execute();
} catch (Exception e) { } catch (Exception e) {


Loading…
Cancel
Save