@InterfaceAudience.Public @InterfaceStability.Evolving public class ScriptBasedMapping extends CachedDNSToSwitchMapping
DNSToSwitchMapping
interface using a
script configured via the
CommonConfigurationKeysPublic.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY
option.
It contains a static class RawScriptBasedMapping
that performs
the work: reading the configuration parameters, executing any defined
script, handling errors and such like. The outer
class extends CachedDNSToSwitchMapping
to cache the delegated
queries.
This DNS mapper's CachedDNSToSwitchMapping.isSingleSwitch()
predicate returns
true if and only if a script is defined.
Modifier and Type | Field and Description |
---|---|
static String |
NO_SCRIPT
Text used in the
toString() method if there is no string
"no script" |
rawMapping
Constructor and Description |
---|
ScriptBasedMapping()
Create an instance with the default configuration.
|
ScriptBasedMapping(Configuration conf)
Create an instance from the given configuration
|
ScriptBasedMapping(DNSToSwitchMapping rawMap)
Create an instance from the given raw mapping
|
Modifier and Type | Method and Description |
---|---|
Configuration |
getConf()
Return the configuration used by this object.
|
void |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
String |
toString() |
getSwitchMap, isSingleSwitch, reloadCachedMappings, reloadCachedMappings, resolve
dumpTopology, isMappingSingleSwitch, isSingleSwitchByScriptPolicy
public static final String NO_SCRIPT
toString()
method if there is no string
"no script"public ScriptBasedMapping()
Calling setConf(Configuration)
will trigger a
re-evaluation of the configuration settings and so be used to
set up the mapping script.
public ScriptBasedMapping(DNSToSwitchMapping rawMap)
rawMap
- raw DNSTOSwithMappingpublic ScriptBasedMapping(Configuration conf)
conf
- configurationpublic Configuration getConf()
Configurable
getConf
in interface Configurable
getConf
in class AbstractDNSToSwitchMapping
public String toString()
toString
in class CachedDNSToSwitchMapping
public void setConf(Configuration conf)
This will get called in the superclass constructor, so a check is needed to ensure that the raw mapping is defined before trying to relaying a null configuration.
setConf
in interface Configurable
setConf
in class AbstractDNSToSwitchMapping
conf
- Copyright © 2021 Apache Software Foundation. All rights reserved.