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 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2011-2015 ForgeRock AS.
026 */
027package org.opends.server.types.operation;
028import java.util.List;
029
030import org.forgerock.i18n.LocalizableMessage;
031
032
033import org.opends.server.types.AdditionalLogItem;
034import org.opends.server.types.Control;
035import org.opends.server.types.DN;
036
037import org.forgerock.i18n.LocalizableMessageBuilder;
038
039
040/**
041 * This class defines a set of methods that are available for use by
042 * pre-operation plugins for all types of operations.  Note that this
043 * interface is intended only to define an API for use by plugins and
044 * is not intended to be implemented by any custom classes.
045 */
046@org.opends.server.types.PublicAPI(
047     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
048     mayInstantiate=false,
049     mayExtend=false,
050     mayInvoke=true)
051public interface PreOperationOperation
052       extends PluginOperation
053{
054  /**
055   * Adds the provided control to the set of controls to include in
056   * the response to the client.
057   *
058   * @param  control  The control to add to the set of controls to
059   *                  include in the response to the client.
060   */
061  void addResponseControl(Control control);
062
063
064
065  /**
066   * Removes the provided control from the set of controls to include
067   * in the response to the client.
068   *
069   * @param  control  The control to remove from the set of controls
070   *                  to include in the response to the client.
071   */
072  void removeResponseControl(Control control);
073
074
075
076  /**
077   * Retrieves the error message for this operation.  Its contents may
078   * be altered by the caller.
079   *
080   * @return  The error message for this operation.
081   */
082  LocalizableMessageBuilder getErrorMessage();
083
084
085
086  /**
087   * Specifies the error message for this operation.
088   *
089   * @param  errorMessage  The error message for this operation.
090   */
091  void setErrorMessage(LocalizableMessageBuilder errorMessage);
092
093
094
095  /**
096   * Appends the provided message to the error message buffer.  If the
097   * buffer has not yet been created, then this will create it first
098   * and then add the provided message.
099   *
100   * @param  message  The message to append to the error message
101   *                  buffer.
102   */
103  void appendErrorMessage(LocalizableMessage message);
104
105
106
107  /**
108   * Retrieves the authorization DN for this operation.  In many
109   * cases, it will be the same as the DN of the authenticated user
110   * for the underlying connection, or the null DN if no
111   * authentication has been performed on that connection.  However,
112   * it may be some other value if special processing has been
113   * requested (e.g., the operation included a proxied authorization
114   * control).
115   *
116   * @return  The authorization DN for this operation.
117   */
118  DN getAuthorizationDN();
119
120
121
122  /**
123   * Returns an unmodifiable list containing the additional log items for this
124   * operation, which should be written to the log but not included in the
125   * response to the client.
126   *
127   * @return An unmodifiable list containing the additional log items for this
128   *         operation.
129   */
130  List<AdditionalLogItem> getAdditionalLogItems();
131
132
133
134  /**
135   * Adds an additional log item to this operation, which should be written to
136   * the log but not included in the response to the client. This method may not
137   * be called by post-response plugins.
138   *
139   * @param item
140   *          The additional log item for this operation.
141   */
142  void addAdditionalLogItem(AdditionalLogItem item);
143}
144