use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos in project geowave by locationtech.
the class GeoWaveGrpcTestClient method ListStatsCommand.
public String ListStatsCommand() {
final ArrayList<String> params = new ArrayList<>();
params.add(GeoWaveGrpcTestUtils.storeName);
final ListStatsCommandParametersProtos request = ListStatsCommandParametersProtos.newBuilder().addAllParameters(params).setCsv(true).build();
final StringResponseProtos resp = coreStoreBlockingStub.listStatsCommand(request);
return resp.getResponseValue();
}
use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos in project geowave by locationtech.
the class GeoWaveGrpcTestClient method RemoveStoreCommand.
public String RemoveStoreCommand() {
final ArrayList<String> params = new ArrayList<>();
params.add(GeoWaveGrpcTestUtils.storeName);
final RemoveStoreCommandParametersProtos request = RemoveStoreCommandParametersProtos.newBuilder().addAllParameters(params).build();
final StringResponseProtos resp = coreStoreBlockingStub.removeStoreCommand(request);
return resp.getResponseValue();
}
use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos in project geowave by locationtech.
the class GeoWaveGrpcTestClient method ListAdapterCommand.
public String ListAdapterCommand() {
final ArrayList<String> params = new ArrayList<>();
params.add(GeoWaveGrpcTestUtils.storeName);
final ListTypesCommandParametersProtos request = ListTypesCommandParametersProtos.newBuilder().addAllParameters(params).build();
final StringResponseProtos resp = coreStoreBlockingStub.listTypesCommand(request);
return resp.getResponseValue();
}
use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos in project geowave by locationtech.
the class GeoWaveGrpcTestClient method ListIndexCommand.
public String ListIndexCommand() {
final ArrayList<String> params = new ArrayList<>();
params.add(GeoWaveGrpcTestUtils.storeName);
final ListIndicesCommandParametersProtos request = ListIndicesCommandParametersProtos.newBuilder().addAllParameters(params).build();
final StringResponseProtos resp = coreStoreBlockingStub.listIndicesCommand(request);
return resp.getResponseValue();
}
use of org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos in project geowave by locationtech.
the class GeoWaveGrpcTestClient method vectorIngest.
// Vector Service Methods
public void vectorIngest(final int minLat, final int maxLat, final int minLon, final int maxLon, final int latStepDegs, final int lonStepDegs) throws InterruptedException, UnsupportedEncodingException, ParseException {
LOGGER.info("Performing Vector Ingest...");
final VectorStoreParametersProtos baseParams = VectorStoreParametersProtos.newBuilder().setStoreName(GeoWaveGrpcTestUtils.storeName).setTypeName(GeoWaveGrpcTestUtils.typeName).setIndexName(GeoWaveGrpcTestUtils.indexName).build();
final CountDownLatch finishLatch = new CountDownLatch(1);
final StreamObserver<StringResponseProtos> responseObserver = new StreamObserver<StringResponseProtos>() {
@Override
public void onNext(final StringResponseProtos value) {
try {
numFeaturesProcessed = Integer.parseInt(value.getResponseValue());
} catch (final NumberFormatException e) {
}
LOGGER.info(value.getResponseValue());
}
@Override
public void onError(final Throwable t) {
LOGGER.error("Error: Vector Ingest failed.", t);
finishLatch.countDown();
}
@Override
public void onCompleted() {
LOGGER.info("Finished Vector Ingest...");
finishLatch.countDown();
}
};
final StreamObserver<VectorIngestParametersProtos> requestObserver = vectorAsyncStub.vectorIngest(responseObserver);
// Build up and add features to the request here...
final VectorIngestParametersProtos.Builder requestBuilder = VectorIngestParametersProtos.newBuilder();
final FeatureAttributeProtos.Builder attBuilder = FeatureAttributeProtos.newBuilder();
for (int longitude = minLon; longitude <= maxLon; longitude += lonStepDegs) {
for (int latitude = minLat; latitude <= maxLat; latitude += latStepDegs) {
attBuilder.setValGeometry(copyFrom(new WKBWriter().write(GeometryUtils.GEOMETRY_FACTORY.createPoint(new Coordinate(longitude, latitude)))));
requestBuilder.putFeature("geometry", attBuilder.build());
final TimeZone tz = TimeZone.getTimeZone("UTC");
// Quoted "Z" to
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
// indicate UTC,
// no timezone offset
df.setTimeZone(tz);
attBuilder.setValDate(Timestamps.fromMillis((df.parse(GeoWaveGrpcTestUtils.temporalQueryStartTime).getTime() + df.parse(GeoWaveGrpcTestUtils.temporalQueryEndTime).getTime()) / 2));
requestBuilder.putFeature("TimeStamp", attBuilder.build());
attBuilder.setValDouble(latitude);
requestBuilder.putFeature("Latitude", attBuilder.build());
attBuilder.setValDouble(longitude);
requestBuilder.putFeature("Longitude", attBuilder.build());
final VectorIngestParametersProtos params = requestBuilder.setBaseParams(baseParams).build();
requestObserver.onNext(params);
if (finishLatch.getCount() == 0) {
// be thrown away.
return;
}
}
}
// Mark the end of requests
requestObserver.onCompleted();
// Receiving happens asynchronously
if (!finishLatch.await(15, TimeUnit.MINUTES)) {
LOGGER.warn("Vector Ingest can not finish within 5 minutes");
}
}
Aggregations