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