From b5c2c2145e4049b490075c8a0568d06a72d9e210 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Thu, 23 May 2013 08:10:24 +0000
Subject: [PATCH] CR-1720 OPENDJ-835 Upgrade should add HTTP Connection Handler to config.ldif OPENDJ-914 Upgrade should add Based HTTP Access Logger to config.ldif - HTTP connection handler and the based HTTP access logger are now added to upgrade. - The http-config.json is added to the config file during upgrade. - Simplified UpgradeTasks.java - Added new messages. - Fixed javadoc for unit test.
---
opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java | 199 ++++++++++++-------------------------------------
1 files changed, 49 insertions(+), 150 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
index 57151a3..fd55162 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -120,27 +120,8 @@
*/
public static UpgradeTask copySchemaFile(final String fileName)
{
- return new UpgradeTask()
+ return new AbstractUpgradeTask()
{
-
- @Override
- public void end(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void interact(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
@Override
public void perform(final UpgradeContext context,
final CallbackHandler handler) throws ClientException
@@ -170,27 +151,54 @@
e.getMessage()), pnc);
}
}
-
-
-
- @Override
- public void start(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void verify(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
};
}
+ /**
+ * This task copies the file placed in parameter within the config
+ * folder. If the file already exists, it's overwritten.
+ *
+ * @param fileName
+ * The name of the file which need to be copied.
+ * @return A task which copy the the file placed in parameter within the
+ * config folder. If the file already exists, it's
+ * overwritten.
+ */
+ public static UpgradeTask addConfigFile(final String fileName)
+ {
+ return new AbstractUpgradeTask()
+ {
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ final Message msg = INFO_UPGRADE_TASK_ADD_CONFIG_FILE.get(fileName);
+ LOG.log(Level.INFO, msg.toString());
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, msg, 0);
+
+ final File configFile = new File(templateConfigDirectory,
+ fileName);
+
+ try
+ {
+ context.notifyProgress(handler, pnc.changeProgress(20));
+
+ copy(configFile, configDirectory, true);
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final IOException e)
+ {
+ manageTaskException(
+ context,
+ handler,
+ ERR_UPGRADE_ADD_CONFIG_FILE_FAILS.get(configFile.getName(),
+ e.getMessage()), pnc);
+ }
+ }
+ };
+ }
/**
@@ -266,27 +274,9 @@
public static UpgradeTask newAttributeTypes(final Message summary,
final String fileName, final String... names)
{
- return new UpgradeTask()
+ return new AbstractUpgradeTask()
{
@Override
- public void end(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void interact(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
public void perform(final UpgradeContext context,
final CallbackHandler handler) throws ClientException
{
@@ -316,24 +306,6 @@
e.getMessage()), pnc);
}
}
-
-
-
- @Override
- public void start(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void verify(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
};
}
@@ -358,27 +330,9 @@
public static UpgradeTask newObjectClasses(final Message summary,
final String fileName, final String... names)
{
- return new UpgradeTask()
+ return new AbstractUpgradeTask()
{
@Override
- public void end(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void interact(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
public void perform(final UpgradeContext context,
final CallbackHandler handler) throws ClientException
{
@@ -411,24 +365,6 @@
schemaFileTemplate.getName(), e.getMessage()), pnc);
}
}
-
-
-
- @Override
- public void start(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void verify(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
};
}
@@ -514,27 +450,8 @@
*/
public static UpgradeTask updateConfigUpgradeFolder()
{
- return new UpgradeTask()
+ return new AbstractUpgradeTask()
{
-
- @Override
- public void end(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void interact(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
@Override
public void perform(final UpgradeContext context,
final CallbackHandler handler) throws ClientException
@@ -560,24 +477,6 @@
pnc);
}
}
-
-
-
- @Override
- public void start(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
-
-
-
- @Override
- public void verify(final UpgradeContext context,
- final CallbackHandler handler) throws ClientException
- {
- // Nothing to do.
- }
};
}
--
Gitblit v1.10.0