public class StageUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Integer |
DEFAULT_PING_PORT |
Constructor and Description |
---|
StageUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
fromJson(String json,
Class<T> clazz) |
static String |
getActionId(long requestId,
long stageId) |
static Stage |
getATestStage(long requestId,
long stageId,
String clusterHostInfo) |
static Stage |
getATestStage(long requestId,
long stageId,
String hostname,
String clusterHostInfo) |
static Map<String,Set<String>> |
getClusterHostInfo(Map<String,Host> allHosts,
Cluster cluster) |
static com.google.gson.Gson |
getGson() |
static String |
getHostName() |
static long[] |
getRequestStage(String actionId) |
static String |
jaxbToString(Object jaxbObj) |
static Set<String> |
replaceMappedRanges(List<Integer> values)
Finds ranges in list and replaces ranges by compact notation
|
static Set<String> |
replaceRanges(SortedSet<Integer> set)
Finds ranges in sorted set and replaces ranges by compact notation
|
static void |
setGson(com.google.gson.Gson gson) |
static ExecutionCommand |
stringToExecutionCommand(String json) |
public static final Integer DEFAULT_PING_PORT
public static com.google.gson.Gson getGson()
public static void setGson(com.google.gson.Gson gson)
public static String getActionId(long requestId, long stageId)
public static long[] getRequestStage(String actionId)
public static Stage getATestStage(long requestId, long stageId, String clusterHostInfo)
public static Stage getATestStage(long requestId, long stageId, String hostname, String clusterHostInfo)
public static String jaxbToString(Object jaxbObj) throws JAXBException, org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
JAXBException
org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
IOException
public static ExecutionCommand stringToExecutionCommand(String json) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, IOException
org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
IOException
public static <T> T fromJson(String json, Class<T> clazz) throws IOException
IOException
public static Map<String,Set<String>> getClusterHostInfo(Map<String,Host> allHosts, Cluster cluster) throws AmbariException
AmbariException
public static Set<String> replaceRanges(SortedSet<Integer> set)
For example, suppose set comprises [1, 2, 3, 4, 7]. After invoking rangedSet = StageUtils.replaceRanges(set) rangedSet will comprise ["1-4", "7"]..
set
- the source set to be rangedpublic static Set<String> replaceMappedRanges(List<Integer> values)
For example, suppose list comprises [1, 1, 2, 2, 1, 3]. After invoking rangedMappedSet = StageUtils.replaceMappedRanges(list) rangedMappedSet will comprise ["1:0-1,4", "2:2-3", "3:5"]..
values
- the source list to be rangedpublic static String getHostName()
Copyright © 2017. All rights reserved.