001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2008 Sun Microsystems, Inc.
025 */
026package org.opends.server.admin;
027
028
029
030/**
031 * This interface is used to determine the "best match" managed object
032 * definition in a definition hierarchy.
033 * <p>
034 * Managed object definitions, like Java classes, are arranged in an
035 * inheritance hierarchy. When managed objects are decoded (e.g. from
036 * LDAP entries), the driver implementation is provided with an
037 * "expected managed object definition". However, the actual decoded
038 * managed object is often an instance of a sub-type of this
039 * definition. For example, when decoding a connection handler managed
040 * object, the actual type can never be a connection handler because
041 * it is an abstract managed object type. Instead, the decoded managed
042 * object must be a "concrete" sub-type: an LDAP connection handler or
043 * JMX connection handler.
044 * <p>
045 * This resolution process is coordinated by the
046 * <code>resolveManagedObjectDefinition</code> method in managed
047 * object definitions, where it is passed a
048 * <code>DefinitionResolver</code> implementation. The
049 * <code>resolveManagedObjectDefinition</code> method takes care of
050 * recursively descending through the definition hierarchy and invokes
051 * the {@link #matches(AbstractManagedObjectDefinition)} method
052 * against each potential sub-type. It is the job of the resolver to
053 * indicate whether the provided managed object definition is a
054 * candidate definition. For example, the LDAP driver provides a
055 * definition resolver which uses the decoded LDAP entry's object
056 * classes to determine the final appropriate managed object
057 * definition.
058 */
059public interface DefinitionResolver {
060
061  /**
062   * Determines whether or not the provided managed object definition matches
063   * this resolver's criteria.
064   *
065   * @param d
066   *          The managed object definition.
067   * @return Returns <code>true</code> if the the provided managed object
068   *         definition matches this resolver's criteria.
069   */
070  boolean matches(AbstractManagedObjectDefinition<?, ?> d);
071}