public class PropertyHelper extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
PropertyHelper.Metric |
Modifier and Type | Field and Description |
---|---|
static List<String> |
AGGREGATE_FUNCTION_IDENTIFIERS
Aggregate functions implicitly supported by the Metrics Service
|
static char |
EXTERNAL_PATH_SEP |
Constructor and Description |
---|
PropertyHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsArguments(String propertyId)
Check to see if the given property id contains replacement arguments (e.g.
|
static boolean |
containsProperty(Set<String> propertyIds,
String propertyId)
Check if the given property id or one of its parent category ids is contained
in the given set of property ids.
|
static Set<String> |
getAssociatedPropertyIds(Request request)
Get all of the property ids associated with the given request.
|
static Set<String> |
getCategories(Set<String> propertyIds)
Get the set of categories for the given property ids.
|
static Request |
getCreateRequest(Set<Map<String,Object>> properties,
Map<String,String> requestInfoProperties)
Factory method to create a create request from the given set of property maps.
|
static Map<String,Map<String,PropertyInfo>> |
getJMXPropertyIds(Resource.Type resourceType) |
static Map<Resource.Type,String> |
getKeyPropertyIds(Resource.Type resourceType) |
static Map<String,Map<String,PropertyInfo>> |
getMetricPropertyIds(Resource.Type resourceType) |
static Map<String,Object> |
getProperties(Resource resource)
Get a map of all the property values keyed by property id for the given resource.
|
static String |
getPropertyCategory(String property)
Gets the parent category from a given property string.
|
static String |
getPropertyId(String category,
String name) |
static Set<String> |
getPropertyIds(Map<String,Map<String,PropertyInfo>> componentPropertyInfoMap)
Extract the set of property ids from a component PropertyInfo map.
|
static Set<String> |
getPropertyIds(Resource.Type resourceType) |
static String |
getPropertyName(String absProperty)
Helper to get a property name from a string.
|
static Request |
getReadRequest(Set<String> propertyIds)
Factory method to create a read request from the given set of property ids.
|
static Request |
getReadRequest(Set<String> propertyIds,
Map<String,String> requestInfoProperties,
Map<String,TemporalInfo> mapTemporalInfo,
PageRequest pageRequest,
SortRequest sortRequest)
Factory method to create a read request from the given set of property ids.
|
static Request |
getReadRequest(Set<String> propertyIds,
Map<String,TemporalInfo> mapTemporalInfo)
Factory method to create a read request from the given set of property ids.
|
static Request |
getReadRequest(String... propertyIds)
Factory method to create a read request from the given set of property ids.
|
static Map<String,Map<String,PropertyInfo>> |
getSQLServerPropertyIds(Resource.Type resourceType) |
static Request |
getUpdateRequest(Map<String,Object> properties,
Map<String,String> requestInfoProperties)
Factory method to create an update request from the given map of properties.
|
static boolean |
hasAggregateFunctionSuffix(String propertyId)
Check if property ends with a trailing suffix of function id.
|
static Map<String,Metric> |
processRpcMetricDefinition(String metricType,
String componentName,
String propertyId,
Metric metric)
Special handle rpc port tags added to metric names for HDFS Namenode
Returns the replacement definitions
|
static void |
setKeyPropertyIds(Resource.Type resourceType,
Map<Resource.Type,String> keyPropertyKeys) |
static void |
setPropertyIds(Resource.Type resourceType,
Set<String> propertyIds) |
static void |
updateMetricsWithAggregateFunctionSupport(Map<String,Map<String,PropertyInfo>> metrics)
This method adds supported propertyInfo for component metrics with
aggregate function ids.
|
public static final char EXTERNAL_PATH_SEP
public static Set<String> getPropertyIds(Resource.Type resourceType)
public static void setPropertyIds(Resource.Type resourceType, Set<String> propertyIds)
public static Set<String> getPropertyIds(Map<String,Map<String,PropertyInfo>> componentPropertyInfoMap)
componentPropertyInfoMap
- the mappublic static Map<String,Map<String,PropertyInfo>> getMetricPropertyIds(Resource.Type resourceType)
public static Map<String,Map<String,PropertyInfo>> getSQLServerPropertyIds(Resource.Type resourceType)
public static Map<String,Map<String,PropertyInfo>> getJMXPropertyIds(Resource.Type resourceType)
public static Map<Resource.Type,String> getKeyPropertyIds(Resource.Type resourceType)
public static void setKeyPropertyIds(Resource.Type resourceType, Map<Resource.Type,String> keyPropertyKeys)
public static String getPropertyName(String absProperty)
absProperty
- the fully qualified propertypublic static String getPropertyCategory(String property)
String.substring(int, int)
is used along with
EXTERNAL_PATH_SEP
.
In the event that a property contains a $d parameter, it will attempt to
strip out any embedded methods in the various tokens. For example, if a
property of foo/$1.substring(5)/bar/$2.substring(1)/baz
is given,
the expected recursive categories would be:
foo/$1.substring(5)/bar
is incorrect as a category.property
- the fully qualified propertypublic static Set<String> getCategories(Set<String> propertyIds)
propertyIds
- the property idspublic static boolean containsProperty(Set<String> propertyIds, String propertyId)
propertyIds
- the set of property idspropertyId
- the property idpublic static boolean containsArguments(String propertyId)
propertyId
- the property id to checkpublic static Set<String> getAssociatedPropertyIds(Request request)
request
- the requestpublic static Map<String,Object> getProperties(Resource resource)
resource
- the resourcepublic static Request getCreateRequest(Set<Map<String,Object>> properties, Map<String,String> requestInfoProperties)
properties
- resource properties associated with the request; may be nullrequestInfoProperties
- request specific properties; may be nullpublic static Request getReadRequest(Set<String> propertyIds)
propertyIds
- the property ids associated with the request; may be nullpublic static Request getReadRequest(Set<String> propertyIds, Map<String,TemporalInfo> mapTemporalInfo)
propertyIds
- the property ids associated with the request; may be nullmapTemporalInfo
- the temporal infopublic static Request getReadRequest(Set<String> propertyIds, Map<String,String> requestInfoProperties, Map<String,TemporalInfo> mapTemporalInfo, PageRequest pageRequest, SortRequest sortRequest)
propertyIds
- the property ids associated with the request; may be nullrequestInfoProperties
- request info propertiesmapTemporalInfo
- the temporal infopageRequest
- an optional page request, or null
for none.sortRequest
- an optional sort request, or null
for none.public static Request getReadRequest(String... propertyIds)
propertyIds
- the property ids associated with the request; may be nullpublic static Request getUpdateRequest(Map<String,Object> properties, Map<String,String> requestInfoProperties)
properties
- resource properties associated with the request; may be nullrequestInfoProperties
- request specific properties; may be nullpublic static void updateMetricsWithAggregateFunctionSupport(Map<String,Map<String,PropertyInfo>> metrics)
public static boolean hasAggregateFunctionSuffix(String propertyId)
Copyright © 2022 Apache Software Foundation. All rights reserved.