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 org.forgerock.i18n.LocalizableMessage;
029
030
031
032import java.util.List;
033
034import org.opends.server.types.*;
035import org.forgerock.opendj.ldap.ResultCode;
036import org.forgerock.i18n.LocalizableMessageBuilder;
037
038
039/**
040 * This class defines a set of methods that are available for use by
041 * post-operation plugins for all types of operations.  Note that this
042 * interface is intended only to define an API for use by plugins and
043 * is not intended to be implemented by any custom classes.
044 */
045@org.opends.server.types.PublicAPI(
046     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
047     mayInstantiate=false,
048     mayExtend=false,
049     mayInvoke=true)
050public interface PostOperationOperation
051       extends PluginOperation
052{
053  /**
054   * Adds the provided control to the set of controls to include in
055   * the response to the client.
056   *
057   * @param  control  The control to add to the set of controls to
058   *                  include in the response to the client.
059   */
060  void addResponseControl(Control control);
061
062
063
064  /**
065   * Removes the provided control from the set of controls to include
066   * in the response to the client.
067   *
068   * @param  control  The control to remove from the set of controls
069   *                  to include in the response to the client.
070   */
071  void removeResponseControl(Control control);
072
073
074
075  /**
076   * Retrieves the result code for this operation.
077   *
078   * @return  The result code associated for this operation, or
079   *          <CODE>UNDEFINED</CODE> if the operation has not yet
080   *          completed.
081   */
082  ResultCode getResultCode();
083
084
085
086  /**
087   * Specifies the result code for this operation.
088   *
089   * @param  resultCode  The result code for this operation.
090   */
091  void setResultCode(ResultCode resultCode);
092
093
094
095  /**
096   * Retrieves the error message for this operation.  Its contents may
097   * be altered by the caller.
098   *
099   * @return  The error message for this operation.
100   */
101  LocalizableMessageBuilder getErrorMessage();
102
103
104
105  /**
106   * Specifies the error message for this operation.
107   *
108   * @param  errorMessage  The error message for this operation.
109   */
110  void setErrorMessage(LocalizableMessageBuilder errorMessage);
111
112
113
114  /**
115   * Appends the provided message to the error message buffer.  If the
116   * buffer has not yet been created, then this will create it first
117   * and then add the provided message.
118   *
119   * @param  message  The message to append to the error message
120   */
121  void appendErrorMessage(LocalizableMessage message);
122
123
124
125  /**
126   * Retrieves the matched DN for this operation.
127   *
128   * @return  The matched DN for this operation, or <CODE>null</CODE>
129   *          if the operation has not yet completed or does not have
130   *          a matched DN.
131   */
132  DN getMatchedDN();
133
134
135
136  /**
137   * Specifies the matched DN for this operation.
138   *
139   * @param  matchedDN  The matched DN for this operation.
140   */
141  void setMatchedDN(DN matchedDN);
142
143
144
145  /**
146   * Retrieves the set of referral URLs for this operation.  Its
147   * contents must not be altered by the caller.
148   *
149   * @return  The set of referral URLs for this operation, or
150   *          <CODE>null</CODE> if the operation is not yet complete
151   *          or does not have a set of referral URLs.
152   */
153  List<String> getReferralURLs();
154
155
156
157  /**
158   * Specifies the set of referral URLs for this operation.
159   *
160   * @param  referralURLs  The set of referral URLs for this operation.
161   */
162  void setReferralURLs(List<String> referralURLs);
163
164
165
166  /**
167   * Sets the response elements for this operation based on the
168   * information contained in the provided
169   * <CODE>DirectoryException</CODE> object.
170   *
171   * @param  directoryException  The exception containing the
172   *                             information to use for the response elements.
173   */
174  void setResponseData(DirectoryException directoryException);
175
176
177
178  /**
179   * Retrieves the authorization DN for this operation.  In many
180   * cases, it will be the same as the DN of the authenticated user
181   * for the underlying connection, or the null DN if no
182   * authentication has been performed on that connection.  However,
183   * it may be some other value if special processing has been
184   * requested (e.g., the operation included a proxied authorization
185   * control).
186   *
187   * @return  The authorization DN for this operation.
188   */
189  DN getAuthorizationDN();
190
191
192
193  /**
194   * Returns an unmodifiable list containing the additional log items for this
195   * operation, which should be written to the log but not included in the
196   * response to the client.
197   *
198   * @return An unmodifiable list containing the additional log items for this
199   *         operation.
200   */
201  List<AdditionalLogItem> getAdditionalLogItems();
202
203
204
205  /**
206   * Adds an additional log item to this operation, which should be written to
207   * the log but not included in the response to the client. This method may not
208   * be called by post-response plugins.
209   *
210   * @param item
211   *          The additional log item for this operation.
212   */
213  void addAdditionalLogItem(AdditionalLogItem item);
214}
215