Search in sources :

Example 1 with GeoServerAddCoverageCommand

use of org.locationtech.geowave.cli.geoserver.coverage.GeoServerAddCoverageCommand in project geowave by locationtech.

the class GeoWaveGrpcCliGeoserverService method geoServerAddCoverageCommand.

@Override
public void geoServerAddCoverageCommand(final org.locationtech.geowave.service.grpc.protobuf.GeoServerAddCoverageCommandParametersProtos request, final StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos> responseObserver) {
    final GeoServerAddCoverageCommand cmd = new GeoServerAddCoverageCommand();
    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 GeoServerAddCoverageCommand...");
    try {
        final String result = cmd.computeResults(params);
        final StringResponseProtos resp = StringResponseProtos.newBuilder().setResponseValue(result).build();
        responseObserver.onNext(resp);
        responseObserver.onCompleted();
    } catch (final Exception e) {
        LOGGER.error("Exception encountered executing command", e);
        responseObserver.onError(e);
    }
}
Also used : GeoServerAddCoverageCommand(org.locationtech.geowave.cli.geoserver.coverage.GeoServerAddCoverageCommand) OperationParams(org.locationtech.geowave.core.cli.api.OperationParams) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos) RepeatedStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.RepeatedStringResponseProtos) File(java.io.File) FieldDescriptor(com.google.protobuf.Descriptors.FieldDescriptor) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Aggregations

FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)1 File (java.io.File)1 GeoServerAddCoverageCommand (org.locationtech.geowave.cli.geoserver.coverage.GeoServerAddCoverageCommand)1 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)1 ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)1 RepeatedStringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.RepeatedStringResponseProtos)1 StringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos)1