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 Sun Microsystems, Inc.
025 */
026package org.forgerock.opendj.config;
027
028import org.forgerock.opendj.config.client.ManagedObject;
029import org.forgerock.opendj.config.server.ServerManagedObject;
030
031/**
032 * Defines the structure of a managed object which can be instantiated.
033 *
034 * @param <C>
035 *            The type of client managed object configuration that this
036 *            definition represents.
037 * @param <S>
038 *            The type of server managed object configuration that this
039 *            definition represents.
040 */
041public abstract class ManagedObjectDefinition<C extends ConfigurationClient, S extends Configuration> extends
042    AbstractManagedObjectDefinition<C, S> {
043
044    /**
045     * Create a new managed object definition.
046     *
047     * @param name
048     *            The name of the definition.
049     * @param parent
050     *            The parent definition, or <code>null</code> if there is no
051     *            parent.
052     */
053    protected ManagedObjectDefinition(String name, AbstractManagedObjectDefinition<? super C, ? super S> parent) {
054        super(name, parent);
055    }
056
057    /**
058     * Creates a client configuration view of the provided managed object.
059     * Modifications made to the underlying managed object will be reflected in
060     * the client configuration view and vice versa.
061     *
062     * @param managedObject
063     *            The managed object.
064     * @return Returns a client configuration view of the provided managed
065     *         object.
066     */
067    public abstract C createClientConfiguration(ManagedObject<? extends C> managedObject);
068
069    /**
070     * Creates a server configuration view of the provided server managed
071     * object.
072     *
073     * @param managedObject
074     *            The server managed object.
075     * @return Returns a server configuration view of the provided server
076     *         managed object.
077     */
078    public abstract S createServerConfiguration(ServerManagedObject<? extends S> managedObject);
079
080    /**
081     * Gets the server configuration class instance associated with this managed
082     * object definition.
083     *
084     * @return Returns the server configuration class instance associated with
085     *         this managed object definition.
086     */
087    public abstract Class<S> getServerConfigurationClass();
088}