1 /*******************************************************************************
2 * Copyright (c) 2010, 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
.repository
;
13 import org
.eclipse
.aether
.RepositoryException
;
16 * Thrown in case of an unsupported local repository type.
18 public class NoLocalRepositoryManagerException
19 extends RepositoryException
22 private final transient LocalRepository repository
;
25 * Creates a new exception with the specified repository.
27 * @param repository The local repository for which no support is available, may be {@code null}.
29 public NoLocalRepositoryManagerException( LocalRepository repository
)
31 this( repository
, toMessage( repository
) );
35 * Creates a new exception with the specified repository and detail message.
37 * @param repository The local repository for which no support is available, may be {@code null}.
38 * @param message The detail message, may be {@code null}.
40 public NoLocalRepositoryManagerException( LocalRepository repository
, String message
)
43 this.repository
= repository
;
47 * Creates a new exception with the specified repository and cause.
49 * @param repository The local repository for which no support is available, may be {@code null}.
50 * @param cause The exception that caused this one, may be {@code null}.
52 public NoLocalRepositoryManagerException( LocalRepository repository
, Throwable cause
)
54 this( repository
, toMessage( repository
), cause
);
58 * Creates a new exception with the specified repository, detail message and cause.
60 * @param repository The local repository for which no support is available, may be {@code null}.
61 * @param message The detail message, may be {@code null}.
62 * @param cause The exception that caused this one, may be {@code null}.
64 public NoLocalRepositoryManagerException( LocalRepository repository
, String message
, Throwable cause
)
66 super( message
, cause
);
67 this.repository
= repository
;
70 private static String
toMessage( LocalRepository repository
)
72 if ( repository
!= null )
74 return "No manager available for local repository (" + repository
.getBasedir().getAbsolutePath()
75 + ") of type " + repository
.getContentType();
79 return "No manager available for local repository";
84 * Gets the local repository whose content type is not supported.
86 * @return The unsupported local repository or {@code null} if unknown.
88 public LocalRepository
getRepository()