Search in sources :

Example 1 with MapStringStringResponseProtos

use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos in project geowave by locationtech.

the class GeoWaveGrpcCoreCliService method listCommand.

@Override
public void listCommand(final org.locationtech.geowave.service.grpc.protobuf.ListCommandParametersProtos request, final StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos> responseObserver) {
    final ListCommand cmd = new ListCommand();
    final Map<FieldDescriptor, Object> m = request.getAllFields();
    GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd);
    final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile;
    final OperationParams params = new ManualOperationParams();
    params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
    cmd.prepare(params);
    LOGGER.info("Executing ListCommand...");
    try {
        final Map<String, String> post_result = new HashMap<>();
        final Map<String, Object> result = cmd.computeResults(params);
        final Iterator<Entry<String, Object>> it = result.entrySet().iterator();
        while (it.hasNext()) {
            final Map.Entry<String, Object> pair = it.next();
            post_result.put(pair.getKey().toString(), pair.getValue().toString());
        }
        final MapStringStringResponseProtos resp = MapStringStringResponseProtos.newBuilder().putAllResponseValue(post_result).build();
        responseObserver.onNext(resp);
        responseObserver.onCompleted();
    } catch (final Exception e) {
        LOGGER.error("Exception encountered executing command", e);
        responseObserver.onError(e);
    }
}
Also used : ListCommand(org.locationtech.geowave.core.cli.operations.config.ListCommand) HashMap(java.util.HashMap) OperationParams(org.locationtech.geowave.core.cli.api.OperationParams) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) FieldDescriptor(com.google.protobuf.Descriptors.FieldDescriptor) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) Entry(java.util.Map.Entry) File(java.io.File) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with MapStringStringResponseProtos

use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos in project geowave by locationtech.

the class GeoWaveGrpcTestClient method listCommand.

public Map<String, String> listCommand() {
    final ListCommandParametersProtos request = ListCommandParametersProtos.newBuilder().build();
    final MapStringStringResponseProtos response = coreCliBlockingStub.listCommand(request);
    final Map<String, String> map = response.getResponseValueMap();
    return map;
}
Also used : MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) ListCommandParametersProtos(org.locationtech.geowave.service.grpc.protobuf.ListCommandParametersProtos) ByteString(com.google.protobuf.ByteString)

Aggregations

MapStringStringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos)2 ByteString (com.google.protobuf.ByteString)1 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)1 ListCommand (org.locationtech.geowave.core.cli.operations.config.ListCommand)1 ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)1 ListCommandParametersProtos (org.locationtech.geowave.service.grpc.protobuf.ListCommandParametersProtos)1