| | |
| | | import javax.naming.directory.DirContext; |
| | | import javax.naming.directory.SearchControls; |
| | | import javax.naming.directory.SearchResult; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.naming.ldap.Rdn; |
| | | import javax.swing.JPanel; |
| | | |
| | |
| | | knownReplicationServerIds, |
| | | knownServerIds); |
| | | localTimeMeasureTime = System.currentTimeMillis(); |
| | | localTime = Utils.getServerClock(conn.getLdapContext()); |
| | | localTime = Utils.getServerClock(conn); |
| | | localServerDisplay = conn.getHostPort(); |
| | | } |
| | | catch (NamingException ne) |
| | |
| | | conn, remoteReplicationServers, replicationPort, enableSecureReplication, |
| | | knownReplicationServerIds, knownServerIds); |
| | | long remoteTimeMeasureTime = System.currentTimeMillis(); |
| | | long remoteTime = Utils.getServerClock(conn.getLdapContext()); |
| | | long remoteTime = Utils.getServerClock(conn); |
| | | if (localTime != -1 |
| | | && remoteTime != -1 |
| | | && Math.abs(localTime - remoteTime - localTimeMeasureTime + remoteTimeMeasureTime) > |
| | |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN()); |
| | | filter.addBaseDNToSearch(Constants.SCHEMA_DN); |
| | | ServerDescriptor s = createStandalone(remoteConn.getLdapContext(), filter); |
| | | ServerDescriptor s = createStandalone(remoteConn, filter); |
| | | for (ReplicaDescriptor replica : s.getReplicas()) |
| | | { |
| | | String dn = replica.getSuffix().getDN(); |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.addBaseDNToSearch(dn); |
| | | ServerDescriptor s = createStandalone(remoteConn.getLdapContext(), filter); |
| | | ServerDescriptor s = createStandalone(remoteConn, filter); |
| | | for (ReplicaDescriptor r : s.getReplicas()) |
| | | { |
| | | if (areDnsEqual(r.getSuffix().getDN(), dn)) |
| | |
| | | logger.info(LocalizableMessage.raw("Calling initializeSuffix with base DN: " + dn)); |
| | | logger.info(LocalizableMessage.raw("Try number: " + (6 - nTries))); |
| | | logger.info(LocalizableMessage.raw("replicationId of source replica: " + replicationId)); |
| | | initializeSuffix(conn.getLdapContext(), replicationId, dn, !isADS && !isSchema, hostPort); |
| | | initializeSuffix(conn, replicationId, dn, !isADS && !isSchema, hostPort); |
| | | initDone = true; |
| | | } |
| | | catch (PeerNotFoundException pnfe) |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.setSearchBaseDNInformation(false); |
| | | ServerDescriptor server = createStandalone(remoteConn.getLdapContext(), filter); |
| | | ServerDescriptor server = createStandalone(remoteConn, filter); |
| | | server.updateAdsPropertiesWithServerProperties(); |
| | | adsContext.registerServer(server.getAdsProperties()); |
| | | createdRemoteAds = true; |
| | |
| | | TopologyCacheFilter filter = new TopologyCacheFilter(); |
| | | filter.setSearchMonitoringInformation(false); |
| | | filter.setSearchBaseDNInformation(false); |
| | | ServerDescriptor server = createStandalone(localConn.getLdapContext(), filter); |
| | | ServerDescriptor server = createStandalone(localConn, filter); |
| | | server.updateAdsPropertiesWithServerProperties(); |
| | | if (0 == adsContext.registerOrUpdateServer(server.getAdsProperties())) |
| | | { |
| | |
| | | } |
| | | if (isRemoteServer) |
| | | { |
| | | seedAdsTrustStore(localConn.getLdapContext(), adsContext.getTrustedCertificates()); |
| | | seedAdsTrustStore(localConn, adsContext.getTrustedCertificates()); |
| | | } |
| | | if (isVerbose()) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | updateUserDataWithSuffixesInServer(conn.getLdapContext()); |
| | | updateUserDataWithSuffixesInServer(conn); |
| | | } |
| | | } |
| | | catch (UserDataException ude) |
| | |
| | | |
| | | /** |
| | | * Update the UserInstallData object with the contents of the server to which |
| | | * we are connected with the provided InitialLdapContext. |
| | | * we are connected with the provided connection. |
| | | */ |
| | | private void updateUserDataWithSuffixesInServer(InitialLdapContext ctx) throws NamingException |
| | | private void updateUserDataWithSuffixesInServer(ConnectionWrapper conn) throws NamingException |
| | | { |
| | | SuffixesToReplicateOptions suf = getUserData().getSuffixesToReplicateOptions(); |
| | | SuffixesToReplicateOptions.Type type; |
| | |
| | | type = SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; |
| | | } |
| | | |
| | | ServerDescriptor s = createStandalone(ctx, new TopologyCacheFilter()); |
| | | ServerDescriptor s = createStandalone(conn, new TopologyCacheFilter()); |
| | | Set<ReplicaDescriptor> replicas = s.getReplicas(); |
| | | for (ReplicaDescriptor replica : replicas) |
| | | { |
| | |
| | | * |
| | | * @param server |
| | | * the object describing the server. |
| | | * @return the InitialLdapContext to the remote server. |
| | | * @return the connection to the remote server. |
| | | * @throws ApplicationException |
| | | * if something goes wrong. |
| | | */ |
| | |
| | | * Initializes a suffix with the contents of a replica that has a given |
| | | * replication id. |
| | | * |
| | | * @param ctx |
| | | * @param conn |
| | | * the connection to the server whose suffix we want to initialize. |
| | | * @param replicaId |
| | | * the replication ID of the replica we want to use to initialize the |
| | |
| | | * @throws PeerNotFoundException |
| | | * if the replication mechanism cannot find a peer. |
| | | */ |
| | | public void initializeSuffix(InitialLdapContext ctx, int replicaId, String suffixDn, boolean displayProgress, |
| | | public void initializeSuffix(ConnectionWrapper conn, int replicaId, String suffixDn, boolean displayProgress, |
| | | HostPort sourceServerDisplay) throws ApplicationException, PeerNotFoundException |
| | | { |
| | | boolean taskCreated = false; |
| | |
| | | attrs.put("ds-task-id", id); |
| | | try |
| | | { |
| | | DirContext dirCtx = ctx.createSubcontext(dn, attrs); |
| | | DirContext dirCtx = conn.getLdapContext().createSubcontext(dn, attrs); |
| | | taskCreated = true; |
| | | logger.info(LocalizableMessage.raw("created task entry: " + attrs)); |
| | | dirCtx.close(); |
| | |
| | | } |
| | | try |
| | | { |
| | | NamingEnumeration<SearchResult> res = ctx.search(dn, filter, searchControls); |
| | | NamingEnumeration<SearchResult> res = conn.getLdapContext().search(dn, filter, searchControls); |
| | | SearchResult sr = null; |
| | | try |
| | | { |
| | |
| | | .get(sourceServerDisplay), ne), ne); |
| | | } |
| | | } |
| | | resetGenerationId(ctx, suffixDn, sourceServerDisplay); |
| | | resetGenerationId(conn, suffixDn, sourceServerDisplay); |
| | | } |
| | | |
| | | /** |
| | |
| | | return getUserData().getHostName() + ":" + getUserData().getReplicationOptions().getReplicationPort(); |
| | | } |
| | | |
| | | private void resetGenerationId(InitialLdapContext ctx, String suffixDn, HostPort sourceServerDisplay) |
| | | private void resetGenerationId(ConnectionWrapper conn, String suffixDn, HostPort sourceServerDisplay) |
| | | throws ApplicationException |
| | | { |
| | | boolean taskCreated = false; |
| | |
| | | attrs.put("ds-task-id", id); |
| | | try |
| | | { |
| | | DirContext dirCtx = ctx.createSubcontext(dn, attrs); |
| | | DirContext dirCtx = conn.getLdapContext().createSubcontext(dn, attrs); |
| | | taskCreated = true; |
| | | logger.info(LocalizableMessage.raw("created task entry: " + attrs)); |
| | | dirCtx.close(); |
| | |
| | | StaticUtils.sleep(500); |
| | | try |
| | | { |
| | | NamingEnumeration<SearchResult> res = ctx.search(dn, filter, searchControls); |
| | | NamingEnumeration<SearchResult> res = conn.getLdapContext().search(dn, filter, searchControls); |
| | | SearchResult sr = null; |
| | | try |
| | | { |