use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode in project geode by apache.
the class PulseController method getQueryStatisticsGridModel.
@RequestMapping(value = "/getQueryStatisticsGridModel", method = RequestMethod.GET)
public void getQueryStatisticsGridModel(HttpServletRequest request, HttpServletResponse response) throws IOException {
ObjectNode responseJSON = mapper.createObjectNode();
// get cluster object
Cluster cluster = Repository.get().getCluster();
String userName = request.getUserPrincipal().getName();
try {
String[] arrColNames = Cluster.Statement.getGridColumnNames();
String[] arrColAttribs = Cluster.Statement.getGridColumnAttributes();
int[] arrColWidths = Cluster.Statement.getGridColumnWidths();
ArrayNode colNamesList = mapper.createArrayNode();
for (int i = 0; i < arrColNames.length; ++i) {
colNamesList.add(arrColNames[i]);
}
ArrayNode colModelList = mapper.createArrayNode();
for (int i = 0; i < arrColAttribs.length; ++i) {
ObjectNode columnJSON = mapper.createObjectNode();
columnJSON.put("name", arrColAttribs[i]);
columnJSON.put("index", arrColAttribs[i]);
columnJSON.put("width", arrColWidths[i]);
columnJSON.put("sortable", "true");
columnJSON.put("sorttype", ((i == 0) ? "String" : "integer"));
colModelList.add(columnJSON);
}
responseJSON.put("columnNames", colNamesList);
responseJSON.put("columnModels", colModelList);
responseJSON.put("clusterName", cluster.getServerName());
responseJSON.put("userName", userName);
// Send json response
response.getOutputStream().write(responseJSON.toString().getBytes());
} catch (Exception e) {
logger.debug("Exception Occurred : ", e);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode in project asterixdb by apache.
the class JobletProfile method toJSON.
@Override
public ObjectNode toJSON() {
ObjectMapper om = new ObjectMapper();
ObjectNode json = om.createObjectNode();
json.put("node-id", nodeId.toString());
populateCounters(json);
ArrayNode tasks = om.createArrayNode();
for (TaskProfile p : taskProfiles.values()) {
tasks.add(p.toJSON());
}
json.set("tasks", tasks);
return json;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode in project asterixdb by apache.
the class TaskProfile method toJSON.
@Override
public ObjectNode toJSON() {
ObjectMapper om = new ObjectMapper();
ObjectNode json = om.createObjectNode();
json.put("activity-id", taskAttemptId.getTaskId().getActivityId().toString());
json.put("partition", taskAttemptId.getTaskId().getPartition());
json.put("attempt", taskAttemptId.getAttempt());
if (partitionSendProfile != null) {
ArrayNode pspArray = om.createArrayNode();
for (PartitionProfile pp : partitionSendProfile.values()) {
ObjectNode ppObj = om.createObjectNode();
PartitionId pid = pp.getPartitionId();
ObjectNode pidObj = om.createObjectNode();
pidObj.put("job-id", pid.getJobId().toString());
pidObj.put("connector-id", pid.getConnectorDescriptorId().toString());
pidObj.put("sender-index", pid.getSenderIndex());
pidObj.put("receiver-index", pid.getReceiverIndex());
ppObj.set("partition-id", pidObj);
ppObj.put("open-time", pp.getOpenTime());
ppObj.put("close-time", pp.getCloseTime());
MultiResolutionEventProfiler samples = pp.getSamples();
ppObj.put("offset", samples.getOffset());
int resolution = samples.getResolution();
int sampleCount = samples.getCount();
ArrayNode ftA = om.createArrayNode();
int[] ft = samples.getSamples();
for (int i = 0; i < sampleCount; ++i) {
ftA.add(ft[i]);
}
ppObj.set("frame-times", ftA);
ppObj.put("resolution", resolution);
pspArray.add(ppObj);
}
json.set("partition-send-profile", pspArray);
}
populateCounters(json);
return json;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode in project asterixdb by apache.
the class AUnorderedList method toJSON.
@Override
public ObjectNode toJSON() {
ObjectMapper om = new ObjectMapper();
ObjectNode json = om.createObjectNode();
ArrayNode list = om.createArrayNode();
for (IAObject v : values) {
list.add(v.toJSON());
}
json.set("AUnorderedList", list);
return json;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode in project asterixdb by apache.
the class NodesAPIIntegrationTest method getNodeIds.
private List<String> getNodeIds() throws IOException, URISyntaxException {
ArrayNode nodes = getNodeSummaries();
final int size = nodes.size();
List<String> nodeIds = new ArrayList<>();
for (int i = 0; i < size; ++i) {
nodeIds.add(nodes.get(i).get("node-id").asText());
}
return nodeIds;
}
Aggregations