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