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 2009 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.server.api.plugin;
018
019import java.util.List;
020import java.util.Set;
021
022import org.forgerock.i18n.LocalizableMessage;
023import org.forgerock.opendj.config.server.ConfigException;
024import org.forgerock.opendj.ldap.DN;
025import org.forgerock.opendj.server.config.server.PluginCfg;
026import org.opends.server.core.DirectoryServer;
027import org.opends.server.types.InitializationException;
028
029/**
030 * An internal directory server plugin which can be registered with
031 * the server without requiring any associated configuration.
032 */
033public abstract class InternalDirectoryServerPlugin extends
034    DirectoryServerPlugin<PluginCfg>
035{
036  /**
037   * Creates a new internal directory server plugin using the provided
038   * component name and plugin types.
039   *
040   * @param componentDN
041   *          The configuration entry name of the component associated
042   *          with this internal plugin.
043   * @param pluginTypes
044   *          The set of plugin types for which this internal plugin
045   *          is registered.
046   * @param invokeForInternalOps
047   *          Indicates whether this internal plugin should be invoked
048   *          for internal operations.
049   */
050  protected InternalDirectoryServerPlugin(DN componentDN,
051      Set<PluginType> pluginTypes, boolean invokeForInternalOps)
052  {
053    // TODO: server context should be provided in constructor
054    initializeInternal(DirectoryServer.getInstance().getServerContext(), componentDN, pluginTypes,
055        invokeForInternalOps);
056  }
057
058  @Override
059  public final void initializePlugin(Set<PluginType> pluginTypes,
060      PluginCfg configuration) throws ConfigException,
061      InitializationException
062  {
063    // Unused.
064  }
065
066  @Override
067  public final boolean isConfigurationAcceptable(
068      PluginCfg configuration, List<LocalizableMessage> unacceptableReasons)
069  {
070    // Unused.
071    return true;
072  }
073}