]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1025] consolidate dependency graphing classes into one module
authorBrett Porter <brett@apache.org>
Fri, 28 Nov 2008 16:29:00 +0000 (16:29 +0000)
committerBrett Porter <brett@apache.org>
Fri, 28 Nov 2008 16:29:00 +0000 (16:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@721529 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-dependency-graph/pom.xml
archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/ProjectModelBasedGraphBuilder.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-layer/pom.xml
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/dependencies/ProjectModelBasedGraphBuilder.java [deleted file]

index 9e629bd281a91542d23f4b718a63b2c39555b16a..a03cebe34f4b4282db7ff5c5e1849f9fb6b4f2be 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-model</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/ProjectModelBasedGraphBuilder.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/ProjectModelBasedGraphBuilder.java
new file mode 100644 (file)
index 0000000..c08b6c4
--- /dev/null
@@ -0,0 +1,111 @@
+package org.apache.maven.archiva.dependency.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.model.ArchivaProjectModel;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.project.ProjectModelException;
+import org.apache.maven.archiva.repository.project.ProjectModelResolverFactory;
+import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
+
+/**
+ * ProjectModelBasedGraphBuilder 
+ *
+ * @version $Id$
+ * 
+ * @plexus.component 
+ *              role="org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder"
+ *              role-hint="project-model"
+ */
+public class ProjectModelBasedGraphBuilder
+    implements DependencyGraphBuilder
+{
+    /**
+     * @plexus.requirement
+     */
+    private ProjectModelResolverFactory resolverFactory;
+
+    /**
+     * @plexus.requirement 
+     *          role="org.apache.maven.archiva.repository.project.ProjectModelFilter"
+     *          role-hint="effective"
+     */
+    private EffectiveProjectModelFilter effectiveFilter = new EffectiveProjectModelFilter();
+
+    public DependencyGraph createGraph( VersionedReference versionedProjectReference )
+    {
+        String groupId = versionedProjectReference.getGroupId();
+        String artifactId = versionedProjectReference.getArtifactId();
+        String version = versionedProjectReference.getVersion();
+
+        DependencyGraph graph = new DependencyGraph( groupId, artifactId, version );
+        return graph;
+    }
+
+    public void resolveNode( DependencyGraph graph, DependencyGraphNode fromNode,
+                             VersionedReference versionedProjectReference )
+    {
+        ArchivaProjectModel model = resolveModel( fromNode.getArtifact() );
+
+        DependencyGraphUtils.addNodeFromModel( model, graph, fromNode );
+    }
+
+    private ArchivaProjectModel resolveModel( ArtifactReference reference )
+    {
+        VersionedReference projectRef = new VersionedReference();
+
+        projectRef.setGroupId( reference.getGroupId() );
+        projectRef.setArtifactId( reference.getArtifactId() );
+        projectRef.setVersion( reference.getVersion() );
+
+        ArchivaProjectModel model = resolverFactory.getCurrentResolverStack().findProject( projectRef );
+
+        if ( model == null )
+        {
+            return createDefaultModel( reference );
+        }
+
+        try
+        {
+            ArchivaProjectModel processedModel = effectiveFilter.filter( model );
+
+            return processedModel;
+        }
+        catch ( ProjectModelException e )
+        {
+            e.printStackTrace( System.err );
+            return createDefaultModel( reference );
+        }
+    }
+
+    private ArchivaProjectModel createDefaultModel( ArtifactReference reference )
+    {
+        ArchivaProjectModel model = new ArchivaProjectModel();
+
+        // Create default (dummy) model
+        model = new ArchivaProjectModel();
+        model.setGroupId( reference.getGroupId() );
+        model.setArtifactId( reference.getArtifactId() );
+        model.setVersion( reference.getVersion() );
+        model.setPackaging( reference.getType() );
+        return model;
+    }
+}
index 15411bd4c21b9947f8c09d938a360cf5d7f3bec4..de93e0429aa749ea66231dd25faa3f8468c3f08d 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-consumer-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-dependency-graph</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-checksum</artifactId>
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/dependencies/ProjectModelBasedGraphBuilder.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/dependencies/ProjectModelBasedGraphBuilder.java
deleted file mode 100644 (file)
index cc47e1a..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.apache.maven.archiva.repository.project.dependencies;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.archiva.dependency.graph.DependencyGraph;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphNode;
-import org.apache.maven.archiva.dependency.graph.DependencyGraphUtils;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArtifactReference;
-import org.apache.maven.archiva.model.VersionedReference;
-import org.apache.maven.archiva.repository.project.ProjectModelException;
-import org.apache.maven.archiva.repository.project.ProjectModelResolverFactory;
-import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
-
-/**
- * ProjectModelBasedGraphBuilder 
- *
- * @version $Id$
- * 
- * @plexus.component 
- *              role="org.apache.maven.archiva.dependency.graph.DependencyGraphBuilder"
- *              role-hint="project-model"
- */
-public class ProjectModelBasedGraphBuilder
-    implements DependencyGraphBuilder
-{
-    /**
-     * @plexus.requirement
-     */
-    private ProjectModelResolverFactory resolverFactory;
-
-    /**
-     * @plexus.requirement 
-     *          role="org.apache.maven.archiva.repository.project.ProjectModelFilter"
-     *          role-hint="effective"
-     */
-    private EffectiveProjectModelFilter effectiveFilter = new EffectiveProjectModelFilter();
-
-    public DependencyGraph createGraph( VersionedReference versionedProjectReference )
-    {
-        String groupId = versionedProjectReference.getGroupId();
-        String artifactId = versionedProjectReference.getArtifactId();
-        String version = versionedProjectReference.getVersion();
-
-        DependencyGraph graph = new DependencyGraph( groupId, artifactId, version );
-        return graph;
-    }
-
-    public void resolveNode( DependencyGraph graph, DependencyGraphNode fromNode,
-                             VersionedReference versionedProjectReference )
-    {
-        ArchivaProjectModel model = resolveModel( fromNode.getArtifact() );
-
-        DependencyGraphUtils.addNodeFromModel( model, graph, fromNode );
-    }
-
-    private ArchivaProjectModel resolveModel( ArtifactReference reference )
-    {
-        VersionedReference projectRef = new VersionedReference();
-
-        projectRef.setGroupId( reference.getGroupId() );
-        projectRef.setArtifactId( reference.getArtifactId() );
-        projectRef.setVersion( reference.getVersion() );
-
-        ArchivaProjectModel model = resolverFactory.getCurrentResolverStack().findProject( projectRef );
-
-        if ( model == null )
-        {
-            return createDefaultModel( reference );
-        }
-
-        try
-        {
-            ArchivaProjectModel processedModel = effectiveFilter.filter( model );
-
-            return processedModel;
-        }
-        catch ( ProjectModelException e )
-        {
-            e.printStackTrace( System.err );
-            return createDefaultModel( reference );
-        }
-    }
-
-    private ArchivaProjectModel createDefaultModel( ArtifactReference reference )
-    {
-        ArchivaProjectModel model = new ArchivaProjectModel();
-
-        // Create default (dummy) model
-        model = new ArchivaProjectModel();
-        model.setGroupId( reference.getGroupId() );
-        model.setArtifactId( reference.getArtifactId() );
-        model.setVersion( reference.getVersion() );
-        model.setPackaging( reference.getType() );
-        return model;
-    }
-}