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 ExecOutputHandler.java DefaultExecOutputHandler.java
Date Sun, 06 Jan 2002 01:37:25 GMT
donaldp     02/01/05 17:37:25

  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec
                        ExecOutputHandler.java
                        DefaultExecOutputHandler.java
  Log:
  Added the ExecOutputHandler abstraction so that tasks don't have to worry about more complicated
stream parsing and can work with just notification of lines appearing.
  
  Also added a default implementation that conforms to the most common pattern of making stdout
info log messages and stderr warn log messages
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecOutputHandler.java
  
  Index: ExecOutputHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework.exec;
  
  /**
   * This class is used to receive notifications of what the native
   * process outputs to standard output and standard error.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/06 01:37:25 $
   */
  public interface ExecOutputHandler
  {
      /**
       * Receive notification about the process writing
       * to standard output.
       */
      void stdout( String line );
  
      /**
       * Receive notification about the process writing
       * to standard error.
       */
      void stderr( String line );
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/DefaultExecOutputHandler.java
  
  Index: DefaultExecOutputHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework.exec;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  
  /**
   * This class is used to receive notifications of what the native
   * process outputs to standard output and standard error.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/06 01:37:25 $
   */
  public class DefaultExecOutputHandler
      extends AbstractLogEnabled
      implements ExecOutputHandler
  {
      /**
       * Receive notification about the process writing
       * to standard output.
       */
      public void stdout( final String line )
      {
          getLogger().info( line );
      }
  
      /**
       * Receive notification about the process writing
       * to standard error.
       */
      public void stderr( final String line )
      {
          getLogger().warn( line );
      }
  }
  
  
  

--
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