Search in sources :

Example 1 with StringResponseProtos

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();
}
Also used : ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos) ListStatsCommandParametersProtos(org.locationtech.geowave.service.grpc.protobuf.ListStatsCommandParametersProtos)

Example 2 with StringResponseProtos

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();
}
Also used : ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos) RemoveStoreCommandParametersProtos(org.locationtech.geowave.service.grpc.protobuf.RemoveStoreCommandParametersProtos)

Example 3 with StringResponseProtos

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();
}
Also used : ArrayList(java.util.ArrayList) ListTypesCommandParametersProtos(org.locationtech.geowave.service.grpc.protobuf.ListTypesCommandParametersProtos) ByteString(com.google.protobuf.ByteString) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos)

Example 4 with StringResponseProtos

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();
}
Also used : ListIndicesCommandParametersProtos(org.locationtech.geowave.service.grpc.protobuf.ListIndicesCommandParametersProtos) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos)

Example 5 with StringResponseProtos

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");
    }
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) WKBWriter(org.locationtech.jts.io.WKBWriter) MapStringStringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos) StringResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos) CountDownLatch(java.util.concurrent.CountDownLatch) TimeZone(java.util.TimeZone) VectorIngestParametersProtos(org.locationtech.geowave.service.grpc.protobuf.VectorIngestParametersProtos) Coordinate(org.locationtech.jts.geom.Coordinate) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) VectorStoreParametersProtos(org.locationtech.geowave.service.grpc.protobuf.VectorStoreParametersProtos) FeatureAttributeProtos(org.locationtech.geowave.service.grpc.protobuf.FeatureAttributeProtos) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

StringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos)42 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)35 File (java.io.File)35 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)35 ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)35 RepeatedStringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.RepeatedStringResponseProtos)25 MapStringStringResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.MapStringStringResponseProtos)7 ByteString (com.google.protobuf.ByteString)6 ArrayList (java.util.ArrayList)5 StreamObserver (io.grpc.stub.StreamObserver)2 ParameterException (com.beust.jcommander.ParameterException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Map (java.util.Map)1 TimeZone (java.util.TimeZone)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 SimpleFeatureBuilder (org.geotools.feature.simple.SimpleFeatureBuilder)1 SimpleFeatureTypeBuilder (org.geotools.feature.simple.SimpleFeatureTypeBuilder)1 FeatureDataAdapter (org.locationtech.geowave.adapter.vector.FeatureDataAdapter)1