Fix for issue 2780.
The problem was that cn=admin data was being overwritten by the reversion. This must not be done. A new file filter class (specific to the reversion) has been added to fix the issue.
1 files added
5 files modified
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | | |
| | | import java.io.File; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.Set; |
| | |
| | | import javax.naming.ldap.Control; |
| | | import javax.naming.ldap.LdapContext; |
| | | |
| | | |
| | | /** |
| | | * Class used to update and read the contents of the Administration Data. |
| | | */ |
| | |
| | | */ |
| | | public static String getAdminLDIFFile() |
| | | { |
| | | return "config/admin-backend.ldif"; |
| | | return "config"+File.separator+"admin-backend.ldif"; |
| | | } |
| | | |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | public static final String DEFAULT_JAVA_PROPERTIES_FILE = "java.properties"; |
| | | |
| | | /** |
| | | * The default java properties file relative path. |
| | | */ |
| | | public static final String RELATIVE_JAVA_PROPERTIES_FILE = |
| | | CONFIG_PATH_RELATIVE+File.separator+"java.properties"; |
| | | |
| | | /** |
| | | * The set java home and arguments properties file for Windows. |
| | | */ |
| | | public static final String SET_JAVA_PROPERTIES_FILE_WINDOWS = |
| 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 |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.upgrader; |
| | | |
| | | import java.io.File; |
| | | import java.util.HashSet; |
| | | |
| | | /** |
| | | * Filter defining files we want to manage in the upgrade |
| | | * process. |
| | | */ |
| | | class RevertFileFilter extends UpgradeFileFilter { |
| | | |
| | | /** |
| | | * Creates a filter for ignoring in an OpenDS installation at |
| | | * <code>root</code>certain OpenDS files below root. |
| | | * @param root the root of the installation |
| | | */ |
| | | public RevertFileFilter(File root) { |
| | | super(root); |
| | | this.filesToIgnore = new HashSet<File>(); |
| | | for (String rootFileNamesToIgnore : |
| | | Upgrader.ROOT_FILES_TO_IGNORE_DURING_BACKUP) { |
| | | filesToIgnore.add(new File(root, rootFileNamesToIgnore)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | notifyListeners(getLineBreak()); |
| | | } |
| | | } catch (ApplicationException ae) { |
| | | runError = ae; |
| | | notifyListeners(getFormattedErrorWithLineBreak()); |
| | | } |
| | | } |
| | |
| | | notifyListeners(getLineBreak()); |
| | | } |
| | | } catch (ApplicationException ae) { |
| | | runError = ae; |
| | | notifyListeners(getFormattedErrorWithLineBreak()); |
| | | } |
| | | } |
| | |
| | | { |
| | | log = getFormattedWithPoints(log); |
| | | } |
| | | notifyListeners(progress, log, log); |
| | | notifyListeners(progress, summary, log); |
| | | } |
| | | |
| | | private void initialize() throws ApplicationException { |
| | |
| | | File filesBackupDirectory = getTempBackupDirectory(); |
| | | FileManager fm = new FileManager(); |
| | | File root = getInstallation().getRootDirectory(); |
| | | FileFilter filter = new UpgradeFileFilter(root); |
| | | FileFilter filter = new RevertFileFilter(root); |
| | | for (String fileName : root.list()) { |
| | | File f = new File(root, fileName); |
| | | |
| | |
| | | Stage stage = getStage(); |
| | | Installation installation = getInstallation(); |
| | | File root = installation.getRootDirectory(); |
| | | stage.move(root); |
| | | stage.move(root, new RevertFileFilter(getReversionFilesDirectory())); |
| | | |
| | | // The bits should now be of the new version. Have |
| | | // the installation update the build information so |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.upgrader; |
| | |
| | | import org.opends.quicksetup.util.FileManager; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileFilter; |
| | | import java.io.IOException; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | |
| | | * Moves the files in the staging area to a destination directory. |
| | | * |
| | | * @param destination for the staged files |
| | | * @param fileFilter the file filter to be used |
| | | * @throws ApplicationException if something goes wrong |
| | | */ |
| | | public void move(File destination) throws ApplicationException { |
| | | UpgradeFileFilter ff = new UpgradeFileFilter(root); |
| | | public void move(File destination, FileFilter fileFilter) |
| | | throws ApplicationException { |
| | | for (String fileName : root.list()) { |
| | | File dest = new File(destination, fileName); |
| | | File src = getSourceForCopy(fileName, dest); |
| | | fm.copyRecursively(src, destination, ff, /*overwrite=*/true); |
| | | //fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true); |
| | | fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true); |
| | | } |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.upgrader; |
| | |
| | | // Files that will be ignored during backup |
| | | static final String[] FILES_TO_IGNORE_DURING_BACKUP = { |
| | | TOOLS_PROPERTIES, // tools.properties |
| | | RELATIVE_JAVA_PROPERTIES_FILE, // java.properties |
| | | ADSContext.getAdminLDIFFile() // admin-backend.ldif |
| | | }; |
| | | |
| | |
| | | Stage stage = getStage(); |
| | | Installation installation = getInstallation(); |
| | | File root = installation.getRootDirectory(); |
| | | stage.move(root); |
| | | stage.move(root, new UpgradeFileFilter(getStageDirectory())); |
| | | |
| | | // The bits should now be of the new version. Have |
| | | // the installation update the build information so |