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-2009 Sun Microsystems, Inc.
025 */
026package org.forgerock.opendj.config;
027
028/**
029 * A strategy for serializing managed object paths.
030 * <p>
031 * This interface provides a generic means for serializing managed object paths
032 * into application specific forms. For example, a JNDI client would use this
033 * interface to construct <code>LdapName</code> objects from a path. Similarly,
034 * on the server side, a serialization strategy is used to construct
035 * <code>DN</code> instances from a path.
036 * <p>
037 * During serialization the serializer is invoked for each element in the
038 * managed object path in big-endian order, starting from the root and
039 * proceeding down to the leaf element.
040 */
041public interface ManagedObjectPathSerializer {
042
043    /**
044     * Append a managed object path element identified by an instantiable
045     * relation and an instance name.
046     *
047     * @param <C>
048     *            The type of client managed object configuration that this path
049     *            element references.
050     * @param <S>
051     *            The type of server managed object configuration that this path
052     *            element references.
053     * @param r
054     *            The instantiable relation.
055     * @param d
056     *            The managed object definition.
057     * @param name
058     *            The instance name.
059     */
060    <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
061        InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d, String name);
062
063    /**
064     * Append a managed object path element identified by an optional relation.
065     *
066     * @param <C>
067     *            The type of client managed object configuration that this path
068     *            element references.
069     * @param <S>
070     *            The type of server managed object configuration that this path
071     *            element references.
072     * @param r
073     *            The optional relation.
074     * @param d
075     *            The managed object definition.
076     */
077    <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
078        OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
079
080    /**
081     * Append a managed object path element identified by a singleton relation.
082     *
083     * @param <C>
084     *            The type of client managed object configuration that this path
085     *            element references.
086     * @param <S>
087     *            The type of server managed object configuration that this path
088     *            element references.
089     * @param r
090     *            The singleton relation.
091     * @param d
092     *            The managed object definition.
093     */
094    <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
095        SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
096
097    /**
098     * Append a managed object path element identified by a set relation.
099     *
100     * @param <C>
101     *            The type of client managed object configuration that this path
102     *            element references.
103     * @param <S>
104     *            The type of server managed object configuration that this path
105     *            element references.
106     * @param r
107     *            The set relation.
108     * @param d
109     *            The managed object definition.
110     */
111    <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
112        SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d);
113
114}