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.RepositoryException;
12  import org.sonatype.aether.repository.RemoteRepository;
13  
14  /**
15   * Thrown in case of an unsupported remote repository type.
16   * 
17   * @author Benjamin Bentmann
18   */
19  public class NoRepositoryConnectorException
20      extends RepositoryException
21  {
22  
23      private final RemoteRepository repository;
24  
25      public NoRepositoryConnectorException( RemoteRepository repository )
26      {
27          this( repository, toMessage( repository ) );
28      }
29  
30      public NoRepositoryConnectorException( RemoteRepository repository, String message )
31      {
32          super( message );
33  
34          this.repository = repository;
35      }
36  
37      public NoRepositoryConnectorException( RemoteRepository repository, Throwable cause )
38      {
39          this( repository, toMessage( repository ), cause );
40      }
41  
42      public NoRepositoryConnectorException( RemoteRepository repository, String message, Throwable cause )
43      {
44          super( message, cause );
45  
46          this.repository = repository;
47      }
48  
49      private static String toMessage( RemoteRepository repository )
50      {
51          if ( repository != null )
52          {
53              return "No connector available to access repository " + repository.getId() + " (" + repository.getUrl()
54                  + ") of type " + repository.getContentType();
55          }
56          else
57          {
58              return "No connector available to access repository";
59          }
60      }
61  
62      public RemoteRepository getRepository()
63      {
64          return repository;
65      }
66  
67  }