Class DeviceDataManager


  • public class DeviceDataManager
    extends Object
    Device topology and config manager.
    • Constructor Detail

      • DeviceDataManager

        public DeviceDataManager()
        Empty constructor without backing files (ex. for unit tests).
    • Method Detail

      • setTopology

        public void setTopology​(DeviceTopology topo)
        Set the topology. May throw unchecked exceptions upon error.
      • getTopologyJson

        public String getTopologyJson()
        Return the topology as a JSON string.
      • getTopologyCopy

        public DeviceTopology getTopologyCopy()
        Return a copy of the topology.
      • getZones

        public List<String> getZones()
        Return all zones in the topology.
      • getDeviceZone

        public String getDeviceZone​(String serialNumber)
        Return the RF zone for the given device, or null if not found.
      • isDeviceInTopology

        public boolean isDeviceInTopology​(String serialNumber)
        Return true if the given device is present in the topology.
      • isZoneInTopology

        public boolean isZoneInTopology​(String zone)
        Return true if the given RF zone is present in the topology.
      • setDeviceLayeredConfig

        public void setDeviceLayeredConfig​(DeviceLayeredConfig cfg)
        Set the device layered config. May throw unchecked exceptions upon error.
      • getDeviceLayeredConfigJson

        public String getDeviceLayeredConfigJson()
        Return the device config layers as a JSON string.
      • getDeviceConfig

        public DeviceConfig getDeviceConfig​(String serialNumber)
        Return config for the given device with all config layers applied, or null if not present in the topology.
      • getDeviceConfig

        public DeviceConfig getDeviceConfig​(String serialNumber,
                                            String zone)
        Return config for the given device with all config layers applied. This method will not check if the device is present in the topology, and uses the supplied zone directly.
      • getAllDeviceConfigs

        public Map<String,​DeviceConfig> getAllDeviceConfigs​(String zone)
        Return config (with all config layers applied) for all devices in a given zone, or null if not present in the topology.
        Parameters:
        zone - the zone that will be looked up for devices
        Returns:
        map of serial number to computed config
      • setDeviceNetworkConfig

        public void setDeviceNetworkConfig​(DeviceConfig networkConfig)
        Set the device network config.
      • setDeviceZoneConfig

        public void setDeviceZoneConfig​(String zone,
                                        DeviceConfig zoneConfig)
        Set the device zone config for the given zone, or erase it if null.
      • setDeviceApConfig

        public void setDeviceApConfig​(String serialNumber,
                                      DeviceConfig apConfig)
        Set the device AP config for the given AP, or erase it if null.
      • updateZoneConfig

        public void updateZoneConfig​(DeviceDataManager.ZoneConfigFunction fn)
        Apply updates to the zone layer (under a write lock)
        Parameters:
        fn - The function to apply for the configs. The key of the argument is the zone name.
      • updateDeviceApConfig

        public void updateDeviceApConfig​(DeviceDataManager.DeviceApConfigFunction fn)
        Apply updates to the device AP config layer (under a write lock).
        Parameters:
        fn - The function to apply for the configs. The key of the argument is the serial number of the device.
      • getZoneConfig

        public DeviceConfig getZoneConfig​(String zone)
        Return config for the given zone with all config layers applied. It is the caller's responsibility to ensure the zone exists in the topology.