mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
12.32.2014 180f9a3fdb817a42b8c63e471e7ab7fd4b22209b
OperationWrapper.java, AbstractOperation.java, Operation.java, PluginOperation.java:
In getAttachment(), removeAttachment() and setAttachment(), changed the return type to a generic type. This simplifies client code by removing the need to cast the returned value.
4 files modified
454 ■■■■■ changed files
opends/src/server/org/opends/server/core/OperationWrapper.java 239 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/AbstractOperation.java 31 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/Operation.java 123 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/operation/PluginOperation.java 61 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/OperationWrapper.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.opends.server.core;
@@ -33,7 +33,18 @@
import org.opends.messages.MessageBuilder;
import org.opends.server.api.ClientConnection;
import org.opends.server.controls.ControlDecoder;
import org.opends.server.types.*;
import org.opends.server.types.AdditionalLogItem;
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DisconnectReason;
import org.opends.server.types.Entry;
import org.opends.server.types.Operation;
import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
/**
 * This abstract class is a generic operation wrapper intended to be subclassed
@@ -58,27 +69,21 @@
    this.operation = operation;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void addRequestControl(Control control)
  {
    operation.addRequestControl(control);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void addResponseControl(Control control)
  {
    operation.addResponseControl(control);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void appendErrorMessage(Message message)
  {
@@ -92,27 +97,21 @@
    operation.appendMaskedErrorMessage(maskedMessage);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public CancelResult cancel(CancelRequest cancelRequest)
  {
    return operation.cancel(cancelRequest);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void abort(CancelRequest cancelRequest)
  {
    operation.abort(cancelRequest);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void disconnectClient(
          DisconnectReason disconnectReason,
@@ -124,90 +123,70 @@
      disconnectReason, sendNotification, message);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean dontSynchronize()
  {
    return operation.dontSynchronize();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Object getAttachment(String name)
  public <T> T getAttachment(String name)
  {
    return operation.getAttachment(name);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Map<String, Object> getAttachments()
  {
    return operation.getAttachments();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DN getAuthorizationDN()
  {
    return operation.getAuthorizationDN();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Entry getAuthorizationEntry()
  {
    return operation.getAuthorizationEntry();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public CancelRequest getCancelRequest()
  {
    return operation.getCancelRequest();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public CancelResult getCancelResult()
  {
    return operation.getCancelResult();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public ClientConnection getClientConnection()
  {
    return operation.getClientConnection();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getConnectionID()
  {
    return operation.getConnectionID();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public MessageBuilder getErrorMessage()
  {
@@ -228,18 +207,14 @@
    return operation.getMaskedResultCode();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public DN getMatchedDN()
  {
    return operation.getMatchedDN();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public int getMessageID()
  {
@@ -256,81 +231,63 @@
    return operation;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getOperationID()
  {
    return operation.getOperationID();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public OperationType getOperationType()
  {
    return operation.getOperationType();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getProcessingStartTime()
  {
    return operation.getProcessingStartTime();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getProcessingStopTime()
  {
    return operation.getProcessingStopTime();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getProcessingTime()
  {
    return operation.getProcessingTime();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public long getProcessingNanoTime()
  {
    return operation.getProcessingNanoTime();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public List<String> getReferralURLs()
  {
    return operation.getReferralURLs();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public List<Control> getRequestControls()
  {
    return operation.getRequestControls();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public <T extends Control> T getRequestControl(
      ControlDecoder<T> d)throws DirectoryException
@@ -338,135 +295,105 @@
    return operation.getRequestControl(d);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public List<Control> getResponseControls()
  {
    return operation.getResponseControls();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public ResultCode getResultCode()
  {
    return operation.getResultCode();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isInnerOperation()
  {
    return operation.isInnerOperation();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isInternalOperation()
  {
    return operation.isInternalOperation();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isSynchronizationOperation()
  {
    return operation.isSynchronizationOperation();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void operationCompleted()
  {
    operation.operationCompleted();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Object removeAttachment(String name)
  public <T> T removeAttachment(String name)
  {
    return operation.removeAttachment(name);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void removeResponseControl(Control control)
  {
    operation.removeResponseControl(control);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Object setAttachment(String name, Object value)
  public <T> T setAttachment(String name, Object value)
  {
    return operation.setAttachment(name, value);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setAttachments(Map<String, Object> attachments)
  {
    operation.setAttachments(attachments);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setAuthorizationEntry(Entry authorizationEntry)
  {
    operation.setAuthorizationEntry(authorizationEntry);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setDontSynchronize(boolean dontSynchronize)
  {
    operation.setDontSynchronize(dontSynchronize);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setErrorMessage(MessageBuilder errorMessage)
  {
    operation.setErrorMessage(errorMessage);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setInnerOperation(boolean isInnerOperation)
  {
    operation.setInnerOperation(isInnerOperation);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setInternalOperation(boolean isInternalOperation)
  {
@@ -487,63 +414,49 @@
    operation.setMaskedResultCode(maskedResultCode);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setMatchedDN(DN matchedDN)
  {
    operation.setMatchedDN(matchedDN);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setReferralURLs(List<String> referralURLs)
  {
    operation.setReferralURLs(referralURLs);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setResponseData(DirectoryException directoryException)
  {
    operation.setResponseData(directoryException);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setResultCode(ResultCode resultCode)
  {
    operation.setResultCode(resultCode);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void setSynchronizationOperation(boolean isSynchronizationOperation)
  {
    operation.setSynchronizationOperation(isSynchronizationOperation);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public final int hashCode()
  {
    return getClientConnection().hashCode() * (int) getOperationID();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public final boolean equals(Object obj)
  {
@@ -568,30 +481,24 @@
  @Override
  public String toString()
  {
    return "Wrapped " + operation.toString();
    return "Wrapped " + operation;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void toString(StringBuilder buffer)
  {
    operation.toString(buffer);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public synchronized final void checkIfCanceled(boolean signalTooLate)
      throws CanceledOperationException {
    operation.checkIfCanceled(signalTooLate);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void registerPostResponseCallback(Runnable callback)
  {
@@ -605,18 +512,14 @@
    operation.run();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public List<AdditionalLogItem> getAdditionalLogItems()
  {
    return operation.getAdditionalLogItems();
  }
  /**
   *{@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void addAdditionalLogItem(AdditionalLogItem item)
  {
opends/src/server/org/opends/server/types/AbstractOperation.java
@@ -22,11 +22,16 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.opends.server.types;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
@@ -179,7 +184,7 @@
  private long processingStopNanoTime;
  /** The callbacks to be invoked once a response has been sent. */
  private List<Runnable> postResponseCallbacks = null;
  private List<Runnable> postResponseCallbacks;
  /**
   * Creates a new operation with the provided information.
@@ -560,23 +565,26 @@
  /** {@inheritDoc} */
  @Override
  public final Object getAttachment(String name)
  @SuppressWarnings("unchecked")
  public final <T> T getAttachment(String name)
  {
    return attachments.get(name);
    return (T) attachments.get(name);
  }
  /** {@inheritDoc} */
  @Override
  public final Object removeAttachment(String name)
  @SuppressWarnings("unchecked")
  public final <T> T removeAttachment(String name)
  {
    return attachments.remove(name);
    return (T) attachments.remove(name);
  }
  /** {@inheritDoc} */
  @Override
  public final Object setAttachment(String name, Object value)
  @SuppressWarnings("unchecked")
  public final <T> T setAttachment(String name, Object value)
  {
    return attachments.put(name, value);
    return (T) attachments.put(name, value);
  }
  /** {@inheritDoc} */
