@Extensible @DirectoryProxyServerExtension(appliesToLocalContent=false, appliesToRemoteContent=true) @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class PlacementAlgorithm extends java.lang.Object implements UnboundIDExtension, Reconfigurable<PlacementAlgorithmConfig>, ExampleUsageProvider
dsconfig create-placement-algorithm \ --algorithm-name "{algorithm-name}" \ --processor-name "{processor-name}" \ --type third-party \ --set enabled:true \ --set "extension-class:{class-name}" \ --set "extension-argument:{name=value}"where "{algorithm-name}" is the to use for the placement algorithm instance, "{processor-name}" is the name of the entry-balancing request processor for which the placement algorithm will be used, "{class-name}" is the fully-qualified name of the Java class that extends
com.unboundid.directory.sdk.proxy.api.PlacementAlgorithm
, and
"{name=value}" represents name-value pairs for any arguments to
provide to the placement algorithm. If multiple arguments should be provided
to the placement algorithm, then the
"--set extension-argument:{name=value}
" option should be
provided multiple times.Constructor and Description |
---|
PlacementAlgorithm()
Creates a new instance of this placement algorithm.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
applyBalancingConfigurationChange(java.lang.String balancingBaseDN,
java.util.List<BackendSet> backendSets)
Adapts to a change in the backend sets configured for use with the
associated entry-balancing request processor.
|
ResultCode |
applyConfiguration(PlacementAlgorithmConfig config,
ArgumentParser parser,
java.util.List<java.lang.String> adminActionsRequired,
java.util.List<java.lang.String> messages)
Attempts to apply the configuration from the provided argument parser to
this extension.
|
void |
defineConfigArguments(ArgumentParser parser)
Updates the provided argument parser to define any configuration arguments
which may be used by this extension.
|
void |
finalizePlacementAlgorithm()
Performs any cleanup which may be necessary when this LDAP health check is
to be taken out of service.
|
java.util.Map<java.util.List<java.lang.String>,java.lang.String> |
getExamplesArgumentSets()
Retrieves a map containing examples of configurations that may be used for
this extension.
|
abstract java.lang.String[] |
getExtensionDescription()
Retrieves a human-readable description for this extension.
|
abstract java.lang.String |
getExtensionName()
Retrieves a human-readable name for this extension.
|
void |
initializePlacementAlgorithm(ProxyServerContext serverContext,
PlacementAlgorithmConfig config,
ArgumentParser parser,
java.lang.String balancingBaseDN,
java.util.List<BackendSet> backendSets)
Initializes this placement algorithm.
|
boolean |
isConfigurationAcceptable(PlacementAlgorithmConfig config,
ArgumentParser parser,
java.util.List<java.lang.String> unacceptableReasons)
Indicates whether the configuration represented by the provided argument
parser is acceptable for use by this extension.
|
abstract BackendSet |
selectBackendSet(OperationContext operationContext,
AddRequest addRequest)
Determines the backend set that should be used to process the specified
add operation.
|
BackendSet |
selectRebalancingBackendSet(OperationContext operationContext,
BackendSet backendSet)
Select a new backend set for an entry that has been modified or a child
entry that has been added below an existing entry in a backend set.
|
boolean |
supportsRebalancing()
Determines whether this placement algorithm implements the
selectRebalancingBackendSet(com.unboundid.directory.sdk.common.types.OperationContext, com.unboundid.directory.sdk.proxy.types.BackendSet) method to rebalance existing entries. |
java.lang.String |
toString()
Retrieves a string representation of this placement algorithm.
|
abstract void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this placement algorithm to the provided
buffer.
|
public PlacementAlgorithm()
initializePlacementAlgorithm
method.public abstract java.lang.String getExtensionName()
getExtensionName
in interface UnboundIDExtension
public abstract java.lang.String[] getExtensionDescription()
getExtensionDescription
in interface UnboundIDExtension
null
or an empty array if no description should be available.public void defineConfigArguments(ArgumentParser parser) throws ArgumentException
defineConfigArguments
in interface Configurable
parser
- The argument parser to be updated with the configuration
arguments which may be used by this extension.ArgumentException
- If a problem is encountered while updating the
provided argument parser.public void initializePlacementAlgorithm(ProxyServerContext serverContext, PlacementAlgorithmConfig config, ArgumentParser parser, java.lang.String balancingBaseDN, java.util.List<BackendSet> backendSets) throws LDAPException
serverContext
- A handle to the server context for the Directory
Proxy server in which this extension is running.config
- The general configuration for this placement
algorithm.parser
- The argument parser which has been initialized
from the configuration for this placement
algorithm..balancingBaseDN
- The balancing base DN for the associated
entry-balancing request processor.backendSets
- The list of backend sets that will be used with
the entry-balancing request processor.LDAPException
- If a problem occurs while initializing this LDAP
health check.public boolean isConfigurationAcceptable(PlacementAlgorithmConfig config, ArgumentParser parser, java.util.List<java.lang.String> unacceptableReasons)
isConfigurationAcceptable
in interface Reconfigurable<PlacementAlgorithmConfig>
config
- The general configuration for this extension.parser
- The argument parser that has been used to
parse the proposed configuration for this
extension.unacceptableReasons
- A list to which messages may be added to
provide additional information about why the
provided configuration is not acceptable.true
if the configuration in the provided argument parser
appears to be acceptable, or false
if not.public ResultCode applyConfiguration(PlacementAlgorithmConfig config, ArgumentParser parser, java.util.List<java.lang.String> adminActionsRequired, java.util.List<java.lang.String> messages)
applyConfiguration
in interface Reconfigurable<PlacementAlgorithmConfig>
config
- The general configuration for this extension.parser
- The argument parser that has been used to
parse the new configuration for this
extension.adminActionsRequired
- A list to which messages may be added to
provide additional information about any
additional administrative actions that may
be required to apply some of the
configuration changes.messages
- A list to which messages may be added to
provide additional information about the
processing performed by this method.SUCCESS
should be
used to indicate that all processing completed successfully. Any
other result will indicate that a problem occurred during
processing.public void finalizePlacementAlgorithm()
public abstract void applyBalancingConfigurationChange(java.lang.String balancingBaseDN, java.util.List<BackendSet> backendSets)
balancingBaseDN
- The updated balancing base DN for the associated
entry-balancing request processor.backendSets
- The updated list of backend sets for the
associated entry-balancing request processor.public abstract BackendSet selectBackendSet(OperationContext operationContext, AddRequest addRequest)
operationContext
- The operation context for the add operation
to be processed.addRequest
- The add request being processed.null
if there is no appropriate backend set.public BackendSet selectRebalancingBackendSet(OperationContext operationContext, BackendSet backendSet)
operationContext
- The operation context for the operation that was
processed.backendSet
- The backend set that currently holds the entry.null
if the entry should not be relocated.public boolean supportsRebalancing()
selectRebalancingBackendSet(com.unboundid.directory.sdk.common.types.OperationContext, com.unboundid.directory.sdk.proxy.types.BackendSet)
method to rebalance existing entries.true
if this placement algorithm supports re-balancing,
or false
if not.public final java.lang.String toString()
toString
in class java.lang.Object
public abstract void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the string representation should be
appended.public java.util.Map<java.util.List<java.lang.String>,java.lang.String> getExamplesArgumentSets()
getExamplesArgumentSets
in interface ExampleUsageProvider
null
or empty if there should
not be any example argument sets.