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-2015 ForgeRock AS.
016 */
017package org.opends.server.types.operation;
018
019import java.util.List;
020
021import org.forgerock.i18n.LocalizableMessage;
022import org.forgerock.i18n.LocalizableMessageBuilder;
023import org.opends.server.types.AdditionalLogItem;
024import org.opends.server.types.Control;
025
026/**
027 * This class defines a set of methods that are available for use by
028 * pre-parse plugins for all types of operations.  Note that this
029 * interface is intended only to define an API for use by plugins and
030 * is not intended to be implemented by any custom classes.
031 */
032@org.opends.server.types.PublicAPI(
033     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
034     mayInstantiate=false,
035     mayExtend=false,
036     mayInvoke=true)
037public interface PreParseOperation
038       extends PluginOperation
039{
040  /**
041   * Adds the provided control to the set of request controls for this
042   * operation.
043   *
044   * @param  control  The control to add to the set of request
045   *                  controls for this operation.
046   */
047  void addRequestControl(Control control);
048
049
050
051  /**
052   * Adds the provided control to the set of controls to include in
053   * the response to the client.
054   *
055   * @param  control  The control to add to the set of controls to
056   *                  include in the response to the client.
057   */
058  void addResponseControl(Control control);
059
060
061
062  /**
063   * Removes the provided control from the set of controls to include
064   * in the response to the client.
065   *
066   * @param  control  The control to remove from the set of controls
067   *                  to include in the response to the client.
068   */
069  void removeResponseControl(Control control);
070
071
072
073  /**
074   * Retrieves the error message for this operation.  Its contents may
075   * be altered by the caller.
076   *
077   * @return  The error message for this operation.
078   */
079  LocalizableMessageBuilder getErrorMessage();
080
081
082
083  /**
084   * Specifies the error message for this operation.
085   *
086   * @param  errorMessage  The error message for this operation.
087   */
088  void setErrorMessage(LocalizableMessageBuilder errorMessage);
089
090
091
092  /**
093   * Appends the provided message to the error message buffer.  If the
094   * buffer has not yet been created, then this will create it first
095   * and then add the provided message.
096   *
097   * @param  message  The message to append to the error message
098   *                  buffer.
099   */
100  void appendErrorMessage(LocalizableMessage message);
101
102
103
104  /**
105   * Returns an unmodifiable list containing the additional log items for this
106   * operation, which should be written to the log but not included in the
107   * response to the client.
108   *
109   * @return An unmodifiable list containing the additional log items for this
110   *         operation.
111   */
112  List<AdditionalLogItem> getAdditionalLogItems();
113
114
115
116  /**
117   * Adds an additional log item to this operation, which should be written to
118   * the log but not included in the response to the client. This method may not
119   * be called by post-response plugins.
120   *
121   * @param item
122   *          The additional log item for this operation.
123   */
124  void addAdditionalLogItem(AdditionalLogItem item);
125}
126