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 ConfigChangeResult
applyConfigurationChange(StaticServiceDiscoveryMechanismCfg configuration)
Applies the configuration changes to this change listener.void
deregisterChangeListener(ServiceDiscoveryChangeListener listener)
De-registers a listener from notifications on service changes.void
finalizeMechanism()
Frees any resources in use, mechanism will not be used anymore afterwards.protected void
fireConnectionOptionsChanged()
String
getName()
Returns the name of the mechanism.Partition
getPartition(Collection<Dn> baseDns)
Returns the partitions.void
initializeMechanism(StaticServiceDiscoveryMechanismCfg cfg, ServerContext serverContext)
Initializes the mechanism with the provided configuration.boolean
isConfigurationAcceptable(StaticServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)
Returns whether the provided configuration is correct for the mechanism.boolean
isConfigurationChangeAcceptable(StaticServiceDiscoveryMechanismCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.void
registerChangeListener(ServiceDiscoveryChangeListener listener)
Registers a listener to be notified when changes in the service occur.String
toString()
-
-
-
Method Detail
-
initializeMechanism
public void initializeMechanism(StaticServiceDiscoveryMechanismCfg cfg, ServerContext serverContext)
Description copied from interface:ServiceDiscoveryMechanism
Initializes the mechanism with the provided configuration.- Specified by:
initializeMechanism
in 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: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<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:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in 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
true
if the proposed change is acceptable, orfalse
if it is not.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(StaticServiceDiscoveryMechanismCfg 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<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:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in 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: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
public final void registerChangeListener(ServiceDiscoveryChangeListener listener)
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
public final void deregisterChangeListener(ServiceDiscoveryChangeListener listener)
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
-
-