| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,14 +20,22 @@ This client supports the following Google Cloud Platform services: | |||
| 20 | 20 | ||
| 21 | 21 | Quickstart | |
| 22 | 22 | ---------- | |
| 23 | - Add this to your pom.xml file | ||
| 23 | + If you are using Maven, add this to your pom.xml file | ||
| 24 | 24 | ```xml | |
| 25 | 25 | <dependency> | |
| 26 | 26 | <groupId>com.google.gcloud</groupId> | |
| 27 | 27 | <artifactId>gcloud-java</artifactId> | |
| 28 | 28 | <version>0.0.10</version> | |
| 29 | 29 | </dependency> | |
| 30 | 30 | ``` | |
| 31 | + If you are using Gradle, add this to your dependencies | ||
| 32 | + ```Groovy | ||
| 33 | + compile 'com.google.gcloud:gcloud-java:jar:0.0.10' | ||
| 34 | + ``` | ||
| 35 | + If you are using SBT, add this to your dependencies | ||
| 36 | + ```Scala | ||
| 37 | + libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.0.10" | ||
| 38 | + ``` | ||
| 31 | 39 | ||
| 32 | 40 | Example Applications | |
| 33 | 41 | -------------------- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,86 @@ | |||
| 1 | + Google Cloud Java Client for BigQuery | ||
| 2 | + ==================================== | ||
| 3 | + | ||
| 4 | + Java idiomatic client for [Google Cloud BigQuery] (https://cloud.google.com/bigquery). | ||
| 5 | + | ||
| 6 | + [](https://travis-ci.org/GoogleCloudPlatform/gcloud-java) | ||
| 7 | + [](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master) | ||
| 8 | + <!-- TODO(mziccard): add in the maven shield once the artifact is pushed to maven --> | ||
| 9 | + | ||
| 10 | + - [Homepage] (https://googlecloudplatform.github.io/gcloud-java/) | ||
| 11 | + +<!-- TODO(mziccard): add link to API documentatin --> | ||
| 12 | + | ||
| 13 | + > Note: This client is a work-in-progress, and may occasionally | ||
| 14 | + > make backwards-incompatible changes. | ||
| 15 | + | ||
| 16 | + Quickstart | ||
| 17 | + ---------- | ||
| 18 | + Add this to your pom.xml file | ||
| 19 | + <!-- TODO(mziccard): add dependency code --> | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + Example Application | ||
| 23 | + ------------------- | ||
| 24 | + | ||
| 25 | + <!-- TODO(mziccard): add example application --> | ||
| 26 | + | ||
| 27 | + Authentication | ||
| 28 | + -------------- | ||
| 29 | + | ||
| 30 | + See the [Authentication](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) section in the base directory's README. | ||
| 31 | + | ||
| 32 | + About Google Cloud BigQuery | ||
| 33 | + -------------------------- | ||
| 34 | + | ||
| 35 | + [Google Cloud BigQuery][cloud-bigquery] is a fully managed, NoOps, low cost data analytics service. | ||
| 36 | + Data can be streamed into BigQuery at millions of rows per second to enable real-time analysis. | ||
| 37 | + With BigQuery you can easily deploy Petabyte-scale Databases. | ||
| 38 | + | ||
| 39 | + Be sure to activate the Google Cloud BigQuery API on the Developer's Console to use BigQuery from your project. | ||
| 40 | + | ||
| 41 | + See the ``gcloud-java`` API [bigquery documentation][bigquery-api] to learn how to interact | ||
| 42 | + with Google Cloud BigQuery using this Client Library. | ||
| 43 | + | ||
| 44 | + Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) and a project ID if running this snippet elsewhere. | ||
| 45 | + | ||
| 46 | + <!-- TODO(mziccard): add code snippet --> | ||
| 47 | + | ||
| 48 | + Java Versions | ||
| 49 | + ------------- | ||
| 50 | + | ||
| 51 | + Java 7 or above is required for using this client. | ||
| 52 | + | ||
| 53 | + Testing | ||
| 54 | + ------- | ||
| 55 | + | ||
| 56 | + <!-- TODO(mziccard): add this in once the RemoteGCBQMHelper class is functional --> | ||
| 57 | + | ||
| 58 | + Versioning | ||
| 59 | + ---------- | ||
| 60 | + | ||
| 61 | + This library follows [Semantic Versioning] (http://semver.org/). | ||
| 62 | + | ||
| 63 | + It is currently in major version zero (``0.y.z``), which means that anything | ||
| 64 | + may change at any time and the public API should not be considered | ||
| 65 | + stable. | ||
| 66 | + | ||
| 67 | + Contributing | ||
| 68 | + ------------ | ||
| 69 | + | ||
| 70 | + Contributions to this library are always welcome and highly encouraged. | ||
| 71 | + | ||
| 72 | + See [CONTRIBUTING] for more information on how to get started. | ||
| 73 | + | ||
| 74 | + License | ||
| 75 | + ------- | ||
| 76 | + | ||
| 77 | + Apache 2.0 - See [LICENSE] for more information. | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + [CONTRIBUTING]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md | ||
| 81 | + [LICENSE]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/LICENSE | ||
| 82 | + [TESTING]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/TESTING.md#testing-code-that-uses-bigquery | ||
| 83 | + [cloud-platform]: https://cloud.google.com/ | ||
| 84 | + | ||
| 85 | + [cloud-bigquery]: https://cloud.google.com/bigquery/ | ||
| 86 | + [bigquery-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/bigquery/package-summary.html | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,50 @@ | |||
| 1 | + <?xml version="1.0"?> | ||
| 2 | + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 3 | + <modelVersion>4.0.0</modelVersion> | ||
| 4 | + <groupId>com.google.gcloud</groupId> | ||
| 5 | + <artifactId>gcloud-java-bigquery</artifactId> | ||
| 6 | + <packaging>jar</packaging> | ||
| 7 | + <name>GCloud Java bigquery</name> | ||
| 8 | + <description> | ||
| 9 | + Java idiomatic client for Google Cloud BigQuery. | ||
| 10 | + </description> | ||
| 11 | + <parent> | ||
| 12 | + <groupId>com.google.gcloud</groupId> | ||
| 13 | + <artifactId>gcloud-java-pom</artifactId> | ||
| 14 | + <version>0.0.11-SNAPSHOT</version> | ||
| 15 | + </parent> | ||
| 16 | + <properties> | ||
| 17 | + <site.installationModule>gcloud-java-bigquery</site.installationModule> | ||
| 18 | + </properties> | ||
| 19 | + <dependencies> | ||
| 20 | + <dependency> | ||
| 21 | + <groupId>${project.groupId}</groupId> | ||
| 22 | + <artifactId>gcloud-java-core</artifactId> | ||
| 23 | + <version>${project.version}</version> | ||
| 24 | + </dependency> | ||
| 25 | + <dependency> | ||
| 26 | + <groupId>com.google.apis</groupId> | ||
| 27 | + <artifactId>google-api-services-bigquery</artifactId> | ||
| 28 | + <version>v2-rev244-1.20.0</version> | ||
| 29 | + <scope>compile</scope> | ||
| 30 | + <exclusions> | ||
| 31 | + <exclusion> | ||
| 32 | + <groupId>com.google.guava</groupId> | ||
| 33 | + <artifactId>guava-jdk5</artifactId> | ||
| 34 | + </exclusion> | ||
| 35 | + </exclusions> | ||
| 36 | + </dependency> | ||
| 37 | + <dependency> | ||
| 38 | + <groupId>junit</groupId> | ||
| 39 | + <artifactId>junit</artifactId> | ||
| 40 | + <version>4.12</version> | ||
| 41 | + <scope>test</scope> | ||
| 42 | + </dependency> | ||
| 43 | + <dependency> | ||
| 44 | + <groupId>org.easymock</groupId> | ||
| 45 | + <artifactId>easymock</artifactId> | ||
| 46 | + <version>3.3</version> | ||
| 47 | + <scope>test</scope> | ||
| 48 | + </dependency> | ||
| 49 | + </dependencies> | ||
| 50 | + </project> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + /* | ||
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + package com.google.gcloud.bigquery; | ||
| 18 | + | ||
| 19 | + import com.google.gcloud.Service; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * An interface for Google Cloud BigQuery. | ||
| 23 | + * | ||
| 24 | + * @see <a href="https://cloud.google.com/bigquery/what-is-bigquery">Google Cloud BigQuery</a> | ||
| 25 | + */ | ||
| 26 | + public interface BigQuery extends Service<BigQueryOptions> { | ||
| 27 | + | ||
| 28 | + // TODO(mziccard) add missing methods | ||
| 29 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,54 @@ | |||
| 1 | + /* | ||
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + package com.google.gcloud.bigquery; | ||
| 18 | + | ||
| 19 | + import com.google.gcloud.BaseServiceException; | ||
| 20 | + import com.google.gcloud.RetryHelper.RetryHelperException; | ||
| 21 | + import com.google.gcloud.RetryHelper.RetryInterruptedException; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * BigQuery service exception. | ||
| 25 | + * | ||
| 26 | + * @see <a href="https://cloud.google.com/bigquery/troubleshooting-errors">Google Cloud | ||
| 27 | + * BigQuery error codes</a> | ||
| 28 | + */ | ||
| 29 | + public class BigQueryException extends BaseServiceException { | ||
| 30 | + | ||
| 31 | + private static final long serialVersionUID = -5504832700512784654L; | ||
| 32 | + public static final int UNKNOWN_CODE = -1; | ||
| 33 | + | ||
| 34 | + public BigQueryException(int code, String message, boolean retryable) { | ||
| 35 | + super(code, message, retryable); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Translate RetryHelperException to the BigQueryException that caused the error. This method will | ||
| 40 | + * always throw an exception. | ||
| 41 | + * | ||
| 42 | + * @throws BigQueryException when {@code ex} was caused by a {@code BigQueryException} | ||
| 43 | + * @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException} | ||
| 44 | + */ | ||
| 45 | + static BigQueryException translateAndThrow(RetryHelperException ex) { | ||
| 46 | + if (ex.getCause() instanceof BigQueryException) { | ||
| 47 | + throw (BigQueryException) ex.getCause(); | ||
| 48 | + } | ||
| 49 | + if (ex instanceof RetryInterruptedException) { | ||
| 50 | + RetryInterruptedException.propagate(); | ||
| 51 | + } | ||
| 52 | + throw new BigQueryException(UNKNOWN_CODE, ex.getMessage(), false); | ||
| 53 | + } | ||
| 54 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + /* | ||
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + package com.google.gcloud.bigquery; | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + import com.google.gcloud.ServiceFactory; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * An interface for BigQuery factories. | ||
| 24 | + */ | ||
| 25 | + public interface BigQueryFactory extends ServiceFactory<BigQuery, BigQueryOptions> { | ||
| 26 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,112 @@ | |||
| 1 | + /* | ||
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + package com.google.gcloud.bigquery; | ||
| 18 | + | ||
| 19 | + import com.google.common.collect.ImmutableSet; | ||
| 20 | + import com.google.gcloud.ServiceOptions; | ||
| 21 | + import com.google.gcloud.spi.DefaultBigQueryRpc; | ||
| 22 | + import com.google.gcloud.spi.BigQueryRpc; | ||
| 23 | + import com.google.gcloud.spi.BigQueryRpcFactory; | ||
| 24 | + | ||
| 25 | + import java.util.Set; | ||
| 26 | + | ||
| 27 | + public class BigQueryOptions extends ServiceOptions<BigQuery, BigQueryRpc, BigQueryOptions> { | ||
| 28 | + | ||
| 29 | + private static final String BIGQUERY_SCOPE = "https://www.googleapis.com/auth/bigquery"; | ||
| 30 | + private static final Set<String> SCOPES = ImmutableSet.of(BIGQUERY_SCOPE); | ||
| 31 | + private static final long serialVersionUID = -215981591481708043L; | ||
| 32 | + | ||
| 33 | + public static class DefaultBigqueryFactory implements BigQueryFactory { | ||
| 34 | + | ||
| 35 | + private static final BigQueryFactory INSTANCE = new DefaultBigqueryFactory(); | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public BigQuery create(BigQueryOptions options) { | ||
| 39 | + // TODO(mziccard) return new BigqueryImpl(options); | ||
| 40 | + return null; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public static class DefaultBigQueryRpcFactory implements BigQueryRpcFactory { | ||
| 45 | + | ||
| 46 | + private static final BigQueryRpcFactory INSTANCE = new DefaultBigQueryRpcFactory(); | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public BigQueryRpc create(BigQueryOptions options) { | ||
| 50 | + // TODO(mziccard) return new DefaultBigqueryRpc(options); | ||
| 51 | + return null; | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public static class Builder extends | ||
| 56 | + ServiceOptions.Builder<BigQuery, BigQueryRpc, BigQueryOptions, Builder> { | ||
| 57 | + | ||
| 58 | + private Builder() { | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + private Builder(BigQueryOptions options) { | ||
| 62 | + super(options); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public BigQueryOptions build() { | ||
| 67 | + return new BigQueryOptions(this); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + private BigQueryOptions(Builder builder) { | ||
| 72 | + super(BigQueryFactory.class, BigQueryRpcFactory.class, builder); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + protected BigQueryFactory defaultServiceFactory() { | ||
| 77 | + return DefaultBigqueryFactory.INSTANCE; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + protected BigQueryRpcFactory defaultRpcFactory() { | ||
| 82 | + return DefaultBigQueryRpcFactory.INSTANCE; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + protected Set<String> scopes() { | ||
| 87 | + return SCOPES; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public Builder toBuilder() { | ||
| 92 | + return new Builder(this); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Override | ||
| 96 | + public int hashCode() { | ||
| 97 | + return baseHashCode(); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + public boolean equals(Object obj) { | ||
| 102 | + if (!(obj instanceof BigQueryOptions)) { | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + BigQueryOptions other = (BigQueryOptions) obj; | ||
| 106 | + return baseEquals(other); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public static Builder builder() { | ||
| 110 | + return new Builder(); | ||
| 111 | + } | ||
| 112 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments