cvs -z9 diff BorlandDeploymentTool.java (in directory C:\Dev\cvs-jakarta-ant\jakarta-ant\src\main\org\apache\tools\ant\taskdefs\optional\ejb\)
Index: BorlandDeploymentTool.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java,v
retrieving revision 1.6
diff -r1.6 BorlandDeploymentTool.java
58c58,60
< import java.io.*;
---
> 
> import java.io.BufferedReader;
> import java.io.File;
59a62,64
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.InputStreamReader;
60a66
> import java.io.OutputStream;
67d72
< 
69c74,76
< import org.apache.tools.ant.taskdefs.ExecTask;
---
> import org.apache.tools.ant.taskdefs.Execute;
> import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
> import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
71d77
< import org.apache.tools.ant.types.*;
72a79,80
> import org.apache.tools.ant.types.Commandline;
> import org.apache.tools.ant.types.Path;
105c113
< public class BorlandDeploymentTool extends GenericDeploymentTool 
---
> public class BorlandDeploymentTool extends GenericDeploymentTool  implements ExecuteStreamHandler 
130d137
< 
139a147,148
>     private Hashtable _genfiles = new Hashtable();
> 
193,201c202,210
<            new DescriptorHandler(getTask(), srcDir) {
<                    protected void processElement() {
<                        if (currentElement.equals("type-storage")) {
<                            // Get the filename of vendor specific descriptor
<                            String fileNameWithMETA = currentText;
<                            //trim the META_INF\ off of the file name
<                            String fileName = fileNameWithMETA.substring(META_DIR.length(), 
<                                                                         fileNameWithMETA.length() );
<                            File descriptorFile = new File(srcDir, fileName);
---
>             new DescriptorHandler(getTask(), srcDir) {
>                     protected void processElement() {
>                         if (currentElement.equals("type-storage")) {
>                             // Get the filename of vendor specific descriptor
>                             String fileNameWithMETA = currentText;
>                             //trim the META_INF\ off of the file name
>                             String fileName = fileNameWithMETA.substring(META_DIR.length(), 
>                                                                          fileNameWithMETA.length() );
>                             File descriptorFile = new File(srcDir, fileName);
203,205c212,214
<                            ejbFiles.put(fileNameWithMETA, descriptorFile);
<                        }
<                    }
---
>                             ejbFiles.put(fileNameWithMETA, descriptorFile);
>                         }
>                     }
223c232
<         File borlandDD = new File(getConfig().descriptorDir,META_DIR+BAS_DD);
---
>         File borlandDD = new File(getConfig().descriptorDir,BAS_DD);
316,320c325
<         org.apache.tools.ant.taskdefs.ExecTask execTask = null;
<         File java2iiopOut = null;
<         try {
<             java2iiopOut = File.createTempFile("java2iiop","log");
<             log(" iiop log file : "+ java2iiopOut ,Project.MSG_DEBUG);
---
>         Execute execTask = null;
322,353c327,353
<             execTask = (ExecTask) getTask().getProject().createTask("exec");
<             execTask.setOutput(java2iiopOut);
<             if ( java2iiopdebug ) {
<                 execTask.createArg().setValue("-VBJdebug");                
<             } // end of if ()
<                        
<             execTask.setDir(getConfig().srcDir);
<             execTask.setExecutable(JAVA2IIOP);
<             //set the classpath 
<             execTask.createArg().setValue("-VBJclasspath");
<             execTask.createArg().setPath(getCombinedClasspath());
<             //list file
<             execTask.createArg().setValue("-list_files");
<             //no TIE classes
<             execTask.createArg().setValue("-no_tie");
<             //root dir
<             execTask.createArg().setValue("-root_dir");
<             execTask.createArg().setValue(getConfig().srcDir.getAbsolutePath());
<             //compiling order
<             execTask.createArg().setValue("-compile");
<             //add the home class
<             while ( ithomes.hasNext()) {
<                 execTask.createArg().setValue(ithomes.next().toString());                
<             } // end of while ()
<             log("Calling java2iiop",Project.MSG_VERBOSE);                       
<             execTask.execute();
<         }
<         catch (Exception e) {
<             // Have to catch this because of the semantics of calling main()
<             String msg = "Exception while calling java2iiop. Details: " + e.toString();
<             throw new BuildException(msg, e);
<         }
---
>         execTask = new Execute(this);
>         Project project = getTask().getProject();
>         execTask.setAntRun(project);
>         execTask.setWorkingDirectory(project.getBaseDir());
>         
>         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 ()
356,377c356,368
<             FileReader fr = new FileReader(java2iiopOut);
<             LineNumberReader lnr = new LineNumberReader(fr);
<             String javafile;
<             while ( ( javafile = lnr.readLine()) != null) {
<                 if ( javafile.endsWith(".java") ) {
<                     String classfile = toClassFile(javafile);
<                     
<                     String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length()+1);
<                     log(" generated : "+ classfile ,Project.MSG_DEBUG);
<                     log(" key       : "+ key       ,Project.MSG_DEBUG);
<                     files.put(key, new File(classfile));                                           
<                 } // end of if ()                
<             } // end of while ()
<             lnr.close();            
<         }
<         catch(Exception e) {
<             String msg = "Exception while parsing  java2iiop output. Details: " + e.toString();
<             throw new BuildException(msg, e);
<         }
< 
<         //delete the output , only if all is succesfull
<         java2iiopOut.delete();
---
>             log("Calling java2iiop",Project.MSG_VERBOSE);                       
>             log(commandline.toString(),Project.MSG_DEBUG);
>             execTask.setCommandline(commandline.getCommandline());
>             int result = execTask.execute();
>             if ( result != 0 ) {
>                 String msg = "Failed executing java2iiop (ret code is "+result+")";
>                 throw new BuildException(msg, getTask().getLocation());
>             }                       
>         }
>         catch (java.io.IOException e) {
>             log("java2iiop exception :"+e.getMessage(),Project.MSG_ERR);
>             throw new BuildException(e,getTask().getLocation());
>         }            
400a392,394
> 
>         //add the gen files to the collection
>         files.putAll(_genfiles);
434a429,476
>     // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface
> 
>     public void start() throws IOException  { }
>     public void stop()  {  }
>     public void setProcessInputStream(OutputStream param1) throws IOException   { }
> 
>     /**
>      *
>      * @param param1 <description>
>      * @exception java.io.IOException <description>
>      */
>     public void setProcessOutputStream(InputStream is) throws IOException
>     {
>         try {
>             BufferedReader reader = new BufferedReader(new InputStreamReader(is));
>             String javafile;
>             while ( ( javafile = reader.readLine()) != null) {
>                 log("buffer:" +javafile,Project.MSG_DEBUG);             
>                 if ( javafile.endsWith(".java") ) {
>                     String classfile = toClassFile(javafile);                  
>                     String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length()+1);
>                     log(" generated : "+ classfile ,Project.MSG_DEBUG);
>                     log(" key       : "+ key       ,Project.MSG_DEBUG);
>                     _genfiles.put(key, new File(classfile));                                           
>                 } // end of if ()                
>             } // end of while ()
>             reader.close();            
>         }
>         catch(Exception e) {
>             String msg = "Exception while parsing  java2iiop output. Details: " + e.toString();
>             throw new BuildException(msg, e);
>         }
>     }
> 
>     /**
>      * @param param1 <description>
>      * @exception java.io.IOException <description>
>      */
>     public void setProcessErrorStream(InputStream is) throws IOException
>     {
>         BufferedReader reader = new BufferedReader(new InputStreamReader(is));
>         String s = reader.readLine();
>         if ( s != null) 
>         {
>             log("[java2iiop] "+s,Project.MSG_DEBUG);
>         } // end of if ()        
>     }
>     