1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.transfer
;
13 import org
.eclipse
.aether
.RepositoryException
;
14 import org
.eclipse
.aether
.repository
.RemoteRepository
;
17 * Thrown in case of an unsupported transport protocol.
19 public class NoTransporterException
20 extends RepositoryException
23 private final transient RemoteRepository repository
;
26 * Creates a new exception with the specified repository.
28 * @param repository The remote repository whose transport layout is not supported, may be {@code null}.
30 public NoTransporterException( RemoteRepository repository
)
32 this( repository
, toMessage( repository
) );
36 * Creates a new exception with the specified repository and detail message.
38 * @param repository The remote repository whose transport layout is not supported, may be {@code null}.
39 * @param message The detail message, may be {@code null}.
41 public NoTransporterException( RemoteRepository repository
, String message
)
44 this.repository
= repository
;
48 * Creates a new exception with the specified repository and cause.
50 * @param repository The remote repository whose transport layout is not supported, may be {@code null}.
51 * @param cause The exception that caused this one, may be {@code null}.
53 public NoTransporterException( RemoteRepository repository
, Throwable cause
)
55 this( repository
, toMessage( repository
), cause
);
59 * Creates a new exception with the specified repository, detail message and cause.
61 * @param repository The remote repository whose transport layout is not supported, may be {@code null}.
62 * @param message The detail message, may be {@code null}.
63 * @param cause The exception that caused this one, may be {@code null}.
65 public NoTransporterException( RemoteRepository repository
, String message
, Throwable cause
)
67 super( message
, cause
);
68 this.repository
= repository
;
71 private static String
toMessage( RemoteRepository repository
)
73 if ( repository
!= null )
75 return "Unsupported transport protocol " + repository
.getProtocol();
79 return "Unsupported transport protocol";
84 * Gets the remote repository whose transport protocol is not supported.
86 * @return The unsupported remote repository or {@code null} if unknown.
88 public RemoteRepository
getRepository()