From 3419fb6f2e0b3125b59d74896b2b43dac2da22ec Mon Sep 17 00:00:00 2001 From: Kurtis Van Gent Date: Thu, 9 Nov 2017 14:18:39 -0800 Subject: [PATCH] Fixed OperationalFuture references. --- dlp/src/main/java/com/example/dlp/Inspect.java | 8 ++++---- dlp/src/main/java/com/example/dlp/RiskAnalysis.java | 10 +++++----- .../src/main/java/com/example/speech/Recognize.java | 12 ++++-------- .../src/main/java/com/example/video/Detect.java | 12 ++++++------ .../java/com/example/video/QuickstartSample.java | 2 +- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/dlp/src/main/java/com/example/dlp/Inspect.java b/dlp/src/main/java/com/example/dlp/Inspect.java index b39be30adc7..28c958d0fcb 100644 --- a/dlp/src/main/java/com/example/dlp/Inspect.java +++ b/dlp/src/main/java/com/example/dlp/Inspect.java @@ -16,7 +16,7 @@ package com.example.dlp; -import com.google.api.gax.rpc.OperationFuture; +import com.google.api.gax.longrunning.OperationFuture; import com.google.cloud.ServiceOptions; import com.google.cloud.dlp.v2beta1.DlpServiceClient; import com.google.longrunning.Operation; @@ -235,7 +235,7 @@ private static void inspectGcsFile( OutputStorageConfig outputConfig = OutputStorageConfig.getDefaultInstance(); // asynchronously submit an inspect operation - OperationFuture responseFuture = + OperationFuture responseFuture = dlpServiceClient.createInspectOperationAsync(inspectConfig, storageConfig, outputConfig); // ... @@ -309,7 +309,7 @@ private static void inspectDatastore( OutputStorageConfig outputConfig = OutputStorageConfig.getDefaultInstance(); // asynchronously submit an inspect operation - OperationFuture responseFuture = + OperationFuture responseFuture = dlpServiceClient.createInspectOperationAsync(inspectConfig, storageConfig, outputConfig); // ... @@ -387,7 +387,7 @@ private static void inspectBigquery( OutputStorageConfig outputConfig = OutputStorageConfig.getDefaultInstance(); // asynchronously submit an inspect operation - OperationFuture responseFuture = + OperationFuture responseFuture = dlpServiceClient.createInspectOperationAsync( inspectConfig, storageConfig, outputConfig); diff --git a/dlp/src/main/java/com/example/dlp/RiskAnalysis.java b/dlp/src/main/java/com/example/dlp/RiskAnalysis.java index 5fc95bdec86..89cb840f2d0 100644 --- a/dlp/src/main/java/com/example/dlp/RiskAnalysis.java +++ b/dlp/src/main/java/com/example/dlp/RiskAnalysis.java @@ -16,7 +16,7 @@ package com.example.dlp; -import com.google.api.gax.rpc.OperationFuture; +import com.google.api.gax.longrunning.OperationFuture; import com.google.cloud.ServiceOptions; import com.google.cloud.dlp.v2beta1.DlpServiceClient; import com.google.longrunning.Operation; @@ -102,7 +102,7 @@ private static void calculateNumericalStats( .build(); // asynchronously submit a risk analysis operation - OperationFuture + OperationFuture responseFuture = dlpServiceClient.analyzeDataSourceRiskAsync(request); // ... @@ -180,7 +180,7 @@ private static void calculateCategoricalStats( .build(); // asynchronously submit a risk analysis operation - OperationFuture + OperationFuture responseFuture = dlpServiceClient.analyzeDataSourceRiskAsync(request); // ... @@ -259,7 +259,7 @@ private static void calculateKAnonymity( .build(); // asynchronously submit a risk analysis operation - OperationFuture + OperationFuture responseFuture = dlpServiceClient.analyzeDataSourceRiskAsync(request); // ... @@ -352,7 +352,7 @@ private static void calculateLDiversity( .build(); // asynchronously submit a risk analysis operation - OperationFuture + OperationFuture responseFuture = dlpServiceClient.analyzeDataSourceRiskAsync(request); // ... diff --git a/speech/cloud-client/src/main/java/com/example/speech/Recognize.java b/speech/cloud-client/src/main/java/com/example/speech/Recognize.java index ef9e5b483a8..27ef28dacb5 100644 --- a/speech/cloud-client/src/main/java/com/example/speech/Recognize.java +++ b/speech/cloud-client/src/main/java/com/example/speech/Recognize.java @@ -18,7 +18,7 @@ import com.google.api.gax.rpc.ApiStreamObserver; import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.OperationFuture; +import com.google.api.gax.longrunning.OperationFuture; import com.google.cloud.speech.v1.LongRunningRecognizeMetadata; import com.google.cloud.speech.v1.LongRunningRecognizeResponse; import com.google.cloud.speech.v1.RecognitionAudio; @@ -34,7 +34,6 @@ import com.google.cloud.speech.v1.StreamingRecognizeResponse; import com.google.cloud.speech.v1.WordInfo; import com.google.common.util.concurrent.SettableFuture; -import com.google.longrunning.Operation; import com.google.protobuf.ByteString; import java.io.IOException; import java.nio.file.Files; @@ -221,8 +220,7 @@ public static void asyncRecognizeFile(String fileName) throws Exception, IOExcep .build(); // Use non-blocking call for getting file transcription - OperationFuture response = + OperationFuture response = speech.longRunningRecognizeAsync(config, audio); while (!response.isDone()) { @@ -263,8 +261,7 @@ public static void asyncRecognizeWords(String gcsUri) throws Exception, IOExcept .build(); // Use non-blocking call for getting file transcription - OperationFuture response = + OperationFuture response = speech.longRunningRecognizeAsync(config, audio); while (!response.isDone()) { System.out.println("Waiting for response..."); @@ -311,8 +308,7 @@ public static void asyncRecognizeGcs(String gcsUri) throws Exception, IOExceptio .build(); // Use non-blocking call for getting file transcription - OperationFuture response = + OperationFuture response = speech.longRunningRecognizeAsync(config, audio); while (!response.isDone()) { System.out.println("Waiting for response..."); diff --git a/video/cloud-client/src/main/java/com/example/video/Detect.java b/video/cloud-client/src/main/java/com/example/video/Detect.java index 09fd5f879e3..23043145a91 100644 --- a/video/cloud-client/src/main/java/com/example/video/Detect.java +++ b/video/cloud-client/src/main/java/com/example/video/Detect.java @@ -16,7 +16,7 @@ package com.example.video; -import com.google.api.gax.rpc.OperationFuture; +import com.google.api.gax.longrunning.OperationFuture; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoProgress; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse; @@ -113,7 +113,7 @@ public static void analyzeFaces(String gcsUri) throws Exception { .build(); // asynchronously perform facial analysis on videos - OperationFuture response + OperationFuture response = client.annotateVideoAsync(request); boolean faceFound = false; @@ -174,7 +174,7 @@ public static void analyzeLabels(String gcsUri) throws Exception { .addFeatures(Feature.LABEL_DETECTION) .build(); // Create an operation that will contain the response when the operation completes. - OperationFuture operation = + OperationFuture operation = client.annotateVideoAsync(request); System.out.println("Waiting for operation to complete..."); @@ -261,7 +261,7 @@ public static void analyzeLabelsFile(String filePath) throws Exception { .build(); // Create an operation that will contain the response when the operation completes. - OperationFuture operation = + OperationFuture operation = client.annotateVideoAsync(request); System.out.println("Waiting for operation to complete..."); @@ -344,7 +344,7 @@ public static void analyzeShots(String gcsUri) throws Exception { .build(); // Create an operation that will contain the response when the operation completes. - OperationFuture operation = + OperationFuture operation = client.annotateVideoAsync(request); System.out.println("Waiting for operation to complete..."); @@ -382,7 +382,7 @@ public static void analyzeExplicitContent(String gcsUri) throws Exception { .addFeatures(Feature.EXPLICIT_CONTENT_DETECTION) .build(); - OperationFuture operation = + OperationFuture operation = client.annotateVideoAsync(request); System.out.println("Waiting for operation to complete..."); diff --git a/video/cloud-client/src/main/java/com/example/video/QuickstartSample.java b/video/cloud-client/src/main/java/com/example/video/QuickstartSample.java index b6f8c8cee75..ca5a51f4809 100644 --- a/video/cloud-client/src/main/java/com/example/video/QuickstartSample.java +++ b/video/cloud-client/src/main/java/com/example/video/QuickstartSample.java @@ -18,7 +18,7 @@ // [START videointelligence_quickstart] -import com.google.api.gax.rpc.OperationFuture; +import com.google.api.gax.longrunning.OperationFuture; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoProgress; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest; import com.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse;