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