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.
1 files added
5 files modified
| | |
| | | INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS_1850=See '%s' for a detailed log of this operation |
| | | INFO_UPGRADE_TASK_REPLACE_SCHEMA_FILE_1851=Replacing schema file '%s' |
| | | INFO_UPGRADE_TASK_REFRESH_UPGRADE_DIRECTORY_1852=Archiving concatenated schema |
| | | INFO_UPGRADE_TASK_ADD_CONFIG_FILE_1853=Adding '%s' configuration file |
| | | SEVERE_ERR_UPGRADE_ADD_CONFIG_FILE_FAILS_1854=An error occurred while adding \ |
| | | configuration file '%s': %s |
| | | |
| | | # Upgrade tasks |
| | | INFO_UPGRADE_TASK_6869_SUMMARY_10000=Fixing de-DE collation matching rule OID |
| | |
| | | INFO_UPGRADE_TASK_8387_SUMMARY_10011=Updating dictionary password validator configuration |
| | | INFO_UPGRADE_TASK_8389_SUMMARY_10012=Updating attribute value password validator configuration |
| | | INFO_UPGRADE_TASK_8487_SUMMARY_10013=Adding PBKDF2 password storage scheme configuration |
| | | INFO_UPGRADE_TASK_8613_SUMMARY_10014=Adding HTTP connection handler configuration |
| | | INFO_UPGRADE_TASK_8832_SUMMARY_10015=Adding file-based HTTP access logger |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.upgrade; |
| | | |
| | | import javax.security.auth.callback.CallbackHandler; |
| | | |
| | | import org.opends.server.tools.ClientException; |
| | | |
| | | /** |
| | | * Abstract upgrade task implementation. |
| | | */ |
| | | public abstract class AbstractUpgradeTask implements UpgradeTask |
| | | { |
| | | /** |
| | | * Creates a new abstract upgrade task. |
| | | */ |
| | | protected AbstractUpgradeTask() |
| | | { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void end(UpgradeContext context, CallbackHandler handler) |
| | | throws ClientException |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void interact(UpgradeContext context, CallbackHandler handler) |
| | | throws ClientException |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void start(UpgradeContext context, CallbackHandler handler) |
| | | throws ClientException |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void verify(UpgradeContext context, CallbackHandler handler) |
| | | throws ClientException |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | } |
| | |
| | | + "PBKDF2PasswordStorageScheme", |
| | | "ds-cfg-enabled: true")); |
| | | |
| | | register("2.5.0.8613", |
| | | addConfigFile("http-config.json"), |
| | | addConfigEntry(INFO_UPGRADE_TASK_8613_SUMMARY.get(), |
| | | "dn: cn=HTTP Connection Handler,cn=Connection Handlers,cn=config", |
| | | "changetype: add", |
| | | "objectClass: ds-cfg-http-connection-handler", |
| | | "objectClass: ds-cfg-connection-handler", |
| | | "objectClass: top", |
| | | "ds-cfg-listen-port: 8080", |
| | | "cn: HTTP Connection Handler", |
| | | "ds-cfg-max-blocked-write-time-limit: 2 minutes", |
| | | "ds-cfg-ssl-client-auth-policy: optional", |
| | | "ds-cfg-use-tcp-keep-alive: true", |
| | | "ds-cfg-max-request-size: 5 megabytes", |
| | | "ds-cfg-use-tcp-no-delay: true", |
| | | "ds-cfg-allow-tcp-reuse-address: true", |
| | | "ds-cfg-accept-backlog: 128", |
| | | "ds-cfg-authentication-required: true", |
| | | "ds-cfg-buffer-size: 4096 bytes", |
| | | "ds-cfg-config-file: config/http-config.json", |
| | | "ds-cfg-listen-address: 0.0.0.0", |
| | | "ds-cfg-java-class: " + |
| | | "org.opends.server.protocols.http.HTTPConnectionHandler", |
| | | "ds-cfg-keep-stats: true", |
| | | "ds-cfg-ssl-cert-nickname: server-cert", |
| | | "ds-cfg-use-ssl: false", |
| | | "ds-cfg-enabled: false")); |
| | | |
| | | register("2.5.0.8832", addConfigEntry(INFO_UPGRADE_TASK_8832_SUMMARY.get(), |
| | | "dn: cn=File-Based HTTP Access Logger,cn=Loggers,cn=config", |
| | | "changetype: add", |
| | | "objectClass: ds-cfg-file-based-http-access-log-publisher", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-http-access-log-publisher", |
| | | "objectClass: ds-cfg-log-publisher", |
| | | "cn: File-Based HTTP Access Logger", |
| | | "ds-cfg-java-class: " + |
| | | "org.opends.server.loggers.TextHTTPAccessLogPublisher", |
| | | "ds-cfg-asynchronous: true", |
| | | "ds-cfg-log-file: logs/http-access", |
| | | "ds-cfg-rotation-policy: " + |
| | | "cn=24 Hours Time Limit Rotation Policy," + |
| | | "cn=Log Rotation Policies,cn=config", |
| | | "ds-cfg-rotation-policy: " + |
| | | "cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config", |
| | | "ds-cfg-retention-policy: " + |
| | | "cn=File Count Retention Policy,cn=Log Retention Policies,cn=config", |
| | | "ds-cfg-log-file-permissions: 640", |
| | | "ds-cfg-enabled: false")); |
| | | /* |
| | | * All upgrades will refresh the server configuration schema and generate |
| | | * a new upgrade folder. |
| | |
| | | /*register("2.5.0.8657", |
| | | rebuildAllIndexes(Message.raw("This is fake Rebuild Task")));*/ |
| | | |
| | | // FIXME: HTTP connection handler and access logger when complete. |
| | | |
| | | // @formatter:on |
| | | } |
| | | |
| | |
| | | */ |
| | | 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 |
| | |
| | | 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); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | 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 |
| | | { |
| | |
| | | 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. |
| | | } |
| | | }; |
| | | } |
| | | |
| | |
| | | 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 |
| | | { |
| | |
| | | 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. |
| | | } |
| | | }; |
| | | } |
| | | |
| | |
| | | */ |
| | | 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 |
| | |
| | | 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. |
| | | } |
| | | }; |
| | | } |
| | | |
| | |
| | | + File.separator + Installation.CONFIG_PATH_RELATIVE + File.separator |
| | | + Installation.SCHEMA_PATH_RELATIVE); |
| | | |
| | | /** The template/config folder of the current installation. */ |
| | | static final File templateConfigDirectory = new File( |
| | | getInstallationPath(), Installation.TEMPLATE_RELATIVE_PATH |
| | | + File.separator + Installation.CONFIG_PATH_RELATIVE); |
| | | |
| | | /** |
| | | * Returns the path of the installation of the directory server. Note that |
| | | * this method assumes that this code is being run locally. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Tests the Upgrade tool with a running server throws an error. |
| | | * Tests the upgrade with an offline server and empty args fails. |
| | | */ |
| | | @Test() |
| | | public void testUpgradeServerOffline() throws InitializationException, |
| | | public void testUpgradeServerOfflineEmptyArgs() throws InitializationException, |
| | | ConfigException, DirectoryException, IOException |
| | | { |
| | | String[] args = { "" }; |