001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2013 ForgeRock AS. 015 */ 016 017package org.forgerock.opendj.ldap; 018 019import org.forgerock.opendj.ldap.spi.Provider; 020 021/** 022 * Exception thrown when a provider of a service can't be found. 023 */ 024@SuppressWarnings("serial") 025public class ProviderNotFoundException extends RuntimeException { 026 027 private final Class<? extends Provider> providerType; 028 private final String providerName; 029 030 /** 031 * Creates the exception with a provider type, provider name and a message. 032 * 033 * @param providerClass 034 * the provider class 035 * @param providerName 036 * the name of the provider implementation that was requested 037 * @param message 038 * the detail message 039 */ 040 public ProviderNotFoundException(final Class<? extends Provider> providerClass, final String providerName, 041 final String message) { 042 super(message); 043 this.providerType = providerClass; 044 this.providerName = providerName; 045 } 046 047 /** 048 * Returns the type of provider. 049 * 050 * @return the provider class 051 */ 052 public Class<?> getProviderType() { 053 return providerType; 054 } 055 056 /** 057 * Returns the name of provider. 058 * 059 * @return the name of the provider implementation that was requested, or 060 * null if the default provider was requested. 061 */ 062 public String getProviderName() { 063 return providerName; 064 } 065 066}