Search in sources :

Example 1 with FirstElementListComparator

use of org.locationtech.geowave.core.cli.utils.FirstElementListComparator in project geowave by locationtech.

the class DescribeStoreCommand method execute.

@Override
public void execute(OperationParams params) throws Exception {
    Map<String, String> configMap = computeResults(params);
    List<List<Object>> rows = new ArrayList<List<Object>>(configMap.size());
    Iterator<Map.Entry<String, String>> entryIter = configMap.entrySet().iterator();
    while (entryIter.hasNext()) {
        Map.Entry<String, String> entry = entryIter.next();
        List<Object> values = new ArrayList<Object>(2);
        values.add(entry.getKey());
        values.add(entry.getValue());
        rows.add(values);
    }
    Collections.sort(rows, new FirstElementListComparator());
    new ConsoleTablePrinter(params.getConsole()).print(Arrays.asList("Config Parameter", "Value"), rows);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) ConsoleTablePrinter(org.locationtech.geowave.core.cli.utils.ConsoleTablePrinter) FirstElementListComparator(org.locationtech.geowave.core.cli.utils.FirstElementListComparator)

Example 2 with FirstElementListComparator

use of org.locationtech.geowave.core.cli.utils.FirstElementListComparator in project geowave by locationtech.

the class ListStoresCommand method execute.

@Override
public void execute(OperationParams params) throws Exception {
    Map<String, String> storeMap = computeResults(params);
    List<List<Object>> rows = new ArrayList<List<Object>>(storeMap.size());
    storeMap.entrySet().forEach(entry -> {
        List<Object> values = new ArrayList<Object>(2);
        String key = entry.getKey();
        values.add(key.substring(6, key.length() - ".type".length()));
        values.add(entry.getValue());
        rows.add(values);
    });
    Collections.sort(rows, new FirstElementListComparator());
    new ConsoleTablePrinter(params.getConsole()).print(Arrays.asList("Data Store", "Type"), rows);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ConsoleTablePrinter(org.locationtech.geowave.core.cli.utils.ConsoleTablePrinter) FirstElementListComparator(org.locationtech.geowave.core.cli.utils.FirstElementListComparator)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 ConsoleTablePrinter (org.locationtech.geowave.core.cli.utils.ConsoleTablePrinter)2 FirstElementListComparator (org.locationtech.geowave.core.cli.utils.FirstElementListComparator)2 Map (java.util.Map)1