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