use of org.locationtech.geowave.core.ingest.operations.SparkToGeoWaveCommand in project geowave by locationtech.
the class GeoWaveGrpcCoreIngestService method sparkToGeoWaveCommand.
@Override
public void sparkToGeoWaveCommand(final org.locationtech.geowave.service.grpc.protobuf.SparkToGeoWaveCommandParametersProtos request, final StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos> responseObserver) {
final SparkToGeoWaveCommand cmd = new SparkToGeoWaveCommand();
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);
if (!cmd.prepare(params)) {
LOGGER.error("Failed to prepare parameters for SparkToGeowaveCommand");
}
LOGGER.info("Executing SparkToGeowaveCommand...");
try {
cmd.computeResults(params);
final VoidResponseProtos resp = VoidResponseProtos.newBuilder().build();
responseObserver.onNext(resp);
responseObserver.onCompleted();
} catch (final Exception e) {
LOGGER.error("Exception encountered executing command", e);
responseObserver.onError(e);
}
}
Aggregations