Class Topology
- java.lang.Object
-
- org.opends.server.replication.common.Topology
-
public final class Topology extends Object
Represents the topology of servers this local server is participating in.A server may be a DS, a RS or a DS/RS.
If the topology contains servers with version 6.5 or lower, there can be multiple entries for the same server because there are multiple server ids per server.
The topology is updated with information from the local server and with information provided by the
TopologyMsg
received. A server is automatically removed from the topology if there is no update received from it during a given period of time.The topology provides a way to know the list of all participating RSs through the
getReplicationListeners()
method. As a RS may listen to several interfaces, it provides one to many hostPorts to contact for each RS.
-
-
Constructor Summary
Constructors Constructor Description Topology(ServerContext serverContext, ServerId<?> localServerId)
Creates an empty topology.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLocalAdminPorts(Collection<com.forgerock.opendj.util.HostPort> adminListeners)
Adds administrative host ports to the local server.void
addLocalLdapPorts(ConnectionSecurity connSecurity, Collection<com.forgerock.opendj.util.HostPort> ldapListeners)
Adds LDAP (LDAPS / StartTLS) host ports to the local server.void
addLocalReplicationDomain(ReplicaId replicaId, Dn baseDn)
Adds a replication domain to the local server in the topology.void
applyTopologyMessage(TopologyMsg topoMsg, Dn baseDn, ReplicationServerId senderId)
Updates the topology with the provided topology message.Set<Set<com.forgerock.opendj.util.HostPort>>
getReplicationListeners()
Returns the set of replication listeners for all the replication servers in the topology.boolean
isLocalServerHost(com.forgerock.opendj.util.HostPort hostPort)
Indicates whether the providedHostPort
has the sameHost
as this local server.boolean
isLocalServerHostPort(com.forgerock.opendj.util.HostPort hostPort)
Indicates whether the providedHostPort
corresponds to this local server.void
removeBootstrapServersForReplicationDomain(Dn domainBaseDn)
Removes the bootstrap servers - i.e the servers known in the configuration - for a replication domain.void
removeBootstrapServersForReplicationServer()
Removes the bootstrap servers - i.e the servers known in the configuration - for the replication server.void
removeLocalAdminPorts(Collection<com.forgerock.opendj.util.HostPort> adminListeners)
Removes administrative host ports from the local server.void
removeLocalLdapPorts(ConnectionSecurity connSecurity, Collection<com.forgerock.opendj.util.HostPort> ldapListeners)
Removes LDAP (LDAPS / StartTLS) host ports from the local server.void
removeLocalReplicationDomain(ReplicaId replicaId, Dn baseDn)
Removes a replication domain from the local server in the topology.void
setBootstrapServersForReplicationDomain(Set<com.forgerock.opendj.util.HostPort> bootstrapServers, Dn domainBaseDn)
Sets the bootstrap servers - i.e the servers known in the configuration - for a replication domain.void
setBootstrapServersForReplicationServer(Set<com.forgerock.opendj.util.HostPort> bootstrapServers)
Sets the bootstrap servers - i.e the servers known in the configuration - for the replication server.void
setLocalReplicationServer(ReplicationServerId rsId, com.forgerock.opendj.discovery.GroupId groupId, Duration changelogPurgeDelay, SortedSet<com.forgerock.opendj.util.Host> replicationListenAddresses, int replicationPort)
Sets the local replication server in the topology, merging it with any existing local replication domains.DSInfo
toDSInfoOrNull(ReplicaId replicaId)
Returns the information available from the topology for this replica ID as aDSInfo
object.RSInfo
toRSInfoOrNull(ReplicationServerId replicationServerId)
Returns the information available from the topology for this replication server ID as aRSInfo
object.String
toString()
void
updateLocalGroupId(String groupId)
Updates the groupID for the local server.
-
-
-
Constructor Detail
-
Topology
public Topology(ServerContext serverContext, ServerId<?> localServerId) throws ConfigException
Creates an empty topology.- Parameters:
serverContext
- The server context.localServerId
- The server id for the local server- Throws:
ConfigException
- if the configuration cannot be read
-
-
Method Detail
-
isLocalServerHostPort
public boolean isLocalServerHostPort(com.forgerock.opendj.util.HostPort hostPort)
Indicates whether the providedHostPort
corresponds to this local server.- Parameters:
hostPort
- the address to test.- Returns:
true
if the providedHostPort
corresponds to this local server.
-
isLocalServerHost
public boolean isLocalServerHost(com.forgerock.opendj.util.HostPort hostPort)
Indicates whether the providedHostPort
has the sameHost
as this local server.Note that the test is comparing hosts without DNS lookup so it requires that the hosts are provided in the same form (i.e with the same hostname or the same IP address).
- Parameters:
hostPort
- the address to test.- Returns:
true
if the providedHostPort
has the sameHost
as this local server.
-
getReplicationListeners
public Set<Set<com.forgerock.opendj.util.HostPort>> getReplicationListeners()
Returns the set of replication listeners for all the replication servers in the topology.A replication server can listen on several addresses, so there is multiple listeners for it.
- Returns:
- the set of replication listeners for all servers in the topology.
-
setBootstrapServersForReplicationDomain
public void setBootstrapServersForReplicationDomain(Set<com.forgerock.opendj.util.HostPort> bootstrapServers, Dn domainBaseDn)
Sets the bootstrap servers - i.e the servers known in the configuration - for a replication domain.- Parameters:
bootstrapServers
- the set of host and port of the bootstrap servers.domainBaseDn
- the base dn of the replication domain
-
setBootstrapServersForReplicationServer
public void setBootstrapServersForReplicationServer(Set<com.forgerock.opendj.util.HostPort> bootstrapServers)
Sets the bootstrap servers - i.e the servers known in the configuration - for the replication server.- Parameters:
bootstrapServers
- the set of host and port of the bootstrap servers.
-
removeBootstrapServersForReplicationDomain
public void removeBootstrapServersForReplicationDomain(Dn domainBaseDn)
Removes the bootstrap servers - i.e the servers known in the configuration - for a replication domain.- Parameters:
domainBaseDn
- the base dn of the replication domain
-
removeBootstrapServersForReplicationServer
public void removeBootstrapServersForReplicationServer()
Removes the bootstrap servers - i.e the servers known in the configuration - for the replication server.
-
setLocalReplicationServer
public void setLocalReplicationServer(ReplicationServerId rsId, com.forgerock.opendj.discovery.GroupId groupId, Duration changelogPurgeDelay, SortedSet<com.forgerock.opendj.util.Host> replicationListenAddresses, int replicationPort)
Sets the local replication server in the topology, merging it with any existing local replication domains.- Parameters:
rsId
- the server ID of the local server.groupId
- the group ID of the local server.changelogPurgeDelay
- the purge delay for the changelog.replicationListenAddresses
- the listen addresses of the local replication server.replicationPort
- the port of the local replication server.
-
addLocalReplicationDomain
public void addLocalReplicationDomain(ReplicaId replicaId, Dn baseDn)
Adds a replication domain to the local server in the topology.- Parameters:
replicaId
- The replicaId of the local server.baseDn
- The baseDn of the replication domain.
-
removeLocalReplicationDomain
public void removeLocalReplicationDomain(ReplicaId replicaId, Dn baseDn)
Removes a replication domain from the local server in the topology.- Parameters:
replicaId
- The replicaId of the local server.baseDn
- The baseDn of the replication domain.
-
addLocalAdminPorts
public void addLocalAdminPorts(Collection<com.forgerock.opendj.util.HostPort> adminListeners)
Adds administrative host ports to the local server.- Parameters:
adminListeners
- the administrative host ports
-
addLocalLdapPorts
public void addLocalLdapPorts(ConnectionSecurity connSecurity, Collection<com.forgerock.opendj.util.HostPort> ldapListeners)
Adds LDAP (LDAPS / StartTLS) host ports to the local server.- Parameters:
connSecurity
- connection security for the provided host portsldapListeners
- the ldap host ports
-
removeLocalAdminPorts
public void removeLocalAdminPorts(Collection<com.forgerock.opendj.util.HostPort> adminListeners)
Removes administrative host ports from the local server.- Parameters:
adminListeners
- the administrative host ports
-
removeLocalLdapPorts
public void removeLocalLdapPorts(ConnectionSecurity connSecurity, Collection<com.forgerock.opendj.util.HostPort> ldapListeners)
Removes LDAP (LDAPS / StartTLS) host ports from the local server.- Parameters:
connSecurity
- connection security for the provided host portsldapListeners
- the ldap host ports
-
toDSInfoOrNull
public DSInfo toDSInfoOrNull(ReplicaId replicaId)
Returns the information available from the topology for this replica ID as aDSInfo
object.- Parameters:
replicaId
- the replica ID- Returns:
- the available information as an DSInfo
-
toRSInfoOrNull
public RSInfo toRSInfoOrNull(ReplicationServerId replicationServerId)
Returns the information available from the topology for this replication server ID as aRSInfo
object.- Parameters:
replicationServerId
- the replication server ID- Returns:
- the available information as an RSInfo
-
updateLocalGroupId
public void updateLocalGroupId(String groupId)
Updates the groupID for the local server.- Parameters:
groupId
- the new groupID
-
applyTopologyMessage
public void applyTopologyMessage(TopologyMsg topoMsg, Dn baseDn, ReplicationServerId senderId)
Updates the topology with the provided topology message.- Parameters:
topoMsg
- a topology message received from a remote RS.baseDn
- the base Dn of the domain for which the topology message was received.senderId
- the id of the RS that sent the topology message.
-
-