git-svn-id: https://svn.apache.org/repos/asf/maven/artifact/branches/CAP@659864 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/mercury/resolver/AbstractArtifactResolutionException.java b/src/main/java/org/apache/maven/mercury/resolver/AbstractArtifactResolutionException.java
deleted file mode 100644
index 2145571..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/AbstractArtifactResolutionException.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-/*
- * 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 java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.maven.mercury.Artifact;
-import org.apache.maven.mercury.ArtifactRepository;
-
-/*
- * Base class for artifact resolution exceptions.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- * @version $Id$
- */
-public class AbstractArtifactResolutionException
- extends Exception
-{
- private String groupId;
-
- private String artifactId;
-
- private String version;
-
- private String type;
-
- private String classifier;
-
- private List remoteRepositories;
-
- private final String originalMessage;
-
- private final String path;
-
- static final String LS = System.getProperty( "line.separator" );
-
- protected AbstractArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, List remoteRepositories, List path )
- {
- super( constructMessageBase( message, groupId, artifactId, version, type, remoteRepositories, path ) );
-
- this.originalMessage = message;
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.type = type;
- this.classifier = classifier;
- this.version = version;
- this.remoteRepositories = remoteRepositories;
- this.path = constructArtifactPath( path, "" );
- }
-
- protected AbstractArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, List remoteRepositories, List path, Throwable t )
- {
- super( constructMessageBase( message, groupId, artifactId, version, type, remoteRepositories, path ), t );
-
- this.originalMessage = message;
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.type = type;
- this.classifier = classifier;
- this.version = version;
- this.remoteRepositories = remoteRepositories;
- this.path = constructArtifactPath( path, "" );
- }
-
- protected AbstractArtifactResolutionException( String message, Artifact artifact )
- {
- this( message, artifact, null );
- }
-
- protected AbstractArtifactResolutionException( String message, Artifact artifact, List remoteRepositories )
- {
- this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), remoteRepositories, artifact.getDependencyTrail() );
- }
-
- protected AbstractArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, Throwable t )
- {
- this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), remoteRepositories, artifact.getDependencyTrail(), t );
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public String getType()
- {
- return type;
- }
-
- /** @return the classifier */
- public String getClassifier()
- {
- return this.classifier;
- }
-
- /** @return the path */
- public String getPath()
- {
- return this.path;
- }
-
- public List getRemoteRepositories()
- {
- return remoteRepositories;
- }
-
- public String getOriginalMessage()
- {
- return originalMessage;
- }
-
- protected static String constructArtifactPath( List path, String indentation )
- {
- StringBuffer sb = new StringBuffer();
-
- if ( path != null )
- {
- sb.append( LS );
- sb.append( indentation );
- sb.append( "Path to dependency: " );
- sb.append( LS );
- int num = 1;
- for ( Iterator i = path.iterator(); i.hasNext(); num++ )
- {
- sb.append( indentation );
- sb.append( "\t" );
- sb.append( num );
- sb.append( ") " );
- sb.append( i.next() );
- sb.append( LS );
- }
- }
-
- return sb.toString();
- }
-
- private static String constructMessageBase( String message, String groupId, String artifactId, String version, String type, List remoteRepositories, List path )
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append( message );
- sb.append( LS );
- sb.append( " " + groupId + ":" + artifactId + ":" + type + ":" + version );
- sb.append( LS );
- if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
- {
- sb.append( LS );
- sb.append( "from the specified remote repositories:" );
- sb.append( LS + " " );
-
- for ( Iterator i = new HashSet( remoteRepositories ).iterator(); i.hasNext(); )
- {
- ArtifactRepository remoteRepository = (ArtifactRepository) i.next();
-
- sb.append( remoteRepository.getId() );
- sb.append( " (" );
- sb.append( remoteRepository.getUrl() );
- sb.append( ")" );
- if ( i.hasNext() )
- {
- sb.append( ",\n " );
- }
- }
- }
-
- sb.append( constructArtifactPath( path, "" ) );
- sb.append( LS );
- return sb.toString();
- }
-
- protected static String constructMissingArtifactMessage( String message, String indentation, String groupId, String artifactId, String version, String type, String classifier, String downloadUrl,
- List path )
- {
- StringBuffer sb = new StringBuffer( message );
-
- if ( !"pom".equals( type ) )
- {
- if ( downloadUrl != null )
- {
- sb.append( LS );
- sb.append( LS );
- sb.append( indentation );
- sb.append( "Try downloading the file manually from: " );
- sb.append( LS );
- sb.append( indentation );
- sb.append( " " );
- sb.append( downloadUrl );
- }
- else
- {
- sb.append( LS );
- sb.append( LS );
- sb.append( indentation );
- sb.append( "Try downloading the file manually from the project website." );
- }
-
- sb.append( LS );
- sb.append( LS );
- sb.append( indentation );
- sb.append( "Then, install it using the command: " );
- sb.append( LS );
- sb.append( indentation );
- sb.append( " mvn install:install-file -DgroupId=" );
- sb.append( groupId );
- sb.append( " -DartifactId=" );
- sb.append( artifactId );
- sb.append( " -Dversion=" );
- sb.append( version );
-
- //insert classifier only if it was used in the artifact
- if ( classifier != null && !classifier.equals( "" ) )
- {
- sb.append( " -Dclassifier=" );
- sb.append( classifier );
- }
- sb.append( " -Dpackaging=" );
- sb.append( type );
- sb.append( " -Dfile=/path/to/file" );
- sb.append( LS );
-
- // If people want to deploy it
- sb.append( LS );
- sb.append( indentation );
- sb.append( "Alternatively, if you host your own repository you can deploy the file there: " );
- sb.append( LS );
- sb.append( indentation );
- sb.append( " mvn deploy:deploy-file -DgroupId=" );
- sb.append( groupId );
- sb.append( " -DartifactId=" );
- sb.append( artifactId );
- sb.append( " -Dversion=" );
- sb.append( version );
-
- //insert classifier only if it was used in the artifact
- if ( classifier != null && !classifier.equals( "" ) )
- {
- sb.append( " -Dclassifier=" );
- sb.append( classifier );
- }
- sb.append( " -Dpackaging=" );
- sb.append( type );
- sb.append( " -Dfile=/path/to/file" );
- sb.append( " -Durl=[url] -DrepositoryId=[id]" );
- sb.append( LS );
- }
-
- sb.append( constructArtifactPath( path, indentation ) );
- sb.append( LS );
-
- return sb.toString();
- }
-
- public String getArtifactPath()
- {
- return path;
- }
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/ArtifactMetadata.java b/src/main/java/org/apache/maven/mercury/resolver/ArtifactMetadata.java
deleted file mode 100644
index 0fed26f..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/ArtifactMetadata.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import java.util.Collection;
-
-import org.apache.maven.mercury.Artifact;
-import org.apache.maven.mercury.ArtifactScopeEnum;
-
-/*
- * Artifact Metadata that is resolved independent of Artifact itself.
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- */
-public class ArtifactMetadata
-{
- /**
- * standard glorified artifact coordinates
- */
- protected String groupId;
-
- protected String artifactId;
-
- protected String version;
-
- protected String type = "jar";
-
- protected ArtifactScopeEnum artifactScope;
-
- protected String classifier;
-
- /**
- * explanation: why this MD was chosen over it's siblings
- * in the resulting structure (classpath for now)
- */
- protected String why;
-
- /** dependencies of the artifact behind this metadata */
- protected Collection<ArtifactMetadata> dependencies;
-
- /** metadata URI */
- protected String uri;
-
- /** is metadata found anywhere */
- protected boolean resolved = false;
-
- /** does the actual artifact for this metadata exists */
- protected boolean artifactExists = false;
-
- /** artifact URI */
- protected String artifactUri;
-
- /** error message */
- private String error;
-
- public ArtifactMetadata( String groupId, String name, String version )
- {
- this( groupId, name, version, null );
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type )
- {
- this( groupId, name, version, type, null );
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope )
- {
- this( groupId, name, version, type, artifactScope, null );
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, String classifier )
- {
- this( groupId, name, version, type, artifactScope, classifier, null );
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, String classifier, String artifactUri )
- {
- this( groupId, name, version, type, artifactScope, classifier, artifactUri, null, true, null );
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, String classifier, String artifactUri, String why, boolean resolved,
- String error )
- {
- this.groupId = groupId;
- this.artifactId = name;
- this.version = version;
- this.type = type;
- this.artifactScope = artifactScope;
- this.classifier = classifier;
- this.artifactUri = artifactUri;
- this.why = why;
- this.resolved = resolved;
- this.error = error;
- }
-
- public ArtifactMetadata( String groupId, String name, String version, String type, String scopeString, String classifier, String artifactUri, String why, boolean resolved, String error )
- {
- this( groupId, name, version, type, scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scopeString ), classifier, artifactUri, why, resolved, error );
- }
-
- public ArtifactMetadata( Artifact af )
- {
- }
-
- @Override
- public String toString()
- {
- return groupId + ":" + artifactId + ":" + version;
- }
-
- public String toDomainString()
- {
- return groupId + ":" + artifactId;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public void setGroupId( String groupId )
- {
- this.groupId = groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public void setArtifactId( String name )
- {
- this.artifactId = name;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- public String getType()
- {
- return type;
- }
-
- public String getCheckedType()
- {
- return type == null ? "jar" : type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public ArtifactScopeEnum getArtifactScope()
- {
- return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope;
- }
-
- public void setArtifactScope( ArtifactScopeEnum artifactScope )
- {
- this.artifactScope = artifactScope;
- }
-
- public void setScope( String scope )
- {
- this.artifactScope = scope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scope );
- }
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public void setClassifier( String classifier )
- {
- this.classifier = classifier;
- }
-
- public boolean isResolved()
- {
- return resolved;
- }
-
- public void setResolved( boolean resolved )
- {
- this.resolved = resolved;
- }
-
- public String getUri()
- {
- return uri;
- }
-
- public void setUri( String uri )
- {
- this.uri = uri;
- }
-
- public String getScope()
- {
- return getArtifactScope().getScope();
- }
-
- public ArtifactScopeEnum getScopeAsEnum()
- {
- return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope;
- }
-
- public boolean isArtifactExists()
- {
- return artifactExists;
- }
-
- public void setArtifactExists( boolean artifactExists )
- {
- this.artifactExists = artifactExists;
- }
-
- public Collection<ArtifactMetadata> getDependencies()
- {
- return dependencies;
- }
-
- public void setDependencies( Collection<ArtifactMetadata> dependencies )
- {
- this.dependencies = dependencies;
- }
-
- public String getArtifactUri()
- {
- return artifactUri;
- }
-
- public void setArtifactUri( String artifactUri )
- {
- this.artifactUri = artifactUri;
- }
-
- public String getWhy()
- {
- return why;
- }
-
- public void setWhy( String why )
- {
- this.why = why;
- }
-
- public String getError()
- {
- return error;
- }
-
- public void setError( String error )
- {
- this.error = error;
- }
-
- public boolean isError()
- {
- return error == null;
- }
-
- public String getDependencyConflictId()
- {
- return groupId + ":" + artifactId;
- }
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/DefaultMetadataResolver.java b/src/main/java/org/apache/maven/mercury/resolver/DefaultMetadataResolver.java
deleted file mode 100644
index b1726d0..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/DefaultMetadataResolver.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.maven.mercury.Artifact;
-import org.apache.maven.mercury.ArtifactRepository;
-import org.apache.maven.mercury.DefaultArtifact;
-import org.apache.maven.mercury.retrieve.ArtifactRetriever;
-import org.apache.maven.mercury.retrieve.ResolutionRequest;
-import org.apache.maven.mercury.retrieve.ResolutionResult;
-
-/*
- * default implementation of the metadata resolver
- *
- * @author Oleg Gusakov
- *
- * @plexus.component
- */
-public class DefaultMetadataResolver
- implements MetadataResolver
-{
- //------------------------------------------------------------------------
-
- /** @plexus.requirement */
- ArtifactRetriever artifactResolver;
-
- /** @plexus.requirement */
- MetadataSource metadataSource;
-
- //------------------------------------------------------------------------
- public MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request )
- throws MetadataResolutionException
- {
- MetadataResolutionResult result = new MetadataResolutionResult();
-
- MetadataTreeNode tree = resolveMetadataTree( request.getQuery(), null, request.getLocalRepository(), request.getRemoteRepositories() );
-
- result.setTree( tree );
-
- return result;
- }
-
- //------------------------------------------------------------------------
- private MetadataTreeNode resolveMetadataTree( ArtifactMetadata query, MetadataTreeNode parent, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
- throws MetadataResolutionException
- {
- try
- {
- Artifact pomArtifact = new DefaultArtifact( query.getGroupId(), query.getArtifactId(), query.getVersion(), query.getType(), null, false, query.getScope(), null );
-
- ResolutionRequest request = new ResolutionRequest().setArtifact( pomArtifact ).setLocalRepository( localRepository ).setRemoteRepostories( remoteRepositories );
-
- ResolutionResult result = artifactResolver.retrieve( request );
-
- // Here we just need to deal with basic retrieval problems.
- if ( result.hasExceptions() )
- {
- pomArtifact.setResolved( false );
- }
-
- if ( pomArtifact.isResolved() )
- {
- MetadataResolution metadataResolution = metadataSource.retrieve( query, localRepository, remoteRepositories );
- ArtifactMetadata found = metadataResolution.getArtifactMetadata();
-
- if ( pomArtifact.getFile() != null && pomArtifact.getFile().toURI() != null )
- {
- found.setArtifactUri( pomArtifact.getFile().toURI().toString() );
- }
-
- MetadataTreeNode node = new MetadataTreeNode( found, parent, true, found.getScopeAsEnum() );
- Collection<ArtifactMetadata> dependencies = metadataResolution.getArtifactMetadata().getDependencies();
-
- if ( dependencies != null && dependencies.size() > 0 )
- {
- int numberOfChildren = dependencies.size();
- node.setNChildren( numberOfChildren );
- int kidNo = 0;
- for ( ArtifactMetadata a : dependencies )
- {
- MetadataTreeNode kidNode = resolveMetadataTree( a, node, localRepository, remoteRepositories );
- node.addChild( kidNo++, kidNode );
- }
- }
- return node;
- }
- else
- {
- return new MetadataTreeNode( pomArtifact, parent, false, query.getArtifactScope() );
- }
- }
- catch ( Exception anyEx )
- {
- throw new MetadataResolutionException( anyEx );
- }
- }
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraph.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataGraph.java
deleted file mode 100644
index dfd1655..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraph.java
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.maven.mercury.ArtifactScopeEnum;
-
-
-/**
- * maven dependency metadata graph
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class MetadataGraph
-{
- public static int DEFAULT_VERTICES = 32;
- public static int DEFAULT_EDGES = 64;
-
- // flags to indicate the granularity of vertices
- private boolean versionedVertices = false;
- private boolean scopedVertices = false;
- /**
- * the entry point we started building the graph from
- */
- MetadataGraphVertex entry;
-
- // graph vertices
- TreeSet< MetadataGraphVertex > vertices;
-
- /**
- * incident and excident edges per node
- */
- Map<MetadataGraphVertex, List<MetadataGraphEdge>> incidentEdges;
- Map<MetadataGraphVertex, List<MetadataGraphEdge>> excidentEdges;
-
- /**
- * null in dirty graph, actual
- * scope for conflict-resolved graph
- */
- ArtifactScopeEnum scope;
-
- //------------------------------------------------------------------------
- /**
- * init graph
- */
- public MetadataGraph( int nVertices )
- {
- init( nVertices, 2*nVertices );
- }
- public MetadataGraph( int nVertices, int nEdges )
- {
- init( nVertices, nEdges );
- }
- //------------------------------------------------------------------------
- /**
- * construct a single vertex
- */
- public MetadataGraph( MetadataGraphVertex entry )
- throws MetadataResolutionException
- {
- checkVertex(entry);
- checkVertices(1);
-
- entry.setCompareVersion( versionedVertices );
- entry.setCompareScope( scopedVertices );
-
- vertices.add( entry );
- this.entry = entry;
- }
- //------------------------------------------------------------------------
- /**
- * construct graph from a "dirty" tree
- */
- public MetadataGraph( MetadataTreeNode tree )
- throws MetadataResolutionException
- {
- this( tree, false, false );
- }
- //------------------------------------------------------------------------
- /**
- * construct graph from a "dirty" tree
- *
- * @param tree "dirty" tree root
- * @param versionedVertices true if graph nodes should be versioned (different versions -> different nodes)
- * @param scopedVertices true if graph nodes should be versioned and scoped (different versions and/or scopes -> different nodes)
- *
- */
- public MetadataGraph( MetadataTreeNode tree, boolean versionedVertices, boolean scopedVertices )
- throws MetadataResolutionException
- {
- if ( tree == null )
- {
- throw new MetadataResolutionException( "tree is null" );
- }
-
- setVersionedVertices(versionedVertices);
- setScopedVertices(scopedVertices);
-
- this.versionedVertices = scopedVertices || versionedVertices;
- this.scopedVertices = scopedVertices;
-
- int count = countNodes( tree );
-
- init( count, count + ( count / 2 ) );
-
- processTreeNodes( null, tree, 0, 0 );
- }
- //------------------------------------------------------------------------
- private void processTreeNodes( MetadataGraphVertex parentVertex
- , MetadataTreeNode node
- , int depth
- , int pomOrder
- )
- throws MetadataResolutionException
- {
- if ( node == null )
- {
- return;
- }
-
- MetadataGraphVertex vertex = new MetadataGraphVertex( node.md, versionedVertices, scopedVertices );
- if( ! vertices.contains(vertex) )
- {
- vertices.add(vertex);
- }
-
- if( parentVertex != null ) // then create the edge
- {
- ArtifactMetadata md = node.getMd();
- MetadataGraphEdge e = new MetadataGraphEdge( md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder );
- addEdge( parentVertex, vertex, e);
- }
- else
- {
- entry = vertex;
- }
-
- MetadataTreeNode[] kids = node.getChildren();
- if ( kids == null || kids.length < 1 )
- {
- return;
- }
-
- for( int i = 0; i< kids.length; i++ )
- {
- MetadataTreeNode n = kids[i];
- processTreeNodes( vertex, n, depth + 1, i );
- }
- }
- //------------------------------------------------------------------------
- public MetadataGraphVertex findVertex( ArtifactMetadata md )
- {
- if( md == null || vertices == null || vertices.size() < 1 )
- return null;
-
- MetadataGraphVertex v = new MetadataGraphVertex(md);
- v.setCompareVersion(versionedVertices);
- v.setCompareScope(scopedVertices);
-
- for( MetadataGraphVertex gv : vertices )
- {
- if( gv.equals(v) )
- return gv;
- }
-
- return null;
- }
- //------------------------------------------------------------------------
- public MetadataGraphVertex addVertex( ArtifactMetadata md )
- {
- if( md == null )
- return null;
-
- checkVertices();
-
- MetadataGraphVertex v = findVertex(md);
- if( v != null)
- return v;
-
- v = new MetadataGraphVertex(md);
-
- v.setCompareVersion(versionedVertices);
- v.setCompareScope(scopedVertices);
-
- vertices.add( v );
- return v;
- }
- //------------------------------------------------------------------------
- /**
- * init graph
- */
- private void init( int nVertices, int nEdges )
- {
- int nV = nVertices;
- if( nVertices < 1 )
- nV = 1;
-
- checkVertices(nV);
-
- int nE = nVertices;
- if( nEdges <= nV )
- nE = 2*nE;
-
- checkEdges(nE);
- }
-
- private void checkVertices()
- {
- checkVertices(DEFAULT_VERTICES);
- }
-
- private void checkVertices( int nVertices )
- {
- if( vertices == null )
- vertices = new TreeSet<MetadataGraphVertex>();
- }
- private void checkEdges()
- {
- int count = DEFAULT_EDGES;
-
- if( vertices != null )
- count = vertices.size() + vertices.size() / 2;
-
- checkEdges( count );
- }
- private void checkEdges( int nEdges )
- {
- if( incidentEdges == null )
- incidentEdges = new HashMap<MetadataGraphVertex, List<MetadataGraphEdge>>( nEdges );
- if( excidentEdges == null )
- excidentEdges = new HashMap<MetadataGraphVertex, List<MetadataGraphEdge>>( nEdges );
- }
- //------------------------------------------------------------------------
- private static void checkVertex( MetadataGraphVertex v )
- throws MetadataResolutionException
- {
- if( v == null )
- throw new MetadataResolutionException( "null vertex" );
- if( v.getMd() == null )
- throw new MetadataResolutionException( "vertex without metadata" );
- }
- //------------------------------------------------------------------------
- private static void checkEdge( MetadataGraphEdge e )
- throws MetadataResolutionException
- {
- if( e == null )
- throw new MetadataResolutionException( "badly formed edge" );
- }
- //------------------------------------------------------------------------
- public List<MetadataGraphEdge> getEdgesBetween(
- MetadataGraphVertex vFrom
- , MetadataGraphVertex vTo
- )
- {
- List<MetadataGraphEdge> edges = getIncidentEdges(vTo);
- if( edges == null || edges.isEmpty() )
- return null;
-
- List<MetadataGraphEdge> res = new ArrayList<MetadataGraphEdge>( edges.size() );
-
- for( MetadataGraphEdge e : edges )
- {
- if( e.getSource().equals(vFrom) )
- res.add(e);
- }
-
- return res;
- }
- //------------------------------------------------------------------------
- public MetadataGraph addEdge( MetadataGraphVertex vFrom
- , MetadataGraphVertex vTo
- , MetadataGraphEdge e
- )
- throws MetadataResolutionException
- {
- checkVertex(vFrom);
- checkVertex(vTo);
-
- checkVertices();
-
- checkEdge(e);
- checkEdges();
-
- e.setSource(vFrom);
- e.setTarget(vTo);
-
- vFrom.setCompareVersion(versionedVertices);
- vFrom.setCompareScope(scopedVertices);
-
- List<MetadataGraphEdge> exList = excidentEdges.get(vFrom);
- if( exList == null ) {
- exList = new ArrayList<MetadataGraphEdge>();
- excidentEdges.put( vFrom, exList );
- }
-
- if( !exList.contains(e) )
- exList.add(e);
-
- List<MetadataGraphEdge> inList = incidentEdges.get(vTo);
- if( inList == null ) {
- inList = new ArrayList<MetadataGraphEdge>();
- incidentEdges.put( vTo, inList );
- }
-
- if( !inList.contains(e) )
- inList.add(e);
-
- return this;
- }
- //------------------------------------------------------------------------
- public MetadataGraph removeVertex( MetadataGraphVertex v )
- {
- if( vertices!= null && v != null )
- vertices.remove(v);
-
- if( incidentEdges!= null )
- incidentEdges.remove(v);
-
- if( excidentEdges!= null )
- excidentEdges.remove(v);
-
- return this;
-
- }
- //------------------------------------------------------------------------
- private static int countNodes( MetadataTreeNode tree )
- {
- if ( tree == null )
- {
- return 0;
- }
-
- int count = 1;
- MetadataTreeNode[] kids = tree.getChildren();
- if ( kids == null || kids.length < 1 )
- {
- return count;
- }
- for ( MetadataTreeNode n : kids )
- {
- count += countNodes( n );
- }
-
- return count;
- }
-
- //------------------------------------------------------------------------
- public MetadataGraphVertex getEntry()
- {
- return entry;
- }
-
- public void setEntry( MetadataGraphVertex entry )
- {
- this.entry = entry;
- }
-
- public TreeSet<MetadataGraphVertex> getVertices()
- {
- return vertices;
- }
-
- public List<MetadataGraphEdge> getIncidentEdges( MetadataGraphVertex vertex )
- {
- checkEdges();
- return incidentEdges.get(vertex);
- }
-
- public List<MetadataGraphEdge> getExcidentEdges( MetadataGraphVertex vertex )
- {
- checkEdges();
- return excidentEdges.get(vertex);
- }
-
- public boolean isVersionedVertices()
- {
- return versionedVertices;
- }
- public void setVersionedVertices(boolean versionedVertices)
- {
- this.versionedVertices = versionedVertices;
- }
- public boolean isScopedVertices()
- {
- return scopedVertices;
- }
- public void setScopedVertices(boolean scopedVertices)
- {
- this.scopedVertices = scopedVertices;
-
- // scoped graph is versioned by definition
- if( scopedVertices )
- versionedVertices = true;
- }
- public ArtifactScopeEnum getScope()
- {
- return scope;
- }
- public void setScope(ArtifactScopeEnum scope)
- {
- this.scope = scope;
- }
- //------------------------------------------------------------------------
- public boolean isEmpty()
- {
- return
- entry == null
- || vertices == null
- || vertices.isEmpty()
- ;
- }
- //------------------------------------------------------------------------
- public boolean isEmptyEdges()
- {
- return
- isEmpty()
- || incidentEdges == null
- || incidentEdges.isEmpty()
- ;
- }
- //------------------------------------------------------------------------
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder(512);
- if( isEmpty() )
- return "empty";
- for( MetadataGraphVertex v : vertices )
- {
- sb.append("Vertex: "+v.getMd().toString()+ "\n");
- List<MetadataGraphEdge> ins = getIncidentEdges(v);
- if( ins != null )
- for( MetadataGraphEdge e : ins )
- {
- sb.append(" from : "+e.toString()+"\n");
- }
- else
- sb.append(" no entries\n");
-
- List<MetadataGraphEdge> outs = getExcidentEdges(v);
- if( outs != null )
- for( MetadataGraphEdge e : outs )
- {
- sb.append(" to : "+e.toString()+ "\n");
- }
- else
- sb.append(" no exit\n");
-
- sb.append("-------------------------------------------------\n");
- }
- sb.append("=============================================================\n");
- return sb.toString();
- }
-
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphEdge.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphEdge.java
deleted file mode 100644
index a856d78..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphEdge.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import org.apache.maven.mercury.ArtifactScopeEnum;
-
-
-/**
- * metadata graph edge - combination of version, scope and depth define
- * an edge in the graph
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class MetadataGraphEdge
-{
- String version;
- ArtifactScopeEnum scope;
- int depth = -1;
- int pomOrder = -1;
- boolean resolved = true;
- String artifactUri;
-
- /**
- * capturing where this link came from
- * and where it is linked to.
- *
- * In the first implementation only source used for explanatory function
- */
- MetadataGraphVertex source;
- MetadataGraphVertex target;
-
- //----------------------------------------------------------------------------
- public MetadataGraphEdge( String version
- , boolean resolved
- , ArtifactScopeEnum scope
- , String artifactUri
- , int depth
- , int pomOrder
- )
- {
- super();
- this.version = version;
- this.scope = scope;
- this.artifactUri = artifactUri;
- this.depth = depth;
- this.resolved = resolved;
- this.pomOrder = pomOrder;
- }
- //----------------------------------------------------------------------------
- /**
- * helper for equals
- */
- private static boolean objectsEqual( Object o1,
- Object o2 )
- {
- if ( o1 == null && o2 == null )
- {
- return true;
- }
- if ( ( o1 == null && o2 != null )
- || ( o1 != null && o2 == null )
- )
- {
- return false;
- }
- return o1.equals( o2 );
- }
-
- //----------------------------------------------------------------------------
- /**
- * used to eliminate exact duplicates in the edge list
- */
- @Override
- public boolean equals( Object o )
- {
- if ( o instanceof MetadataGraphEdge )
- {
- MetadataGraphEdge e = (MetadataGraphEdge) o;
-
- return
- objectsEqual( version, e.version )
- && ArtifactScopeEnum.checkScope(scope).getScope().equals(
- ArtifactScopeEnum.checkScope(e.scope).getScope()
- )
- && depth == e.depth
- ;
- }
- return false;
- }
-
- //----------------------------------------------------------------------------
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- public ArtifactScopeEnum getScope()
- {
- return scope;
- }
-
- public void setScope( ArtifactScopeEnum scope )
- {
- this.scope = scope;
- }
-
- public int getDepth()
- {
- return depth;
- }
-
- public void setDepth( int depth )
- {
- this.depth = depth;
- }
-
- public boolean isResolved()
- {
- return resolved;
- }
-
- public void setResolved(boolean resolved)
- {
- this.resolved = resolved;
- }
-
- public int getPomOrder()
- {
- return pomOrder;
- }
-
- public void setPomOrder(int pomOrder)
- {
- this.pomOrder = pomOrder;
- }
-
- public String getArtifactUri()
- {
- return artifactUri;
- }
- public void setArtifactUri(String artifactUri)
- {
- this.artifactUri = artifactUri;
- }
-
- public MetadataGraphVertex getSource()
- {
- return source;
- }
- public void setSource(MetadataGraphVertex source)
- {
- this.source = source;
- }
- public MetadataGraphVertex getTarget()
- {
- return target;
- }
- public void setTarget(MetadataGraphVertex target)
- {
- this.target = target;
- }
- @Override
- public String toString()
- {
- return "[ "
- + "FROM:("+( source==null?"no source":(source.md==null?"no source MD":source.md.toString()) )+") "
- + "TO:("+( target==null?"no target":(target.md==null?"no target MD":target.md.toString()) )+") "
- +"version="+version
- +", scope="+(scope == null ? "null" : scope.getScope())
- +", depth="+depth+"]"
- ;
- }
- //----------------------------------------------------------------------------
- //----------------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphVertex.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphVertex.java
deleted file mode 100644
index 642c0c7..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataGraphVertex.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import org.apache.maven.mercury.ArtifactScopeEnum;
-
-
-/**
- * metadata graph vertice - just a wrapper around artifact's metadata
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class MetadataGraphVertex
-implements Comparable<MetadataGraphVertex>
-{
- ArtifactMetadata md;
-
- // indications to use these in comparrison
- private boolean compareVersion = false;
- private boolean compareScope = false;
-
- public MetadataGraphVertex( ArtifactMetadata md )
- {
- super();
- this.md = md;
- }
-
- public MetadataGraphVertex( ArtifactMetadata md, boolean compareVersion, boolean compareScope )
- {
- this(md);
- this.compareVersion = compareVersion;
- this.compareScope = compareScope;
- }
-
- public ArtifactMetadata getMd()
- {
- return md;
- }
-
- public void setMd( ArtifactMetadata md )
- {
- this.md = md;
- }
- //---------------------------------------------------------------------
- public boolean isCompareVersion()
- {
- return compareVersion;
- }
-
- public void setCompareVersion(boolean compareVersion)
- {
- this.compareVersion = compareVersion;
- }
-
- public boolean isCompareScope()
- {
- return compareScope;
- }
-
- public void setCompareScope(boolean compareScope)
- {
- this.compareScope = compareScope;
- }
-
- //---------------------------------------------------------------------
- @Override
- public String toString()
- {
- return "["+ (md == null ? "no metadata" : md.toString()) + "]";
- }
- //---------------------------------------------------------------------
- private static int compareStrings( String s1, String s2 )
- {
- if( s1 == null && s2 == null )
- return 0;
-
- if( s1 == null && s2 != null )
- return -1;
-
- if( s1 != null && s2 == null )
- return 1;
-
- return s1.compareTo(s2);
- }
- //---------------------------------------------------------------------
- public int compareTo(MetadataGraphVertex vertex)
- {
- if( vertex == null || vertex.getMd() == null )
- return 1;
-
- ArtifactMetadata vmd = vertex.getMd();
-
- if( vmd == null )
- {
- if( md == null )
- return 0;
- else
- return 1;
- }
-
- int g = compareStrings( md.groupId, vmd.groupId );
-
- if( g == 0 )
- {
- int a = compareStrings( md.artifactId, vmd.artifactId );
- if( a == 0 )
- {
- if( compareVersion )
- {
- int v = compareStrings( md.version, vmd.version );
- if( v == 0) {
- if( compareScope ) {
- String s1 = ArtifactScopeEnum.checkScope( md.artifactScope).getScope();
- String s2 = ArtifactScopeEnum.checkScope(vmd.artifactScope).getScope();
- return s1.compareTo(s2);
- }
- else
- return 0;
- }
- else
- return v;
- }
- else
- return 0;
- }
- else
- return a;
- }
-
- return g;
- }
- //---------------------------------------------------------------------
- @Override
- public boolean equals(Object vo)
- {
- if( vo == null || !(vo instanceof MetadataGraphVertex) )
- return false;
- return compareTo( (MetadataGraphVertex)vo ) == 0;
- }
- //---------------------------------------------------------------------
-
- @Override
- public int hashCode()
- {
- if( md == null )
- return super.hashCode();
- StringBuilder hashString = new StringBuilder(128);
- hashString.append( md.groupId+"|" );
- hashString.append( md.artifactId+"|" );
-
- if( compareVersion )
- hashString.append(md.version + "|");
-
- if( compareScope )
- hashString.append(md.getArtifactScope() + "|");
-
- return hashString.toString().hashCode();
-
-// BASE64Encoder b64 = new BASE64Encoder();
-// return b64.encode( hashString.toString().getBytes() ).hashCode();
- }
-
- //---------------------------------------------------------------------
- //---------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolution.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolution.java
deleted file mode 100644
index 69642f8..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolution.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import java.util.Collection;
-
-import org.apache.maven.mercury.ArtifactRepository;
-
-/**
- *
- * @author Jason van Zyl
- *
- */
-public class MetadataResolution
-{
- /** resolved MD */
- private ArtifactMetadata artifactMetadata;
-
- /** repositories, added by this POM */
- private Collection<ArtifactRepository> metadataRepositories;
- //-------------------------------------------------------------------
- public MetadataResolution( ArtifactMetadata artifactMetadata )
- {
- this.artifactMetadata = artifactMetadata;
- }
- //-------------------------------------------------------------------
- public MetadataResolution( ArtifactMetadata artifactMetadata,
- Collection<ArtifactRepository> metadataRepositories )
- {
- this( artifactMetadata );
- this.metadataRepositories = metadataRepositories;
- }
- //-------------------------------------------------------------------
- public Collection<ArtifactRepository> getMetadataRepositories()
- {
- return metadataRepositories;
- }
-
- public void setMetadataRepositories(
- Collection<ArtifactRepository> metadataRepositories)
- {
- this.metadataRepositories = metadataRepositories;
- }
- //-------------------------------------------------------------------
- public ArtifactMetadata getArtifactMetadata()
- {
- return artifactMetadata;
- }
-
- public void setArtifactMetadata(ArtifactMetadata artifactMetadata)
- {
- this.artifactMetadata = artifactMetadata;
- }
- //-------------------------------------------------------------------
- //-------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionException.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionException.java
deleted file mode 100644
index 1470967..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-public class MetadataResolutionException
- extends Exception
-{
-
- public MetadataResolutionException()
- {
- // TODO Auto-generated constructor stub
- }
-
- public MetadataResolutionException( String message )
- {
- super( message );
- // TODO Auto-generated constructor stub
- }
-
- public MetadataResolutionException( Throwable cause )
- {
- super( cause );
- // TODO Auto-generated constructor stub
- }
-
- public MetadataResolutionException( String message,
- Throwable cause )
- {
- super( message, cause );
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequest.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequest.java
deleted file mode 100644
index 11f1862..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import java.util.List;
-
-import org.apache.maven.mercury.ArtifactRepository;
-
-
-/** @author Oleg Gusakov */
-public class MetadataResolutionRequest
-{
- protected ArtifactMetadata query;
- protected ArtifactRepository localRepository;
- protected List<ArtifactRepository> remoteRepositories;
-
- //--------------------------------------------------------------------
- public MetadataResolutionRequest()
- {
- }
-
- //--------------------------------------------------------------------
- public MetadataResolutionRequest( ArtifactMetadata query,
- ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
- {
- this.query = query;
- this.localRepository = localRepository;
- this.remoteRepositories = remoteRepositories;
- }
-
- //--------------------------------------------------------------------
- public ArtifactMetadata getQuery()
- {
- return query;
- }
-
- public void setQuery( ArtifactMetadata query )
- {
- this.query = query;
- }
-
- public ArtifactRepository getLocalRepository()
- {
- return localRepository;
- }
-
- public void setLocalRepository( ArtifactRepository localRepository )
- {
- this.localRepository = localRepository;
- }
-
- public List<ArtifactRepository> getRemoteRepositories()
- {
- return remoteRepositories;
- }
-
- public void setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
- {
- this.remoteRepositories = remoteRepositories;
- }
- //--------------------------------------------------------------------
- //--------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequestTypeEnum.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequestTypeEnum.java
deleted file mode 100644
index 70b1c69..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionRequestTypeEnum.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-public enum MetadataResolutionRequestTypeEnum
-{
- tree( 1 )
- , graph( 2 )
- , classpathCompile( 3 )
- , classpathTest( 4 )
- , classpathRuntime( 5 )
- , versionedGraph( 6 )
- , scopedGraph( 7 )
- ;
-
- private int id;
-
- // Constructor
- MetadataResolutionRequestTypeEnum( int id )
- {
- this.id = id;
- }
-
- int getId()
- {
- return id;
- }
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionResult.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionResult.java
deleted file mode 100644
index d91270e..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolutionResult.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import org.apache.maven.mercury.ArtifactScopeEnum;
-import org.apache.maven.mercury.conflict.ConflictResolutionException;
-import org.apache.maven.mercury.conflict.ConflictResolver;
-import org.apache.maven.mercury.transform.ClasspathContainer;
-import org.apache.maven.mercury.transform.ClasspathTransformation;
-import org.apache.maven.mercury.transform.MetadataGraphTransformationException;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-/**
- * This object is tinted with ClasspathTransformation and GraphConflictResolver.
- * Get rid of them after debugging
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- */
-public class MetadataResolutionResult
-{
- MetadataTreeNode treeRoot;
-
- /**
- * these components are are initialized on demand by
- * explicit call of the initTreeProcessing()
- */
- ClasspathTransformation classpathTransformation;
- ConflictResolver conflictResolver;
-
- //----------------------------------------------------------------------------
- public MetadataResolutionResult( )
- {
- }
- //----------------------------------------------------------------------------
- public MetadataResolutionResult( MetadataTreeNode root )
- {
- this.treeRoot = root;
- }
- //----------------------------------------------------------------------------
- public MetadataTreeNode getTree()
- {
- return treeRoot;
- }
- //----------------------------------------------------------------------------
- public void setTree( MetadataTreeNode root )
- {
- this.treeRoot = root;
- }
-
- public void initTreeProcessing( PlexusContainer plexus )
- throws ComponentLookupException
- {
- classpathTransformation = (ClasspathTransformation)plexus.lookup(ClasspathTransformation.class);
- conflictResolver = (ConflictResolver)plexus.lookup(ConflictResolver.class);
- }
- //----------------------------------------------------------------------------
- public MetadataGraph getGraph()
- throws MetadataResolutionException
- {
- return treeRoot == null ? null : new MetadataGraph(treeRoot);
- }
- //----------------------------------------------------------------------------
- public MetadataGraph getGraph( ArtifactScopeEnum scope )
- throws MetadataResolutionException, ConflictResolutionException
- {
- if( treeRoot == null )
- return null;
-
- if( conflictResolver == null )
- return null;
-
- return conflictResolver.resolveConflicts( getGraph(), scope );
- }
- //----------------------------------------------------------------------------
- public MetadataGraph getGraph( MetadataResolutionRequestTypeEnum requestType )
- throws MetadataResolutionException, ConflictResolutionException
- {
- if( requestType == null )
- return null;
-
- if( treeRoot == null )
- return null;
-
- if( conflictResolver == null )
- return null;
-
- if( requestType.equals(MetadataResolutionRequestTypeEnum.classpathCompile) )
- return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.compile );
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.classpathRuntime) )
- return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.runtime );
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.classpathRuntime) )
- return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.test );
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.classpathRuntime) )
- return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.test );
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.graph) )
- return getGraph();
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.versionedGraph) ) {
- return new MetadataGraph( getTree(), true, false );
- }
- else if( requestType.equals(MetadataResolutionRequestTypeEnum.scopedGraph) ) {
- return new MetadataGraph( getTree(), true, true );
- }
- return null;
- }
- //----------------------------------------------------------------------------
- public ClasspathContainer getClasspath( ArtifactScopeEnum scope )
- throws MetadataGraphTransformationException, MetadataResolutionException
- {
- if( classpathTransformation == null )
- return null;
-
- MetadataGraph dirtyGraph = getGraph();
- if( dirtyGraph == null )
- return null;
-
- return classpathTransformation.transform( dirtyGraph, scope, false );
- }
-
- //----------------------------------------------------------------------------
- public MetadataTreeNode getClasspathTree( ArtifactScopeEnum scope )
- throws MetadataGraphTransformationException, MetadataResolutionException
- {
- ClasspathContainer cpc = getClasspath(scope);
- if( cpc == null )
- return null;
-
- return cpc.getClasspathAsTree();
- }
- //----------------------------------------------------------------------------
- //----------------------------------------------------------------------------
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolver.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataResolver.java
deleted file mode 100644
index f91acd3..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataResolver.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-/**
- * entry point into metadata resolution component
- *
- * @author Jason van Zyl
- * @author Oleg Gusakov
- */
-public interface MetadataResolver
-{
- String ROLE = MetadataResolver.class.getName();
-
- /**
- * collect all dependency metadata into one "dirty" tree
- *
- * @param request
- * @return
- * @throws MetadataResolutionException
- */
- MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request )
- throws MetadataResolutionException;
-}
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataRetrievalException.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataRetrievalException.java
deleted file mode 100644
index f225afe..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataRetrievalException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-/*
- * 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.
- */
-
-/**
- * Error while retrieving repository metadata from the repository.
- *
- * @author Jason van Zyl
- * @version $Id$
- */
-public class MetadataRetrievalException
- extends Exception
-{
-
- private ArtifactMetadata artifact;
-
- public MetadataRetrievalException( String message )
- {
- this( message, null, null );
- }
-
- public MetadataRetrievalException( Throwable cause )
- {
- this( null, cause, null );
- }
-
- public MetadataRetrievalException( String message,
- Throwable cause )
- {
- this( message, cause, null );
- }
-
- public MetadataRetrievalException( String message,
- Throwable cause,
- ArtifactMetadata artifact )
- {
- super( message, cause );
-
- this.artifact = artifact;
- }
-
- public ArtifactMetadata getArtifactMetadata()
- {
- return artifact;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataSource.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataSource.java
deleted file mode 100644
index 216de5a..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataSource.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-/*
- * 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 java.util.List;
-
-import org.apache.maven.mercury.ArtifactRepository;
-
-/**
- * Provides some metadata operations, like querying the remote repository for a list of versions available for an
- * artifact.
- *
- * @author Jason van Zyl
- * @version $Id$
- */
-public interface MetadataSource
-{
- String ROLE = MetadataSource.class.getName();
-
- MetadataResolution retrieve( ArtifactMetadata artifact,
- ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories )
- throws MetadataRetrievalException;
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/mercury/resolver/MetadataTreeNode.java b/src/main/java/org/apache/maven/mercury/resolver/MetadataTreeNode.java
deleted file mode 100644
index 1ae35ce..0000000
--- a/src/main/java/org/apache/maven/mercury/resolver/MetadataTreeNode.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.apache.maven.mercury.resolver;
-
-import org.apache.maven.mercury.Artifact;
-import org.apache.maven.mercury.ArtifactScopeEnum;
-/**
- * metadata [dirty] Tree
- *
- * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
- *
- */
-
-public class MetadataTreeNode
-{
- ArtifactMetadata md; // this node
-
- MetadataTreeNode parent; // papa
-
- /** default # of children. Used for tree creation optimization only */
- int nChildren = 8;
-
- MetadataTreeNode[] children; // of cause
-
- public int getNChildren()
- {
- return nChildren;
- }
-
- public void setNChildren(int children)
- {
- nChildren = children;
- }
-
- //------------------------------------------------------------------------
- public MetadataTreeNode()
- {
- }
- //------------------------------------------------------------------------
- public MetadataTreeNode( ArtifactMetadata md,
- MetadataTreeNode parent,
- boolean resolved,
- ArtifactScopeEnum scope )
- {
- if ( md != null )
- {
- md.setArtifactScope( ArtifactScopeEnum.checkScope(scope) );
- md.setResolved(resolved);
- }
-
- this.md = md;
- this.parent = parent;
- }
- //------------------------------------------------------------------------
- public MetadataTreeNode( Artifact af,
- MetadataTreeNode parent,
- boolean resolved,
- ArtifactScopeEnum scope
- )
- {
- this( new ArtifactMetadata( af ), parent, resolved, scope );
- }
- //------------------------------------------------------------------------
- public void addChild( int index, MetadataTreeNode kid )
- {
- if ( kid == null )
- {
- return;
- }
-
- if( children == null )
- children = new MetadataTreeNode[nChildren];
-
- children[index % nChildren] = kid;
- }
- //------------------------------------------------------------------
- @Override
- public String toString()
- {
- return md == null ? "no metadata" : md.toString();
- }
- //------------------------------------------------------------------
- public String graphHash()
- throws MetadataResolutionException
- {
- if ( md == null )
- {
- throw new MetadataResolutionException( "treenode without metadata, parent: "
- + ( parent == null ? "null" : parent.toString() )
- );
- }
-
- return md.groupId + ":" + md.artifactId;
- }
-
- //------------------------------------------------------------------------
- public boolean hasChildren()
- {
- return children != null;
- }
- //------------------------------------------------------------------------
- public ArtifactMetadata getMd()
- {
- return md;
- }
-
- public void setMd( ArtifactMetadata md )
- {
- this.md = md;
- }
-
- public MetadataTreeNode getParent()
- {
- return parent;
- }
-
- public void setParent( MetadataTreeNode parent )
- {
- this.parent = parent;
- }
-
- public MetadataTreeNode[] getChildren()
- {
- return children;
- }
-
- public void setChildren( MetadataTreeNode[] children )
- {
- this.children = children;
- }
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
-
-}