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 2008 Sun Microsystems, Inc.
015 */
016package org.forgerock.opendj.config;
017
018/**
019 * This interface is used to determine the "best match" managed object
020 * definition in a definition hierarchy.
021 * <p>
022 * Managed object definitions, like Java classes, are arranged in an inheritance
023 * hierarchy. When managed objects are decoded (e.g. from LDAP entries), the
024 * driver implementation is provided with an
025 * "expected managed object definition". However, the actual decoded managed
026 * object is often an instance of a sub-type of this definition. For example,
027 * when decoding a connection handler managed object, the actual type can never
028 * be a connection handler because it is an abstract managed object type.
029 * Instead, the decoded managed object must be a "concrete" sub-type: an LDAP
030 * connection handler or JMX connection handler.
031 * <p>
032 * This resolution process is coordinated by the
033 * <code>resolveManagedObjectDefinition</code> method in managed object
034 * definitions, where it is passed a <code>DefinitionResolver</code>
035 * implementation. The <code>resolveManagedObjectDefinition</code> method takes
036 * care of recursively descending through the definition hierarchy and invokes
037 * the {@link #matches(AbstractManagedObjectDefinition)} method against each
038 * potential sub-type. It is the job of the resolver to indicate whether the
039 * provided managed object definition is a candidate definition. For example,
040 * the LDAP driver provides a definition resolver which uses the decoded LDAP
041 * entry's object classes to determine the final appropriate managed object
042 * definition.
043 */
044public interface DefinitionResolver {
045
046    /**
047     * Determines whether or not the provided managed object definition matches
048     * this resolver's criteria.
049     *
050     * @param d
051     *            The managed object definition.
052     * @return Returns <code>true</code> if the the provided managed object
053     *         definition matches this resolver's criteria.
054     */
055    boolean matches(AbstractManagedObjectDefinition<?, ?> d);
056}