| | |
| | | import org.opends.quicksetup.util.FileManager; |
| | | import org.opends.quicksetup.util.IncompatibleVersionException; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.tools.BackendTypeHelper; |
| | | import org.opends.server.tools.BackendTypeHelper.BackendTypeUIAdapter; |
| | | import org.opends.server.util.CertificateManager; |
| | |
| | | |
| | | // The keys are the backend IDs and the values the list of base DNs. |
| | | final Map<String, Set<String>> hmBackendSuffix = new HashMap<>(); |
| | | final Map<String, BackendTypeUIAdapter> backendTypes = new HashMap<>(); |
| | | final Set<SuffixDescriptor> suffixes = getUserData().getSuffixesToReplicateOptions().getSuffixes(); |
| | | |
| | | populateBackendsToCreate(hmBackendSuffix, suffixes, backendTypes); |
| | | createReplicatedBackends(hmBackendSuffix, backendTypes); |
| | | final SuffixesToReplicateOptions suffixData = getUserData().getSuffixesToReplicateOptions(); |
| | | populateBackendsToCreate(hmBackendSuffix, suffixData.getSuffixes()); |
| | | createReplicatedBackends(hmBackendSuffix, suffixData.getSuffixBackendTypes()); |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | checkAbort(); |
| | | } |
| | |
| | | * configuration of the other server. The algorithm consists on putting the |
| | | * remote servers in a list and pick the backend as they appear on the list. |
| | | */ |
| | | private void populateBackendsToCreate(Map<String, Set<String>> hmBackendSuffix, Set<SuffixDescriptor> suffixes, |
| | | Map<String, BackendTypeUIAdapter> backendTypes) |
| | | private void populateBackendsToCreate(Map<String, Set<String>> hmBackendSuffix, Set<SuffixDescriptor> suffixes) |
| | | { |
| | | Set<ServerDescriptor> serverList = getServerListFromSuffixes(suffixes); |
| | | for (SuffixDescriptor suffix : suffixes) |
| | |
| | | { |
| | | final String backendNameKey = getOrAddBackend(hmBackendSuffix, replica.getBackendName()); |
| | | hmBackendSuffix.get(backendNameKey).add(suffix.getDN()); |
| | | backendTypes.put(backendNameKey, getBackendType(replica.getObjectClasses())); |
| | | } |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | private BackendTypeUIAdapter getBackendType(Set<String> objectClasses) |
| | | { |
| | | for (String objectClass : objectClasses) |
| | | { |
| | | BackendTypeUIAdapter adapter = |
| | | BackendTypeHelper.getBackendTypeAdapter(objectClass.replace(ConfigConstants.NAME_PREFIX_CFG, "")); |
| | | if (adapter != null) |
| | | { |
| | | return adapter; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String getOrAddBackend(Map<String, Set<String>> hmBackendSuffix, String backendName) |
| | | { |
| | | for (String storedBackend : hmBackendSuffix.keySet()) |
| | |
| | | * @throws UserDataException |
| | | * if the data provided by the user is not valid. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | private void updateUserDataForSuffixesOptionsPanel(QuickSetup qs) throws UserDataException |
| | | { |
| | | List<LocalizableMessage> errorMsgs = new ArrayList<>(); |
| | |
| | | } |
| | | qs.displayFieldInvalid(FieldName.SUFFIXES_TO_REPLICATE, false); |
| | | Set<SuffixDescriptor> available = getUserData().getSuffixesToReplicateOptions().getAvailableSuffixes(); |
| | | |
| | | SuffixesToReplicateOptions options = |
| | | new SuffixesToReplicateOptions(SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES, available, |
| | | chosen); |
| | | Map<String, BackendTypeUIAdapter> suffixesBackendTypes = |
| | | (Map<String, BackendTypeUIAdapter>) qs.getFieldValue(FieldName.SUFFIXES_TO_REPLICATE_BACKEND_TYPE); |
| | | SuffixesToReplicateOptions options = new SuffixesToReplicateOptions( |
| | | SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES, available, chosen, suffixesBackendTypes); |
| | | getUserData().setSuffixesToReplicateOptions(options); |
| | | } |
| | | getUserData().setRemoteWithNoReplicationPort(getRemoteWithNoReplicationPort(getUserData())); |