From 897c4335fde7e69c72930d3432b203efaa681ba9 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 10 Apr 2015 08:16:10 +0000
Subject: [PATCH] More code cleanup: Added generics Ignored javadocs warnings etc.
---
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java | 2
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java | 12 +++---
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java | 18 ++------
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java | 18 +++++++--
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/spi/ReadableTransaction.java | 2
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PersistItStorage.java | 15 ++++---
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java | 2
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java | 9 ++--
8 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PersistItStorage.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PersistItStorage.java
index b4bd496..8076ff5 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PersistItStorage.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PersistItStorage.java
@@ -84,6 +84,7 @@
import com.persistit.exception.RollbackException;
/** PersistIt database implementation of the {@link Storage} engine. */
+@SuppressWarnings("javadoc")
public final class PersistItStorage implements Storage, ConfigurationChangeListener<PersistitBackendCfg>,
DiskSpaceMonitorHandler, AlertGenerator
{
@@ -92,7 +93,7 @@
private static final int BUFFER_SIZE = 16 * 1024;
/** PersistIt implementation of the {@link Cursor} interface. */
- private final class CursorImpl implements Cursor
+ private final class CursorImpl implements Cursor<ByteString, ByteString>
{
private ByteString currentKey;
private ByteString currentValue;
@@ -261,13 +262,13 @@
}
@Override
- public void put(final TreeName treeName, final ByteSequence key,
- final ByteSequence value)
+ public void put(final TreeName treeName, final ByteSequence key, final ByteSequence value)
{
try
{
final Tree tree = trees.get(treeName);
- importer.store(tree, bytesToKey(importKey, key),
+ importer.store(tree,
+ bytesToKey(importKey, key),
bytesToValue(importValue, value));
}
catch (final Exception e)
@@ -337,8 +338,8 @@
@Override
public long getRecordCount(TreeName treeName)
{
- // FIXME: is the a better/quicker way to do this?
- final Cursor cursor = openCursor(treeName);
+ // FIXME: is there a better/quicker way to do this?
+ final Cursor<?, ?> cursor = openCursor(treeName);
try
{
long count = 0;
@@ -355,7 +356,7 @@
}
@Override
- public Cursor openCursor(final TreeName treeName)
+ public Cursor<ByteString, ByteString> openCursor(final TreeName treeName)
{
try
{
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
index ec6fd15..c93a5b4 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -71,6 +71,7 @@
* by the ordering matching rule. If these could be guaranteed to be identical
* then we would not need a separate ordering index.
*/
+@SuppressWarnings("javadoc")
class AttributeIndex
implements ConfigurationChangeListener<BackendIndexCfg>, Closeable
{
@@ -434,8 +435,7 @@
* @throws StorageRuntimeException If an error occurs in the database.
* @throws DirectoryException If a Directory Server error occurs.
*/
- void addEntry(IndexBuffer buffer, EntryID entryID, Entry entry)
- throws StorageRuntimeException, DirectoryException
+ void addEntry(IndexBuffer buffer, EntryID entryID, Entry entry) throws StorageRuntimeException, DirectoryException
{
for (MatchingRuleIndex index : nameToIndexes.values())
{
@@ -457,8 +457,7 @@
* @throws StorageRuntimeException If an error occurs in the database.
* @throws DirectoryException If a Directory Server error occurs.
*/
- void removeEntry(IndexBuffer buffer, EntryID entryID, Entry entry)
- throws StorageRuntimeException, DirectoryException
+ void removeEntry(IndexBuffer buffer, EntryID entryID, Entry entry) throws StorageRuntimeException, DirectoryException
{
for (MatchingRuleIndex index : nameToIndexes.values())
{
@@ -479,16 +478,10 @@
* @param entryID The ID of the entry that was modified.
* @param oldEntry The entry before the modifications were applied.
* @param newEntry The entry after the modifications were applied.
- * @param mods The sequence of modifications in the Modify operation.
* @throws StorageRuntimeException If an error occurs during an operation on a
* database.
*/
- void modifyEntry(IndexBuffer buffer,
- EntryID entryID,
- Entry oldEntry,
- Entry newEntry,
- List<Modification> mods)
- throws StorageRuntimeException
+ void modifyEntry(IndexBuffer buffer, EntryID entryID, Entry oldEntry, Entry newEntry) throws StorageRuntimeException
{
for (MatchingRuleIndex index : nameToIndexes.values())
{
@@ -610,8 +603,7 @@
* @return The candidate entry IDs that might contain a value
* that matches the filter type.
*/
- EntryIDSet evaluateFilter(IndexQueryFactory<IndexQuery> indexQueryFactory,
- IndexFilterType indexFilterType,
+ EntryIDSet evaluateFilter(IndexQueryFactory<IndexQuery> indexQueryFactory, IndexFilterType indexFilterType,
SearchFilter filter, StringBuilder debugBuffer, DatabaseEnvironmentMonitor monitor)
{
try
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
index 4765ddf..c16bbb1 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -258,7 +258,7 @@
*/
private ConditionResult containsReferrals(ReadableTransaction txn)
{
- Cursor cursor = txn.openCursor(getName());
+ Cursor<?, ?> cursor = txn.openCursor(getName());
try
{
return ConditionResult.valueOf(cursor.next());
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
index 001cf63..14ceb70 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
@@ -26,11 +26,10 @@
*/
package org.opends.server.backends.pluggable;
-import static org.forgerock.util.Reject.checkNotNull;
-import static org.opends.messages.JebMessages.ERR_JEB_INDEX_CORRUPT_REQUIRES_REBUILD;
+import static org.forgerock.util.Reject.*;
+import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
-import static org.opends.server.backends.pluggable.State.IndexFlag.COMPACTED;
-import static org.opends.server.backends.pluggable.State.IndexFlag.TRUSTED;
+import static org.opends.server.backends.pluggable.State.IndexFlag.*;
import java.util.EnumSet;
@@ -54,6 +53,7 @@
* is a byte array, and is constructed from some normalized form of an attribute value (or fragment
* of a value) appearing in the entry.
*/
+@SuppressWarnings("javadoc")
class DefaultIndex extends AbstractDatabaseContainer implements Index
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -115,6 +115,7 @@
}
}
+ @Override
public final Cursor<ByteString, EntryIDSet> openCursor(ReadableTransaction txn)
{
checkNotNull(txn, "txn must not be null");
@@ -129,6 +130,7 @@
});
}
+ @Override
public final void importPut(WriteableTransaction txn, ImportIDSet idsToBeAdded) throws StorageRuntimeException
{
ByteSequence key = idsToBeAdded.getKey();
@@ -145,6 +147,7 @@
}
}
+ @Override
public final void importRemove(WriteableTransaction txn, ImportIDSet idsToBeRemoved) throws StorageRuntimeException
{
ByteSequence key = idsToBeRemoved.getKey();
@@ -169,6 +172,7 @@
}
}
+ @Override
public final void update(final WriteableTransaction txn, final ByteString key, final EntryIDSet deletedIDs,
final EntryIDSet addedIDs) throws StorageRuntimeException
{
@@ -317,6 +321,7 @@
logger.error(ERR_JEB_INDEX_CORRUPT_REQUIRES_REBUILD, getName());
}
+ @Override
public final EntryIDSet get(ReadableTransaction txn, ByteSequence key)
{
try
@@ -335,6 +340,7 @@
}
}
+ @Override
public final boolean setIndexEntryLimit(int indexEntryLimit)
{
final boolean rebuildRequired = this.indexEntryLimit < indexEntryLimit;
@@ -342,11 +348,13 @@
return rebuildRequired;
}
+ @Override
public final int getIndexEntryLimit()
{
return indexEntryLimit;
}
+ @Override
public final synchronized void setTrusted(WriteableTransaction txn, boolean trusted) throws StorageRuntimeException
{
this.trusted = trusted;
@@ -360,11 +368,13 @@
}
}
+ @Override
public final boolean isTrusted()
{
return trusted;
}
+ @Override
public final boolean getMaintainCount()
{
return maintainCount;
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
index 6a8654b..5c23733 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -2642,7 +2642,7 @@
// Check whether any modifications apply to this indexed attribute.
if (isAttributeModified(index, mods))
{
- index.modifyEntry(buffer, entryID, oldEntry, newEntry, mods);
+ index.modifyEntry(buffer, entryID, oldEntry, newEntry);
}
}
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java
index b55bbe6..b3e46c6 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/TracedStorage.java
@@ -46,6 +46,7 @@
/**
* Decorates a {@link Storage} with additional trace logging.
*/
+@SuppressWarnings("javadoc")
final class TracedStorage implements Storage
{
/**
@@ -112,9 +113,9 @@
}
@Override
- public Cursor openCursor(final TreeName name)
+ public Cursor<ByteString, ByteString> openCursor(final TreeName name)
{
- final Cursor cursor = txn.openCursor(name);
+ final Cursor<ByteString, ByteString> cursor = txn.openCursor(name);
logger.trace("Storage@%s.ReadableStorage@%s.openCursor(%s, %s)",
storageId(), id(), backendId, name);
return cursor;
@@ -188,9 +189,9 @@
}
@Override
- public Cursor openCursor(final TreeName name)
+ public Cursor<ByteString, ByteString> openCursor(final TreeName name)
{
- final Cursor cursor = txn.openCursor(name);
+ final Cursor<ByteString, ByteString> cursor = txn.openCursor(name);
logger.trace("Storage@%s.WriteableStorage@%s.openCursor(%s, %s)",
storageId(), id(), backendId, name);
return cursor;
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
index 4e2279f..289ff3c 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -26,8 +26,8 @@
*/
package org.opends.server.backends.pluggable;
-import static org.opends.messages.JebMessages.*;
import static org.opends.messages.BackendMessages.*;
+import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import static org.opends.server.util.StaticUtils.*;
@@ -87,6 +87,7 @@
* "tie-breaker" and ensures that keys correspond to one and only one entry. This ensures that all
* database updates can be performed using lock-free operations.
*/
+@SuppressWarnings("javadoc")
class VLVIndex extends AbstractDatabaseContainer implements ConfigurationChangeListener<BackendVLVIndexCfg>, Closeable
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -484,14 +485,14 @@
{
return evaluateVLVRequestByOffset(txn, searchOperation, vlvRequest, debugBuilder);
}
- return evaluateVLVRequestByAssertion(txn, searchOperation, vlvRequest, debugBuilder);
+ return evaluateVLVRequestByAssertion(txn, searchOperation, vlvRequest);
}
return evaluateNonVLVRequest(txn, debugBuilder);
}
private EntryIDSet evaluateNonVLVRequest(final ReadableTransaction txn, final StringBuilder debugBuilder)
{
- final Cursor cursor = txn.openCursor(getName());
+ final Cursor<ByteString, ByteString> cursor = txn.openCursor(getName());
try
{
final long[] selectedIDs = readRange(cursor, count.get(), debugBuilder);
@@ -509,7 +510,7 @@
* entries following the nearest entry.
*/
private EntryIDSet evaluateVLVRequestByAssertion(final ReadableTransaction txn,
- final SearchOperation searchOperation, final VLVRequestControl vlvRequest, final StringBuilder debugBuilder)
+ final SearchOperation searchOperation, final VLVRequestControl vlvRequest)
throws DirectoryException
{
final int currentCount = count.get();
@@ -518,7 +519,6 @@
final ByteString assertion = vlvRequest.getGreaterThanOrEqualAssertion();
final ByteSequence encodedTargetAssertion =
encodeTargetAssertion(sortOrder, assertion, searchOperation, currentCount);
- @SuppressWarnings("unchecked")
final Cursor<ByteString, ByteString> cursor = txn.openCursor(getName());
try
{
@@ -672,7 +672,7 @@
}
final int count = 1 + beforeCount + afterCount;
- final Cursor cursor = txn.openCursor(getName());
+ final Cursor<ByteString, ByteString> cursor = txn.openCursor(getName());
try
{
final long[] selectedIDs;
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/spi/ReadableTransaction.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/spi/ReadableTransaction.java
index 000c9e6..10d8bb1 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/spi/ReadableTransaction.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/spi/ReadableTransaction.java
@@ -53,7 +53,7 @@
* the tree name
* @return a new cursor
*/
- Cursor openCursor(TreeName treeName);
+ Cursor<ByteString, ByteString> openCursor(TreeName treeName);
/**
* Returns the number of key/value pairs in the provided tree.
--
Gitblit v1.10.0