Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.artifact.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 java.util.Set;
 
Specific problems during resolution that we want to account for:

- missing metadata - version range violations - version circular dependencies - missing artifacts - network/transfer errors - file system errors: permissions

Author(s):
Jason van Zyl
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
 
 {
     private Artifact originatingArtifact;
 
     private List<ArtifactmissingArtifacts;
 
     // Exceptions
 
     private List<Exceptionexceptions;
 
 
 
 
 
     // file system errors
 
     private List<ArtifactRepositoryrepositories;
 
     private Set<Artifactartifacts;
 
     private Set<ResolutionNoderesolutionNodes;
 
     public Artifact getOriginatingArtifact()
     {
         return ;
     }
 
     public ArtifactResolutionResult setOriginatingArtifactfinal Artifact originatingArtifact )
     {
         this. = originatingArtifact;
 
         return this;
     }
 
     public void addArtifactArtifact artifact )
     {
         if (  == null )
         {
              = new LinkedHashSet<Artifact>();
         }
 
         .addartifact );
     }
 
     public Set<ArtifactgetArtifacts()
     {
         if (  == null )
         {
              = new LinkedHashSet<Artifact>();
         }
 
         return ;
     }
    public void setArtifactsSet<Artifactartifacts )
    {
        this. = artifacts;
    }
    {
        if (  == null )
        {
             = new LinkedHashSet<ResolutionNode>();
        }
        return ;
    }
    public void setArtifactResolutionNodesSet<ResolutionNoderesolutionNodes )
    {
        this. = resolutionNodes;
    }
    public boolean hasMissingArtifacts()
    {
        return  != null && !.isEmpty();
    }
    {
        return  == null ? Collections.<ArtifactemptyList() : ;
    }
    {
        .addartifact );
        return this;
    }
    public ArtifactResolutionResult setUnresolvedArtifactsfinal List<ArtifactunresolvedArtifacts )
    {
        this. = unresolvedArtifacts;
        return this;
    }
    public boolean isSuccess()
    {
        return !( hasMissingArtifacts() || hasExceptions() );
    }
    // ------------------------------------------------------------------------
    // Exceptions
    // ------------------------------------------------------------------------
    public boolean hasExceptions()
    {
        return  != null && !.isEmpty();
    }
    public List<ExceptiongetExceptions()
    {
        return  == null ? Collections.<ExceptionemptyList() : ;
    }
    // ------------------------------------------------------------------------
    // Version Range Violations
    // ------------------------------------------------------------------------
    public boolean hasVersionRangeViolations()
    {
        return  != null;
    }

    

TODO:
this needs to accept a org.apache.maven.artifact.versioning.OverConstrainedVersionException as returned by getVersionRangeViolation(int) but it's not used like that in DefaultLegacyArtifactCollector
    {
        .adde );
         = initList );
        .adde );
        return this;
    }
    {
    }
    {
        return  == null ? Collections.<ExceptionemptyList() : ;
    }
    // ------------------------------------------------------------------------
    // Metadata Resolution Exceptions: ArtifactResolutionExceptions
    // ------------------------------------------------------------------------
    public boolean hasMetadataResolutionExceptions()
    {
        return  != null;
    }
    {
        .adde );
         = initList );
        .adde );
        return this;
    }
    {
        return .geti );
    }
    {
        return  == null ? Collections.<ArtifactResolutionExceptionemptyList()
                        : ;
    }
    // ------------------------------------------------------------------------
    // ErrorArtifactExceptions: ArtifactResolutionExceptions
    // ------------------------------------------------------------------------
    public boolean hasErrorArtifactExceptions()
    {
        return  != null;
    }
    {
        .adde );
         = initList );
        .adde );
        return this;
    }
    {
        if (  == null )
        {
            return Collections.emptyList();
        }
        return ;
    }
    // ------------------------------------------------------------------------
    // Circular Dependency Exceptions
    // ------------------------------------------------------------------------
    public boolean hasCircularDependencyExceptions()
    {
        return  != null;
    }
    {
        .adde );
         = initList );
        .adde );
        return this;
    }
    {
        return .geti );
    }
    {
        if (  == null )
        {
            return Collections.emptyList();
        }
        return ;
    }
    // ------------------------------------------------------------------------
    // Repositories
    // ------------------------------------------------------------------------
    {
        if (  == null )
        {
            return Collections.emptyList();
        }
        return ;
    }
    public ArtifactResolutionResult setRepositoriesfinal List<ArtifactRepositoryrepositories )
    {
        this. = repositories;
        return this;
    }
    //
    // Internal
    //
    private <T> List<T> initListfinal List<T> l )
    {
        if ( l == null )
        {
            return new ArrayList<T>();
        }
        return l;
    }
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        if (  != null )
        {
            int i = 1;
            sb.append"---------" ).append"\n" );
            sb.append.size() ).append"\n" );
            for ( Artifact a :  )
            {
                sb.appendi ).append" " ).appenda ).append"\n" );
                i++;
            }
            sb.append"---------" ).append"\n" );
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X