avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools Component.java
Date Fri, 23 May 2003 17:04:30 GMT
bloritsch    2003/05/23 10:04:30

  Modified:    fortress/src/tools/org/apache/avalon/fortress/tools
                        Component.java
  Log:
  Make sure dependencies are added late so we can test them all.
  
  Revision  Changes    Path
  1.6       +24 -15    avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java
  
  Index: Component.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Component.java	15 May 2003 18:56:28 -0000	1.5
  +++ Component.java	23 May 2003 17:04:30 -0000	1.6
  @@ -88,7 +88,7 @@
   
           m_type = type;
           m_attributes = new Properties();
  -        m_dependencies = new ArrayList(10);
  +        m_dependencies = new ArrayList( 10 );
           m_vertex = new Vertex( this );
   
           m_repository.add( this );
  @@ -109,22 +109,31 @@
        *
        * @param service  The name of the service that depends on this.
        */
  -    public void addDependency(Service service)
  +    public void addDependency( Service service )
       {
  -        if ( ! m_dependencies.contains(service) )
  +        if ( !m_dependencies.contains( service ) )
           {
  -            m_dependencies.add(service);
  -
  -            Iterator cit = service.getComponents();
  -            while ( cit.hasNext() )
  -            {
  -                m_vertex.addDependency( ( (Component) cit.next() ).getVertex() );
  -            }
  +            m_dependencies.add( service );
           }
       }
   
       public Vertex getVertex()
       {
  +        if ( m_vertex.getDependencies().size() != m_dependencies.size() )
  +        {
  +            Iterator it = m_dependencies.iterator();
  +            while ( it.hasNext() )
  +            {
  +                Service service = (Service) it.next();
  +
  +                Iterator cit = service.getComponents();
  +                while ( cit.hasNext() )
  +                {
  +                    Component component = (Component)cit.next();
  +                    m_vertex.addDependency( component.getVertex() );
  +                }
  +            }
  +        }
           return m_vertex;
       }
   
  @@ -160,14 +169,14 @@
               if ( m_dependencies.size() > 0 )
               {
                   writer.close();
  -                output = new File(rootDir, depsName);
  +                output = new File( rootDir, depsName );
                   writer = new FileOutputStream( output );
   
                   Iterator it = m_dependencies.iterator();
  -                while(it.hasNext())
  +                while ( it.hasNext() )
                   {
  -                    Service service = (Service)it.next();
  -                    writer.write(service.getType().getBytes());
  +                    Service service = (Service) it.next();
  +                    writer.write( service.getType().getBytes() );
                   }
               }
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message