You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2008/02/14 07:06:38 UTC

svn commit: r627669 - /maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/

Author: jvanzyl
Date: Wed Feb 13 22:06:36 2008
New Revision: 627669

URL: http://svn.apache.org/viewvc?rev=627669&view=rev
Log:
pulling everything required into single package

Added:
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java   (with props)
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java   (with props)
Modified:
    maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolver.java

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,323 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * 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;
+    }
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/AbstractArtifactResolutionException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,100 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id$
+ */
+public class ArtifactNotFoundException
+    extends AbstractArtifactResolutionException
+{
+    private String downloadUrl;
+
+    protected ArtifactNotFoundException( String message,
+                                         Artifact artifact,
+                                         List remoteRepositories )
+    {
+        super( message, artifact, remoteRepositories );
+    }
+
+    public ArtifactNotFoundException( String message,
+                                      Artifact artifact )
+    {
+        this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
+            artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
+    }
+
+    protected ArtifactNotFoundException( String message,
+                                         Artifact artifact,
+                                         List remoteRepositories,
+                                         ResourceDoesNotExistException cause )
+    {
+        this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
+            artifact.getClassifier(),
+            remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(), cause );
+    }
+
+    public ArtifactNotFoundException( String message,
+                                      String groupId,
+                                      String artifactId,
+                                      String version,
+                                      String type,
+                                      String classifier,
+                                      List remoteRepositories,
+                                      String downloadUrl,
+                                      List path,
+                                      ResourceDoesNotExistException cause )
+    {
+        super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
+            downloadUrl, path ), groupId, artifactId,
+            version, type, classifier, remoteRepositories, null, cause );
+
+        this.downloadUrl = downloadUrl;
+    }
+
+    private ArtifactNotFoundException( String message,
+                                       String groupId,
+                                       String artifactId,
+                                       String version,
+                                       String type,
+                                       String classifier,
+                                       List remoteRepositories,
+                                       String downloadUrl,
+                                       List path )
+    {
+        super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
+            downloadUrl, path ), groupId, artifactId,
+            version, type, classifier, remoteRepositories, null );
+
+        this.downloadUrl = downloadUrl;
+    }
+
+    public String getDownloadUrl()
+    {
+        return downloadUrl;
+    }
+
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactNotFoundException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,111 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
+import org.apache.maven.wagon.TransferFailedException;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author Jason van Zyl
+ * @version $Id$
+ */
+public class ArtifactResolutionException
+    extends AbstractArtifactResolutionException
+{
+    public ArtifactResolutionException( String message,
+                                        String groupId,
+                                        String artifactId,
+                                        String version,
+                                        String type,
+                                        String classifier,
+                                        List remoteRepositories,
+                                        List path,
+                                        Throwable t )
+    {
+        super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t );
+    }
+
+    public ArtifactResolutionException( String message,
+                                        String groupId,
+                                        String artifactId,
+                                        String version,
+                                        String type,
+                                        String classifier,
+                                        Throwable t )
+    {
+        super( message, groupId, artifactId, version, type, classifier, null, null, t );
+    }
+
+    public ArtifactResolutionException( String message,
+                                        Artifact artifact )
+    {
+        super( message, artifact );
+    }
+
+    public ArtifactResolutionException( String message,
+                                        Artifact artifact,
+                                        List remoteRepositories )
+    {
+        super( message, artifact, remoteRepositories );
+    }
+
+    public ArtifactResolutionException( String message,
+                                        Artifact artifact,
+                                        ArtifactMetadataRetrievalException cause )
+    {
+        super( message, artifact, null, cause );
+    }
+
+    protected ArtifactResolutionException( String message,
+                                           Artifact artifact,
+                                           List remoteRepositories,
+                                           ArtifactMetadataRetrievalException cause )
+    {
+        super( message, artifact, remoteRepositories, cause );
+    }
+
+    protected ArtifactResolutionException( String message,
+                                           Artifact artifact,
+                                           List remoteRepositories,
+                                           TransferFailedException cause )
+    {
+        super( message, artifact, remoteRepositories, cause );
+    }
+
+    protected ArtifactResolutionException( String message,
+                                           Artifact artifact,
+                                           List remoteRepositories,
+                                           IOException cause )
+    {
+        super( message, artifact, remoteRepositories, cause );
+    }
+
+    public ArtifactResolutionException( String message,
+                                        Artifact artifact,
+                                        RepositoryMetadataResolutionException cause )
+    {
+        super( message, artifact, null, cause );
+    }
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolutionException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,36 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.
+ */
+
+/**
+ * I want to use it for hidding the fact that sometime artifact must be
+ * downloaded. I am just asking LocalRepository for given artifact and I don't
+ * care if it is alredy there or how it will get there.
+ *
+ * @author Jason van Zyl
+ * @version $Id$
+ */
+public interface ArtifactResolver
+{
+    String ROLE = ArtifactResolver.class.getName();
+
+    /** @since 3.0 */
+    ResolutionResult resolve( ResolutionRequest request );
+}
\ No newline at end of file

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactResolver.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,54 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/**
+ * @author Jason van Zyl
+ * @plexus.component
+ */
+public class DefaultArtifactResolver
+    extends AbstractLogEnabled
+    implements ArtifactResolver
+{
+    /** @plexus.requirement */
+    private WagonManager wagonManager;
+
+    public ResolutionResult resolve( ResolutionRequest request )
+    {
+        ResolutionResult result = new ResolutionResult();
+        
+        Artifact originatingArtifact = request.getArtifact();
+
+        ArtifactRepository localRepository = request.getLocalRepository();
+
+        List remoteRepositories = request.getRemoteRepostories();
+
+        result.setRepositories( remoteRepositories );
+
+        return result;
+    }
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/DefaultArtifactResolver.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolver.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolver.java?rev=627669&r1=627668&r2=627669&view=diff
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolver.java (original)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolver.java Wed Feb 13 22:06:36 2008
@@ -7,7 +7,6 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
-
 /**
  * entry point into metadata resolution component
  * 
@@ -37,10 +36,7 @@
      * @return collection of resolved artifacts
      * @throws ArtifactResolutionException
      */
-	public List<Artifact> resolveArtifact(
-			List<ArtifactMetadata> mdCollection
-			, ArtifactRepository localRepository
-		    , List<ArtifactRepository> remoteRepositories
-							)
-	throws ArtifactResolutionException;
+    public List<Artifact> resolveArtifact( List<ArtifactMetadata> mdCollection, ArtifactRepository localRepository,
+                                           List<ArtifactRepository> remoteRepositories )
+        throws ArtifactResolutionException;
 }

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,140 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A resolution request allows you to either use an existing MavenProject, or a coordinate (gid:aid:version)
+ * to process a POMs dependencies.
+ *
+ * @author Jason van Zyl
+ */
+public class ResolutionRequest
+{
+    private Artifact artifact;
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private ArtifactRepository localRepository;
+
+    private List remoteRepostories;
+
+    private List listeners = new ArrayList();
+
+    public Artifact getArtifact()
+    {
+        return artifact;
+    }
+
+    public ResolutionRequest setArtifact( Artifact artifact )
+    {
+        this.artifact = artifact;
+
+        return this;
+    }
+
+    public boolean hasArtifact()
+    {
+        return artifact != null;
+    }
+
+    public String getGroupId()
+    {
+        if ( artifact != null )
+        {
+            return artifact.getGroupId();
+        }
+
+        return groupId;
+    }
+
+    public ResolutionRequest setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+
+        return this;
+    }
+
+    public String getArtifactId()
+    {
+        if ( artifact != null )
+        {
+            return artifact.getArtifactId();
+        }
+
+        return artifactId;
+    }
+
+    public ResolutionRequest setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+
+        return this;
+    }
+
+    public String getVersion()
+    {
+        if ( artifact != null )
+        {
+            return artifact.getVersion();
+        }
+
+        return version;
+    }
+
+    public ResolutionRequest setVersion( String version )
+    {
+        this.version = version;
+
+        return this;
+    }
+
+    public ArtifactRepository getLocalRepository()
+    {
+        return localRepository;
+    }
+
+    public ResolutionRequest setLocalRepository( ArtifactRepository localRepository )
+    {
+        this.localRepository = localRepository;
+
+        return this;
+    }
+
+    public List getRemoteRepostories()
+    {
+        return remoteRepostories;
+    }
+
+    public ResolutionRequest setRemoteRepostories( List remoteRepostories )
+    {
+        this.remoteRepostories = remoteRepostories;
+
+        return this;
+    }
+
+    // ------------------------------------------------------------------------
+    //
+    // ------------------------------------------------------------------------
+
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer()
+            .append( "groupId = " + getGroupId() )
+            .append( "artifactId = " + getArtifactId() )
+            .append( "version = " + getVersion() );
+
+        return sb.toString();
+    }
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionRequest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java
URL: http://svn.apache.org/viewvc/maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java?rev=627669&view=auto
==============================================================================
--- maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java (added)
+++ maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java Wed Feb 13 22:06:36 2008
@@ -0,0 +1,221 @@
+package org.apache.maven.artifact.resolver.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Specific problems during resolution that we want to account for:
+ * <p/>
+ * - missing metadata
+ * - version range violations
+ * - version circular dependencies
+ * - missing artifacts
+ * - network/transfer errors
+ * - file system errors: permissions
+ *
+ * @author Jason van Zyl
+ * @version $Id$
+ * @TODO carlos: all these possible has*Exceptions and get*Exceptions methods make the clients too
+ * complex requiring a long list of checks, need to create a parent/interfact/encapsulation
+ * for the types of exceptions
+ */
+public class ResolutionResult
+{
+    private Artifact originatingArtifact;
+
+    private List versionRangeViolations;
+
+    private List metadataResolutionExceptions;
+
+    private List missingArtifacts;
+
+    private List errorArtifactExceptions;
+
+    // file system errors
+
+    private List repositories;
+
+    private Set artifacts;
+
+    //
+
+    public Artifact getOriginatingArtifact()
+    {
+        return originatingArtifact;
+    }
+
+    public ResolutionResult ListOriginatingArtifact( Artifact originatingArtifact )
+    {
+        this.originatingArtifact = originatingArtifact;
+
+        return this;
+    }
+
+    /**
+     * 
+     * @return set of Artifact instances
+     */
+    
+    public Set getArtifacts()
+    {
+        return artifacts;
+    }
+
+    public List getMissingArtifacts()
+    {
+        return missingArtifacts == null ? Collections.EMPTY_LIST : missingArtifacts;
+    }
+
+    public ResolutionResult addMissingArtifact( Artifact artifact )
+    {
+        missingArtifacts = initList( missingArtifacts );
+
+        missingArtifacts.add( artifact );
+
+        return this;
+    }
+
+    public ResolutionResult setUnresolvedArtifacts( List unresolvedArtifacts )
+    {
+        this.missingArtifacts = unresolvedArtifacts;
+
+        return this;
+    }
+
+    // ------------------------------------------------------------------------
+    // Version Range Violations
+    // ------------------------------------------------------------------------
+
+    public boolean hasVersionRangeViolations()
+    {
+        return versionRangeViolations != null;
+    }
+
+    /**
+     * @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by
+     * {@link #getVersionRangeViolation(int)} but it's not used like that in
+     * {@link DefaultArtifactCollector}
+     */
+    public ResolutionResult addVersionRangeViolation( Exception e )
+    {
+        versionRangeViolations = initList( versionRangeViolations );
+
+        versionRangeViolations.add( e );
+
+        return this;
+    }
+
+    public OverConstrainedVersionException getVersionRangeViolation( int i )
+    {
+        return (OverConstrainedVersionException) versionRangeViolations.get( i );
+    }
+
+    public List getVersionRangeViolations()
+    {
+        return versionRangeViolations == null ? Collections.EMPTY_LIST : versionRangeViolations;
+    }
+
+    // ------------------------------------------------------------------------
+    // Metadata Resolution Exceptions: ArtifactResolutionExceptions
+    // ------------------------------------------------------------------------
+
+    public boolean hasMetadataResolutionExceptions()
+    {
+        return metadataResolutionExceptions != null;
+    }
+
+    public ResolutionResult addMetadataResolutionException( ArtifactResolutionException e )
+    {
+        metadataResolutionExceptions = initList( metadataResolutionExceptions );
+
+        metadataResolutionExceptions.add( e );
+
+        return this;
+    }
+
+    public ArtifactResolutionException getMetadataResolutionException( int i )
+    {
+        return (ArtifactResolutionException) metadataResolutionExceptions.get( i );
+    }
+
+    public List getMetadataResolutionExceptions()
+    {
+        return metadataResolutionExceptions == null ? Collections.EMPTY_LIST : metadataResolutionExceptions;
+    }
+
+    // ------------------------------------------------------------------------
+    // ErrorArtifactExceptions: ArtifactResolutionExceptions
+    // ------------------------------------------------------------------------
+
+    public boolean hasErrorArtifactExceptions()
+    {
+        return errorArtifactExceptions != null;
+    }
+
+    public ResolutionResult addErrorArtifactException( ArtifactResolutionException e )
+    {
+        errorArtifactExceptions = initList( errorArtifactExceptions );
+
+        errorArtifactExceptions.add( e );
+
+        return this;
+    }
+
+    public List getErrorArtifactExceptions()
+    {
+        return errorArtifactExceptions == null ? Collections.EMPTY_LIST : errorArtifactExceptions;
+    }
+
+    // ------------------------------------------------------------------------
+    //
+    // ------------------------------------------------------------------------
+
+    // Repositories
+
+    public List getRepositories()
+    {
+        return repositories == null ? Collections.EMPTY_LIST : repositories;
+    }
+
+    public ResolutionResult setRepositories( List repositories )
+    {
+        this.repositories = repositories;
+
+        return this;
+    }
+
+    private List initList( List l )
+    {
+        if ( l == null )
+        {
+            return new ArrayList();
+        }
+        return l;
+    }
+}

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/artifact/branches/CAP/src/main/java/org/apache/maven/artifact/resolver/metadata/ResolutionResult.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"