Package org.opends.server.discovery
Class ReplicationServiceDiscoveryMechanism
java.lang.Object
org.opends.server.discovery.ReplicationServiceDiscoveryMechanism
- All Implemented Interfaces:
ConfigurationChangeListener<ReplicationServiceDiscoveryMechanismCfg>
,ServiceDiscoveryMechanism<ReplicationServiceDiscoveryMechanismCfg>
public final class ReplicationServiceDiscoveryMechanism
extends Object
implements ConfigurationChangeListener<ReplicationServiceDiscoveryMechanismCfg>
Service Discovery Mechanism retrieving information from a replication topology.
The partitions returned by this class contain the directory servers that are part of the same topology as the configured replication servers.
It will periodically query the topology to discover any new or removed servers and notify listeners of any changes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapplyConfigurationChange
(ReplicationServiceDiscoveryMechanismCfg configuration) Applies the configuration changes to this change listener.final void
De-registers a listener from notifications on service changes.final void
Frees any resources in use, mechanism will not be used anymore afterwards.protected final void
final String
getName()
Returns the name of the mechanism.getPartition
(Collection<Dn> baseDNs) Returns the partitions.void
initializeMechanism
(ReplicationServiceDiscoveryMechanismCfg config, ServerContext serverContext) Initializes the mechanism with the provided configuration.boolean
isConfigurationAcceptable
(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext) Returns whether the provided configuration is correct for the mechanism.boolean
isConfigurationChangeAcceptable
(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.final void
Registers a listener to be notified when changes in the service occur.toString()
-
Constructor Details
-
ReplicationServiceDiscoveryMechanism
public ReplicationServiceDiscoveryMechanism()
-
-
Method Details
-
initializeMechanism
public void initializeMechanism(ReplicationServiceDiscoveryMechanismCfg config, ServerContext serverContext) Description copied from interface:ServiceDiscoveryMechanism
Initializes the mechanism with the provided configuration.- Specified by:
initializeMechanism
in interfaceServiceDiscoveryMechanism<ReplicationServiceDiscoveryMechanismCfg>
- Parameters:
config
- the configuration for initializationserverContext
- the server context for this Directory Server instance
-
getPartition
Description copied from interface:ServiceDiscoveryMechanism
Returns the partitions.Each
Partition
will only contain servers that are known to expose the provided list of base DNs. An empty list of base DNs will result in all partitions and all servers being returned. In other words, an empty list of base DNs implies that all servers contain exactly the same base DNs.- Specified by:
getPartition
in interfaceServiceDiscoveryMechanism<ReplicationServiceDiscoveryMechanismCfg>
- Parameters:
baseDNs
- the baseDNs for which to retrieve the partitions- Returns:
- the partitions that can serve the provided base DNs
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext) Description copied from interface:ServiceDiscoveryMechanism
Returns whether the provided configuration is correct for the mechanism. It should be possible to call this method on an uninitialized mechanism to check the configuration for correctness.- Specified by:
isConfigurationAcceptable
in interfaceServiceDiscoveryMechanism<ReplicationServiceDiscoveryMechanismCfg>
- Parameters:
configuration
- the configuration to checkunacceptableReasons
- the list of reasons the configuration is not acceptableserverContext
- the server context of this Directory Server instance- Returns:
- if the provided configuration is correct for the mechanism.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons) Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<ReplicationServiceDiscoveryMechanismCfg>
- Parameters:
configuration
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(ReplicationServiceDiscoveryMechanismCfg configuration) Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<ReplicationServiceDiscoveryMechanismCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
getName
Description copied from interface:ServiceDiscoveryMechanism
Returns the name of the mechanism.- Specified by:
getName
in interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>
- Returns:
- the name of the mechanism
-
finalizeMechanism
public final void finalizeMechanism()Description copied from interface:ServiceDiscoveryMechanism
Frees any resources in use, mechanism will not be used anymore afterwards.- Specified by:
finalizeMechanism
in interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>
-
fireConnectionOptionsChanged
protected final void fireConnectionOptionsChanged() -
registerChangeListener
Description copied from interface:ServiceDiscoveryMechanism
Registers a listener to be notified when changes in the service occur.- Specified by:
registerChangeListener
in interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>
- Parameters:
listener
- the listener to register for notifications
-
deregisterChangeListener
Description copied from interface:ServiceDiscoveryMechanism
De-registers a listener from notifications on service changes.- Specified by:
deregisterChangeListener
in interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>
- Parameters:
listener
- the listener to de-register
-
toString
-