Package org.opends.server.discovery
Class StaticServiceDiscoveryMechanism
- java.lang.Object
-
- org.opends.server.discovery.StaticServiceDiscoveryMechanism
-
- All Implemented Interfaces:
ConfigurationChangeListener<StaticServiceDiscoveryMechanismCfg>,ServiceDiscoveryMechanism<StaticServiceDiscoveryMechanismCfg>
public final class StaticServiceDiscoveryMechanism extends Object implements ConfigurationChangeListener<StaticServiceDiscoveryMechanismCfg>
This mechanism only returns the list of servers in its configuration, without checking for availability. It will periodically query the list of servers for changes in their baseDns.
-
-
Constructor Summary
Constructors Constructor Description StaticServiceDiscoveryMechanism()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(StaticServiceDiscoveryMechanismCfg 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(StaticServiceDiscoveryMechanismCfg cfg, ServerContext serverContext)Initializes the mechanism with the provided configuration.booleanisConfigurationAcceptable(StaticServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)Returns whether the provided configuration is correct for the mechanism.booleanisConfigurationChangeAcceptable(StaticServiceDiscoveryMechanismCfg 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(StaticServiceDiscoveryMechanismCfg cfg, ServerContext serverContext)
Description copied from interface:ServiceDiscoveryMechanismInitializes the mechanism with the provided configuration.- Specified by:
initializeMechanismin interfaceServiceDiscoveryMechanism<StaticServiceDiscoveryMechanismCfg>- Parameters:
cfg- 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<StaticServiceDiscoveryMechanismCfg>- Parameters:
baseDns- the baseDNs for which to retrieve the partitions- Returns:
- the partitions that can serve the provided base DNs
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(StaticServiceDiscoveryMechanismCfg 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<StaticServiceDiscoveryMechanismCfg>- 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.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(StaticServiceDiscoveryMechanismCfg 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<StaticServiceDiscoveryMechanismCfg>- 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.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(StaticServiceDiscoveryMechanismCfg configuration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<StaticServiceDiscoveryMechanismCfg>- 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
-
-