From 989396ebc3ef244c00e12917ade24dacd50dab0c Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Tue, 18 Sep 2012 20:45:16 +0000
Subject: [PATCH] Fix issue OPENDJ-587: Control-panel rebuild-index shouldn't disable the backend and use offline rebuild-index command. Removed useless message properties as well.
---
opends/src/messages/messages/admin_tool_fr.properties | 3 -
opends/src/messages/messages/admin_tool_es.properties | 3 -
opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java | 118 ++++-----------------------------------
opends/src/messages/messages/admin_tool.properties | 5 -
opends/src/messages/messages/admin_tool_ja.properties | 3 -
opends/src/messages/messages/admin_tool_zh_CN.properties | 3 -
opends/src/messages/messages/admin_tool_de.properties | 3 -
7 files changed, 12 insertions(+), 126 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java b/opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
index 969a9a9..5b09397 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.guitools.controlpanel.task;
@@ -44,17 +45,10 @@
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.IndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
-import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.ui.ProgressDialog;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.messages.Message;
-import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor;
-import org.opends.server.admin.client.ldap.LDAPManagementContext;
-import org.opends.server.admin.std.client.LocalDBBackendCfgClient;
-import org.opends.server.admin.std.client.RootCfgClient;
import org.opends.server.tools.RebuildIndex;
-import org.opends.server.types.OpenDsException;
/**
* The class that is used when a set of indexes must be rebuilt.
@@ -88,6 +82,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Type getType()
{
return Type.REBUILD_INDEXES;
@@ -96,6 +91,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Message getTaskDescription()
{
if (baseDNs.size() == 1)
@@ -114,6 +110,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean canLaunch(Task taskToBeLaunched,
Collection<Message> incompatibilityReasons)
{
@@ -138,34 +135,14 @@
/**
* {@inheritDoc}
*/
+ @Override
public void runTask()
{
state = State.RUNNING;
lastException = null;
try
{
- boolean mustDisable = false;
- boolean mustEnable = false;
boolean isLocal = getInfo().getServerDescriptor().isLocal();
- String backendName = backendSet.iterator().next();
- if (isServerRunning() && isLocal)
- {
- for (BackendDescriptor backend :
- getInfo().getServerDescriptor().getBackends())
- {
- if (backendName.equals(backend.getBackendID()))
- {
- mustDisable = backend.isEnabled();
- break;
- }
- }
- }
-
- if (mustDisable)
- {
- setBackendEnable(backendName, false);
- mustEnable = true;
- }
for (final String baseDN : baseDNs)
{
@@ -181,6 +158,7 @@
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
printEquivalentCommandLine(getCommandLinePath("rebuild-index"),
@@ -189,7 +167,7 @@
}
});
- if (isLocal)
+ if (isLocal && !isServerRunning())
{
returnCode = executeCommandLine(getCommandLinePath("rebuild-index"),
args);
@@ -205,10 +183,6 @@
break;
}
}
- if (mustEnable)
- {
- setBackendEnable(backendName, true);
- }
if (returnCode != 0)
{
@@ -234,6 +208,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected ArrayList<String> getCommandLineArguments()
{
return new ArrayList<String>();
@@ -275,10 +250,10 @@
}
boolean isLocal = getInfo().getServerDescriptor().isLocal();
- if (!isLocal)
+ if (isLocal && isServerRunning())
{
- args.addAll(getConnectionCommandLineArguments());
- args.addAll(getConfigCommandLineArguments());
+ args.addAll(getConnectionCommandLineArguments());
+ args.addAll(getConfigCommandLineArguments());
}
return args;
@@ -287,81 +262,12 @@
/**
* {@inheritDoc}
*/
+ @Override
protected String getCommandLinePath()
{
return null;
}
- /**
- * Enables a backend.
- * @param backendName the backend name.
- * @param enable whether to enable or disable the backend.
- * @throws OpenDsException if an error occurs.
- */
- private void setBackendEnable(final String backendName,
- final boolean enable) throws OpenDsException
- {
- final ArrayList<String> args = new ArrayList<String>();
- args.add("set-backend-prop");
- args.add("--backend-name");
- args.add(backendName);
- args.add("--set");
- args.add("enabled:"+enable);
-
- args.addAll(getConnectionCommandLineArguments());
- args.add(getNoPropertiesFileArgument());
- args.add("--no-prompt");
-
- final ProgressDialog progressDialog = getProgressDialog();
-
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- if (enable)
- {
- printEquivalentCommandLine(getCommandLinePath("dsconfig"),
- args, INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND.get(
- backendName));
- progressDialog.appendProgressHtml(Utilities.getProgressWithPoints(
- INFO_CTRL_PANEL_ENABLING_BACKEND.get(backendName),
- ColorAndFontConstants.progressFont));
- }
- else
- {
- printEquivalentCommandLine(getCommandLinePath("dsconfig"),
- args, INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND.get(
- backendName));
- progressDialog.appendProgressHtml(Utilities.getProgressWithPoints(
- INFO_CTRL_PANEL_DISABLING_BACKEND.get(backendName),
- ColorAndFontConstants.progressFont));
- }
- }
- });
-
- ManagementContext mCtx = LDAPManagementContext.createFromContext(
- JNDIDirContextAdaptor.adapt(getInfo().getDirContext()));
- RootCfgClient root = mCtx.getRootConfiguration();
- LocalDBBackendCfgClient backend =
- (LocalDBBackendCfgClient)root.getBackend(backendName);
-
- if (backend.isEnabled() != enable)
- {
- backend.setEnabled(enable);
- backend.commit();
- }
-
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- progressDialog.appendProgressHtml(Utilities.getProgressDone(
- ColorAndFontConstants.progressFont)+
- "<br><br>");
- }
- });
- }
-
private boolean rebuildAll()
{
boolean rebuildAll = true;
diff --git a/opends/src/messages/messages/admin_tool.properties b/opends/src/messages/messages/admin_tool.properties
index fd64451..12380ad 100644
--- a/opends/src/messages/messages/admin_tool.properties
+++ b/opends/src/messages/messages/admin_tool.properties
@@ -1128,11 +1128,6 @@
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION=Rebuild indexes in '%s'.
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX=Equivalent command line to \
rebuild indexes in '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=Equivalent command line to \
- enable the backend '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=Equivalent command line to \
- disable the backend '%s':
-
INFO_CTRL_PANEL_ENABLING_BACKEND=Enabling backend '%s'
INFO_CTRL_PANEL_DISABLING_BACKEND=Disabling backend '%s'
diff --git a/opends/src/messages/messages/admin_tool_de.properties b/opends/src/messages/messages/admin_tool_de.properties
index 7a0f25b..6fb7c6f 100644
--- a/opends/src/messages/messages/admin_tool_de.properties
+++ b/opends/src/messages/messages/admin_tool_de.properties
@@ -603,9 +603,6 @@
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY=Entsprechende Befehlszeile zum Erstellen des Eintrags:
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION=Indizes in '%s' neu erstellen.
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX=Entsprechende Befehlszeile zum Neuerstellen der Indizes in '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=Entsprechende Befehlszeile zum Aktivieren des Backends '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=Entsprechende Befehlszeile zum Deaktivieren des Backends '%s':
-
INFO_CTRL_PANEL_ENABLING_BACKEND=Backend '%s' wird aktiviert
INFO_CTRL_PANEL_DISABLING_BACKEND=Backend '%s' wird deaktiviert
diff --git a/opends/src/messages/messages/admin_tool_es.properties b/opends/src/messages/messages/admin_tool_es.properties
index 9020ab0..9f3664c 100644
--- a/opends/src/messages/messages/admin_tool_es.properties
+++ b/opends/src/messages/messages/admin_tool_es.properties
@@ -603,9 +603,6 @@
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY=L\u00ednea de comando equivalente para crear la entrada:
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION=Regenerar \u00edndices en '%s'.
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX=L\u00ednea de comandos equivalente para regenerar \u00edndices en '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=L\u00ednea de comando equivalente para eliminar el backend '%s':
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=L\u00ednea de comando equivalente para deshabilitar el backend '%s':
-
INFO_CTRL_PANEL_ENABLING_BACKEND=Habilitando backend '%s'
INFO_CTRL_PANEL_DISABLING_BACKEND=Deshabilitando backend '%s'
diff --git a/opends/src/messages/messages/admin_tool_fr.properties b/opends/src/messages/messages/admin_tool_fr.properties
index c261b93..6e55bf6 100644
--- a/opends/src/messages/messages/admin_tool_fr.properties
+++ b/opends/src/messages/messages/admin_tool_fr.properties
@@ -603,9 +603,6 @@
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY=Ligne de commande \u00e9quivalente pour cr\u00e9er l'entr\u00e9e\u00a0:
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION=Reconstituer les index dans '%s'
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX=Ligne de commande \u00e9quivalente pour reconstituer les index dans '%s'\u00a0:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=Ligne de commande \u00e9quivalente pour activer le backend '%s'\u00a0:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=Ligne de commande \u00e9quivalente pour d\u00e9sactiver le backend '%s'\u00a0:
-
INFO_CTRL_PANEL_ENABLING_BACKEND=Activation du backend '%s'
INFO_CTRL_PANEL_DISABLING_BACKEND=D\u00e9sactivation du backend '%s'
diff --git a/opends/src/messages/messages/admin_tool_ja.properties b/opends/src/messages/messages/admin_tool_ja.properties
index 4649c50..974c12e 100644
--- a/opends/src/messages/messages/admin_tool_ja.properties
+++ b/opends/src/messages/messages/admin_tool_ja.properties
@@ -600,9 +600,6 @@
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY=\u30a8\u30f3\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u540c\u7b49\u306e\u30b3\u30de\u30f3\u30c9\u884c:
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION='%s' \u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u518d\u69cb\u7bc9\u3057\u307e\u3059\u3002
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX='%s' \u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u518d\u69cb\u7bc9\u3059\u308b\u540c\u7b49\u306e\u30b3\u30de\u30f3\u30c9\u884c:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 '%s' \u3092\u6709\u52b9\u306b\u3059\u308b\u540c\u7b49\u306e\u30b3\u30de\u30f3\u30c9\u884c:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 '%s' \u3092\u7121\u52b9\u306b\u3059\u308b\u540c\u7b49\u306e\u30b3\u30de\u30f3\u30c9\u884c:
-
INFO_CTRL_PANEL_ENABLING_BACKEND=\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 '%s' \u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059
INFO_CTRL_PANEL_DISABLING_BACKEND=\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 '%s' \u3092\u7121\u52b9\u306b\u3057\u3066\u3044\u307e\u3059
diff --git a/opends/src/messages/messages/admin_tool_zh_CN.properties b/opends/src/messages/messages/admin_tool_zh_CN.properties
index 08aca34..fcf5a56 100644
--- a/opends/src/messages/messages/admin_tool_zh_CN.properties
+++ b/opends/src/messages/messages/admin_tool_zh_CN.properties
@@ -603,9 +603,6 @@
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY=\u53ef\u521b\u5efa\u6761\u76ee\u7684\u7b49\u6548\u547d\u4ee4\u884c:
INFO_CTRL_PANEL_REBUILD_INDEX_TASK_DESCRIPTION=\u5728 '%s' \u4e2d\u91cd\u65b0\u751f\u6210\u7d22\u5f15\u3002
INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_REBUILD_INDEX=\u53ef\u5728 '%s' \u4e2d\u91cd\u65b0\u751f\u6210\u7d22\u5f15\u7684\u7b49\u6548\u547d\u4ee4\u884c:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_ENABLE_BACKEND=\u53ef\u542f\u7528\u540e\u7aef '%s' \u7684\u7b49\u6548\u547d\u4ee4\u884c:
-INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DISABLE_BACKEND=\u53ef\u7981\u7528\u540e\u7aef '%s' \u7684\u7b49\u6548\u547d\u4ee4\u884c:
-
INFO_CTRL_PANEL_ENABLING_BACKEND=\u542f\u7528\u540e\u7aef '%s'
INFO_CTRL_PANEL_DISABLING_BACKEND=\u7981\u7528\u540e\u7aef '%s'
--
Gitblit v1.10.0