4015N/A/*
4015N/A * CDDL HEADER START
4015N/A *
4015N/A * The contents of this file are subject to the terms of the
4015N/A * Common Development and Distribution License, Version 1.0 only
4015N/A * (the "License"). You may not use this file except in compliance
4015N/A * with the License.
4015N/A *
4015N/A * You can obtain a copy of the license at
4015N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
4015N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
4015N/A * See the License for the specific language governing permissions
4015N/A * and limitations under the License.
4015N/A *
4015N/A * When distributing Covered Code, include this CDDL HEADER in each
4015N/A * file and include the License file at
4015N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
4015N/A * add the following below this CDDL HEADER, with the fields enclosed
4015N/A * by brackets "[]" replaced with your own identifying information:
4015N/A * Portions Copyright [yyyy] [name of copyright owner]
4015N/A *
4015N/A * CDDL HEADER END
4015N/A *
4015N/A *
4015N/A * Copyright 2008 Sun Microsystems, Inc.
4015N/A */
4015N/Apackage org.opends.server.api;
4015N/A
4015N/A
4015N/Aimport java.util.Collection;
4015N/Aimport java.util.List;
4015N/A
4015N/Aimport org.opends.server.admin.std.server.MatchingRuleCfg;
4015N/Aimport org.opends.server.config.ConfigException;
4015N/Aimport org.opends.messages.Message;
4015N/Aimport org.opends.server.types.InitializationException;
4015N/A
4015N/A/**
4015N/A * This class defines the set of methods and structures that must be
4015N/A * implemented by a Directory Server module that implements a matching
4015N/A * rule factory.
4015N/A *
4015N/A * @param <T> The type of configuration handled by this matching
4015N/A * rule.
4015N/A */
4015N/A@org.opends.server.types.PublicAPI(
4015N/A stability=org.opends.server.types.StabilityLevel.VOLATILE,
4015N/A mayInstantiate=false,
4015N/A mayExtend=true,
4015N/A mayInvoke=false)
4015N/Apublic abstract class MatchingRuleFactory<T extends MatchingRuleCfg>
4015N/A{
4015N/A
4015N/A /**
4015N/A * Initializes the matching rule(s) based on the information in the
4015N/A * provided configuration entry.
4015N/A *
4015N/A * @param configuration The configuration to use to intialize this
4015N/A * matching rule.
4015N/A *
4015N/A * @throws ConfigException If an unrecoverable problem arises in
4015N/A * the process of performing the
4015N/A * initialization.
4015N/A *
4015N/A * @throws InitializationException If a problem that is not
4015N/A * configuration-related occurs
4015N/A * during initialization.
4015N/A */
4015N/A public abstract void initializeMatchingRule(T configuration)
4015N/A throws ConfigException, InitializationException;
4015N/A
4015N/A
4015N/A
4015N/A /**
4015N/A * Performs any finalization that may be needed whenever this
4015N/A * matching rule factory is taken out of service.
4015N/A */
4015N/A public void finalizeMatchingRule()
4015N/A {
4015N/A //No implementation is required by default.
4015N/A }
4015N/A
4015N/A
4015N/A
4015N/A /**
4015N/A * Indicates whether the provided configuration is acceptable for
4015N/A * this matching rule. It should be possible to call this method on
4015N/A * an uninitialized matching rule instance in order to determine
4015N/A * whether the matching rule would be able to use the provided
4015N/A * configuration.
4015N/A * <BR><BR>
4015N/A * Note that implementations which use a subclass of the provided
4015N/A * configuration class will likely need to cast the configuration
4015N/A * to the appropriate subclass type.
4015N/A *
4015N/A * @param configuration The matching rule configuration for
4015N/A * which to make the determination.
4015N/A * @param unacceptableReasons A list that may be used to hold the
4015N/A * reasons that the provided
4015N/A * configuration is not acceptable.
4015N/A *
4015N/A * @return {@code true} if the provided configuration is acceptable
4015N/A * for this matching rule, or {@code false} if not.
4015N/A */
4015N/A public boolean isConfigurationAcceptable(
4015N/A T configuration,
4015N/A List<Message> unacceptableReasons)
4015N/A {
4015N/A // This default implementation does not perform any special
4015N/A // validation. It should be overridden by matching rule
4015N/A // implementations that wish to perform more detailed validation.
4015N/A return true;
4015N/A }
4015N/A
4015N/A
4015N/A
4015N/A /**
4015N/A * Returns an umodifiable view of Collection of associated
4015N/A * MatchingRules.
4015N/A *
4015N/A * @return An unmodifiable view of Collection of
4015N/A * MatchingRule instances.
4015N/A */
4015N/A public abstract Collection<MatchingRule> getMatchingRules();
4015N/A}