org.opends.admin.ads
Class ServerDescriptor

java.lang.Object
  extended by org.opends.admin.ads.ServerDescriptor

public class ServerDescriptor
extends java.lang.Object

The object of this class represent an OpenDS server.


Nested Class Summary
static class ServerDescriptor.ServerProperty
          Enumeration containing the different server properties that we can keep in the ServerProperty object.
 
Method Summary
static ServerDescriptor createStandalone(javax.naming.ldap.InitialLdapContext ctx, TopologyCacheFilter filter)
          Creates a ServerDescriptor object based on the configuration that we read using the provided InitialLdapContext.
static ServerDescriptor createStandalone(java.util.Map<ADSContext.ServerProperty,java.lang.Object> adsProperties)
          Creates a ServerDescriptor object based on some ADS properties provided.
 java.util.Map<ADSContext.ServerProperty,java.lang.Object> getAdsProperties()
          Returns a Map containing the ADS properties of the server.
 java.lang.String getHostName()
          Returns the host name of the server.
 java.lang.String getHostPort(boolean securePreferred)
          Returns a String of type host-name:port-number for the server.
 java.lang.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.
 java.lang.String getLDAPsURL()
          Returns the URL to access this server using LDAPS.
 java.lang.String getLDAPURL()
          Returns the URL to access this server using LDAP.
 java.util.Set<ReplicaDescriptor> getReplicas()
          Returns the replicas contained on the server.
 java.lang.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.
 java.lang.String getSchemaReplicationID()
          Returns the schema generation ID of the server.
 java.util.Map<ServerDescriptor.ServerProperty,java.lang.Object> getServerProperties()
          Returns a Map containing the properties of the server.
 boolean isRegistered()
          Tells whether this server is registered in the ADS 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.
static void seedAdsTrustStore(javax.naming.ldap.InitialLdapContext ctx, java.util.Map<java.lang.String,byte[]> keyEntryMap)
          Seeds the bound instance's local ads-truststore with a set of instance key-pair public key certificates.
 void setAdsProperties(java.util.Map<ADSContext.ServerProperty,java.lang.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(java.util.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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getReplicas

public java.util.Set<ReplicaDescriptor> getReplicas()
Returns the replicas contained on the server.

Returns:
the replicas contained on the server.

setReplicas

public void setReplicas(java.util.Set<ReplicaDescriptor> replicas)
Sets the replicas contained on the server.

Parameters:
replicas - the replicas contained on the server.

getAdsProperties

public java.util.Map<ADSContext.ServerProperty,java.lang.Object> getAdsProperties()
Returns a Map containing the ADS properties of the server.

Returns:
a Map containing the ADS properties of the server.

getServerProperties

public java.util.Map<ServerDescriptor.ServerProperty,java.lang.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 or not.

Returns:
true if the server is registered in the ADS and false otherwise.

isReplicationServer

public boolean isReplicationServer()
Tells whether this server is a replication server or not.

Returns:
true if the server is a replication server and false otherwise.

getReplicationServerHostPort

public java.lang.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.

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.

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 or not.

Returns:
true if the communication with the replication port on the server is encrypted and false otherwise.

setAdsProperties

public void setAdsProperties(java.util.Map<ADSContext.ServerProperty,java.lang.Object> adsProperties)
Sets the ADS properties of the server.

Parameters:
adsProperties - a Map containing the ADS properties of the server.

getHostName

public java.lang.String getHostName()
Returns the host name of the server.

Returns:
the host name of the server.

getLDAPURL

public java.lang.String getLDAPURL()
Returns the URL to access this server using LDAP. Returns null if the server is not configured to listen on an LDAP port.

Returns:
the URL to access this server using LDAP.

getLDAPsURL

public java.lang.String getLDAPsURL()
Returns the URL to access this server using LDAPS. Returns null if the server is not configured to listen on an LDAPS port.

Returns:
the URL to access this server using LDAP.

getHostPort

public java.lang.String 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 (if LDAPS is enabled) will be the LDAPS port.

Parameters:
securePreferred - whether to try to use the secure port as part of the returning String or not.
Returns:
a String of type host-name:port-number for the server.

getId

public java.lang.String getId()
Returns an Id that is unique for this server.

Returns:
an Id that is unique for this server.

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 java.lang.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(java.util.Map<ADSContext.ServerProperty,java.lang.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(javax.naming.ldap.InitialLdapContext ctx,
                                                TopologyCacheFilter filter)
                                         throws javax.naming.NamingException
Creates a ServerDescriptor object based on the configuration that we read using the provided InitialLdapContext.

Parameters:
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.
Returns:
a ServerDescriptor object that corresponds to the read configuration.
Throws:
javax.naming.NamingException - if a problem occurred reading the server configuration.

seedAdsTrustStore

public static void seedAdsTrustStore(javax.naming.ldap.InitialLdapContext ctx,
                                     java.util.Map<java.lang.String,byte[]> keyEntryMap)
                              throws javax.naming.NamingException
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 posessing 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:
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).
Throws:
javax.naming.NamingException - in case an error occurs while updating the instance's ads-truststore via LDAP.