Package org.opends.admin.ads
Class ServerDescriptor
- java.lang.Object
-
- org.opends.admin.ads.ServerDescriptor
-
- All Implemented Interfaces:
Comparable<ServerDescriptor>
public class ServerDescriptor extends Object implements Comparable<ServerDescriptor>
The object of this class represent an OpenDJ server instance.It can represent either a DS-only, a RS-only or a combined DS-RS.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServerDescriptor.ServerPropertyEnumeration containing the different server properties that we can keep in the ServerProperty object.
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerDescriptor()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ServerDescriptor o)static ServerDescriptorcreateStandalone(Map<ADSContext.ServerProperty,Object> adsProperties)Creates a ServerDescriptor object based on some ADS properties provided.static ServerDescriptorcreateStandalone(ConnectionWrapper conn, TopologyCacheFilter filter)Creates a ServerDescriptor object based on the configuration that we read using the provided connection.HostPortgetAdminConnectorHostPort()Returns the HostPort 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.StringgetHostName()Returns the host name of the server.HostPortgetHostPort(boolean securePreferred)Returns a String of type host-name:port-number for the server.StringgetId()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.TopologyCacheExceptiongetLastException()Returns the last exception that was encountered reading the configuration of the server.HostPortgetLdapHostPort()Returns the HostPort to access this server using LDAP.HostPortgetLdapsHostPort()Returns the HostPort to access this server using LDAPS.Set<ReplicaDescriptor>getReplicas()Returns the replicas contained on the server.HostPortgetReplicationServerHostPort()Returns the String representation of this replication server based on the information we have ("hostname":"replication port") andnullif this is not a replication server.intgetReplicationServerId()Returns the replication server ID of this server and -1 if this is not a replications server.intgetReplicationServerPort()Returns the replication port of this server and -1 if this is not a replications server.StringgetSchemaReplicationID()Returns the schema generation ID of the server.Map<ServerDescriptor.ServerProperty,Object>getServerProperties()Returns a Map containing the properties of the server.static StringgetSuffixDisplay(DN baseDN, Set<ServerDescriptor> servers)Returns a representation of a base DN for a set of servers.booleanisRegistered()Tells whether this server is registered in the ADS.booleanisReplicationEnabled()Tells whether replication is enabled on this server.booleanisReplicationSecure()Returns whether the communication with the replication port on the server is encrypted.booleanisReplicationServer()Tells whether this server is a replication server.booleanisSameServer(ServerDescriptor server)Tells whether the provided server descriptor represents the same server as this object.static voidseedAdsTrustStore(ConnectionWrapper connWrapper, Map<String,byte[]> keyEntryMap)Seeds the bound instance's local ads-truststore with a set of instance key-pair public key certificates.voidsetAdsProperties(Map<ADSContext.ServerProperty,Object> adsProperties)Sets the ADS properties of the server.voidsetLastException(TopologyCacheException lastException)Sets the last exception that occurred while reading the configuration of the server.voidsetReplicas(Set<ReplicaDescriptor> replicas)Sets the replicas contained on the server.StringtoString()voidupdateAdsPropertiesWithServerProperties()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).
-
-
-
Method Detail
-
getReplicas
public Set<ReplicaDescriptor> getReplicas()
Returns the replicas contained on the server.- Returns:
- the replicas contained on the server.
-
setReplicas
public void setReplicas(Set<ReplicaDescriptor> replicas)
Sets the replicas contained on the server.- Parameters:
replicas- the replicas contained on the server.
-
getAdsProperties
public Map<ADSContext.ServerProperty,Object> getAdsProperties()
Returns a Map containing the ADS properties of the server.- Returns:
- a Map containing the ADS properties of the server.
-
getServerProperties
public Map<ServerDescriptor.ServerProperty,Object> getServerProperties()
Returns a Map containing the properties of the server.- Returns:
- a Map containing the properties of the server.
-
isRegistered
public boolean isRegistered()
Tells whether this server is registered in the ADS.- Returns:
trueif the server is registered in the ADS andfalseotherwise.
-
isReplicationServer
public boolean isReplicationServer()
Tells whether this server is a replication server.- Returns:
trueif the server is a replication server andfalseotherwise.
-
isReplicationEnabled
public boolean isReplicationEnabled()
Tells whether replication is enabled on this server.- Returns:
trueif replication is enabled andfalseotherwise.
-
getReplicationServerHostPort
public HostPort getReplicationServerHostPort()
Returns the String representation of this replication server based on the information we have ("hostname":"replication port") andnullif this is not a replication server.- Returns:
- the String representation of this replication server based
on the information we have ("hostname":"replication port") and
nullif this is not a replication server.
-
getReplicationServerId
public int getReplicationServerId()
Returns the replication server ID of this server and -1 if this is not a replications server.- Returns:
- the replication server ID of this server and -1 if this is not a replications server.
-
getReplicationServerPort
public int getReplicationServerPort()
Returns the replication port of this server and -1 if this is not a replications server.- Returns:
- the replication port of this server and -1 if this is not a replications server.
-
isReplicationSecure
public boolean isReplicationSecure()
Returns whether the communication with the replication port on the server is encrypted.- Returns:
trueif the communication with the replication port on the server is encrypted andfalseotherwise.
-
setAdsProperties
public void setAdsProperties(Map<ADSContext.ServerProperty,Object> adsProperties)
Sets the ADS properties of the server.- Parameters:
adsProperties- a Map containing the ADS properties of the server.
-
getHostName
public String getHostName()
Returns the host name of the server.- Returns:
- the host name of the server.
-
getLdapHostPort
public HostPort getLdapHostPort()
Returns the HostPort to access this server using LDAP.- Returns:
- the HostPort to access this server using LDAP,
nullif the server is not configured to listen on an LDAP port.
-
getLdapsHostPort
public HostPort getLdapsHostPort()
Returns the HostPort to access this server using LDAPS.- Returns:
- the HostPort to access this server using LDAPS,
nullif the server is not configured to listen on an LDAPS port.
-
getAdminConnectorHostPort
public HostPort getAdminConnectorHostPort()
Returns the HostPort to access this server using the administration connector.- Returns:
- the HostPort to access this server using the administration connector,
nullif the server cannot get the administration connector.
-
getEnabledAdministrationPorts
public List<Integer> getEnabledAdministrationPorts()
Returns the list of enabled administration ports.- Returns:
- the list of enabled administration ports.
-
getHostPort
public HostPort getHostPort(boolean securePreferred)
Returns a String of type host-name:port-number for the server. If the provided securePreferred is set to true the port that will be used will be the administration connector port.- Parameters:
securePreferred- whether to try to use the secure port as part of the returning String.- Returns:
- a String of type host-name:port-number for the server.
-
getId
public String getId()
Returns an Id that is unique for this server.- Returns:
- an Id that is unique for this server.
-
compareTo
public int compareTo(ServerDescriptor o)
- Specified by:
compareToin interfaceComparable<ServerDescriptor>
-
getInstancePublicKeyCertificate
public byte[] getInstancePublicKeyCertificate()
Returns the instance-key public-key certificate retrieved from the truststore backend of the instance referenced through this descriptor.- Returns:
- The public-key certificate of the instance.
-
getSchemaReplicationID
public String getSchemaReplicationID()
Returns the schema generation ID of the server.- Returns:
- the schema generation ID of the server.
-
getLastException
public TopologyCacheException getLastException()
Returns the last exception that was encountered reading the configuration of the server. Returns null if there was no problem loading the configuration of the server.- Returns:
- the last exception that was encountered reading the configuration of the server. Returns null if there was no problem loading the configuration of the server.
-
setLastException
public void setLastException(TopologyCacheException lastException)
Sets the last exception that occurred while reading the configuration of the server.- Parameters:
lastException- the last exception that occurred while reading the configuration of the server.
-
updateAdsPropertiesWithServerProperties
public 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).
-
createStandalone
public static ServerDescriptor createStandalone(Map<ADSContext.ServerProperty,Object> adsProperties)
Creates a ServerDescriptor object based on some ADS properties provided.- Parameters:
adsProperties- the ADS properties of the server.- Returns:
- a ServerDescriptor object that corresponds to the provided ADS properties.
-
createStandalone
public static ServerDescriptor createStandalone(ConnectionWrapper conn, TopologyCacheFilter filter) throws IOException
Creates a ServerDescriptor object based on the configuration that we read using the provided connection.- Parameters:
conn- 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.- Returns:
- a ServerDescriptor object that corresponds to the read configuration.
- Throws:
IOException- if a problem occurred reading the server configuration.
-
seedAdsTrustStore
public static void seedAdsTrustStore(ConnectionWrapper connWrapper, Map<String,byte[]> keyEntryMap) throws LdapException
Seeds the bound instance's local ads-truststore with a set of instance key-pair public key certificates. The result is the instance will trust any instance possessing the private key corresponding to one of the public-key certificates. This trust is necessary at least to initialize replication, which uses the trusted certificate entries in the ads-truststore for server authentication.- Parameters:
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).- Throws:
LdapException- in case an error occurs while updating the instance's ads-truststore via LDAP.
-
getSuffixDisplay
public static String getSuffixDisplay(DN baseDN, Set<ServerDescriptor> servers)
Returns a representation of a base DN for a set of servers.- Parameters:
baseDN- the base DN.servers- the servers.- Returns:
- a representation of a base DN for a set of servers.
-
isSameServer
public boolean isSameServer(ServerDescriptor server)
Tells whether the provided server descriptor represents the same server as this object.- Parameters:
server- the server to make the comparison.- Returns:
trueif the provided server descriptor represents the same server as this object,falseotherwise.
-
-