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