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.KeyManager;
020
021import org.forgerock.opendj.server.config.server.KeyManagerProviderCfg;
022import org.opends.server.api.KeyManagerProvider;
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 key manager provider that does not
029 * actually have the ability to provide a key manager.  It will be used when no
030 * other key manager provider has been defined in the server configuration.
031 */
032public class NullKeyManagerProvider
033       extends KeyManagerProvider<KeyManagerProviderCfg>{
034  /**
035   * Creates a new instance of this null key manager provider.  The
036   * <CODE>initializeKeyManagerProvider</CODE> method must be called on the
037   * resulting object before it may be used.
038   */
039  public NullKeyManagerProvider()
040  {
041    // No implementation is required.
042  }
043
044  @Override
045  public void initializeKeyManagerProvider(
046      KeyManagerProviderCfg configuration) throws ConfigException,
047      InitializationException {
048    // No implementation is required.
049  }
050
051  @Override
052  public void finalizeKeyManagerProvider()
053  {
054    // No implementation is required.
055  }
056
057  /**
058   * Retrieves a <CODE>KeyManager</CODE> object that may be used for
059   * interactions requiring access to a key manager.
060   *
061   * @return  A <CODE>KeyManager</CODE> object that may be used for interactions
062   *          requiring access to a key manager.
063   *
064   * @throws  DirectoryException  If a problem occurs while attempting to obtain
065   *                              the set of key managers.
066   */
067  @Override
068  public KeyManager[] getKeyManagers()
069         throws DirectoryException
070  {
071    return new KeyManager[0];
072  }
073}