public class ServerDescriptor extends Object implements Comparable<ServerDescriptor>
It can represent either a DS-only, a RS-only or a combined DS-RS.
Modifier | Constructor and Description |
---|---|
protected |
ServerDescriptor()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ServerDescriptor o) |
static ServerDescriptor |
createStandalone(ConnectionWrapper connWrapper,
TopologyCacheFilter filter)
Creates a ServerDescriptor object based on the configuration that we read using the provided connection.
|
static ServerDescriptor |
createStandalone(Map<ADSContext.ServerProperty,Object> adsProperties)
Creates a ServerDescriptor object based on some ADS properties provided.
|
Map<ADSContext.ServerProperty,Object> |
getAdsProperties()
Returns a Map containing the ADS properties of the server.
|
String |
getHostName()
Returns the host name of the server.
|
HostPort |
getHostPort(boolean securePreferred)
Returns a String of type host-name:port-number for the server.
|
String |
getId()
Returns an Id that is unique for this server.
|
HostPort |
getLdapHostPort()
Returns the HostPort to access this server using LDAP.
|
HostPort |
getLdapsHostPort()
Returns the HostPort to access this server using LDAPS.
|
Set<ReplicaDescriptor> |
getReplicas()
Returns the replicas contained on the server.
|
HostPort |
getReplicationServerHostPort()
Returns the String representation of this replication server based on the information we have
("hostname":"replication port") and
null if this is not a replication server. |
int |
getReplicationServerId()
Returns the replication server ID of this server and -1 if this is not a replication server.
|
int |
getReplicationServerPort()
Returns the replication port of this server and -1 if this is not a replication server.
|
String |
getSchemaReplicationID()
Returns the schema generation ID of the server.
|
static String |
getSuffixDisplay(Dn baseDN,
Set<ServerDescriptor> servers)
Returns a representation of a base DN for a set of servers.
|
boolean |
isRegistered()
Tells whether this server is registered in the ADS.
|
boolean |
isReplicationSecure()
Returns whether the communication with the replication port on the server is encrypted.
|
boolean |
isReplicationServer()
Tells whether this server is a replication server.
|
boolean |
isSameServer(ServerDescriptor server)
Tells whether the provided server descriptor represents the same server as this object.
|
static void |
seedAdsTrustStore(ConnectionWrapper connWrapper,
Map<String,byte[]> keyEntryMap)
Seeds the bound instance's local ads-truststore with a set of instance key-pair public key certificates.
|
void |
setAdsProperties(Map<ADSContext.ServerProperty,Object> adsProperties)
Sets the ADS properties of the server.
|
void |
setLastException(TopologyCacheException lastException)
Sets the last exception that occurred while reading the configuration of the server.
|
void |
setReplicas(Set<ReplicaDescriptor> replicas)
Sets the replicas contained on the server.
|
String |
toString() |
void |
updateAdsPropertiesWithServerProperties()
This methods updates the ADS properties (the ones that were read from the ADS) with the contents of the server
properties (the ones that were read directly from the server).
|
public Set<ReplicaDescriptor> getReplicas()
public void setReplicas(Set<ReplicaDescriptor> replicas)
replicas
- the replicas contained on the server.public Map<ADSContext.ServerProperty,Object> getAdsProperties()
public boolean isRegistered()
true
if the server is registered in the ADS and false
otherwise.public boolean isReplicationServer()
true
if the server is a replication server and false
otherwise.public HostPort getReplicationServerHostPort()
null
if this is not a replication server.null
if this is not a replication server.public int getReplicationServerId()
public int getReplicationServerPort()
public boolean isReplicationSecure()
true
if the communication with the replication port on the server is encrypted and false
otherwise.public void setAdsProperties(Map<ADSContext.ServerProperty,Object> adsProperties)
adsProperties
- a Map containing the ADS properties of the server.public String getHostName()
public HostPort getLdapHostPort()
null
if the server is not configured to listen on
an LDAP port.public HostPort getLdapsHostPort()
null
if the server is not configured to listen on
an LDAPS port.public HostPort getHostPort(boolean securePreferred)
securePreferred
- whether to try to use the secure port as part of the returning String.public String getId()
public int compareTo(ServerDescriptor o)
compareTo
in interface Comparable<ServerDescriptor>
public String getSchemaReplicationID()
public void setLastException(TopologyCacheException lastException)
lastException
- the last exception that occurred while reading the configuration of the server.public void updateAdsPropertiesWithServerProperties()
public static ServerDescriptor createStandalone(Map<ADSContext.ServerProperty,Object> adsProperties)
adsProperties
- the ADS properties of the server.public static ServerDescriptor createStandalone(ConnectionWrapper connWrapper, TopologyCacheFilter filter) throws IOException
connWrapper
- the connection that will be used to read the configuration of the server.filter
- the topology cache filter describing the information that must be retrieved.IOException
- if a problem occurred reading the server configuration.public static void seedAdsTrustStore(ConnectionWrapper connWrapper, Map<String,byte[]> keyEntryMap) throws LdapException
connWrapper
- The connection to the server.keyEntryMap
- The set of valid (i.e., not tagged as compromised) instance key-pair public-key certificate entries in
ADS represented as a map from keyID to public-key certificate (binary).LdapException
- in case an error occurs while updating the instance's ads-truststore via LDAP.public static String getSuffixDisplay(Dn baseDN, Set<ServerDescriptor> servers)
baseDN
- the base DN.servers
- the servers.public boolean isSameServer(ServerDescriptor server)
server
- the server to make the comparison.true
if the provided server descriptor represents the same server as this object, false
otherwise.Copyright 2010-2018 ForgeRock AS.