From 4299c8c37993ca97f28b2e731f6fd5ba1fb53943 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 07 Nov 2016 15:05:30 +0000
Subject: [PATCH] OPENDJ-3417 Move methods down to LocalBackend class and rename BackendMonitor to LocalBackendMonitor
---
opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java | 57 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java
index 9fc34f0..afe752c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java
@@ -46,6 +46,7 @@
import org.opends.server.core.PersistentSearch.CancellationCallback;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
+import org.opends.server.monitors.LocalBackendMonitor;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
@@ -95,23 +96,8 @@
/** The set of persistent searches registered with this backend. */
private final ConcurrentLinkedQueue<PersistentSearch> persistentSearches = new ConcurrentLinkedQueue<>();
- /**
- * Returns the provided backend instance as a LocalBackend.
- *
- * @param backend
- * A backend
- * @return a local backend
- * @throws IllegalArgumentException
- * If the provided backend is not a LocalBackend
- */
- public static LocalBackend<?> asLocalBackend(Backend<?> backend)
- {
- if (backend instanceof LocalBackend)
- {
- return (LocalBackend<?>) backend;
- }
- throw new IllegalArgumentException("Backend " + backend.getBackendID() + " is not a local backend");
- }
+ /** The backend monitor associated with this backend. */
+ private LocalBackendMonitor backendMonitor;
/**
* Opens this backend based on the information provided when the backend was configured.
@@ -848,6 +834,43 @@
}
/**
+ * Retrieves the backend monitor that is associated with this
+ * backend.
+ *
+ * @return The backend monitor that is associated with this
+ * backend, or {@code null} if none has been assigned.
+ */
+ public final LocalBackendMonitor getBackendMonitor()
+ {
+ return backendMonitor;
+ }
+
+ /**
+ * Sets the backend monitor for this backend.
+ *
+ * @param backendMonitor The backend monitor for this backend.
+ */
+ public final void setBackendMonitor(LocalBackendMonitor backendMonitor)
+ {
+ this.backendMonitor = backendMonitor;
+ }
+
+ /**
+ * Indicates whether this backend supports the specified control.
+ *
+ * @param controlOID The OID of the control for which to make the
+ * determination.
+ *
+ * @return {@code true} if this backends supports the control with
+ * the specified OID, or {@code false} if it does not.
+ */
+ public final boolean supportsControl(String controlOID)
+ {
+ Set<String> supportedControls = getSupportedControls();
+ return supportedControls != null && supportedControls.contains(controlOID);
+ }
+
+ /**
* Indicates whether a backend should be used to handle operations
* for the provided entry given the set of base DNs and exclude DNs.
*
--
Gitblit v1.10.0