Class TableMapping

  extended by
      extended by
          extended by
All Implemented Interfaces:
Configurable, DNSToSwitchMapping

public class TableMapping
extends CachedDNSToSwitchMapping

Simple DNSToSwitchMapping implementation that reads a 2 column text file. The columns are separated by whitespace. The first column is a DNS or IP address and the second column specifies the rack where the address maps.

This class uses the configuration parameter to locate the mapping file.

Calls to CachedDNSToSwitchMapping.resolve(List) will look up the address as defined in the mapping file. If no entry corresponding to the address is found, the value /default-rack is returned.

Field Summary
Fields inherited from class
Constructor Summary
Method Summary
 Configuration getConf()
          Return the configuration used by this object.
 void reloadCachedMappings()
          Reload all of the cached mappings.
 void setConf(Configuration conf)
          Set the configuration to be used by this object.
Methods inherited from class
getSwitchMap, isSingleSwitch, reloadCachedMappings, resolve, toString
Methods inherited from class
dumpTopology, isMappingSingleSwitch, isSingleSwitchByScriptPolicy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public TableMapping()
Method Detail


public Configuration getConf()
Description copied from interface: Configurable
Return the configuration used by this object.

Specified by:
getConf in interface Configurable
getConf in class AbstractDNSToSwitchMapping


public void setConf(Configuration conf)
Description copied from interface: Configurable
Set the configuration to be used by this object.

Specified by:
setConf in interface Configurable
setConf in class AbstractDNSToSwitchMapping


public void reloadCachedMappings()
Description copied from interface: DNSToSwitchMapping
Reload all of the cached mappings. If there is a cache, this method will clear it, so that future accesses will get a chance to see the new data.

Specified by:
reloadCachedMappings in interface DNSToSwitchMapping
reloadCachedMappings in class CachedDNSToSwitchMapping

Copyright © 2014 Apache Software Foundation. All Rights Reserved.