com.cisco.provisioning.cpe.extensions.services
Class DiscoveredDataHelper

java.lang.Object
  extended by com.cisco.provisioning.cpe.extensions.services.DiscoveredDataHelper

public class DiscoveredDataHelper
extends Object

Provides helper methods for manipulation of discovered data.


Constructor Summary
DiscoveredDataHelper()
           
 
Method Summary
static List<com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption> getAllDiscoveredValueAsDhcpOption(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, DHCPDict dictionary, String name)
          Returns the list of DHCP option instances that match the given discovered data by dictionary and name.
static Map<DHCPDict,List<DHCPData>> getDiscoveredDataByDictionary(List<? extends DiscoveredData> discoveredDataList)
          Convert a list of DHCP discovered data into a map of discovered data keyed by DHCP dictionary.
static Map<String,Map<String,String>> getDiscoveredDataStringsByDictionary(com.cisco.provisioning.cpe.base.net.dhcp.DhcpOptionDefinitionRegistry registry, DiscoveredDataType discoveredDataType, List<? extends DiscoveredData> discoveredData, boolean rawDataOnly)
          Return a Map of DHCP discovered data name/values by dictionary for logging and tracing messages.
static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(com.cisco.provisioning.cpe.base.net.dhcp.DhcpOptionDefinitionRegistry registry, DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, DHCPDict dictionary, String name)
          Returns the DHCP option class for the given discovered data by dictionary and name.
static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, DHCPDict dictionary, String name)
          Returns the DHCP option class for the given discovered data by dictionary and name.
static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, DHCPDict dictionary, String name, long enterpriseNumber)
          Returns the DHCP option class for the given discovered data by dictionary name, and enterprise number.
static Object getDiscoveredValueAsObject(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, DHCPDict dictionary, String name)
          Returns the object value for the given discovered data by dictionary and name.
static Object getDiscoveredValueAsObject(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData, String name)
          Returns the object value for the given discovered data by name.
static boolean hasDiscoveredData(DiscoveredDataType type, Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData)
          Returns true if the specified discovered data type is available.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveredDataHelper

public DiscoveredDataHelper()
Method Detail

hasDiscoveredData

public static boolean hasDiscoveredData(DiscoveredDataType type,
                                        Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData)
Returns true if the specified discovered data type is available.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
Returns:
true if the required discovered data is available for configuration generation to occur.

getDiscoveredDataByDictionary

public static Map<DHCPDict,List<DHCPData>> getDiscoveredDataByDictionary(List<? extends DiscoveredData> discoveredDataList)
Convert a list of DHCP discovered data into a map of discovered data keyed by DHCP dictionary.

Parameters:
discoveredDataList - the list of discovered DHCP data
Returns:
a map of discovered DHCP data by DHCP dictionary, or null if no discovered data supplied.

getDiscoveredDataStringsByDictionary

public static Map<String,Map<String,String>> getDiscoveredDataStringsByDictionary(com.cisco.provisioning.cpe.base.net.dhcp.DhcpOptionDefinitionRegistry registry,
                                                                                  DiscoveredDataType discoveredDataType,
                                                                                  List<? extends DiscoveredData> discoveredData,
                                                                                  boolean rawDataOnly)
Return a Map of DHCP discovered data name/values by dictionary for logging and tracing messages.

Parameters:
registry - the DHCP Option Registry
discoveredDataType - the type of discovered data that is required
discoveredData - the map of discovered data
rawDataOnly - true if raw DHCP discovered data is desired
Returns:
a Map of DHCP discovered data name/values by dictionary

getDiscoveredValueAsObject

public static Object getDiscoveredValueAsObject(DiscoveredDataType type,
                                                Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                String name)
Returns the object value for the given discovered data by name. Returns null if not found. This method searches the discovered data for all dictionary values.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
name - the name of the discovered data item
Returns:
the discovered data item value as Java object, or null if not found

getDiscoveredValueAsObject

public static Object getDiscoveredValueAsObject(DiscoveredDataType type,
                                                Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                DHCPDict dictionary,
                                                String name)
Returns the object value for the given discovered data by dictionary and name. Returns null if not found.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
dictionary - the dictionary containing the discovered data
name - the name of the discovered data attribute/option
Returns:
the discovered data object value, or null if not found

getDiscoveredValueAsDhcpOption

public static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(DiscoveredDataType type,
                                                                                                 Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                                                                 DHCPDict dictionary,
                                                                                                 String name)
Returns the DHCP option class for the given discovered data by dictionary and name. Returns null if not found.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
dictionary - the dictionary containing the discovered data
name - the name of the discovered data attribute/option
Returns:
the discovered data DHCP option, or null if not found

getDiscoveredValueAsDhcpOption

public static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(com.cisco.provisioning.cpe.base.net.dhcp.DhcpOptionDefinitionRegistry registry,
                                                                                                 DiscoveredDataType type,
                                                                                                 Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                                                                 DHCPDict dictionary,
                                                                                                 String name)
Returns the DHCP option class for the given discovered data by dictionary and name. Returns null if not found.

Parameters:
registry - the DHCP Option Registry
type - the type of discovered data that is required
discoveredData - the map of discovered data
dictionary - the dictionary containing the discovered data
name - the name of the discovered data attribute/option
Returns:
the discovered data DHCP option, or null if not found

getDiscoveredValueAsDhcpOption

public static com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption getDiscoveredValueAsDhcpOption(DiscoveredDataType type,
                                                                                                 Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                                                                 DHCPDict dictionary,
                                                                                                 String name,
                                                                                                 long enterpriseNumber)
Returns the DHCP option class for the given discovered data by dictionary name, and enterprise number. The DHCP option is presumed to be a vendor-identifying option. Returns null if not found.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
dictionary - the dictionary containing the discovered data
name - the name of the discovered data attribute/option
enterpriseNumber - the private enterprise number
Returns:
the discovered data DHCP option, or null if not found

getAllDiscoveredValueAsDhcpOption

public static List<com.cisco.provisioning.cpe.base.net.dhcp.DhcpOption> getAllDiscoveredValueAsDhcpOption(DiscoveredDataType type,
                                                                                                          Map<DiscoveredDataType,List<? extends DiscoveredData>> discoveredData,
                                                                                                          DHCPDict dictionary,
                                                                                                          String name)
Returns the list of DHCP option instances that match the given discovered data by dictionary and name. Returns empty list if none found.

Parameters:
type - the type of discovered data that is required
discoveredData - the map of discovered data
dictionary - the dictionary containing the discovered data
name - the name of the discovered data attribute/option
Returns:
the list of discovered data options, or null if not found