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

Matthew Swift
27.32.2015 10a58f5110dd42aae14addffcfb981adc3e08c62
OPENDJ-1855: minor code cleanup

* reduce visibility of methods
* remove unnecessary boilerplate Javadoc
* remove unnecessary method overrides
* add some comments explaining some subtle behavior when processing IndexBuffers.

4 files modified
61 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java 30 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DatabaseContainer.java 17 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexBuffer.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
@@ -28,7 +28,6 @@
import static org.opends.server.backends.pluggable.JebFormat.*;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.backends.pluggable.spi.ReadableStorage;
import org.opends.server.backends.pluggable.spi.Storage;
@@ -82,26 +81,6 @@
  }
  /**
   * Write a record to the DN database, where the key and value are already
   * formatted.
   *
   * @param txn
   *          A JE database transaction to be used for the database operation,
   *          or null if none.
   * @param key
   *          A ByteString containing the record key.
   * @param value
   *          A ByteString containing the record value.
   * @throws StorageRuntimeException
   *           If an error occurred while attempting to write the record.
   */
  @Override
  public void put(WriteableStorage txn, ByteSequence key, ByteSequence value) throws StorageRuntimeException
  {
    super.put(txn, key, value);
  }
  /**
   * Remove a record from the DN database.
   * @param txn A JE database transaction to be used for the database operation,
   * or null if none.
@@ -126,7 +105,7 @@
   * @return The entry ID, or null if the given DN is not in the DN database.
   * @throws StorageRuntimeException If an error occurs in the JE database.
   */
  public EntryID get(ReadableStorage txn, DN dn, boolean isRMW) throws StorageRuntimeException
  EntryID get(ReadableStorage txn, DN dn, boolean isRMW) throws StorageRuntimeException
  {
    ByteString key = dnToDNKey(dn, prefixRDNComponents);
    ByteString value = read(txn, key, isRMW);
@@ -136,11 +115,4 @@
    }
    return null;
  }
  /** {@inheritDoc} */
  @Override
  public ByteString read(ReadableStorage txn, ByteSequence key, boolean isRMW)
  {
    return super.read(txn, key, isRMW);
  }
}
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DatabaseContainer.java
@@ -114,14 +114,6 @@
    }
  }
  /**
   * Replace or insert a record into a JE database, with optional debug logging.
   * This is a simple wrapper around the JE Database.put method.
   * @param txn The JE transaction handle, or null if none.
   * @param key The record key.
   * @param value The record value.
   * @throws StorageRuntimeException If an error occurs in the JE operation.
   */
  void put(WriteableStorage txn, ByteSequence key, ByteSequence value) throws StorageRuntimeException
  {
    txn.create(treeName, key, value);
@@ -131,15 +123,6 @@
    }
  }
  /**
   * Read a record from a JE database, with optional debug logging. This is a
   * simple wrapper around the JE Database.get method.
   * @param txn The JE transaction handle, or null if none.
   * @param key The key of the record to be read.
   * @param isRMW whether the read operation is part of a larger read-modify-write operation
   * @return The operation status.
   * @throws StorageRuntimeException If an error occurs in the JE operation.
   */
  ByteString read(ReadableStorage txn, ByteSequence key, boolean isRMW) throws StorageRuntimeException
  {
    ByteString value = isRMW ? txn.getRMW(treeName, key) : txn.read(treeName, key);
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java
@@ -210,7 +210,12 @@
  void updateKey(WriteableStorage txn, ByteString key, EntryIDSet deletedIDs, EntryIDSet addedIDs)
      throws StorageRuntimeException
  {
    if(deletedIDs == null && addedIDs == null)
    /*
     * Check the special condition where both deletedIDs and addedIDs are null. This is used when
     * deleting entries and corresponding id2children and id2subtree records must be completely
     * removed.
     */
    if (deletedIDs == null && addedIDs == null)
    {
      boolean success = delete(txn, key);
      if (success && logger.isTraceEnabled())
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexBuffer.java
@@ -59,7 +59,12 @@
  private final LinkedHashMap<VLVIndex, BufferedVLVIndexValues> bufferedVLVIndexes =
      new LinkedHashMap<VLVIndex, BufferedVLVIndexValues>();
  /** A simple class representing a pair of added and deleted indexed IDs. */
  /**
   * A simple class representing a pair of added and deleted indexed IDs. Initially both addedIDs
   * and deletedIDs are {@code null} indicating that that the whole record should be deleted. This
   * state is only ever used when updating the id2children and id2subtree indexes when deleting an
   * entry.
   */
  static class BufferedIndexValues
  {
    private EntryIDSet addedIDs;