| | |
| | | static boolean isRebuildAllIndexesTaskAccepted = false; |
| | | |
| | | /** |
| | | * Returns a new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | * Returns a new upgrade task which adds a config entry to the underlying |
| | | * config file. |
| | | * |
| | | * @param summary |
| | | * The summary of this upgrade task. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns a new upgrade task which deletes a config entry from the underlying |
| | | * config file. |
| | | * |
| | | * @param summary |
| | | * The summary of this upgrade task. |
| | | * @param dnInLDIF |
| | | * The dn to delete in the form of LDIF. |
| | | * @return A new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | */ |
| | | public static UpgradeTask deleteConfigEntry(final Message summary, |
| | | final String dnInLDIF) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | | @Override |
| | | public void perform(final UpgradeContext context) throws ClientException |
| | | { |
| | | perform0(summary, null, ChangeOperationType.DELETE, context, dnInLDIF); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Returns a new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | * |
| | |
| | | { |
| | | if (userConfirmation) |
| | | { |
| | | displayTaskLogInformation(summary.toString(), null, ldif); |
| | | |
| | | final ProgressNotificationCallback pnc = |
| | | new ProgressNotificationCallback(0, summary, 20); |
| | | |
| | | context.notifyProgress(pnc); |
| | | |
| | | try |
| | | { |
| | | // TODO change the directory to the config if it exists. |
| | | final File configFile = |
| | | new File(configDirectory, |
| | | Installation.CURRENT_CONFIG_FILE_NAME); |
| | | |
| | | final int changeCount = |
| | | updateConfigFile(configFile.getPath(), null, |
| | | ChangeOperationType.ADD, ldif); |
| | | |
| | | displayChangeCount(configFile.getPath(), changeCount); |
| | | |
| | | context.notifyProgress(pnc.setProgress(100)); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | manageTaskException(context, Message.fromObject(e.getMessage()), |
| | | pnc); |
| | | } |
| | | perform0(summary, null, ChangeOperationType.ADD, context, ldif); |
| | | } |
| | | } |
| | | }; |
| | |
| | | { |
| | | if (userConfirmation) |
| | | { |
| | | displayTaskLogInformation(summary.toString(), filter, ldif); |
| | | |
| | | final ProgressNotificationCallback pnc = |
| | | new ProgressNotificationCallback(0, summary, 20); |
| | | |
| | | context.notifyProgress(pnc); |
| | | |
| | | try |
| | | { |
| | | final File configFile = |
| | | new File(configDirectory, |
| | | Installation.CURRENT_CONFIG_FILE_NAME); |
| | | |
| | | final int changeCount = |
| | | updateConfigFile(configFile.getPath(), Filter.valueOf(filter), |
| | | ChangeOperationType.MODIFY, ldif); |
| | | |
| | | displayChangeCount(configFile.getPath(), changeCount); |
| | | |
| | | context.notifyProgress(pnc.setProgress(100)); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | manageTaskException(context, Message.fromObject(e.getMessage()), |
| | | pnc); |
| | | } |
| | | perform0(summary, filter, ChangeOperationType.MODIFY, context, ldif); |
| | | } |
| | | } |
| | | |
| | | }; |
| | | } |
| | | |
| | | private static void perform0(final Message summary, final String filter, |
| | | final ChangeOperationType changeOperationType, |
| | | final UpgradeContext context, final String... ldif) |
| | | throws ClientException |
| | | { |
| | | displayTaskLogInformation(summary.toString(), filter, ldif); |
| | | |
| | | final ProgressNotificationCallback pnc = |
| | | new ProgressNotificationCallback(0, summary, 20); |
| | | |
| | | context.notifyProgress(pnc); |
| | | |
| | | try |
| | | { |
| | | final File configFile = |
| | | new File(configDirectory, Installation.CURRENT_CONFIG_FILE_NAME); |
| | | |
| | | final Filter filterVal = filter != null ? Filter.valueOf(filter) : null; |
| | | final int changeCount = |
| | | updateConfigFile(configFile.getPath(), filterVal, |
| | | changeOperationType, ldif); |
| | | |
| | | displayChangeCount(configFile.getPath(), changeCount); |
| | | |
| | | context.notifyProgress(pnc.setProgress(100)); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | | manageTaskException(context, Message.fromObject(e.getMessage()), pnc); |
| | | } |
| | | } |
| | | |
| | | // Prevent instantiation. |
| | | private UpgradeTasks() |