ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/impl DefaultExecManager.java
Date Sun, 06 Jan 2002 01:43:39 GMT
donaldp     02/01/05 17:43:39

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec
                        ExecManager.java
               proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/impl
                        DefaultExecManager.java
  Log:
  Made the ExecManager support another method of execution that involves supplying an ExecOutputHandler
  
  Revision  Changes    Path
  1.3       +19 -1     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java
  
  Index: ExecManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExecManager.java	22 Dec 2001 23:54:47 -0000	1.2
  +++ ExecManager.java	6 Jan 2002 01:43:39 -0000	1.3
  @@ -26,7 +26,7 @@
    * </ul>
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.2 $ $Date: 2001/12/22 23:54:47 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/06 01:43:39 $
    */
   public interface ExecManager
   {
  @@ -51,6 +51,24 @@
                    InputStream input,
                    OutputStream output,
                    OutputStream error,
  +                 long timeout )
  +        throws IOException, ExecException /*TimeoutException*/;
  +
  +    /**
  +     * Execute a process and wait for it to finish before
  +     * returning. Note that this version of execute() does not allow you
  +     * to specify input.
  +     *
  +     * @param  execMetaData the metaData for native command to execute
  +     * @param  handler the handler to which line-orientated output of
  +     *         process is directed for standard output and standard error
  +     * @param  timeout the maximum duration in milliseconds that a process
  +     *         can execute. The value must be positive or zero. If it is zero
  +     *         then the process will not timeout. If the process times out it
  +     *         will be forcibly shutdown and a TimeoutException thrown
  +     */
  +    int execute( ExecMetaData execMetaData,
  +                 ExecOutputHandler handler,
                    long timeout )
           throws IOException, ExecException /*TimeoutException*/;
   }
  
  
  
  1.3       +16 -1     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/impl/DefaultExecManager.java
  
  Index: DefaultExecManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/impl/DefaultExecManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultExecManager.java	30 Dec 2001 06:53:15 -0000	1.2
  +++ DefaultExecManager.java	6 Jan 2002 01:43:39 -0000	1.3
  @@ -18,6 +18,7 @@
   import org.apache.myrmidon.framework.exec.ExecException;
   import org.apache.myrmidon.framework.exec.ExecManager;
   import org.apache.myrmidon.framework.exec.ExecMetaData;
  +import org.apache.myrmidon.framework.exec.ExecOutputHandler;
   import org.apache.myrmidon.framework.exec.launchers.DefaultCommandLauncher;
   import org.apache.myrmidon.framework.exec.launchers.MacCommandLauncher;
   import org.apache.myrmidon.framework.exec.launchers.ScriptCommandLauncher;
  @@ -29,7 +30,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
  - * @version $Revision: 1.2 $ $Date: 2001/12/30 06:53:15 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/06 01:43:39 $
    * @see ExecManager
    * @see ExecMetaData
    */
  @@ -49,6 +50,20 @@
       {
           m_launcher = new DefaultCommandLauncher();
           m_shellLauncher = createShellLauncher( antDir );
  +    }
  +
  +    /**
  +     * Execute a process and wait for it to finish before
  +     * returning.
  +     */
  +    public int execute( final ExecMetaData execMetaData,
  +                        final ExecOutputHandler handler,
  +                        long timeout )
  +        throws IOException, ExecException /*TimeoutException*/
  +    {
  +        final LogOutputStream output = new LogOutputStream( handler, false );
  +        final LogOutputStream error = new LogOutputStream( handler, true );
  +        return execute( execMetaData, null, output, error, timeout );
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message