Return-Path: X-Original-To: apmail-beam-commits-archive@minotaur.apache.org Delivered-To: apmail-beam-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A647419C56 for ; Thu, 7 Apr 2016 18:21:17 +0000 (UTC) Received: (qmail 94644 invoked by uid 500); 7 Apr 2016 18:21:17 -0000 Delivered-To: apmail-beam-commits-archive@beam.apache.org Received: (qmail 94592 invoked by uid 500); 7 Apr 2016 18:21:17 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 94572 invoked by uid 99); 7 Apr 2016 18:21:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 18:21:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C3817180551 for ; Thu, 7 Apr 2016 18:21:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id sa3OqETnsqCD for ; Thu, 7 Apr 2016 18:21:14 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id BB89E5FB46 for ; Thu, 7 Apr 2016 18:21:12 +0000 (UTC) Received: (qmail 93832 invoked by uid 99); 7 Apr 2016 18:21:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 18:21:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E0193E97F4; Thu, 7 Apr 2016 18:21:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lcwik@apache.org To: commits@beam.incubator.apache.org Date: Thu, 07 Apr 2016 18:21:19 -0000 Message-Id: <809ef76cae2d47759d5ce682e98fa323@git.apache.org> In-Reply-To: <2c54fae1788246bba4854eea2756300d@git.apache.org> References: <2c54fae1788246bba4854eea2756300d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [09/12] incubator-beam git commit: [BEAM-151] Migrate options relevant to pubsub to its own options interface [BEAM-151] Migrate options relevant to pubsub to its own options interface This prevents moving DataflowPipelineOptions to the Dataflow runner maven module. Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/c8cb55af Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/c8cb55af Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/c8cb55af Branch: refs/heads/master Commit: c8cb55af49832f39788e1936a9576760fd720eb1 Parents: a502baa Author: Luke Cwik Authored: Mon Mar 28 10:02:01 2016 -0700 Committer: Luke Cwik Committed: Thu Apr 7 11:19:49 2016 -0700 ---------------------------------------------------------------------- .../google/cloud/dataflow/sdk/io/PubsubIO.java | 6 ++-- .../options/DataflowPipelineDebugOptions.java | 8 ----- .../sdk/options/DataflowPipelineOptions.java | 2 +- .../dataflow/sdk/options/PubsubOptions.java | 35 ++++++++++++++++++++ .../cloud/dataflow/sdk/util/Transport.java | 3 +- 5 files changed, 41 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c8cb55af/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/io/PubsubIO.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/io/PubsubIO.java b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/io/PubsubIO.java index b7f2afe..68615c5 100644 --- a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/io/PubsubIO.java +++ b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/io/PubsubIO.java @@ -33,7 +33,7 @@ import com.google.api.services.pubsub.model.Subscription; import com.google.cloud.dataflow.sdk.coders.Coder; import com.google.cloud.dataflow.sdk.coders.StringUtf8Coder; import com.google.cloud.dataflow.sdk.coders.VoidCoder; -import com.google.cloud.dataflow.sdk.options.DataflowPipelineOptions; +import com.google.cloud.dataflow.sdk.options.PubsubOptions; import com.google.cloud.dataflow.sdk.runners.DataflowPipelineRunner; import com.google.cloud.dataflow.sdk.runners.DirectPipelineRunner; import com.google.cloud.dataflow.sdk.runners.PipelineRunner; @@ -728,7 +728,7 @@ public class PubsubIO { @Override public void processElement(ProcessContext c) throws IOException { Pubsub pubsubClient = - Transport.newPubsubClient(c.getPipelineOptions().as(DataflowPipelineOptions.class)) + Transport.newPubsubClient(c.getPipelineOptions().as(PubsubOptions.class)) .build(); String subscription; @@ -1004,7 +1004,7 @@ public class PubsubIO { public void startBundle(Context c) { this.output = new ArrayList<>(); this.pubsubClient = - Transport.newPubsubClient(c.getPipelineOptions().as(DataflowPipelineOptions.class)) + Transport.newPubsubClient(c.getPipelineOptions().as(PubsubOptions.class)) .build(); } http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c8cb55af/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineDebugOptions.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineDebugOptions.java b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineDebugOptions.java index d4f6385..b55fa17 100644 --- a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineDebugOptions.java +++ b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineDebugOptions.java @@ -164,14 +164,6 @@ public interface DataflowPipelineDebugOptions extends PipelineOptions { } /** - * Root URL for use with the Pubsub API. - */ - @Description("Root URL for use with the Pubsub API") - @Default.String("https://pubsub.googleapis.com") - String getPubsubRootUrl(); - void setPubsubRootUrl(String value); - - /** * Whether to update the currently running pipeline with the same name as this one. * * @deprecated This property is replaced by {@link DataflowPipelineOptions#getUpdate()} http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c8cb55af/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineOptions.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineOptions.java b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineOptions.java index 23ca0e7..dbfafd1 100644 --- a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineOptions.java +++ b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/DataflowPipelineOptions.java @@ -33,7 +33,7 @@ public interface DataflowPipelineOptions extends PipelineOptions, GcpOptions, ApplicationNameOptions, DataflowPipelineDebugOptions, DataflowPipelineWorkerPoolOptions, BigQueryOptions, GcsOptions, StreamingOptions, CloudDebuggerOptions, DataflowWorkerLoggingOptions, - DataflowProfilingOptions { + DataflowProfilingOptions, PubsubOptions { @Description("Project id. Required when running a Dataflow in the cloud. " + "See https://cloud.google.com/storage/docs/projects for further details.") http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c8cb55af/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/PubsubOptions.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/PubsubOptions.java b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/PubsubOptions.java new file mode 100644 index 0000000..51cf62c --- /dev/null +++ b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/options/PubsubOptions.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.cloud.dataflow.sdk.options; + +/** + * Properties that can be set when using Pubsub with the Dataflow SDK. + */ +@Description("Options that are used to configure BigQuery. See " + + "https://cloud.google.com/bigquery/what-is-bigquery for details on BigQuery.") +public interface PubsubOptions extends ApplicationNameOptions, GcpOptions, + PipelineOptions, StreamingOptions { + + /** + * Root URL for use with the Pubsub API. + */ + @Description("Root URL for use with the Pubsub API") + @Default.String("https://pubsub.googleapis.com") + @Hidden + String getPubsubRootUrl(); + void setPubsubRootUrl(String value); +} http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/c8cb55af/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/Transport.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/Transport.java b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/Transport.java index 27f61fa..187d164 100644 --- a/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/Transport.java +++ b/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/Transport.java @@ -32,6 +32,7 @@ import com.google.cloud.dataflow.sdk.options.BigQueryOptions; import com.google.cloud.dataflow.sdk.options.DataflowPipelineDebugOptions; import com.google.cloud.dataflow.sdk.options.DataflowPipelineOptions; import com.google.cloud.dataflow.sdk.options.GcsOptions; +import com.google.cloud.dataflow.sdk.options.PubsubOptions; import com.google.cloud.hadoop.util.ChainingHttpRequestInitializer; import com.google.common.collect.ImmutableList; @@ -115,7 +116,7 @@ public class Transport { * {@link DataflowPipelineDebugOptions#getApiRootUrl()} option. */ public static Pubsub.Builder - newPubsubClient(DataflowPipelineOptions options) { + newPubsubClient(PubsubOptions options) { return new Pubsub.Builder(getTransport(), getJsonFactory(), chainHttpRequestInitializer( options.getGcpCredential(),