diff --git a/speech/grpc/pom.xml b/speech/grpc/pom.xml index cdb241b940c..d0fa0ada6c6 100644 --- a/speech/grpc/pom.xml +++ b/speech/grpc/pom.xml @@ -49,7 +49,8 @@ limitations under the License. UTF-8 2.2 - 3.1 + 1.0.0 + 3.5.1 0.5.0 @@ -126,6 +127,11 @@ limitations under the License. commons-cli 1.3.1 + + com.google.auth + google-auth-library-credentials + 0.4.0 + com.google.auth google-auth-library-oauth2-http @@ -144,31 +150,46 @@ limitations under the License. guava 19.0 + + com.google.truth + truth + 0.29 + test + + + io.grpc + grpc-auth + 1.0.0 + io.grpc - grpc-all - 0.15.0 + grpc-netty + 1.0.0 + + + io.grpc + grpc-protobuf + ${grpc-protobuf-version} + + + io.grpc + grpc-stub + 1.0.0 +- It is recommended to use OpenSSL: Statically Linked Netty +- for transport security. These steps do not use the TLS that +- comes with JDK (Jetty APLN/NPN), which is not +- recommended. See +- https://github.com/grpc/grpc-java/blob/master/SECURITY.md +- for details. +- --> io.netty netty-tcnative-boringssl-static - 1.1.33.Fork20 + 1.1.33.Fork21 ${tcnative.classifier} - - com.google.truth - truth - 0.29 - test - log4j log4j @@ -216,10 +237,10 @@ limitations under the License. transitively depending on the protobuf-java version that grpc depends on. --> - com.google.protobuf:protoc:3.0.0-beta-2:exe:${os.detected.classifier} + com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier} grpc-java ${basedir}/src/main/java/third_party - io.grpc:protoc-gen-grpc-java:0.13.2:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:${grpc-protobuf-version}:exe:${os.detected.classifier} diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java index 7b74cd96d4f..2b29e68157b 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/AsyncRecognizeClient.java @@ -35,7 +35,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; @@ -166,29 +166,33 @@ public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption( - OptionBuilder.withLongOpt("uri") - .withDescription("path to audio uri") + Option.builder() + .longOpt("uri") + .desc("path to audio uri") .hasArg() - .withArgName("FILE_PATH") - .create()); + .argName("FILE_PATH") + .build()); options.addOption( - OptionBuilder.withLongOpt("host") - .withDescription("endpoint for api, e.g. speech.googleapis.com") + Option.builder() + .longOpt("host") + .desc("endpoint for api, e.g. speech.googleapis.com") .hasArg() - .withArgName("ENDPOINT") - .create()); + .argName("ENDPOINT") + .build()); options.addOption( - OptionBuilder.withLongOpt("port") - .withDescription("SSL port, usually 443") + Option.builder() + .longOpt("port") + .desc("SSL port, usually 443") .hasArg() - .withArgName("PORT") - .create()); + .argName("PORT") + .build()); options.addOption( - OptionBuilder.withLongOpt("sampling") - .withDescription("Sampling Rate, i.e. 16000") + Option.builder() + .longOpt("sampling") + .desc("Sampling Rate, i.e. 16000") .hasArg() - .withArgName("RATE") - .create()); + .argName("RATE") + .build()); try { CommandLine line = parser.parse(options, args); diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/StreamingRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/StreamingRecognizeClient.java index a302f2415c4..a7da0e81f1e 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/StreamingRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/StreamingRecognizeClient.java @@ -33,7 +33,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.log4j.ConsoleAppender; @@ -180,29 +180,33 @@ public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption( - OptionBuilder.withLongOpt("file") - .withDescription("path to audio file") + Option.builder() + .longOpt("file") + .desc("path to audio file") .hasArg() - .withArgName("FILE_PATH") - .create()); + .argName("FILE_PATH") + .build()); options.addOption( - OptionBuilder.withLongOpt("host") - .withDescription("endpoint for api, e.g. speech.googleapis.com") + Option.builder() + .longOpt("host") + .desc("endpoint for api, e.g. speech.googleapis.com") .hasArg() - .withArgName("ENDPOINT") - .create()); + .argName("ENDPOINT") + .build()); options.addOption( - OptionBuilder.withLongOpt("port") - .withDescription("SSL port, usually 443") + Option.builder() + .longOpt("port") + .desc("SSL port, usually 443") .hasArg() - .withArgName("PORT") - .create()); + .argName("PORT") + .build()); options.addOption( - OptionBuilder.withLongOpt("sampling") - .withDescription("Sampling Rate, i.e. 16000") + Option.builder() + .longOpt("sampling") + .desc("Sampling Rate, i.e. 16000") .hasArg() - .withArgName("RATE") - .create()); + .argName("RATE") + .build()); try { CommandLine line = parser.parse(options, args); diff --git a/speech/grpc/src/main/java/com/examples/cloud/speech/SyncRecognizeClient.java b/speech/grpc/src/main/java/com/examples/cloud/speech/SyncRecognizeClient.java index 88d634a8f65..cf6208774da 100644 --- a/speech/grpc/src/main/java/com/examples/cloud/speech/SyncRecognizeClient.java +++ b/speech/grpc/src/main/java/com/examples/cloud/speech/SyncRecognizeClient.java @@ -30,7 +30,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; @@ -117,29 +117,33 @@ public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption( - OptionBuilder.withLongOpt("uri") - .withDescription("path to audio uri") + Option.builder() + .longOpt("uri") + .desc("path to audio uri") .hasArg() - .withArgName("FILE_PATH") - .create()); + .argName("FILE_PATH") + .build()); options.addOption( - OptionBuilder.withLongOpt("host") - .withDescription("endpoint for api, e.g. speech.googleapis.com") + Option.builder() + .longOpt("host") + .desc("endpoint for api, e.g. speech.googleapis.com") .hasArg() - .withArgName("ENDPOINT") - .create()); + .argName("ENDPOINT") + .build()); options.addOption( - OptionBuilder.withLongOpt("port") - .withDescription("SSL port, usually 443") + Option.builder() + .longOpt("port") + .desc("SSL port, usually 443") .hasArg() - .withArgName("PORT") - .create()); + .argName("PORT") + .build()); options.addOption( - OptionBuilder.withLongOpt("sampling") - .withDescription("Sampling Rate, i.e. 16000") + Option.builder() + .longOpt("sampling") + .desc("Sampling Rate, i.e. 16000") .hasArg() - .withArgName("RATE") - .create()); + .argName("RATE") + .build()); try { CommandLine line = parser.parse(options, args);