added tree-based resolution result to request/response

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@760781 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Gusakov 2009-04-01 04:49:10 +00:00
parent 790ecaa7bf
commit 860c7e04c0
4 changed files with 66 additions and 0 deletions

View File

@ -19,6 +19,7 @@ under the License.
package org.apache.maven.repository;
/**
*
*
@ -28,6 +29,8 @@ package org.apache.maven.repository;
*/
public class MavenArtifactMetadata
{
public static final String DEFAULT_TYPE = "jar";
String groupId;
String artifactId;
String version;
@ -107,4 +110,13 @@ public class MavenArtifactMetadata
this.scope = scope;
}
@Override
public String toString()
{
return getGroupId()+":"+getArtifactId()+":"+getVersion()
+":" + (getClassifier() == null ? "" : getClassifier() )
+":" + (getType() == null ? DEFAULT_TYPE : getType() )
;
}
}

View File

@ -19,6 +19,9 @@ under the License.
package org.apache.maven.repository;
import java.util.ArrayList;
import java.util.Collection;
/**
*
*
@ -28,5 +31,23 @@ package org.apache.maven.repository;
*/
public class MetadataGraph
{
Collection<MetadataGraphNode> nodes;
MetadataGraphNode entry;
public MetadataGraph( MetadataGraphNode entry )
{
this();
this.entry = entry;
}
public MetadataGraph()
{
nodes = new ArrayList<MetadataGraphNode>( 64 );
}
public void addNode( MetadataGraphNode node )
{
nodes.add( node );
}
}

View File

@ -31,6 +31,35 @@ import java.util.List;
public class MetadataGraphNode
{
MavenArtifactMetadata metadata;
List<MetadataGraphNode> inNodes;
List<MetadataGraphNode> exNodes;
@Override
public boolean equals( Object obj )
{
if( obj == null )
return false;
if( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) )
{
MetadataGraphNode node2 = (MetadataGraphNode) obj;
if( node2.metadata == null )
return metadata == null;
return metadata == null ? false: metadata.toString().equals( node2.metadata.toString() );
}
else
return super.equals( obj );
}
@Override
public int hashCode()
{
if( metadata == null )
return super.hashCode();
return metadata.toString().hashCode();
}
}

View File

@ -66,8 +66,12 @@ public class MetadataResolutionResult
private Set<Artifact> artifacts;
private MetadataGraph dirtyTree;
private MetadataGraph resolvedTree;
private MetadataGraph resolvedGraph;
public Artifact getOriginatingArtifact()
{
return originatingArtifact;