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