@@ -595,8 +603,7 @@
    abort(cancelRequest);
    long stopWaitingTime = System.currentTimeMillis() + 5000;
    while ((cancelResult == null) &&
        (System.currentTimeMillis() < stopWaitingTime))
    while (cancelResult == null && System.currentTimeMillis() < stopWaitingTime)
    {
      try
      {
@@ -635,7 +642,7 @@
  /** {@inheritDoc} */
  @Override
  final synchronized public void checkIfCanceled(boolean signalTooLate)
  public final synchronized void checkIfCanceled(boolean signalTooLate)
      throws CanceledOperationException
  {
    if(cancelRequest != null)
opends/src/server/org/opends/server/types/Operation.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS.
 *      Portions copyright 2011-2014 ForgeRock AS.
 */
package org.opends.server.types;
@@ -34,7 +34,6 @@
import org.opends.server.api.ClientConnection;
import org.opends.server.controls.ControlDecoder;
/**
 * This interface defines a generic operation that may be processed by
 * the Directory Server.  Specific subclasses should implement
@@ -56,15 +55,14 @@
   * Identifier used to get the local operation [if any] in the
   * attachments.
   */
  public static final String LOCALBACKENDOPERATIONS =
    "LocalBackendOperations";
  String LOCALBACKENDOPERATIONS = "LocalBackendOperations";
  /**
   * Retrieves the operation type for this operation.
   *
   * @return  The operation type for this operation.
   */
  public abstract OperationType getOperationType();
  OperationType getOperationType();
  /**
   * Terminates the client connection being used to process this
@@ -82,10 +80,7 @@
   *                           may be {@code null} if no notification
   *                           is to be sent.
   */
  public abstract void disconnectClient(
          DisconnectReason disconnectReason,
          boolean sendNotification, Message message
  );
  void disconnectClient(DisconnectReason disconnectReason, boolean sendNotification, Message message);
  /**
   * Retrieves the client connection with which this operation is
@@ -94,7 +89,7 @@
   * @return  The client connection with which this operation is
   *          associated.
   */
  public abstract ClientConnection getClientConnection();
  ClientConnection getClientConnection();
  /**
   * Retrieves the unique identifier that is assigned to the client
@@ -103,21 +98,21 @@
   * @return  The unique identifier that is assigned to the client
   *          connection that submitted this operation.
   */
  public abstract long getConnectionID();
  long getConnectionID();
  /**
   * Retrieves the operation ID for this operation.
   *
   * @return  The operation ID for this operation.
   */
  public abstract long getOperationID();
  long getOperationID();
  /**
   * Retrieves the message ID assigned to this operation.
   *
   * @return  The message ID assigned to this operation.
   */
  public abstract int getMessageID();
  int getMessageID();
  /**
   * Retrieves the set of controls included in the request from the
@@ -126,7 +121,7 @@
   * @return  The set of controls included in the request from the
   *          client.
   */
  public abstract List<Control> getRequestControls();
  List<Control> getRequestControls();
  /**
   * Retrieves a control included in the request from the client.
@@ -141,8 +136,7 @@
   * @throws DirectoryException
   *           if an error occurs while decoding the control.
   */
  public abstract <T extends Control> T getRequestControl(
      ControlDecoder<T> d) throws DirectoryException;
  <T extends Control> T getRequestControl(ControlDecoder<T> d) throws DirectoryException;
  /**
   * Adds the provided control to the set of request controls for this
@@ -151,7 +145,7 @@
   * @param  control  The control to add to the set of request
   *                  controls for this operation.
   */
  public abstract void addRequestControl(Control control);
  void addRequestControl(Control control);
  /**
   * Retrieves the set of controls to include in the response to the
@@ -160,7 +154,7 @@
   * @return  The set of controls to include in the response to the
   *          client.
   */
  public abstract List<Control> getResponseControls();
  List<Control> getResponseControls();
  /**
   * Adds the provided control to the set of controls to include in
@@ -170,7 +164,7 @@
   * @param  control  The control to add to the set of controls to
   *                  include in the response to the client.
   */
  public abstract void addResponseControl(Control control);
  void addResponseControl(Control control);
  /**
   * Removes the provided control from the set of controls to include
@@ -180,7 +174,7 @@
   * @param  control  The control to remove from the set of controls
   *                  to include in the response to the client.
   */
  public abstract void removeResponseControl(Control control);
  void removeResponseControl(Control control);
  /**
   * Retrieves the result code for this operation.
@@ -189,7 +183,7 @@
   *          {@code UNDEFINED} if the operation has not yet
   *          completed.
   */
  public abstract ResultCode getResultCode();
  ResultCode getResultCode();
  /**
   * Specifies the result code for this operation.  This method may
@@ -197,7 +191,7 @@
   *
   * @param  resultCode  The result code for this operation.
   */
  public abstract void setResultCode(ResultCode resultCode);
  void setResultCode(ResultCode resultCode);
  /**
   * Retrieves the real, masked result code for this operation.
@@ -223,7 +217,7 @@
   *
   * @return  The error message for this operation.
   */
  public abstract MessageBuilder getErrorMessage();
  MessageBuilder getErrorMessage();
  /**
   * Specifies the error message for this operation.  This method may
@@ -231,7 +225,7 @@
   *
   * @param  errorMessage  The error message for this operation.
   */
  public abstract void setErrorMessage(MessageBuilder errorMessage);
  void setErrorMessage(MessageBuilder errorMessage);
  /**
   * Appends the provided message to the error message buffer.  If the
@@ -241,7 +235,7 @@
   *
   * @param  message  The message to append to the error message
   */
  public abstract void appendErrorMessage(Message message);
  void appendErrorMessage(Message message);
  /**
   * Retrieves the real, masked error message for this operation. Its contents
@@ -280,7 +274,7 @@
   * @return An unmodifiable list containing the additional log items for this
   *         operation.
   */
  public abstract List<AdditionalLogItem> getAdditionalLogItems();
  List<AdditionalLogItem> getAdditionalLogItems();
  /**
   * Adds an additional log item to this operation, which should be written to
@@ -290,7 +284,7 @@
   * @param item
   *          The additional log item for this operation.
   */
  public abstract void addAdditionalLogItem(AdditionalLogItem item);
  void addAdditionalLogItem(AdditionalLogItem item);
  /**
   * Retrieves the matched DN for this operation.
@@ -299,7 +293,7 @@
   *          the operation has not yet completed or does not have a
   *          matched DN.
   */
  public abstract DN getMatchedDN();
  DN getMatchedDN();
  /**
   * Specifies the matched DN for this operation.  This may not be
@@ -307,7 +301,7 @@
   *
   * @param  matchedDN  The matched DN for this operation.
   */
  public abstract void setMatchedDN(DN matchedDN);
  void setMatchedDN(DN matchedDN);
  /**
   * Retrieves the set of referral URLs for this operation.  Its
@@ -317,7 +311,7 @@
   *          {@code null} if the operation is not yet complete or
   *          does not have a set of referral URLs.
   */
  public abstract List<String> getReferralURLs();
  List<String> getReferralURLs();
  /**
   * Specifies the set of referral URLs for this operation.  This may
@@ -326,7 +320,7 @@
   * @param  referralURLs  The set of referral URLs for this
   *                       operation.
   */
  public abstract void setReferralURLs(List<String> referralURLs);
  void setReferralURLs(List<String> referralURLs);
  /**
   * Sets the response elements for this operation based on the
@@ -337,8 +331,7 @@
   *                             information to use for the response
   *                             elements.
   */
  public abstract void setResponseData(
      DirectoryException directoryException);
  void setResponseData(DirectoryException directoryException);
  /**
   * Indicates whether this is an internal operation rather than one
@@ -347,7 +340,7 @@
   * @return  {@code true} if this is an internal operation, or
   *          {@code false} if it is not.
   */
  public abstract boolean isInternalOperation();
  boolean isInternalOperation();
  /**
   * Specifies whether this is an internal operation rather than one
@@ -359,8 +352,7 @@
   *                              that was requested by an external
   *                              client.
   */
  public abstract void setInternalOperation(boolean
      isInternalOperation);
  void setInternalOperation(boolean isInternalOperation);
  /**
   * Indicates whether this is an inner operation rather than one that was
@@ -394,7 +386,7 @@
   * @return  {@code true} if this is a data synchronization
   *          operation, or {@code false} if it is not.
   */
  public abstract boolean isSynchronizationOperation();
  boolean isSynchronizationOperation();
  /**
   * Specifies whether this is a synchronization operation rather than
@@ -407,8 +399,7 @@
   *                                     requested by an external
   *                                     client.
   */
  public abstract void setSynchronizationOperation(
      boolean isSynchronizationOperation);
  void setSynchronizationOperation(boolean isSynchronizationOperation);
  /**
   * Specifies whether this operation must be synchronized to other
@@ -418,7 +409,7 @@
   *                          synchronized to other copies
   *                          of the data.
   */
  public abstract void setDontSynchronize(boolean dontSynchronize);
  void setDontSynchronize(boolean dontSynchronize);
  /**
   * Retrieves the entry for the user that should be considered the
@@ -436,7 +427,7 @@
   *          {@code null} if the authorization identity should be the
   *          unauthenticated  user.
   */
  public abstract Entry getAuthorizationEntry();
  Entry getAuthorizationEntry();
  /**
   * Provides the entry for the user that should be considered the
@@ -449,8 +440,7 @@
   *                             if it should be the unauthenticated
   *                             user.
   */
  public abstract void setAuthorizationEntry(Entry
      authorizationEntry);
  void setAuthorizationEntry(Entry authorizationEntry);
  /**
   * Retrieves the authorization DN for this operation.  In many
@@ -465,7 +455,7 @@
   * @return  The authorization DN for this operation, or the null DN
   *          if it should be the unauthenticated user..
   */
  public abstract DN getAuthorizationDN();
  DN getAuthorizationDN();
  /**
   * Retrieves the set of attachments defined for this operation, as a
@@ -473,35 +463,38 @@
   *
   * @return  The set of attachments defined for this operation.
   */
  public abstract Map<String, Object> getAttachments();
  Map<String, Object> getAttachments();
  /**
   * Retrieves the attachment with the specified name.
   *
   * @param <T> the type of the attached object
   * @param  name  The name for the attachment to retrieve.  It will
   *               be treated in a case-sensitive manner.
   *
   * @return  The requested attachment object, or {@code null} if it
   *          does not exist.
   */
  public abstract Object getAttachment(String name);
  <T> T getAttachment(String name);
  /**
   * Removes the attachment with the specified name.
   *
   * @param <T> the type of the attached object
   * @param  name  The name for the attachment to remove.  It will be
   *               treated in a case-sensitive manner.
   *
   * @return  The attachment that was removed, or {@code null} if it
   *          does not exist.
   */
  public abstract Object removeAttachment(String name);
  <T> T removeAttachment(String name);
  /**
   * Sets the value of the specified attachment.  If an attachment
   * already exists with the same name, it will be replaced.
   * Otherwise, a new attachment will be added.
   *
   * @param <T> the type of the attached object
   * @param  name   The name to use for the attachment.
   * @param  value  The value to use for the attachment.
   *
@@ -509,14 +502,14 @@
   *          name, or {@code null} if there was previously no such
   *          attachment.
   */
  public abstract Object setAttachment(String name, Object value);
  <T> T setAttachment(String name, Object value);
  /**
   * Retrieves the time that processing started for this operation.
   *
   * @return  The time that processing started for this operation.
   */
  public abstract long getProcessingStartTime();
  long getProcessingStartTime();
  /**
   * Retrieves the time that processing stopped for this operation.
@@ -525,7 +518,7 @@
   *
   * @return  The time that processing stopped for this operation.
   */
  public abstract long getProcessingStopTime();
  long getProcessingStopTime();
  /**
   * Retrieves the length of time in milliseconds that the server
@@ -535,7 +528,7 @@
   * @return  The length of time in milliseconds that the server spent
   *          processing this operation.
   */
  public abstract long getProcessingTime();
  long getProcessingTime();
  /**
   * Retrieves the length of time in nanoseconds that
@@ -547,14 +540,14 @@
   *          spent processing this operation or -1 if its not
   *          available.
   */
  public abstract long getProcessingNanoTime();
  long getProcessingNanoTime();
  /**
   * Indicates that processing on this operation has completed
   * successfully and that the client should perform any associated
   * cleanup work.
   */
  public abstract void operationCompleted();
  void operationCompleted();
  /**
   * Attempts to cancel this operation before processing has
@@ -566,7 +559,7 @@
   * @return  A code providing information on the result of the
   *          cancellation.
   */
  public abstract CancelResult cancel(CancelRequest cancelRequest);
  CancelResult cancel(CancelRequest cancelRequest);
  /**
   * Attempts to abort this operation before processing has
@@ -575,8 +568,7 @@
   * @param  cancelRequest  Information about the way in which the
   *                        operation should be canceled.
   */
  public abstract void abort(CancelRequest cancelRequest);
  void abort(CancelRequest cancelRequest);
  /**
   * Retrieves the cancel request that has been issued for this
@@ -587,7 +579,7 @@
   *          operation, or {@code null} if there has not been any
   *          request to cancel.
   */
  public abstract CancelRequest getCancelRequest();
  CancelRequest getCancelRequest();
  /**
   * Retrieves the cancel result for this operation.
@@ -596,15 +588,14 @@
   *          {@code null} if the operation has not seen and reacted
   *          to a cancel request.
   */
  public abstract CancelResult getCancelResult();
  CancelResult getCancelResult();
  /**
   * Retrieves a string representation of this operation.
   *
   * @return  A string representation of this operation.
   */
  @Override
  public abstract String toString();
  @Override String toString();
  /**
   * Appends a string representation of this operation to the provided
@@ -613,7 +604,7 @@
   * @param  buffer  The buffer into which a string representation of
   *                 this operation should be appended.
   */
  public abstract void toString(StringBuilder buffer);
  void toString(StringBuilder buffer);
  /**
   * Indicates whether this operation needs to be synchronized to
@@ -623,7 +614,7 @@
   *          synchronized, or {@code false} if it should be
   *          synchronized.
   */
  public abstract boolean dontSynchronize();
  boolean dontSynchronize();
  /**
   * Set the attachments to the operation.
@@ -631,8 +622,7 @@
   * @param attachments - Attachments to register within the
   *                      operation
   */
  public abstract void setAttachments(Map<String,
      Object> attachments);
  void setAttachments(Map<String, Object> attachments);
  /**
   * Checks to see if this operation requested to cancel in which case
@@ -646,8 +636,7 @@
   * @throws CanceledOperationException if this operation should
   * be cancelled.
   */
  public void checkIfCanceled(boolean signalTooLate)
      throws CanceledOperationException;
  void checkIfCanceled(boolean signalTooLate) throws CanceledOperationException;
  /**
   * Registers a callback which should be run once this operation has
@@ -657,7 +646,7 @@
   *          The callback to be run once this operation has completed
   *          and the response sent back to the client.
   */
  public void registerPostResponseCallback(Runnable callback);
  void registerPostResponseCallback(Runnable callback);
  /**
   * Performs the work of actually processing this operation. This should
opends/src/server/org/opends/server/types/operation/PluginOperation.java
@@ -22,19 +22,20 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS
 */
package org.opends.server.types.operation;
import org.opends.messages.Message;
import java.util.List;
import java.util.Map;
import org.opends.messages.Message;
import org.opends.server.api.ClientConnection;
import org.opends.server.types.*;
import org.opends.server.controls.ControlDecoder;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DisconnectReason;
import org.opends.server.types.OperationType;
/**
 * This class defines a set of methods that are available for use by
@@ -56,7 +57,7 @@
   *
   * @return  The operation type for this operation.
   */
  public OperationType getOperationType();
  OperationType getOperationType();
@@ -67,14 +68,14 @@
   * @return  The client connection with which this operation is
   *          associated.
   */
  public ClientConnection getClientConnection();
  ClientConnection getClientConnection();
  /**
   * Terminates the client connection being used to process this
   * operation.  The plugin must return a result indicating that the
   * client connection has been teriminated.
   * client connection has been terminated.
   *
   * @param  disconnectReason  The disconnect reason that provides the
   *                           generic cause for the disconnect.
@@ -85,9 +86,7 @@
   *                           may be <CODE>null</CODE> if no
   *                           notification is to be sent.
   */
  public void disconnectClient(DisconnectReason disconnectReason,
                               boolean sendNotification,
                               Message message);
  void disconnectClient(DisconnectReason disconnectReason, boolean sendNotification, Message message);
@@ -98,7 +97,7 @@
   * @return  The unique identifier that is assigned to the client
   *          connection that submitted this operation.
   */
  public long getConnectionID();
  long getConnectionID();
@@ -107,7 +106,7 @@
   *
   * @return  The operation ID for this operation.
   */
  public long getOperationID();
  long getOperationID();
@@ -116,7 +115,7 @@
   *
   * @return  The message ID assigned to this operation.
   */
  public int getMessageID();
  int getMessageID();
@@ -127,7 +126,7 @@
   * @return  The set of controls included in the request from the
   *          client.
   */
  public List<Control> getRequestControls();
  List<Control> getRequestControls();
@@ -144,8 +143,7 @@
   * @throws DirectoryException
   *           if an error occurs while decoding the control.
   */
  public <T extends Control> T getRequestControl(ControlDecoder<T> d)
      throws DirectoryException;
  <T extends Control> T getRequestControl(ControlDecoder<T> d) throws DirectoryException;
@@ -156,7 +154,7 @@
   * @return  The set of controls to include in the response to the
   *          client.
   */
  public List<Control> getResponseControls();
  List<Control> getResponseControls();
@@ -167,7 +165,7 @@
   * @return  <CODE>true</CODE> if this is an internal operation, or
   *          <CODE>false</CODE> if it is not.
   */
  public boolean isInternalOperation();
  boolean isInternalOperation();
@@ -178,7 +176,7 @@
   * @return  <CODE>true</CODE> if this is a data synchronization
   *          operation, or <CODE>false</CODE> if it is not.
   */
  public boolean isSynchronizationOperation();
  boolean isSynchronizationOperation();
@@ -188,33 +186,35 @@
   *
   * @return  The set of attachments defined for this operation.
   */
  public Map<String,Object> getAttachments();
  Map<String,Object> getAttachments();
  /**
   * Retrieves the attachment with the specified name.
   *
   * @param <T> the type of the attached object
   * @param  name  The name for the attachment to retrieve.  It will
   *               be treated in a case-sensitive manner.
   *
   * @return  The requested attachment object, or <CODE>null</CODE> if
   *          it does not exist.
   */
  public Object getAttachment(String name);
  <T> T getAttachment(String name);
  /**
   * Removes the attachment with the specified name.
   *
   * @param <T> the type of the attached object
   * @param  name  The name for the attachment to remove.  It will be
   *               treated in a case-sensitive manner.
   *
   * @return  The attachment that was removed, or <CODE>null</CODE> if
   *          it does not exist.
   */
  public Object removeAttachment(String name);
  <T> T removeAttachment(String name);
@@ -223,6 +223,7 @@
   * already exists with the same name, it will be replaced.
   * Otherwise, a new attachment will be added.
   *
   * @param <T> the type of the attached object
   * @param  name   The name to use for the attachment.
   * @param  value  The value to use for the attachment.
   *
@@ -230,7 +231,7 @@
   *          name, or <CODE>null</CODE> if there was previously no
   *          such attachment.
   */
  public Object setAttachment(String name, Object value);
  <T> T setAttachment(String name, Object value);
@@ -239,7 +240,7 @@
   *
   * @return  The time that processing started for this operation.
   */
  public long getProcessingStartTime();
  long getProcessingStartTime();
@@ -248,7 +249,8 @@
   *
   * @return  A string representation of this operation.
   */
  public String toString();
  @Override
  String toString();
@@ -259,7 +261,7 @@
   * @param  buffer  The buffer into which a string representation of
   *                 this operation should be appended.
   */
  public void toString(StringBuilder buffer);
  void toString(StringBuilder buffer);
@@ -275,7 +277,6 @@
   * @throws CanceledOperationException if this operation should
   * be cancelled.
   */
  public void checkIfCanceled(boolean signalTooLate)
      throws CanceledOperationException;
  void checkIfCanceled(boolean signalTooLate) throws CanceledOperationException;
}