Renamed openMethod local variables to importCommand.
| | |
| | | } |
| | | for (DN dn : cfg.getBaseDN()) |
| | | { |
| | | ImportSuffixCommand openMethod = new ImportSuffixCommand(dn, importConfig); |
| | | if (openMethod.getSuffixImportStrategy() == SuffixImportStrategy.MERGE_DB_WITH_LDIF) |
| | | ImportSuffixCommand importCommand = new ImportSuffixCommand(dn, importConfig); |
| | | if (importCommand.getSuffixImportStrategy() == SuffixImportStrategy.MERGE_DB_WITH_LDIF) |
| | | { |
| | | // fail-fast to avoid ending up in an unrecoverable state for the server |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, ERR_IMPORT_UNSUPPORTED_WITH_BRANCH.get()); |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | |
| | | /** Command that describes how a suffix should be imported. Gives the strategy to use and the data to drive the |
| | | * import operation of a single suffix. |
| | | /** |
| | | * Command that describes how a suffix should be imported. Gives the strategy to use and the data to |
| | | * drive the import operation of a single suffix. |
| | | */ |
| | | public class ImportSuffixCommand |
| | | { |
| | |
| | | * branches are needed, normally used for append or clear backend modes. |
| | | */ |
| | | APPEND_OR_REPLACE, |
| | | /** |
| | | * Do not create a {@link Suffix}. |
| | | */ |
| | | /** Do not create a {@link Suffix}. */ |
| | | SKIP_SUFFIX, |
| | | /** |
| | | * Before creating a {@link Suffix}, clear the {@link EntryContainer} of the baseDN. |
| | | */ |
| | | /** Before creating a {@link Suffix}, clear the {@link EntryContainer} of the baseDN. */ |
| | | CLEAR_SUFFIX, |
| | | /** |
| | | * Create a temporary {@link EntryContainer} to merge LDIF with original data. |
| | | */ |
| | | /** Create a temporary {@link EntryContainer} to merge LDIF with original data. */ |
| | | MERGE_DB_WITH_LDIF, |
| | | /** |
| | | * Create a {@link Suffix} specifying include and exclude branches and optionally a source {@link EntryContainer}. |
| | | */ |
| | | INCLUDE_EXCLUDE_BRANCHES}; |
| | | INCLUDE_EXCLUDE_BRANCHES |
| | | } |
| | | |
| | | private List<DN> includeBranches; |
| | | private List<DN> excludeBranches; |
| | |
| | | * Shim that allows properly constructing an {@link OnDiskMergeBufferImporter} without polluting |
| | | * {@link ImportStrategy} and {@link RootContainer} with this importer inner workings. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | static final class StrategyImpl implements ImportStrategy |
| | | { |
| | | private final PluggableBackendCfg backendCfg; |
| | |
| | | /** Number of phase one buffers. */ |
| | | private int phaseOneBufferCount; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | OnDiskMergeBufferImporter(RootContainer rootContainer, RebuildConfig rebuildConfig, PluggableBackendCfg cfg, |
| | | ServerContext serverContext) throws InitializationException, StorageRuntimeException, ConfigException |
| | | { |
| | |
| | | throws ConfigException, DirectoryException |
| | | { |
| | | DN baseDN = entryContainer.getBaseDN(); |
| | | ImportSuffixCommand openMethod = new ImportSuffixCommand(baseDN, importCfg); |
| | | ImportSuffixCommand importCommand = new ImportSuffixCommand(baseDN, importCfg); |
| | | EntryContainer sourceEntryContainer = null; |
| | | |
| | | switch(openMethod.getSuffixImportStrategy()) |
| | | switch (importCommand.getSuffixImportStrategy()) |
| | | { |
| | | case APPEND_OR_REPLACE: |
| | | return new Suffix(entryContainer); |
| | |
| | | ERR_IMPORT_UNKNOWN_SUFFIX_COMMAND_STRATEGY.get(baseDN)); |
| | | } |
| | | |
| | | return new Suffix(entryContainer, sourceEntryContainer, openMethod.getIncludeBranches(), |
| | | openMethod.getExcludeBranches()); |
| | | return new Suffix(entryContainer, sourceEntryContainer, importCommand.getIncludeBranches(), |
| | | importCommand.getExcludeBranches()); |
| | | } |
| | | |
| | | private static void clearSuffix(EntryContainer entryContainer) |
| | |
| | | * Shim that allows properly constructing an {@link OnDiskMergeStorageImporter} without polluting |
| | | * {@link ImportStrategy} and {@link RootContainer} with this importer inner workings. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | static final class StrategyImpl implements ImportStrategy |
| | | { |
| | | private final PluggableBackendCfg backendCfg; |
| | |
| | | throws ConfigException, DirectoryException |
| | | { |
| | | DN baseDN = entryContainer.getBaseDN(); |
| | | ImportSuffixCommand openMethod = new ImportSuffixCommand(baseDN, importCfg); |
| | | ImportSuffixCommand importCommand = new ImportSuffixCommand(baseDN, importCfg); |
| | | EntryContainer sourceEntryContainer = null; |
| | | |
| | | switch(openMethod.getSuffixImportStrategy()) |
| | | switch (importCommand.getSuffixImportStrategy()) |
| | | { |
| | | case APPEND_OR_REPLACE: |
| | | return new Suffix(entryContainer); |
| | |
| | | ERR_IMPORT_UNKNOWN_SUFFIX_COMMAND_STRATEGY.get(baseDN)); |
| | | } |
| | | |
| | | return new Suffix(entryContainer, sourceEntryContainer, openMethod.getIncludeBranches(), |
| | | openMethod.getExcludeBranches()); |
| | | return new Suffix(entryContainer, sourceEntryContainer, importCommand.getIncludeBranches(), |
| | | importCommand.getExcludeBranches()); |
| | | } |
| | | |
| | | private static void clearSuffix(EntryContainer entryContainer) |