| | |
| | | uData.setUseStartTLS1(useStartTLS1); |
| | | } |
| | | int replicationPort1 = -1; |
| | | boolean secureReplication1 = argParser.isSecureReplication1(); |
| | | if (ctx1 != null) |
| | | { |
| | | // Try to get the replication port for server 1 only if it is required. |
| | |
| | | } |
| | | } |
| | | } |
| | | if (!secureReplication1) |
| | | { |
| | | secureReplication1 = |
| | | confirm(INFO_REPLICATION_ENABLE_SECURE1_PROMPT.get( |
| | | String.valueOf(replicationPort1)), false); |
| | | } |
| | | } |
| | | // If the server contains an ADS. Try to load it and only load it: if |
| | | // there are issues with the ADS they will be encountered in the |
| | |
| | | } |
| | | } |
| | | uData.setReplicationPort1(replicationPort1); |
| | | uData.setSecureReplication1(secureReplication1); |
| | | |
| | | /* |
| | | * Prompt for information on the second server. |
| | |
| | | uData.setUseStartTLS2(useStartTLS2); |
| | | } |
| | | int replicationPort2 = -1; |
| | | boolean secureReplication2 = argParser.isSecureReplication2(); |
| | | if (ctx2 != null) |
| | | { |
| | | if (!hasReplicationPort(ctx2)) |
| | |
| | | } |
| | | if (host1.equalsIgnoreCase(host2)) |
| | | { |
| | | if (replicationPort1 == replicationPort2) |
| | | if ((replicationPort1 > 0) && |
| | | (replicationPort1 == replicationPort2)) |
| | | { |
| | | printLineBreak(); |
| | | printErrorMessage(ERR_REPLICATION_SAME_REPLICATION_PORT.get( |
| | | String.valueOf(replicationPort1), host1)); |
| | | String.valueOf(replicationPort2), host1)); |
| | | printLineBreak(); |
| | | replicationPort2 = -1; |
| | | } |
| | | } |
| | | } |
| | | if (!secureReplication2) |
| | | { |
| | | secureReplication2 = |
| | | confirm(INFO_REPLICATION_ENABLE_SECURE2_PROMPT.get( |
| | | String.valueOf(replicationPort2)), false); |
| | | } |
| | | } |
| | | // If the server contains an ADS. Try to load it and only load it: if |
| | | // there are issues with the ADS they will be encountered in the |
| | |
| | | } |
| | | } |
| | | uData.setReplicationPort2(replicationPort2); |
| | | uData.setSecureReplication2(secureReplication2); |
| | | |
| | | // If the adminUid and adminPwd are not set in the EnableReplicationUserData |
| | | // object, that means that there are no administrators and that they |
| | |
| | | int replicationPort1 = getValue(argParser.getReplicationPort1(), |
| | | argParser.getDefaultReplicationPort1()); |
| | | uData.setReplicationPort1(replicationPort1); |
| | | uData.setSecureReplication1(argParser.isSecureReplication1()); |
| | | |
| | | String host2Name = getValue(argParser.getHostName2(), |
| | | argParser.getDefaultHostName2()); |
| | |
| | | int replicationPort2 = getValue(argParser.getReplicationPort2(), |
| | | argParser.getDefaultReplicationPort2()); |
| | | uData.setReplicationPort2(replicationPort2); |
| | | uData.setSecureReplication2(argParser.isSecureReplication2()); |
| | | uData.setReplicateSchema(!argParser.noSchemaReplication()); |
| | | } |
| | | |
| | |
| | | ReplicationSynchronizationProviderCfgClient sync = null; |
| | | sync = (ReplicationSynchronizationProviderCfgClient) |
| | | root.getSynchronizationProvider("Multimaster Synchronization"); |
| | | /* |
| | | * Configure the replication server. |
| | | */ |
| | | if (sync.hasReplicationServer()) |
| | | { |
| | | ReplicationServerCfgClient replicationServer = |
| | |
| | | try |
| | | { |
| | | configureAsReplicationServer(ctx1, uData.getReplicationPort1(), |
| | | allRepServers, usedReplicationServerIds); |
| | | uData.isSecureReplication1(), allRepServers, |
| | | usedReplicationServerIds); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | try |
| | | { |
| | | configureAsReplicationServer(ctx2, uData.getReplicationPort2(), |
| | | allRepServers, usedReplicationServerIds); |
| | | uData.isSecureReplication2(), allRepServers, |
| | | usedReplicationServerIds); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | int nCols; |
| | | final int SERVERPORT = 0; |
| | | final int NUMBER_ENTRIES = 1; |
| | | final int MISSING_CHANGES = 2; |
| | | final int AGE_OF_OLDEST_MISSING_CHANGE = 3; |
| | | final int REPLICATION_PORT = 4; |
| | | final int SECURE = 5; |
| | | Message[] headers; |
| | | if (scriptFriendly) |
| | | { |
| | | if (isReplicated) |
| | | { |
| | | nCols = 4; |
| | | headers = new Message[] { |
| | | INFO_REPLICATION_STATUS_LABEL_SERVERPORT.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_NUMBER_ENTRIES.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_MISSING_CHANGES.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_AGE_OF_OLDEST_MISSING_CHANGE.get() |
| | | INFO_REPLICATION_STATUS_LABEL_AGE_OF_OLDEST_MISSING_CHANGE.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_REPLICATION_PORT.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_SECURE.get() |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | nCols = 2; |
| | | headers = new Message[] { |
| | | INFO_REPLICATION_STATUS_LABEL_SERVERPORT.get(), |
| | | INFO_REPLICATION_STATUS_LABEL_NUMBER_ENTRIES.get() |
| | |
| | | { |
| | | if (isReplicated) |
| | | { |
| | | nCols = 4; |
| | | headers = new Message[] { |
| | | INFO_REPLICATION_STATUS_HEADER_SERVERPORT.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_NUMBER_ENTRIES.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_MISSING_CHANGES.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_AGE_OF_OLDEST_MISSING_CHANGE.get() |
| | | INFO_REPLICATION_STATUS_HEADER_AGE_OF_OLDEST_MISSING_CHANGE.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_REPLICATION_PORT.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_SECURE.get() |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | nCols = 2; |
| | | headers = new Message[] { |
| | | INFO_REPLICATION_STATUS_HEADER_SERVERPORT.get(), |
| | | INFO_REPLICATION_STATUS_HEADER_NUMBER_ENTRIES.get() |
| | | }; |
| | | } |
| | | } |
| | | Message[][] values = new Message[orderedReplicas.size()][nCols]; |
| | | Message[][] values = new Message[orderedReplicas.size()][headers.length]; |
| | | |
| | | int[] maxWidths = new int[nCols]; |
| | | int[] maxWidths = new int[headers.length]; |
| | | int i; |
| | | for (i=0; i<maxWidths.length; i++) |
| | | { |
| | |
| | | for (ReplicaDescriptor replica : orderedReplicas) |
| | | { |
| | | Message v; |
| | | for (int j=0; j<nCols; j++) |
| | | for (int j=0; j<headers.length; j++) |
| | | { |
| | | switch (j) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | v = INFO_NOT_AVAILABLE_LABEL.get(); |
| | | v = INFO_NOT_AVAILABLE_SHORT_LABEL.get(); |
| | | } |
| | | break; |
| | | case MISSING_CHANGES: |
| | |
| | | } |
| | | else |
| | | { |
| | | v = INFO_NOT_AVAILABLE_LABEL.get(); |
| | | v = INFO_NOT_AVAILABLE_SHORT_LABEL.get(); |
| | | } |
| | | break; |
| | | case AGE_OF_OLDEST_MISSING_CHANGE: |
| | |
| | | } |
| | | else |
| | | { |
| | | v = INFO_NOT_AVAILABLE_LABEL.get(); |
| | | v = INFO_NOT_AVAILABLE_SHORT_LABEL.get(); |
| | | } |
| | | break; |
| | | case REPLICATION_PORT: |
| | | int replicationPort = replica.getServer().getReplicationServerPort(); |
| | | if (replicationPort >= 0) |
| | | { |
| | | v = Message.raw(String.valueOf(replicationPort)); |
| | | } |
| | | else |
| | | { |
| | | v = INFO_NOT_AVAILABLE_SHORT_LABEL.get(); |
| | | } |
| | | break; |
| | | case SECURE: |
| | | if (replica.getServer().isReplicationSecure()) |
| | | { |
| | | v = INFO_REPLICATION_STATUS_SECURITY_ENABLED.get(); |
| | | } |
| | | else |
| | | { |
| | | v = INFO_REPLICATION_STATUS_SECURITY_DISABLED.get(); |
| | | } |
| | | break; |
| | | default: |
| | |
| | | }; |
| | | for (i=0; i<labels.length; i++) |
| | | { |
| | | printProgressMessage(labels[i]+": "+vs[i]); |
| | | printProgressMessage(labels[i]+" "+vs[i]); |
| | | printProgressLineBreak(); |
| | | } |
| | | |
| | |
| | | printProgressLineBreak(); |
| | | for (int j=0; j<values[i].length; j++) |
| | | { |
| | | printProgressMessage(headers[j]+": "+values[i][j]); |
| | | printProgressMessage(headers[j]+" "+values[i][j]); |
| | | printProgressLineBreak(); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (isReplicated) |
| | | { |
| | | printProgressMessage( |
| | | printProgressMessageNoWrap( |
| | | INFO_REPLICATION_STATUS_REPLICATED.get(dn)); |
| | | printProgressLineBreak(); |
| | | } |
| | | else |
| | | { |
| | | printProgressMessage( |
| | | printProgressMessageNoWrap( |
| | | INFO_REPLICATION_STATUS_NOT_REPLICATED.get(dn)); |
| | | printProgressLineBreak(); |
| | | } |
| | |
| | | { |
| | | builder.append("="); |
| | | } |
| | | printProgressMessage(builder.toString()); |
| | | printProgressMessageNoWrap(builder.toString()); |
| | | printProgressLineBreak(); |
| | | printProgressMessage(headerLine.toMessage()); |
| | | printProgressMessageNoWrap(headerLine.toMessage()); |
| | | printProgressLineBreak(); |
| | | builder = new StringBuilder(); |
| | | for (i=0; i<headerLine.length(); i++) |
| | | { |
| | | builder.append("-"); |
| | | } |
| | | printProgressMessage(builder.toString()); |
| | | printProgressMessageNoWrap(builder.toString()); |
| | | printProgressLineBreak(); |
| | | |
| | | for (i=0; i<values.length; i++) |
| | |
| | | line.append(" "); |
| | | } |
| | | } |
| | | printProgressMessage(line.toMessage()); |
| | | printProgressMessageNoWrap(line.toMessage()); |
| | | printProgressLineBreak(); |
| | | } |
| | | } |
| | |
| | | * port. |
| | | * @param ctx the context connected to the server that we want to configure. |
| | | * @param replicationPort the replication port of the replication server. |
| | | * @param useSecureReplication whether to have encrypted communication with |
| | | * the replication port or not. |
| | | * @param replicationServers the list of replication servers to which the |
| | | * replication server will communicate with. |
| | | * @param usedReplicationServerIds the set of replication server IDs that |
| | |
| | | * @throws OpenDsException if there is an error updating the configuration. |
| | | */ |
| | | private void configureAsReplicationServer(InitialLdapContext ctx, |
| | | int replicationPort, LinkedHashSet<String> replicationServers, |
| | | int replicationPort, boolean useSecureReplication, |
| | | LinkedHashSet<String> replicationServers, |
| | | Set<Integer> usedReplicationServerIds) throws OpenDsException |
| | | { |
| | | printProgressMessage(formatter.getFormattedWithPoints( |
| | |
| | | |
| | | if (!sync.hasReplicationServer()) |
| | | { |
| | | CryptoManagerCfgClient crypto = root.getCryptoManager(); |
| | | if (useSecureReplication != crypto.isSSLEncryption()) |
| | | { |
| | | crypto.setSSLEncryption(useSecureReplication); |
| | | crypto.commit(); |
| | | } |
| | | int id = InstallerHelper.getReplicationId(usedReplicationServerIds); |
| | | usedReplicationServerIds.add(id); |
| | | replicationServer = sync.createReplicationServer( |