View Javadoc

1   package org.sonatype.aether.transfer;
2   
3   /*******************************************************************************
4    * Copyright (c) 2010-2011 Sonatype, Inc.
5    * All rights reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    *   http://www.eclipse.org/legal/epl-v10.html
9    *******************************************************************************/
10  
11  import org.sonatype.aether.artifact.Artifact;
12  import org.sonatype.aether.repository.RemoteRepository;
13  
14  /**
15   * Thrown when an artifact was not found in a particular repository.
16   * 
17   * @author Benjamin Bentmann
18   */
19  public class ArtifactNotFoundException
20      extends ArtifactTransferException
21  {
22  
23      public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository )
24      {
25          super( artifact, repository, "Could not find artifact " + artifact + getString( " in ", repository )
26              + getLocalPathInfo( artifact, repository ) );
27      }
28  
29      private static String getLocalPathInfo( Artifact artifact, RemoteRepository repository )
30      {
31          String localPath = ( artifact != null ) ? artifact.getProperty( "localPath", null ) : null;
32          if ( localPath != null && repository == null )
33          {
34              return " at specified path " + localPath;
35          }
36          else
37          {
38              return "";
39          }
40      }
41  
42      public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository, String message )
43      {
44          super( artifact, repository, message );
45      }
46  
47  }