From 02bbeacbfb05101989dac510cbef7815fdf28a2e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 01 Sep 2014 12:51:46 +0000
Subject: [PATCH] OPENDJ-1206 (CR-4393) Create a new ReplicationBackend/ChangelogBackend to support cn=changelog
---
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java | 109 +++++++++++-------------------------------------------
1 files changed, 23 insertions(+), 86 deletions(-)
diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index 0dd0f22..45134e4 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.workflowelement.localbackend;
@@ -30,7 +30,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
-import java.util.concurrent.CopyOnWriteArrayList;
import org.opends.messages.Message;
import org.opends.messages.MessageDescriptor;
@@ -68,7 +67,7 @@
private static final DebugTracer TRACER = getTracer();
/** the backend associated with the local workflow element. */
- private Backend backend;
+ private Backend<?> backend;
/** the set of local backend workflow elements registered with the server. */
@@ -77,13 +76,7 @@
new TreeMap<String, LocalBackendWorkflowElement>();
/**
- * The set of persistent searches registered with this work flow element.
- */
- private final List<PersistentSearch> persistentSearches =
- new CopyOnWriteArrayList<PersistentSearch>();
-
- /**
- * a lock to guarantee safe concurrent access to the registeredLocalBackends
+ * A lock to guarantee safe concurrent access to the registeredLocalBackends
* variable.
*/
private static final Object registeredLocalBackendsLock = new Object();
@@ -112,9 +105,8 @@
* @param workflowElementID the workflow element identifier
* @param backend the backend associated to that workflow element
*/
- private void initialize(String workflowElementID, Backend backend)
+ private void initialize(String workflowElementID, Backend<?> backend)
{
- // Initialize the workflow ID
super.initialize(workflowElementID, BACKEND_WORKFLOW_ELEMENT);
this.backend = backend;
@@ -154,29 +146,16 @@
processWorkflowElementConfig(configuration, true);
}
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public void finalizeWorkflowElement()
{
- // null all fields so that any use of the finalized object will raise
- // an NPE
+ // null all fields so that any use of the finalized object will raise a NPE
super.initialize(null, null);
backend = null;
-
- // Cancel all persistent searches.
- for (PersistentSearch psearch : persistentSearches) {
- psearch.cancel();
- }
- persistentSearches.clear();
}
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
LocalBackendWorkflowElementCfg configuration,
@@ -186,10 +165,7 @@
return processWorkflowElementConfig(configuration, false);
}
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public ConfigChangeResult applyConfigurationChange(
LocalBackendWorkflowElementCfg configuration
@@ -224,7 +200,7 @@
{
// Read configuration.
String newBackendID = configuration.getBackend();
- Backend newBackend = DirectoryServer.getBackend(newBackendID);
+ Backend<?> newBackend = DirectoryServer.getBackend(newBackendID);
// If the backend is null (i.e. not found in the list of
// registered backends, this is probably because we are looking
@@ -273,8 +249,7 @@
* element.
*/
public static LocalBackendWorkflowElement createAndRegister(
- String workflowElementID,
- Backend backend)
+ String workflowElementID, Backend<?> backend)
{
// If the requested workflow element does not exist then create one.
LocalBackendWorkflowElement localBackend =
@@ -661,11 +636,7 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public void execute(Operation operation) throws CanceledOperationException {
switch (operation.getOperationType())
@@ -766,54 +737,11 @@
* @return The backend associated with this local backend workflow
* element.
*/
- public Backend getBackend()
+ public Backend<?> getBackend()
{
return backend;
}
-
-
- /**
- * Registers the provided persistent search operation with this
- * local backend workflow element so that it will be notified of any
- * add, delete, modify, or modify DN operations that are performed.
- *
- * @param persistentSearch
- * The persistent search operation to register with this
- * local backend workflow element.
- */
- void registerPersistentSearch(PersistentSearch persistentSearch)
- {
- PersistentSearch.CancellationCallback callback =
- new PersistentSearch.CancellationCallback()
- {
- @Override
- public void persistentSearchCancelled(PersistentSearch psearch)
- {
- persistentSearches.remove(psearch);
- }
- };
-
- persistentSearches.add(persistentSearch);
- persistentSearch.registerCancellationCallback(callback);
- }
-
-
-
- /**
- * Gets the list of persistent searches currently active against
- * this local backend workflow element.
- *
- * @return The list of persistent searches currently active against
- * this local backend workflow element.
- */
- List<PersistentSearch> getPersistentSearches()
- {
- return persistentSearches;
- }
-
-
-
/**
* Checks if an update operation can be performed against a backend. The
* operation will be rejected based on the server and backend writability
@@ -834,7 +762,7 @@
* @throws DirectoryException
* If the update operation has been rejected.
*/
- static void checkIfBackendIsWritable(Backend backend, Operation op,
+ static void checkIfBackendIsWritable(Backend<?> backend, Operation op,
DN entryDN, MessageDescriptor.Arg1<CharSequence> serverMsg,
MessageDescriptor.Arg1<CharSequence> backendMsg)
throws DirectoryException
@@ -870,5 +798,14 @@
}
}
}
-}
+ /** {@inheritDoc} */
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName()
+ + " backend=" + backend
+ + " workflowElementID=" + getWorkflowElementID()
+ + " workflowElementTypeInfo=" + getWorkflowElementTypeInfo();
+ }
+}
--
Gitblit v1.10.0