1 /*******************************************************************************
2 * Copyright (c) 2012, 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 when a transfer could not be performed because a remote repository is not accessible in offline mode.
19 public class RepositoryOfflineException
20 extends RepositoryException
23 private final transient RemoteRepository repository
;
25 private static String
getMessage( RemoteRepository repository
)
27 if ( repository
== null )
29 return "Cannot access remote repositories in offline mode";
33 return "Cannot access " + repository
.getId() + " (" + repository
.getUrl() + ") in offline mode";
38 * Creates a new exception with the specified repository.
40 * @param repository The inaccessible remote repository, may be {@code null}.
42 public RepositoryOfflineException( RemoteRepository repository
)
44 super( getMessage( repository
) );
45 this.repository
= repository
;
49 * Creates a new exception with the specified repository and detail message.
51 * @param repository The inaccessible remote repository, may be {@code null}.
52 * @param message The detail message, may be {@code null}.
54 public RepositoryOfflineException( RemoteRepository repository
, String message
)
57 this.repository
= repository
;
61 * Gets the remote repository that could not be accessed due to offline mode.
63 * @return The inaccessible remote repository or {@code null} if unknown.
65 public RemoteRepository
getRepository()