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