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.server.config.server;
017
018
019
020import java.util.SortedSet;
021import org.forgerock.opendj.config.Configuration;
022import org.forgerock.opendj.config.server.ConfigException;
023import org.forgerock.opendj.config.server.ConfigurationAddListener;
024import org.forgerock.opendj.config.server.ConfigurationChangeListener;
025import org.forgerock.opendj.config.server.ConfigurationDeleteListener;
026import org.forgerock.opendj.server.config.meta.RootDNCfgDefn.DefaultRootPrivilegeName;
027
028
029
030/**
031 * A server-side interface for querying Root DN settings.
032 * <p>
033 * The Root DN configuration contains all the Root DN Users defined in
034 * the directory server. In addition, it also defines the default set
035 * of privileges that Root DN Users automatically inherit.
036 */
037public interface RootDNCfg extends Configuration {
038
039  /**
040   * Gets the configuration class associated with this Root DN.
041   *
042   * @return Returns the configuration class associated with this Root DN.
043   */
044  Class<? extends RootDNCfg> configurationClass();
045
046
047
048  /**
049   * Register to be notified when this Root DN is changed.
050   *
051   * @param listener
052   *          The Root DN configuration change listener.
053   */
054  void addChangeListener(ConfigurationChangeListener<RootDNCfg> listener);
055
056
057
058  /**
059   * Deregister an existing Root DN configuration change listener.
060   *
061   * @param listener
062   *          The Root DN configuration change listener.
063   */
064  void removeChangeListener(ConfigurationChangeListener<RootDNCfg> listener);
065
066
067
068  /**
069   * Gets the "default-root-privilege-name" property.
070   * <p>
071   * Specifies the names of the privileges that root users will be
072   * granted by default.
073   *
074   * @return Returns an unmodifiable set containing the values of the "default-root-privilege-name" property.
075   */
076  SortedSet<DefaultRootPrivilegeName> getDefaultRootPrivilegeName();
077
078
079
080  /**
081   * Lists the Root DN Users.
082   *
083   * @return Returns an array containing the names of the
084   *         Root DN Users.
085   */
086  String[] listRootDNUsers();
087
088
089
090  /**
091   * Gets the named Root DN User.
092   *
093   * @param name
094   *          The name of the Root DN User to retrieve.
095   * @return Returns the named Root DN User.
096   * @throws ConfigException
097   *           If the Root DN User could not be found or it
098   *           could not be successfully decoded.
099   */
100  RootDNUserCfg getRootDNUser(String name) throws ConfigException;
101
102
103
104  /**
105   * Registers to be notified when new Root DN Users are added.
106   *
107   * @param listener
108   *          The Root DN User configuration add listener.
109   * @throws ConfigException
110   *          If the add listener could not be registered.
111   */
112  void addRootDNUserAddListener(ConfigurationAddListener<RootDNUserCfg> listener) throws ConfigException;
113
114
115
116  /**
117   * Deregisters an existing Root DN User configuration add listener.
118   *
119   * @param listener
120   *          The Root DN User configuration add listener.
121   */
122  void removeRootDNUserAddListener(ConfigurationAddListener<RootDNUserCfg> listener);
123
124
125
126  /**
127   * Registers to be notified when existing Root DN Users are deleted.
128   *
129   * @param listener
130   *          The Root DN User configuration delete listener.
131   * @throws ConfigException
132   *          If the delete listener could not be registered.
133   */
134  void addRootDNUserDeleteListener(ConfigurationDeleteListener<RootDNUserCfg> listener) throws ConfigException;
135
136
137
138  /**
139   * Deregisters an existing Root DN User configuration delete listener.
140   *
141   * @param listener
142   *          The Root DN User configuration delete listener.
143   */
144  void removeRootDNUserDeleteListener(ConfigurationDeleteListener<RootDNUserCfg> listener);
145
146}