ScriptBasedMappingWithDependency (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.net, class: ScriptBasedMappingWithDependency

Package org.apache.hadoop.net

# Class ScriptBasedMappingWithDependency

java.lang.Object
org.apache.hadoop.net.AbstractDNSToSwitchMapping
org.apache.hadoop.net.CachedDNSToSwitchMapping
org.apache.hadoop.net.ScriptBasedMapping
org.apache.hadoop.net.ScriptBasedMappingWithDependency

All Implemented Interfaces:
  `Configurable`, `DNSToSwitchMapping`, `DNSToSwitchMappingWithDependency`

@Private @Evolving public class ScriptBasedMappingWithDependency extends ScriptBasedMapping implements DNSToSwitchMappingWithDependency
This class extends ScriptBasedMapping class and implements the `DNSToSwitchMappingWithDependency` interface using a script configured via the `CommonConfigurationKeysPublic.NET_DEPENDENCY_SCRIPT_FILE_NAME_KEY` option.

It contains a static class `RawScriptBasedMappingWithDependency` that performs the getDependency work.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.net.ScriptBasedMapping

  `ScriptBasedMapping.RawScriptBasedMapping`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.net.ScriptBasedMapping

  `NO_SCRIPT`

  ### Fields inherited from class org.apache.hadoop.net.CachedDNSToSwitchMapping

  `rawMapping`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ScriptBasedMappingWithDependency()`
  Create an instance with the default configuration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<String>`
  `getDependency(String name)`
  Get dependencies in the topology for a given host
  `void`
  `setConf(Configuration conf)`
  Set the configuration to be used by this object.
  `String`
  `toString()`

  ### Methods inherited from class org.apache.hadoop.net.ScriptBasedMapping

  `getConf`

  ### Methods inherited from class org.apache.hadoop.net.CachedDNSToSwitchMapping

  `getSwitchMap, isSingleSwitch, reloadCachedMappings, reloadCachedMappings, resolve`

  ### Methods inherited from class org.apache.hadoop.net.AbstractDNSToSwitchMapping

  `dumpTopology, isMappingSingleSwitch, isSingleSwitchByScriptPolicy`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.hadoop.net.DNSToSwitchMapping

  `reloadCachedMappings, reloadCachedMappings, resolve`

- ## Constructor Details

  - ### ScriptBasedMappingWithDependency

    public ScriptBasedMappingWithDependency()
    Create an instance with the default configuration.

    Calling `setConf(Configuration)` will trigger a re-evaluation of the configuration settings and so be used to set up the mapping script.

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `ScriptBasedMapping`

  - ### setConf

    public void setConf(Configuration conf)
    Set the configuration to be used by this object..

    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.

    .

    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.

    Specified by:
      `setConf` in interface `Configurable`
    Overrides:
      `setConf` in class `ScriptBasedMapping`
    Parameters:
      `conf` - input Configuration.

  - ### getDependency

    public List<String> getDependency(String name)
    Get dependencies in the topology for a given host
    Specified by:
      `getDependency` in interface `DNSToSwitchMappingWithDependency`
    Parameters:
      `name` - - host name for which we are getting dependency
    Returns:
      a list of hosts dependent on the provided host name