Browse Source

Don't use ExecTask directly but instead go via Commandline + Execute2

Move all the generic scanners into types package


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270719 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
aff894bd1a
12 changed files with 144 additions and 124 deletions
  1. +37
    -34
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  2. +31
    -24
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  3. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  4. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
  5. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  6. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
  7. +37
    -34
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  8. +31
    -24
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  9. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  10. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
  11. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  12. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java

+ 37
- 34
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -17,9 +17,8 @@ import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
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.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -361,43 +360,18 @@ public class BorlandDeploymentTool
*/ */
private void buildBorlandStubs( Iterator ithomes, Hashtable files ) private void buildBorlandStubs( Iterator ithomes, Hashtable files )
{ {
Execute execTask = null;
final Execute2 exe = new Execute2();
exe.setWorkingDirectory( getTask().getBaseDirectory() );


execTask = new Execute( this );
Project project = getTask().getProject();
execTask.setWorkingDirectory( project.getBaseDir() );
final Commandline cmd = buildCommandline( ithomes );
exe.setCommandline( cmd.getCommandline() );


Commandline commandline = new Commandline();
commandline.setExecutable( JAVA2IIOP );
//debug ?
if( java2iiopdebug )
{
commandline.createArgument().setValue( "-VBJdebug" );
}// end of if ()
//set the classpath
commandline.createArgument().setValue( "-VBJclasspath" );
commandline.createArgument().setPath( getCombinedClasspath() );
//list file
commandline.createArgument().setValue( "-list_files" );
//no TIE classes
commandline.createArgument().setValue( "-no_tie" );
//root dir
commandline.createArgument().setValue( "-root_dir" );
commandline.createArgument().setValue( getConfig().srcDir.getAbsolutePath() );
//compiling order
commandline.createArgument().setValue( "-compile" );
//add the home class
while( ithomes.hasNext() )
{
commandline.createArgument().setValue( ithomes.next().toString() );
}// end of while ()
getLogger().debug( "Calling java2iiop" );
getLogger().debug( cmd.toString() );


try try
{ {
getLogger().debug( "Calling java2iiop" );
getLogger().debug( commandline.toString() );
execTask.setCommandline( commandline.getCommandline() );
int result = execTask.execute();
final int result = exe.execute();
if( result != 0 ) if( result != 0 )
{ {
String msg = "Failed executing java2iiop (ret code is " + result + ")"; String msg = "Failed executing java2iiop (ret code is " + result + ")";
@@ -411,6 +385,35 @@ public class BorlandDeploymentTool
} }
} }


private Commandline buildCommandline( final Iterator ithomes )
{
final Commandline cmd = new Commandline();
cmd.setExecutable( JAVA2IIOP );
//debug ?
if( java2iiopdebug )
{
cmd.createArgument().setValue( "-VBJdebug" );
}// end of if ()
//set the classpath
cmd.createArgument().setValue( "-VBJclasspath" );
cmd.createArgument().setPath( getCombinedClasspath() );
//list file
cmd.createArgument().setValue( "-list_files" );
//no TIE classes
cmd.createArgument().setValue( "-no_tie" );
//root dir
cmd.createArgument().setValue( "-root_dir" );
cmd.createArgument().setValue( getConfig().srcDir.getAbsolutePath() );
//compiling order
cmd.createArgument().setValue( "-compile" );
//add the home class
while( ithomes.hasNext() )
{
cmd.createArgument().setValue( ithomes.next().toString() );
}
return cmd;
}

/** /**
* Generate the client jar corresponding to the jar file passed as paremeter * Generate the client jar corresponding to the jar file passed as paremeter
* the method uses the BorlandGenerateClient task. * the method uses the BorlandGenerateClient task.


+ 31
- 24
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.exec.ExecTask;
import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -150,31 +150,17 @@ public class BorlandGenerateClient extends Task
{ {
try try
{ {
getLogger().info( "mode : fork" );

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


execTask.setDir( new File( "." ) );
execTask.setExecutable( "iastool" );
execTask.createArg().setValue( "generateclient" );
if( debug )
{
execTask.createArg().setValue( "-trace" );
}// end of if ()

//
execTask.createArg().setValue( "-short" );
execTask.createArg().setValue( "-jarfile" );
// ejb jar file
execTask.createArg().setValue( ejbjarfile.getAbsolutePath() );
//client jar file
execTask.createArg().setValue( "-single" );
execTask.createArg().setValue( "-clientjarfile" );
execTask.createArg().setValue( clientjarfile.getAbsolutePath() );
final Commandline cmd = buildCommand();


getLogger().info( "mode : fork" );
getLogger().debug( "Calling java2iiop" ); getLogger().debug( "Calling java2iiop" );
execTask.execute();

final Execute2 exe = new Execute2();
setupLogger( exe );
exe.setWorkingDirectory( new File( "." ) );
exe.setCommandline( cmd.getCommandline() );
exe.execute();
} }
catch( Exception e ) catch( Exception e )
{ {
@@ -185,6 +171,27 @@ public class BorlandGenerateClient extends Task


} }


private Commandline buildCommand()
{
final Commandline cmd = new Commandline();
cmd.setExecutable( "iastool" );
cmd.createArgument().setValue( "generateclient" );
if( debug )
{
cmd.createArgument().setValue( "-trace" );
}

cmd.createArgument().setValue( "-short" );
cmd.createArgument().setValue( "-jarfile" );
// ejb jar file
cmd.createArgument().setValue( ejbjarfile.getAbsolutePath() );
//client jar file
cmd.createArgument().setValue( "-single" );
cmd.createArgument().setValue( "-clientjarfile" );
cmd.createArgument().setValue( clientjarfile.getAbsolutePath() );
return cmd;
}

/** /**
* launch the generate client using java api * launch the generate client using java api
* *


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

@@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;


import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
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.Argument; import org.apache.tools.ant.types.Argument;


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

@@ -15,7 +15,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


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

@@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;


import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
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.Argument; import org.apache.tools.ant.types.Argument;


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

@@ -28,7 +28,7 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.bcel.*; import org.apache.bcel.*;
import org.apache.bcel.classfile.*; import org.apache.bcel.classfile.*;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


+ 37
- 34
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -17,9 +17,8 @@ import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
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.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -361,43 +360,18 @@ public class BorlandDeploymentTool
*/ */
private void buildBorlandStubs( Iterator ithomes, Hashtable files ) private void buildBorlandStubs( Iterator ithomes, Hashtable files )
{ {
Execute execTask = null;
final Execute2 exe = new Execute2();
exe.setWorkingDirectory( getTask().getBaseDirectory() );


execTask = new Execute( this );
Project project = getTask().getProject();
execTask.setWorkingDirectory( project.getBaseDir() );
final Commandline cmd = buildCommandline( ithomes );
exe.setCommandline( cmd.getCommandline() );


Commandline commandline = new Commandline();
commandline.setExecutable( JAVA2IIOP );
//debug ?
if( java2iiopdebug )
{
commandline.createArgument().setValue( "-VBJdebug" );
}// end of if ()
//set the classpath
commandline.createArgument().setValue( "-VBJclasspath" );
commandline.createArgument().setPath( getCombinedClasspath() );
//list file
commandline.createArgument().setValue( "-list_files" );
//no TIE classes
commandline.createArgument().setValue( "-no_tie" );
//root dir
commandline.createArgument().setValue( "-root_dir" );
commandline.createArgument().setValue( getConfig().srcDir.getAbsolutePath() );
//compiling order
commandline.createArgument().setValue( "-compile" );
//add the home class
while( ithomes.hasNext() )
{
commandline.createArgument().setValue( ithomes.next().toString() );
}// end of while ()
getLogger().debug( "Calling java2iiop" );
getLogger().debug( cmd.toString() );


try try
{ {
getLogger().debug( "Calling java2iiop" );
getLogger().debug( commandline.toString() );
execTask.setCommandline( commandline.getCommandline() );
int result = execTask.execute();
final int result = exe.execute();
if( result != 0 ) if( result != 0 )
{ {
String msg = "Failed executing java2iiop (ret code is " + result + ")"; String msg = "Failed executing java2iiop (ret code is " + result + ")";
@@ -411,6 +385,35 @@ public class BorlandDeploymentTool
} }
} }


private Commandline buildCommandline( final Iterator ithomes )
{
final Commandline cmd = new Commandline();
cmd.setExecutable( JAVA2IIOP );
//debug ?
if( java2iiopdebug )
{
cmd.createArgument().setValue( "-VBJdebug" );
}// end of if ()
//set the classpath
cmd.createArgument().setValue( "-VBJclasspath" );
cmd.createArgument().setPath( getCombinedClasspath() );
//list file
cmd.createArgument().setValue( "-list_files" );
//no TIE classes
cmd.createArgument().setValue( "-no_tie" );
//root dir
cmd.createArgument().setValue( "-root_dir" );
cmd.createArgument().setValue( getConfig().srcDir.getAbsolutePath() );
//compiling order
cmd.createArgument().setValue( "-compile" );
//add the home class
while( ithomes.hasNext() )
{
cmd.createArgument().setValue( ithomes.next().toString() );
}
return cmd;
}

/** /**
* Generate the client jar corresponding to the jar file passed as paremeter * Generate the client jar corresponding to the jar file passed as paremeter
* the method uses the BorlandGenerateClient task. * the method uses the BorlandGenerateClient task.


+ 31
- 24
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.exec.ExecTask;
import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -150,31 +150,17 @@ public class BorlandGenerateClient extends Task
{ {
try try
{ {
getLogger().info( "mode : fork" );

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


execTask.setDir( new File( "." ) );
execTask.setExecutable( "iastool" );
execTask.createArg().setValue( "generateclient" );
if( debug )
{
execTask.createArg().setValue( "-trace" );
}// end of if ()

//
execTask.createArg().setValue( "-short" );
execTask.createArg().setValue( "-jarfile" );
// ejb jar file
execTask.createArg().setValue( ejbjarfile.getAbsolutePath() );
//client jar file
execTask.createArg().setValue( "-single" );
execTask.createArg().setValue( "-clientjarfile" );
execTask.createArg().setValue( clientjarfile.getAbsolutePath() );
final Commandline cmd = buildCommand();


getLogger().info( "mode : fork" );
getLogger().debug( "Calling java2iiop" ); getLogger().debug( "Calling java2iiop" );
execTask.execute();

final Execute2 exe = new Execute2();
setupLogger( exe );
exe.setWorkingDirectory( new File( "." ) );
exe.setCommandline( cmd.getCommandline() );
exe.execute();
} }
catch( Exception e ) catch( Exception e )
{ {
@@ -185,6 +171,27 @@ public class BorlandGenerateClient extends Task


} }


private Commandline buildCommand()
{
final Commandline cmd = new Commandline();
cmd.setExecutable( "iastool" );
cmd.createArgument().setValue( "generateclient" );
if( debug )
{
cmd.createArgument().setValue( "-trace" );
}

cmd.createArgument().setValue( "-short" );
cmd.createArgument().setValue( "-jarfile" );
// ejb jar file
cmd.createArgument().setValue( ejbjarfile.getAbsolutePath() );
//client jar file
cmd.createArgument().setValue( "-single" );
cmd.createArgument().setValue( "-clientjarfile" );
cmd.createArgument().setValue( clientjarfile.getAbsolutePath() );
return cmd;
}

/** /**
* launch the generate client using java api * launch the generate client using java api
* *


+ 1
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java View File

@@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;


import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
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.Argument; import org.apache.tools.ant.types.Argument;


+ 1
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java View File

@@ -15,7 +15,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


+ 1
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -9,7 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb;


import java.io.File; import java.io.File;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
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.Argument; import org.apache.tools.ant.types.Argument;


+ 1
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java View File

@@ -28,7 +28,7 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.bcel.*; import org.apache.bcel.*;
import org.apache.bcel.classfile.*; import org.apache.bcel.classfile.*;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


Loading…
Cancel
Save