| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.tools.upgrade; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import javax.security.auth.callback.Callback; |
| | |
| | | import javax.security.auth.callback.TextOutputCallback; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ReturnCode; |
| | | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.BuildVersion; |
| | | |
| | | |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ReturnCode; |
| | | |
| | | /** |
| | | * Context information which is passed to upgrade tasks. This might include |
| | |
| | | */ |
| | | public final class UpgradeContext |
| | | { |
| | | |
| | | /** |
| | | * The version we upgrade from. |
| | | */ |
| | | /** The version we upgrade from. */ |
| | | private final BuildVersion fromVersion; |
| | | |
| | | /** |
| | | * The version we want to upgrade to. |
| | | */ |
| | | /** The version we want to upgrade to. */ |
| | | private final BuildVersion toVersion; |
| | | |
| | | /** |
| | | * The call-back handler for interacting with the upgrade application. |
| | | */ |
| | | /** The call-back handler for interacting with the upgrade application. */ |
| | | private final CallbackHandler handler; |
| | | |
| | | /** |
| | | * If ignore errors is enabled. |
| | | */ |
| | | /** If ignore errors is enabled. */ |
| | | private boolean isIgnoreErrorsMode; |
| | | |
| | | /** |
| | | * If accept license is enabled. |
| | | */ |
| | | /** If accept license is enabled. */ |
| | | private boolean isAcceptLicenseMode; |
| | | |
| | | /** |
| | | * If interactive mode is enabled. |
| | | */ |
| | | /** If interactive mode is enabled. */ |
| | | private boolean isInteractiveMode; |
| | | |
| | | /** |
| | | * If force upgrade is enabled. |
| | | */ |
| | | /** If force upgrade is enabled. */ |
| | | private boolean isForceUpgradeMode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new upgrade context for upgrading from the instance version (as |
| | | * obtained from config/buildinfo) to the binary version. |
| | |
| | | this(BuildVersion.instanceVersion(), BuildVersion.binaryVersion(), handler); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Constructor for the upgrade context. |
| | | * |
| | |
| | | this.handler = handler; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the old version. |
| | | * |
| | |
| | | return fromVersion; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the new version. |
| | | * |
| | |
| | | return toVersion; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the ignore error mode. |
| | | * |
| | |
| | | return isIgnoreErrorsMode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the ignore errors mode. |
| | | * |
| | |
| | | return this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the accept license mode. |
| | | * |
| | |
| | | return isAcceptLicenseMode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the accept license mode. |
| | | * |
| | |
| | | return this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the callback handler. |
| | | * |
| | |
| | | return handler; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the status of the interactive mode. |
| | | * |
| | |
| | | return isInteractiveMode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the interactive mode. |
| | | * |
| | |
| | | return this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the status of the force upgrade mode. |
| | | * |
| | |
| | | return isForceUpgradeMode; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the force upgrade mode. |
| | | * |
| | |
| | | return this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sends notification message to the application via the call-back handler. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sends notification message to the application via the call-back handler |
| | | * containing specific sub type message. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Displays a progress callback. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Asks a confirmation to the user. Answer is yes or no. |
| | | * |
| | |
| | | } |
| | | return confirmYNCallback.getSelectedIndex(); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "Upgrade from " + fromVersion + " to " + toVersion; |
| | | } |
| | | } |