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.metadata.Metadata;
12  import org.sonatype.aether.repository.LocalRepository;
13  import org.sonatype.aether.repository.RemoteRepository;
14  
15  /**
16   * Thrown when metadata was not found in a particular repository.
17   * 
18   * @author Benjamin Bentmann
19   */
20  public class MetadataNotFoundException
21      extends MetadataTransferException
22  {
23  
24      public MetadataNotFoundException( Metadata metadata, LocalRepository repository )
25      {
26          super( metadata, null, "Could not find metadata " + metadata + getString( " in ", repository ) );
27      }
28  
29      private static String getString( String prefix, LocalRepository repository )
30      {
31          if ( repository == null )
32          {
33              return "";
34          }
35          else
36          {
37              return prefix + repository.getId() + " (" + repository.getBasedir() + ")";
38          }
39      }
40  
41      public MetadataNotFoundException( Metadata metadata, RemoteRepository repository )
42      {
43          super( metadata, repository, "Could not find metadata " + metadata + getString( " in ", repository ) );
44      }
45  
46      public MetadataNotFoundException( Metadata metadata, RemoteRepository repository, String message )
47      {
48          super( metadata, repository, message );
49      }
50  
51  }