net.floodlightcontroller.devicemanager.internal
Class DeviceMultiIndex

java.lang.Object
  extended by net.floodlightcontroller.devicemanager.internal.DeviceIndex
      extended by net.floodlightcontroller.devicemanager.internal.DeviceMultiIndex

public class DeviceMultiIndex
extends DeviceIndex

An index that maps key fields of an entity to device keys, with multiple device keys allowed per entity


Field Summary
 
Fields inherited from class net.floodlightcontroller.devicemanager.internal.DeviceIndex
keyFields
 
Constructor Summary
DeviceMultiIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
           
 
Method Summary
 java.util.Iterator<java.lang.Long> getAll()
          Get all device keys in the index.
 java.util.Iterator<java.lang.Long> queryByEntity(Entity entity)
          Find all device keys in the index that match the given entity on all the key fields for this index
 void removeEntity(Entity entity)
          Remove the entry for the given entity
 void removeEntity(Entity entity, java.lang.Long deviceKey)
          Remove the given device key from the index for the given entity
 boolean updateIndex(Device device, java.lang.Long deviceKey)
          Attempt to update an index with the entities in the provided Device.
 void updateIndex(Entity entity, java.lang.Long deviceKey)
          Add a mapping from the given entity to the given device key.
 
Methods inherited from class net.floodlightcontroller.devicemanager.internal.DeviceIndex
removeEntityIfNeeded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceMultiIndex

public DeviceMultiIndex(java.util.EnumSet<IDeviceService.DeviceField> keyFields)
Parameters:
keyFields -
Method Detail

queryByEntity

public java.util.Iterator<java.lang.Long> queryByEntity(Entity entity)
Description copied from class: DeviceIndex
Find all device keys in the index that match the given entity on all the key fields for this index

Specified by:
queryByEntity in class DeviceIndex
Returns:
an iterator over device keys

getAll

public java.util.Iterator<java.lang.Long> getAll()
Description copied from class: DeviceIndex
Get all device keys in the index. If certain devices exist multiple times, then these devices may be returned multiple times

Specified by:
getAll in class DeviceIndex
Returns:
an iterator over device keys

updateIndex

public boolean updateIndex(Device device,
                           java.lang.Long deviceKey)
Description copied from class: DeviceIndex
Attempt to update an index with the entities in the provided Device. If the update fails because of a concurrent update, will return false.

Specified by:
updateIndex in class DeviceIndex
Parameters:
device - the device to update
deviceKey - the device key for the device
Returns:
true if the update succeeded, false otherwise.

updateIndex

public void updateIndex(Entity entity,
                        java.lang.Long deviceKey)
Description copied from class: DeviceIndex
Add a mapping from the given entity to the given device key. This update will not fail because of a concurrent update

Specified by:
updateIndex in class DeviceIndex
deviceKey - the device key for the device

removeEntity

public void removeEntity(Entity entity)
Description copied from class: DeviceIndex
Remove the entry for the given entity

Specified by:
removeEntity in class DeviceIndex
Parameters:
entity - the entity to remove

removeEntity

public void removeEntity(Entity entity,
                         java.lang.Long deviceKey)
Description copied from class: DeviceIndex
Remove the given device key from the index for the given entity

Specified by:
removeEntity in class DeviceIndex
Parameters:
entity - the entity to search for
deviceKey - the key to remove