public class ServerDescriptor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ServerDescriptor.ServerProperty
Enumeration containing the different server properties that we can keep in
the ServerProperty object.
|
Modifier | Constructor and Description |
---|---|
protected |
ServerDescriptor()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
cleanAdsTrustStore(InitialLdapContext ctx)
Cleans up the contents of the ads truststore.
|
static ServerDescriptor |
createStandalone(InitialLdapContext ctx,
TopologyCacheFilter filter)
Creates a ServerDescriptor object based on the configuration that we read
using the provided InitialLdapContext.
|
static ServerDescriptor |
createStandalone(Map<ADSContext.ServerProperty,Object> adsProperties)
Creates a ServerDescriptor object based on some ADS properties provided.
|
String |
getAdminConnectorURL()
Returns the URL to access this server using the administration connector.
|
Map<ADSContext.ServerProperty,Object> |
getAdsProperties()
Returns a Map containing the ADS properties of the server.
|
List<Integer> |
getEnabledAdministrationPorts()
Returns the list of enabled administration ports.
|
String |
getHostName()
Returns the host name of the server.
|
String |
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.
|
byte[] |
getInstancePublicKeyCertificate()
Returns the instance-key public-key certificate retrieved from the
truststore backend of the instance referenced through this descriptor.
|
TopologyCacheException |
getLastException()
Returns the last exception that was encountered reading the configuration
of the server.
|
String |
getLDAPsURL()
Returns the URL to access this server using LDAPS.
|
String |
getLDAPURL()
Returns the URL to access this server using LDAP.
|
Set<ReplicaDescriptor> |
getReplicas()
Returns the replicas contained on the server.
|
static String |
getReplicationServer(String hostName,
int replicationPort)
Returns the replication server normalized String for a given host name
and replication port.
|
String |
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
replications server.
|
int |
getReplicationServerPort()
Returns the replication port of this server and -1 if this is not a
replications server.
|
String |
getSchemaReplicationID()
Returns the schema generation ID of the server.
|
Map<ServerDescriptor.ServerProperty,Object> |
getServerProperties()
Returns a Map containing the properties of the server.
|
static String |
getServerRepresentation(String hostName,
int port)
Returns the normalized server representation for a given host name and
port.
|
static String |
getSuffixDisplay(String 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 or not.
|
boolean |
isReplicationEnabled()
Tells whether replication is enabled on this server or not.
|
boolean |
isReplicationSecure()
Returns whether the communication with the replication port on the server
is encrypted or not.
|
boolean |
isReplicationServer()
Tells whether this server is a replication server or not.
|
boolean |
isSameServer(ServerDescriptor server)
Tells whether the provided server descriptor represents the same server
as this object.
|
static void |
seedAdsTrustStore(InitialLdapContext ctx,
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.
|
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).
|
protected ServerDescriptor()
public Set<ReplicaDescriptor> getReplicas()
public void setReplicas(Set<ReplicaDescriptor> replicas)
replicas
- the replicas contained on the server.public Map<ADSContext.ServerProperty,Object> getAdsProperties()
public Map<ServerDescriptor.ServerProperty,Object> getServerProperties()
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 boolean isReplicationEnabled()
true
if replication is enabled and
false
otherwise.public String 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 String getLDAPURL()
null
if the server is not configured to listen on an LDAP
port.public String getLDAPsURL()
null
if the server is not configured to listen on an LDAPS
port.public String getAdminConnectorURL()
null
if the server cannot get the administration
connector.public List<Integer> getEnabledAdministrationPorts()
public String getHostPort(boolean securePreferred)
securePreferred
- whether to try to use the secure port as part
of the returning String or not.public String getId()
public byte[] getInstancePublicKeyCertificate()
public String getSchemaReplicationID()
public TopologyCacheException getLastException()
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(InitialLdapContext ctx, TopologyCacheFilter filter) throws NamingException
ctx
- the InitialLdapContext that will be used to read the
configuration of the server.filter
- the topology cache filter describing the information that
must be retrieved.NamingException
- if a problem occurred reading the server
configuration.public static void seedAdsTrustStore(InitialLdapContext ctx, Map<String,byte[]> keyEntryMap) throws NamingException
ctx
- The bound instance.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).NamingException
- in case an error occurs while updating the instance's
ads-truststore via LDAP.public static void cleanAdsTrustStore(InitialLdapContext ctx) throws NamingException
ctx
- the bound instance.NamingException
- in case an error occurs while updating the
instance's ads-truststore via LDAP.public static String getReplicationServer(String hostName, int replicationPort)
hostName
- the host name.replicationPort
- the replication port.public static String getServerRepresentation(String hostName, int port)
hostName
- the host name.port
- the port.public static String getSuffixDisplay(String baseDN, Set<ServerDescriptor> servers)
baseDN
- the base DN.servers
- the servers.public boolean isSameServer(ServerDescriptor server)
server
- the server to make the comparison.Copyright © 2010-2016 ForgeRock AS. All Rights Reserved.