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-myrmidon/container/src/test/org/apache/myrmidon/components/property/test AbstractPropertyResolverTestCase.java
Date Thu, 25 Apr 2002 09:54:33 GMT
donaldp     02/04/25 02:54:33

  Modified:    container/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java DefaultWorkspace.java
               container/src/test/org/apache/myrmidon/components/configurer/test
                        DefaultConfigurerTestCase.java
               container/src/test/org/apache/myrmidon/components/property/test
                        AbstractPropertyResolverTestCase.java
  Removed:     container/src/java/org/apache/myrmidon/components/workspace
                        ProjectListenerSupport.java RoutingLogger.java
  Log:
  The LogEvents now get routed via TaskListener and then onto ProjectListener
  
  Revision  Changes    Path
  1.40      +85 -15    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
  
  Index: DefaultTaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- DefaultTaskContext.java	24 Apr 2002 02:21:00 -0000	1.39
  +++ DefaultTaskContext.java	25 Apr 2002 09:54:33 -0000	1.40
  @@ -16,17 +16,19 @@
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.event.TaskEvent;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.property.PropertyResolver;
   import org.apache.myrmidon.interfaces.property.PropertyStore;
  -import org.apache.myrmidon.interfaces.role.RoleManager;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
  +import org.apache.myrmidon.interfaces.role.RoleManager;
   
   /**
    * Default implementation of TaskContext.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.39 $ $Date: 2002/04/24 02:21:00 $
  + * @version $Revision: 1.40 $ $Date: 2002/04/25 09:54:33 $
    */
   public class DefaultTaskContext
       implements TaskContext
  @@ -35,17 +37,34 @@
           ResourceManager.getPackageResources( DefaultTaskContext.class );
   
       private final ExecutionFrame m_frame;
  +    private final String m_name;
  +    private final String m_location;
  +    private TaskEventManager m_eventManager;
   
       /**
        * Constructor that takes adapts TaskContext to a particular frame.
        */
  -    public DefaultTaskContext( final ExecutionFrame frame )
  +    public DefaultTaskContext( final ExecutionFrame frame,
  +                               final String name,
  +                               final String location )
  +        throws TaskException
       {
           if( null == frame )
           {
               throw new NullPointerException( "frame" );
           }
  +        if( null == name )
  +        {
  +            throw new NullPointerException( "name" );
  +        }
  +        if( null == location )
  +        {
  +            throw new NullPointerException( "location" );
  +        }
           m_frame = frame;
  +        m_name = name;
  +        m_location = location;
  +        m_eventManager = (TaskEventManager)getService( TaskEventManager.class );
       }
   
       /**
  @@ -55,7 +74,7 @@
        */
       public String getName()
       {
  -        return (String)getProperty( NAME );
  +        return m_name;
       }
   
       /**
  @@ -221,7 +240,7 @@
        */
       public void debug( final String message )
       {
  -        m_frame.getLogger().debug( message );
  +        debug( message, null );
       }
   
       /**
  @@ -232,7 +251,17 @@
        */
       public void debug( final String message, final Throwable throwable )
       {
  -        m_frame.getLogger().debug( message, throwable );
  +        if( isDebugEnabled() )
  +        {
  +            final TaskEvent event =
  +                new TaskEvent( m_frame.getName(),
  +                               getName(),
  +                               m_location,
  +                               message,
  +                               throwable,
  +                               0 );
  +            m_eventManager.fireTaskMessage( event );
  +        }
       }
   
       /**
  @@ -250,9 +279,9 @@
        *
        * @param message the message
        */
  -    public void verbose( String message )
  +    public void verbose( final String message )
       {
  -        m_frame.getLogger().info( message );
  +        verbose( message, null );
       }
   
       /**
  @@ -263,7 +292,18 @@
        */
       public void verbose( String message, Throwable throwable )
       {
  -        m_frame.getLogger().info( message, throwable );
  +        if( isVerboseEnabled() )
  +        {
  +            final TaskEvent event =
  +                new TaskEvent( m_frame.getName(),
  +                               getName(),
  +                               m_location,
  +                               message,
  +                               throwable,
  +                               0 );
  +            m_eventManager.fireTaskMessage( event );
  +        }
  +
       }
   
       /**
  @@ -283,7 +323,7 @@
        */
       public void info( final String message )
       {
  -        m_frame.getLogger().warn( message );
  +        info( message, null );
       }
   
       /**
  @@ -294,7 +334,17 @@
        */
       public void info( final String message, final Throwable throwable )
       {
  -        m_frame.getLogger().warn( message, throwable );
  +        if( isInfoEnabled() )
  +        {
  +            final TaskEvent event =
  +                new TaskEvent( m_frame.getName(),
  +                               getName(),
  +                               m_location,
  +                               message,
  +                               throwable,
  +                               0 );
  +            m_eventManager.fireTaskMessage( event );
  +        }
       }
   
       /**
  @@ -314,7 +364,7 @@
        */
       public void warn( final String message )
       {
  -        m_frame.getLogger().error( message );
  +        warn( message, null );
       }
   
       /**
  @@ -325,7 +375,17 @@
        */
       public void warn( final String message, final Throwable throwable )
       {
  -        m_frame.getLogger().error( message, throwable );
  +        if( isWarnEnabled() )
  +        {
  +            final TaskEvent event =
  +                new TaskEvent( m_frame.getName(),
  +                               getName(),
  +                               m_location,
  +                               message,
  +                               throwable,
  +                               0 );
  +            m_eventManager.fireTaskMessage( event );
  +        }
       }
   
       /**
  @@ -345,7 +405,7 @@
        */
       public void error( final String message )
       {
  -        m_frame.getLogger().fatalError( message );
  +        error( message, null );
       }
   
       /**
  @@ -356,7 +416,17 @@
        */
       public void error( final String message, final Throwable throwable )
       {
  -        m_frame.getLogger().fatalError( message, throwable );
  +        if( isErrorEnabled() )
  +        {
  +            final TaskEvent event =
  +                new TaskEvent( m_frame.getName(),
  +                               getName(),
  +                               m_location,
  +                               message,
  +                               throwable,
  +                               0 );
  +            m_eventManager.fireTaskMessage( event );
  +        }
       }
   
       /**
  
  
  
  1.48      +1 -18     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- DefaultWorkspace.java	25 Apr 2002 08:19:41 -0000	1.47
  +++ DefaultWorkspace.java	25 Apr 2002 09:54:33 -0000	1.48
  @@ -40,7 +40,7 @@
    * This is the default implementation of Workspace.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.47 $ $Date: 2002/04/25 08:19:41 $
  + * @version $Revision: 1.48 $ $Date: 2002/04/25 09:54:33 $
    */
   public class DefaultWorkspace
       extends AbstractLogEnabled
  @@ -50,7 +50,6 @@
           ResourceManager.getPackageResources( DefaultWorkspace.class );
   
       private Executor m_executor;
  -    private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport();
       private TypeManager m_typeManager;
       private Deployer m_deployer;
       private Context m_context;
  @@ -114,11 +113,7 @@
       {
           final ProjectEntry entry = getProjectEntry( project );
   
  -        m_listenerSupport.projectStarted( project.getProjectName() );
  -
           executeTarget( entry, target );
  -
  -        m_listenerSupport.projectFinished();
       }
   
       private File findTypeLib( final String libraryName )
  @@ -399,9 +394,6 @@
       {
           final Project project = entry.getProject();
   
  -        // Notify listeners
  -        m_listenerSupport.targetStarted( project.getProjectName(), name );
  -
           if( getLogger().isDebugEnabled() )
           {
               final String message = REZ.getString( "exec-target.notice",
  @@ -420,9 +412,6 @@
           {
               executeTask( tasks[ i ], frame );
           }
  -
  -        // Notify listeners
  -        m_listenerSupport.targetFinished();
       }
   
       /**
  @@ -447,14 +436,8 @@
           //is setting name even necessary ???
           frame.getPropertyStore().setProperty( TaskContext.NAME, name );
   
  -        //notify listeners
  -        m_listenerSupport.taskStarted( name );
  -
           //run task
           m_executor.execute( task, frame );
  -
  -        //notify listeners task has ended
  -        m_listenerSupport.taskFinished();
       }
   
   }
  
  
  
  1.13      +1 -1      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java
  
  Index: DefaultConfigurerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/DefaultConfigurerTestCase.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultConfigurerTestCase.java	25 Apr 2002 09:34:45 -0000	1.12
  +++ DefaultConfigurerTestCase.java	25 Apr 2002 09:54:33 -0000	1.13
  @@ -83,7 +83,7 @@
           final TaskEventManager eventManager = new DefaultTaskEventManager();
           final ExecutionFrame frame
               = new DefaultExecutionFrame( "/", getLogger(), store, getServiceManager(),
eventManager );
  -        m_context = new DefaultTaskContext( frame );
  +        m_context = new DefaultTaskContext( frame, "test", "gen:///test:0:0" );
           final File baseDir = new File( "." ).getAbsoluteFile();
           m_context.setProperty( TaskContext.BASE_DIRECTORY, baseDir );
       }
  
  
  
  1.10      +2 -2      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java
  
  Index: AbstractPropertyResolverTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractPropertyResolverTestCase.java	23 Apr 2002 07:44:23 -0000	1.9
  +++ AbstractPropertyResolverTestCase.java	25 Apr 2002 09:54:33 -0000	1.10
  @@ -27,7 +27,7 @@
    * General-purpose property resolver test cases.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.9 $ $Date: 2002/04/23 07:44:23 $
  + * @version $Revision: 1.10 $ $Date: 2002/04/25 09:54:33 $
    */
   public abstract class AbstractPropertyResolverTestCase
       extends AbstractComponentTest
  @@ -53,7 +53,7 @@
                                          store,
                                          new DefaultServiceManager(),
                                          new DefaultTaskEventManager() );
  -        m_context = new DefaultTaskContext( frame );
  +        m_context = new DefaultTaskContext( frame, "test", "gen:///test:0:0" );
   
           m_context.setProperty( "intProp", new Integer( 333 ) );
           m_context.setProperty( "stringProp", "String property" );
  
  
  

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