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
Constructors Constructor Description ReplicationServiceDiscoveryMechanism()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(ReplicationServiceDiscoveryMechanismCfg configuration)Applies the configuration changes to this change listener.voidderegisterChangeListener(ServiceDiscoveryChangeListener listener)De-registers a listener from notifications on service changes.voidfinalizeMechanism()Frees any resources in use, mechanism will not be used anymore afterwards.protected voidfireConnectionOptionsChanged()StringgetName()Returns the name of the mechanism.PartitiongetPartition(Collection<Dn> baseDNs)Returns the partitions.voidinitializeMechanism(ReplicationServiceDiscoveryMechanismCfg config, ServerContext serverContext)Initializes the mechanism with the provided configuration.booleanisConfigurationAcceptable(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)Returns whether the provided configuration is correct for the mechanism.booleanisConfigurationChangeAcceptable(ReplicationServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.voidregisterChangeListener(ServiceDiscoveryChangeListener listener)Registers a listener to be notified when changes in the service occur.StringtoString()
-
-
-
Method Detail
-
initializeMechanism
public void initializeMechanism(ReplicationServiceDiscoveryMechanismCfg config, ServerContext serverContext)
Description copied from interface:ServiceDiscoveryMechanismInitializes the mechanism with the provided configuration.- Specified by:
initializeMechanismin interfaceServiceDiscoveryMechanism<ReplicationServiceDiscoveryMechanismCfg>- Parameters:
config- the configuration for initializationserverContext- the server context for this Directory Server instance
-
getPartition
public Partition getPartition(Collection<Dn> baseDNs)
Description copied from interface:ServiceDiscoveryMechanismReturns the partitions.Each
Partitionwill 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:
getPartitionin 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:ServiceDiscoveryMechanismReturns 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:
isConfigurationAcceptablein 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:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(ReplicationServiceDiscoveryMechanismCfg configuration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<ReplicationServiceDiscoveryMechanismCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
getName
public final String getName()
Description copied from interface:ServiceDiscoveryMechanismReturns the name of the mechanism.- Specified by:
getNamein interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>- Returns:
- the name of the mechanism
-
finalizeMechanism
public final void finalizeMechanism()
Description copied from interface:ServiceDiscoveryMechanismFrees any resources in use, mechanism will not be used anymore afterwards.- Specified by:
finalizeMechanismin interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>
-
fireConnectionOptionsChanged
protected final void fireConnectionOptionsChanged()
-
registerChangeListener
public final void registerChangeListener(ServiceDiscoveryChangeListener listener)
Description copied from interface:ServiceDiscoveryMechanismRegisters a listener to be notified when changes in the service occur.- Specified by:
registerChangeListenerin interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>- Parameters:
listener- the listener to register for notifications
-
deregisterChangeListener
public final void deregisterChangeListener(ServiceDiscoveryChangeListener listener)
Description copied from interface:ServiceDiscoveryMechanismDe-registers a listener from notifications on service changes.- Specified by:
deregisterChangeListenerin interfaceServiceDiscoveryMechanism<C extends ServiceDiscoveryMechanismCfg>- Parameters:
listener- the listener to de-register
-
-