Coverage Report - org.apache.maven.archiva.dependency.graph.tasks.PopulateGraphMasterTask
 
Classes in this File Line Coverage Branch Coverage Complexity
PopulateGraphMasterTask
0%
0/21
0%
0/6
1.5
 
 1  
 package org.apache.maven.archiva.dependency.graph.tasks;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.archiva.dependency.graph.DependencyGraph;
 23  
 import org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder;
 24  
 import org.apache.maven.archiva.dependency.graph.DependencyGraphUtils;
 25  
 import org.apache.maven.archiva.dependency.graph.GraphTask;
 26  
 import org.apache.maven.archiva.dependency.graph.GraphTaskException;
 27  
 import org.apache.maven.archiva.dependency.graph.walk.DependencyGraphWalker;
 28  
 import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
 29  
 
 30  
 /**
 31  
  * PopulateGraphMasterTask - will perform a resolve / depman apply loop until the graph is fully populated. 
 32  
  *
 33  
  * @version $Id: PopulateGraphMasterTask.java 718864 2008-11-19 06:33:35Z brett $
 34  
  */
 35  0
 public class PopulateGraphMasterTask
 36  
     implements GraphTask
 37  
 {
 38  
     private DependencyGraphBuilder builder;
 39  
 
 40  0
     private ResolveGraphTask resolveGraphTask = new ResolveGraphTask();
 41  
 
 42  0
     private DependencyManagementApplier depManApplier = new DependencyManagementApplier();
 43  
 
 44  
     public void executeTask( DependencyGraph graph )
 45  
         throws GraphTaskException
 46  
     {
 47  0
         DependencyGraphWalker walker = new WalkDepthFirstSearch();
 48  
 
 49  0
         boolean done = false;
 50  0
         int maxiters = 5;
 51  
 
 52  0
         while ( !done )
 53  
         {
 54  0
             resolveGraphTask.executeTask( graph );
 55  0
             walker.visit( graph, depManApplier );
 56  
 
 57  0
             if ( !depManApplier.hasCreatedNodes() || ( maxiters < 0 ) )
 58  
             {
 59  0
                 done = true;
 60  0
                 break;
 61  
             }
 62  
 
 63  0
             maxiters--;
 64  
         }
 65  
 
 66  0
         DependencyGraphUtils.cleanupOrphanedNodes( graph );
 67  0
     }
 68  
 
 69  
     public String getTaskId()
 70  
     {
 71  0
         return "populate-graph";
 72  
     }
 73  
 
 74  
     public DependencyGraphBuilder getBuilder()
 75  
     {
 76  0
         return builder;
 77  
     }
 78  
 
 79  
     public void setBuilder( DependencyGraphBuilder builder )
 80  
     {
 81  0
         this.builder = builder;
 82  0
         this.resolveGraphTask.setBuilder( builder );
 83  0
         this.depManApplier.setBuilder( builder );
 84  0
     }
 85  
 
 86  
 }