You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/09/20 00:53:52 UTC

svn commit: r448005 - in /maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies: Dependencies.java ReportResolutionListener.java

Author: brett
Date: Tue Sep 19 15:53:52 2006
New Revision: 448005

URL: http://svn.apache.org/viewvc?view=rev&rev=448005
Log:
missed from last commit
Submitted by: Pete Marvin King

Modified:
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/ReportResolutionListener.java

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java?view=diff&rev=448005&r1=448004&r2=448005
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/Dependencies.java Tue Sep 19 15:53:52 2006
@@ -42,18 +42,6 @@
 
 public class Dependencies
 {
-    public final static String IS_DEBUG_PRESENT = "is-debug-present";
-
-    public final static String IS_SEALED = "sealed";
-
-    public final static String FILE_LENGTH = "filelength";
-
-    public final static String JAR_ENTRIES = "jar-entries";
-
-    public final static String NUM_OF_CLASSES = "num-of-classes";
-
-    public final static String NUM_OF_PACKAGES = "num-of-packages";
-
     private List projectDependencies;
 
     private ReportResolutionListener resolvedDependencies;
@@ -78,16 +66,20 @@
 
         mapArtifactFiles( listener.getRootNode(), projectMap );
 
+        // quick fix
         try
-        {
-            this.jar = (Jar) container.lookup( Jar.ROLE );
+        { 
+            if ( container != null )
+            {    
+                this.jar = (Jar) container.lookup( Jar.ROLE );
+            }    
         }
         catch ( ComponentLookupException ex )
         {
             //TODO: handle exception
         }
-    }
-
+    } 
+    
     public static Map getManagedVersionMap( MavenProject project, ArtifactFactory factory )
         throws ProjectBuildingException
     {
@@ -206,5 +198,10 @@
         jarClasses = jar.getClasses();
 
         return new JarDependencyDetails( jarClasses, jar.isSealed(), jar.getEntries() );
+    }
+    
+    public ReportResolutionListener.Node getResolvedRoot()
+    {
+        return resolvedDependencies.getRootNode();
     }
 }

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/ReportResolutionListener.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/ReportResolutionListener.java?view=diff&rev=448005&r1=448004&r2=448005
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/ReportResolutionListener.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/ReportResolutionListener.java Tue Sep 19 15:53:52 2006
@@ -38,6 +38,8 @@
     private Map artifacts = new HashMap();
 
     private Node rootNode;
+    
+    private int currentDepth = 0;
 
     public void testArtifact( Artifact artifact )
     {
@@ -47,6 +49,8 @@
     public void startProcessChildren( Artifact artifact )
     {
         Node node = (Node) artifacts.get( artifact.getDependencyConflictId() );
+        
+        node.depth = currentDepth++;        
         if ( parents.isEmpty() )
         {
             rootNode = node;
@@ -59,6 +63,7 @@
     {
         Node check = (Node) parents.pop();
         assert artifact.equals( check.artifact );
+        currentDepth--;
     }
 
     public void omitForNearer( Artifact omitted, Artifact kept )
@@ -101,6 +106,7 @@
         {
             node.parent = (Node) parents.peek();
             node.parent.children.add( node );
+            node.depth = currentDepth;
         }
         artifacts.put( artifact.getDependencyConflictId(), node );
     }
@@ -156,6 +162,8 @@
         private List children = new ArrayList();
 
         private Artifact artifact;
+        
+        private int depth;
 
         public List getChildren()
         {
@@ -165,6 +173,11 @@
         public Artifact getArtifact()
         {
             return artifact;
+        }
+        
+        public int getDepth()
+        {
+            return depth;
         }
     }