ArrayList<String> cmdLine = new ArrayList<String>();
String cmdName = getCommandLinePath("dsreplication");
cmdLine.add(cmdName);
cmdLine.add("enable");
DataReplicationOptions replOptions = userData.getReplicationOptions();
cmdLine.add("--host1");
cmdLine.add(server.getHostName());
cmdLine.add("--port1");
cmdLine.add(String.valueOf(server.getEnabledAdministrationPorts().get(0)));
AuthenticationData authData =
userData.getReplicationOptions().getAuthenticationData();
if (!Utils.areDnsEqual(authData.getDn(),
ADSContext.getAdministratorDN(userData.getGlobalAdministratorUID())))
{
cmdLine.add("--bindDN1");
cmdLine.add(authData.getDn());
cmdLine.add("--bindPassword1");
cmdLine.add(OBFUSCATED_VALUE);
}
for (ServerDescriptor s :
userData.getRemoteWithNoReplicationPort().keySet())
{
if (s.getAdminConnectorURL().equals(server.getAdminConnectorURL()))
{
AuthenticationData remoteRepl =
userData.getRemoteWithNoReplicationPort().get(server);
int remoteReplicationPort = remoteRepl.getPort();
cmdLine.add("--replicationPort1");
cmdLine.add(String.valueOf(remoteReplicationPort));
if (remoteRepl.useSecureConnection())
{
cmdLine.add("--secureReplication1");
}
}
}
cmdLine.add("--host2");
cmdLine.add(userData.getHostName());
cmdLine.add("--port2");
cmdLine.add(String.valueOf(userData.getAdminConnectorPort()));
cmdLine.add("--bindDN2");
cmdLine.add(userData.getDirectoryManagerDn());
cmdLine.add("--bindPassword2");
cmdLine.add(OBFUSCATED_VALUE);
if (replOptions.getReplicationPort() != -1)
{
cmdLine.add("--replicationPort2");
cmdLine.add(
String.valueOf(replOptions.getReplicationPort()));
if (replOptions.useSecureReplication())
{
cmdLine.add("--secureReplication2");
}
}