| | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.admin.ads.ServerDescriptor.*; |
| | | import static org.opends.admin.ads.ServerDescriptor.ServerProperty.*; |
| | | import static org.opends.admin.ads.util.ConnectionUtils.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static org.opends.quicksetup.Step.*; |
| | | import static org.opends.quicksetup.util.Utils.*; |
| | |
| | | // Try to connect |
| | | DataReplicationOptions repl = getUserData().getReplicationOptions(); |
| | | AuthenticationData auth = repl.getAuthenticationData(); |
| | | String ldapUrl = getLdapUrl(auth); |
| | | String dn = auth.getDn(); |
| | | String pwd = auth.getPwd(); |
| | | if (isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedWithPoints( |
| | |
| | | } |
| | | try |
| | | { |
| | | if (auth.useSecureConnection()) |
| | | { |
| | | ApplicationTrustManager trustManager = getTrustManager(); |
| | | trustManager.setHost(auth.getHostName()); |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | else |
| | | { |
| | | ctx = createLdapContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null); |
| | | } |
| | | ctx = createInitialLdapContext(auth); |
| | | |
| | | ADSContext adsContext = new ADSContext(ctx); |
| | | if (createdRemoteAds) |
| | |
| | | } |
| | | for (ServerDescriptor server : lastLoadedCache.getServers()) |
| | | { |
| | | Object v = server.getServerProperties().get |
| | | (ServerDescriptor.ServerProperty.REPLICATION_SERVER_ID); |
| | | Object v = server.getServerProperties().get(REPLICATION_SERVER_ID); |
| | | if (v != null) |
| | | { |
| | | knownReplicationServerIds.add((Integer)v); |
| | |
| | | for (ReplicaDescriptor replica : suffix.getReplicas()) |
| | | { |
| | | knownServerIds.add(replica.getReplicationId()); |
| | | Object v = replica.getServer().getServerProperties().get |
| | | (ServerDescriptor.ServerProperty.REPLICATION_SERVER_ID); |
| | | Object v = replica.getServer().getServerProperties().get(REPLICATION_SERVER_ID); |
| | | if (v != null) |
| | | { |
| | | knownReplicationServerIds.add((Integer)v); |
| | |
| | | for (ServerDescriptor server : hm.keySet()) |
| | | { |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_CONFIGURING_REPLICATION_REMOTE.get( |
| | | getHostPort(server)))); |
| | | Integer v = (Integer)server.getServerProperties().get( |
| | | ServerDescriptor.ServerProperty.REPLICATION_SERVER_PORT); |
| | | INFO_PROGRESS_CONFIGURING_REPLICATION_REMOTE.get(getHostPort(server)))); |
| | | Integer v = (Integer)server.getServerProperties().get(REPLICATION_SERVER_PORT); |
| | | int replicationPort; |
| | | boolean enableSecureReplication; |
| | | if (v != null) |
| | |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN()); |
| | | filter.addBaseDNToSearch(Constants.SCHEMA_DN); |
| | | ServerDescriptor s = ServerDescriptor.createStandalone(rCtx, filter); |
| | | ServerDescriptor s = createStandalone(rCtx, filter); |
| | | for (ReplicaDescriptor replica : s.getReplicas()) |
| | | { |
| | | String dn = replica.getSuffix().getDN(); |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.addBaseDNToSearch(dn); |
| | | ServerDescriptor s = ServerDescriptor.createStandalone(rCtx, filter); |
| | | ServerDescriptor s = createStandalone(rCtx, filter); |
| | | for (ReplicaDescriptor r : s.getReplicas()) |
| | | { |
| | | if (areDnsEqual(r.getSuffix().getDN(), dn)) |
| | |
| | | { |
| | | if (isRemoteServer) |
| | | { |
| | | /* In case the user specified an existing topology... */ |
| | | String ldapUrl = getLdapUrl(auth); |
| | | String dn = auth.getDn(); |
| | | String pwd = auth.getPwd(); |
| | | if (auth.useSecureConnection()) |
| | | { |
| | | ApplicationTrustManager trustManager = getTrustManager(); |
| | | trustManager.setHost(auth.getHostName()); |
| | | remoteCtx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | else |
| | | { |
| | | remoteCtx = createLdapContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null); |
| | | } |
| | | remoteCtx = createInitialLdapContext(auth); |
| | | adsContext = new ADSContext(remoteCtx); // adsContext owns remoteCtx |
| | | |
| | | /* Check the remote server for ADS. If it does not exist, create the |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.setSearchBaseDNInformation(false); |
| | | ServerDescriptor server |
| | | = ServerDescriptor.createStandalone(remoteCtx, filter); |
| | | ServerDescriptor server = createStandalone(remoteCtx, filter); |
| | | server.updateAdsPropertiesWithServerProperties(); |
| | | adsContext.registerServer(server.getAdsProperties()); |
| | | createdRemoteAds = true; |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.setSearchBaseDNInformation(false); |
| | | ServerDescriptor server = ServerDescriptor.createStandalone(localCtx, |
| | | filter); |
| | | ServerDescriptor server = createStandalone(localCtx, filter); |
| | | server.updateAdsPropertiesWithServerProperties(); |
| | | if (0 == adsContext.registerOrUpdateServer(server.getAdsProperties())) { |
| | | if (isRemoteServer) |
| | |
| | | } |
| | | if (isRemoteServer) |
| | | { |
| | | ServerDescriptor.seedAdsTrustStore(localCtx, |
| | | adsContext.getTrustedCertificates()); |
| | | seedAdsTrustStore(localCtx, adsContext.getTrustedCertificates()); |
| | | } |
| | | if (isVerbose()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private InitialLdapContext createInitialLdapContext(AuthenticationData auth) throws NamingException |
| | | { |
| | | String ldapUrl = getLdapUrl(auth); |
| | | String dn = auth.getDn(); |
| | | String pwd = auth.getPwd(); |
| | | |
| | | if (auth.useSecureConnection()) |
| | | { |
| | | ApplicationTrustManager trustManager = getTrustManager(); |
| | | trustManager.setHost(auth.getHostName()); |
| | | return createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, trustManager, null); |
| | | } |
| | | return createLdapContext(ldapUrl, dn, pwd, getConnectTimeout(), null); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether we must create a suffix that we are not going to replicate |
| | | * with other servers or not. |
| | |
| | | try |
| | | { |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager, null); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | dn = ADSContext.getAdministratorDN(dn); |
| | | effectiveDn[0] = dn; |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager, null); |
| | | } |
| | | else |
| | | { |
| | |
| | | type = SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; |
| | | } |
| | | |
| | | ServerDescriptor s = ServerDescriptor.createStandalone(ctx, |
| | | new TopologyCacheFilter()); |
| | | ServerDescriptor s = createStandalone(ctx, new TopologyCacheFilter()); |
| | | Set<ReplicaDescriptor> replicas = s.getReplicas(); |
| | | for (ReplicaDescriptor replica : replicas) |
| | | { |
| | |
| | | for (ReplicaDescriptor replica : suffix.getReplicas()) |
| | | { |
| | | ServerDescriptor server = replica.getServer(); |
| | | Object v = server.getServerProperties().get( |
| | | ServerDescriptor.ServerProperty.IS_REPLICATION_SERVER); |
| | | Object v = server.getServerProperties().get(IS_REPLICATION_SERVER); |
| | | if (!Boolean.TRUE.equals(v)) |
| | | { |
| | | AuthenticationData authData = new AuthenticationData(); |
| | |
| | | String dn = getUserData().getDirectoryManagerDn(); |
| | | String pwd = getUserData().getDirectoryManagerPwd(); |
| | | return createLdapsContext(ldapUrl, dn, pwd, |
| | | getConnectTimeout(), null, null); |
| | | getConnectTimeout(), null, null, null); |
| | | } |
| | | |
| | | /** |