/** * Constructor. * * @param table Logical table for the table identifier */ public TableIdentifier(LogicalTable table) { this(table.getName(), table.getGranularity()); }
/** * Get the URL of the logical table. * * @param logicalTable Logical table to get the URL of * @param uriInfo URI Info for the request * * @return The absolute URL for the logical table */ public static String getLogicalTableUrl(LogicalTable logicalTable, UriInfo uriInfo) { return uriInfo.getBaseUriBuilder() .path(TablesServlet.class) .path(TablesServlet.class, "getTableByGrain") .build(logicalTable.getName(), logicalTable.getGranularity().getName()) .toASCIIString(); }
) { this.table = table.getName(); this.timeGrain = table.getGranularity().toString(); this.numBuckets = 0;
/** * Get the summary view of the logical table. * * @param logicalTable Logical table to get the view of * @param uriInfo UriInfo of the request * * @return Summary view of the logical table */ public static Map<String, String> getLogicalTableSummaryView(LogicalTable logicalTable, UriInfo uriInfo) { Map<String, String> resultRow = new LinkedHashMap<>(); resultRow.put("category", logicalTable.getCategory()); resultRow.put("name", logicalTable.getName()); resultRow.put("longName", logicalTable.getLongName()); resultRow.put("granularity", logicalTable.getGranularity().getName()); resultRow.put("uri", getLogicalTableUrl(logicalTable, uriInfo)); return resultRow; }
/** * Method to provide full view of the tables which includes grains, metrics and dimensions. * * @param logicalTables Set of logical tables * @param uriInfo Uri information to construct the uri's * * @return List of table details with all the associated meta info */ @Override public List<TableView> formatTables(Set<LogicalTable> logicalTables, UriInfo uriInfo) { //Map to keep meta info of the logical table Map<String, TableView> tablesMeta = new HashMap<>(); //Map to keep list of time grain details for the logical table Map<String, List<TableGrainView>> grainsData = new HashMap<>(); for (LogicalTable logicalTable : logicalTables) { //An array list to store grain level definition of given logical table List<TableGrainView> grains = grainsData .computeIfAbsent(logicalTable.getName(), (ignore) -> new ArrayList<>()); grains.add(formatTableGrain(logicalTable, logicalTable.getGranularity().getName(), uriInfo)); tablesMeta.computeIfAbsent(logicalTable.getName(), k -> formatTable(logicalTable, uriInfo)); } List<TableView> tableViewList = new ArrayList<>(); Set<Map.Entry<String, TableView>> entrySet = tablesMeta.entrySet(); for (Map.Entry<String, TableView> entry : entrySet) { TableView tableView = entry.getValue(); tableView.put("timeGrains", grainsData.get(entry.getKey())); tableViewList.add(tableView); } return tableViewList; }
resultRow.put("longName", logicalTable.getLongName()); resultRow.put("retention", logicalTable.getRetention().toString()); resultRow.put("granularity", logicalTable.getGranularity().getName()); resultRow.put("description", logicalTable.getDescription()); resultRow.put(
new SimpleImmutableEntry<>("longName", logicalTable.getLongName()), new SimpleImmutableEntry<>("retention", logicalTable.getRetention().toString()), new SimpleImmutableEntry<>("granularity", logicalTable.getGranularity().getName()), new SimpleImmutableEntry<>("description", logicalTable.getDescription()), new SimpleImmutableEntry<>(
REGISTRY.meter("request.logical.table." + table.getName() + "." + table.getGranularity()).mark();