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 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.server.extensions;
018
019import javax.net.ssl.TrustManager;
020
021import org.forgerock.opendj.server.config.server.TrustManagerProviderCfg;
022import org.opends.server.api.TrustManagerProvider;
023import org.forgerock.opendj.config.server.ConfigException;
024import org.opends.server.types.DirectoryException;
025import org.opends.server.types.InitializationException;
026
027/**
028 * This class provides an implementation of a trust manager provider that does
029 * not actually have the ability to provide a trust manager.  It will be used
030 * when no other trust manager provider has been defined in the server
031 * configuration.
032 */
033public class NullTrustManagerProvider
034       extends TrustManagerProvider<TrustManagerProviderCfg>
035{
036  /**
037   * Creates a new instance of this null trust manager provider.  The
038   * <CODE>initializeTrustManagerProvider</CODE> method must be called on the
039   * resulting object before it may be used.
040   */
041  public NullTrustManagerProvider()
042  {
043    // No implementation is required.
044  }
045
046  @Override
047  public void initializeTrustManagerProvider(
048                     TrustManagerProviderCfg configuration)
049         throws ConfigException, InitializationException
050  {
051    // No implementation is required.
052  }
053
054  @Override
055  public void finalizeTrustManagerProvider()
056  {
057    // No implementation is required.
058  }
059
060  /**
061   * Retrieves a <CODE>TrustManager</CODE> object that may be used for
062   * interactions requiring access to a trust manager.
063   *
064   * @return  A <CODE>TrustManager</CODE> object that may be used for
065   *          interactions requiring access to a trust manager.
066   *
067   * @throws  DirectoryException  If a problem occurs while attempting to obtain
068   *                              the set of trust managers.
069   */
070  @Override
071  public TrustManager[] getTrustManagers()
072         throws DirectoryException
073  {
074    return new TrustManager[0];
075  }
076}