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.server.ConfigurationChangeListener;
022import org.forgerock.opendj.ldap.DN;
023import org.forgerock.opendj.ldap.schema.AttributeType;
024
025
026
027/**
028 * A server-side interface for querying Regular Expression Identity
029 * Mapper settings.
030 * <p>
031 * The Regular Expression Identity Mapper provides a way to use a
032 * regular expression to translate the provided identifier when
033 * searching for the appropriate user entry.
034 */
035public interface RegularExpressionIdentityMapperCfg extends IdentityMapperCfg {
036
037  /**
038   * Gets the configuration class associated with this Regular Expression Identity Mapper.
039   *
040   * @return Returns the configuration class associated with this Regular Expression Identity Mapper.
041   */
042  Class<? extends RegularExpressionIdentityMapperCfg> configurationClass();
043
044
045
046  /**
047   * Register to be notified when this Regular Expression Identity Mapper is changed.
048   *
049   * @param listener
050   *          The Regular Expression Identity Mapper configuration change listener.
051   */
052  void addRegularExpressionChangeListener(ConfigurationChangeListener<RegularExpressionIdentityMapperCfg> listener);
053
054
055
056  /**
057   * Deregister an existing Regular Expression Identity Mapper configuration change listener.
058   *
059   * @param listener
060   *          The Regular Expression Identity Mapper configuration change listener.
061   */
062  void removeRegularExpressionChangeListener(ConfigurationChangeListener<RegularExpressionIdentityMapperCfg> listener);
063
064
065
066  /**
067   * Gets the "java-class" property.
068   * <p>
069   * Specifies the fully-qualified name of the Java class that
070   * provides the Regular Expression Identity Mapper implementation.
071   *
072   * @return Returns the value of the "java-class" property.
073   */
074  String getJavaClass();
075
076
077
078  /**
079   * Gets the "match-attribute" property.
080   * <p>
081   * Specifies the name or OID of the attribute whose value should
082   * match the provided identifier string after it has been processed
083   * by the associated regular expression.
084   * <p>
085   * All values must refer to the name or OID of an attribute type
086   * defined in the directory server schema. If multiple attributes or
087   * OIDs are provided, at least one of those attributes must contain
088   * the provided ID string value in exactly one entry.
089   *
090   * @return Returns an unmodifiable set containing the values of the "match-attribute" property.
091   */
092  SortedSet<AttributeType> getMatchAttribute();
093
094
095
096  /**
097   * Gets the "match-base-dn" property.
098   * <p>
099   * Specifies the base DN(s) that should be used when performing
100   * searches to map the provided ID string to a user entry. If
101   * multiple values are given, searches are performed below all the
102   * specified base DNs.
103   *
104   * @return Returns an unmodifiable set containing the values of the "match-base-dn" property.
105   */
106  SortedSet<DN> getMatchBaseDN();
107
108
109
110  /**
111   * Gets the "match-pattern" property.
112   * <p>
113   * Specifies the regular expression pattern that is used to identify
114   * portions of the ID string that will be replaced.
115   * <p>
116   * Any portion of the ID string that matches this pattern is
117   * replaced in accordance with the provided replace pattern (or is
118   * removed if no replace pattern is specified). If multiple
119   * substrings within the given ID string match this pattern, all
120   * occurrences are replaced. If no part of the given ID string
121   * matches this pattern, the ID string is not altered. Exactly one
122   * match pattern value must be provided, and it must be a valid
123   * regular expression as described in the API documentation for the
124   * java.util.regex.Pattern class, including support for capturing
125   * groups.
126   *
127   * @return Returns the value of the "match-pattern" property.
128   */
129  String getMatchPattern();
130
131
132
133  /**
134   * Gets the "replace-pattern" property.
135   * <p>
136   * Specifies the replacement pattern that should be used for
137   * substrings in the ID string that match the provided regular
138   * expression pattern.
139   * <p>
140   * If no replacement pattern is provided, then any matching portions
141   * of the ID string will be removed (i.e., replaced with an empty
142   * string). The replacement pattern may include a string from a
143   * capturing group by using a dollar sign ($) followed by an integer
144   * value that indicates which capturing group should be used.
145   *
146   * @return Returns the value of the "replace-pattern" property.
147   */
148  String getReplacePattern();
149
150}