Skip to content

Pull changes from master #598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 464 commits into from
Feb 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
464 commits
Select commit Hold shift + click to select a range
231b84a
Update release notes procedure
Dec 2, 2015
abf6b06
add note about creating new draft
ajkannan Dec 2, 2015
217a356
Merge pull request #435 from ajkannan/update-releasing-docs
aozarov Dec 3, 2015
ba9059c
Fix gradle dependency in README.md
mziccard Dec 3, 2015
c920387
Merge pull request #437 from mziccard/fix-gradle-dependency
aozarov Dec 3, 2015
f84a3b1
Handle unset of Field's mode and description
mziccard Dec 3, 2015
bd58ee5
Make FormatOptions.csv return CsvOptions, remove getters from Externa…
mziccard Dec 3, 2015
66972df
Add TableType hierarcy to wrap different types of tables
mziccard Dec 3, 2015
ae2a484
Remove TableType, add TableInfo, ViewInfo ExternalTableInfo hierarcy
mziccard Dec 4, 2015
338ede1
Fix mode's nullability by internally storing a string
mziccard Dec 4, 2015
9df4005
Make BaseTableInfo abstract and other minor fixes
mziccard Dec 4, 2015
12185e8
Merge pull request #423 from mziccard/bigquery
aozarov Dec 4, 2015
722e4a7
Add JobInfo hierarcy and related classes
mziccard Dec 9, 2015
a88e0da
Merge pull request #442 from mziccard/bigquery
mziccard Dec 9, 2015
c36b857
fix checkstyle issues and warnings
Dec 10, 2015
27f4d0d
Add InsertAllRequest and InsertAllResponse. Add model classes for tab…
mziccard Dec 9, 2015
d0eec71
Add generic type to ServiceOption definition + minor fixes
Dec 10, 2015
21d985c
Merge pull request #446 from ajkannan/fix-checkstyle-errors
aozarov Dec 10, 2015
1674c9c
Document ClassCastException in FieldValue
mziccard Dec 10, 2015
f22e41f
Specify HTTP Transport in DefaultDatastoreRpc
Dec 11, 2015
e86259d
Merge pull request #448 from ajkannan/specify-transport
aozarov Dec 11, 2015
d2f0a82
Minor changes to FieldValue and InsertAllRequest
mziccard Dec 11, 2015
50d381f
Remove TableRow class
mziccard Dec 11, 2015
aacc383
Fix javadoc error, add checkNotNull to FieldValue getters
mziccard Dec 11, 2015
7dfca8e
Merge pull request #443 from mziccard/bigquery
aozarov Dec 11, 2015
20d4841
Add query request and query response classes and tests
mziccard Dec 11, 2015
9756dff
Refactor QueryRequest and QueryResponse
mziccard Dec 14, 2015
e16c027
Add QueryResult class and tests
mziccard Dec 14, 2015
c6e53c8
Rename QueryResponse.job to jobId, better javadoc, no errors as empty…
mziccard Dec 14, 2015
36c7406
Merge pull request #452 from mziccard/bigquery
aozarov Dec 14, 2015
3b70b20
Refactor BigQueryRpc and DefaultBigQueryRpc
mziccard Dec 14, 2015
0f765b7
Merge pull request #453 from mziccard/bigquery
aozarov Dec 14, 2015
e1dc3af
Add BigQuery service implementation
mziccard Dec 15, 2015
d676636
Fix minor errors
mziccard Dec 16, 2015
814264a
Merge pull request #454 from mziccard/bigquery
ajkannan Dec 17, 2015
e91f47b
Make checkstyle happy, fix minor issues, add better javadoc
mziccard Dec 17, 2015
f569bdd
Move StreamingBuffer to TableInfo, remove streamingBuffer from Extern…
mziccard Dec 17, 2015
433c286
Merge pull request #482 from mziccard/bigquery
ajkannan Dec 17, 2015
2271ab9
Merge branch 'master' into bigquery
mziccard Dec 18, 2015
a08e7bb
Change poms and code to match with master udpates
mziccard Dec 18, 2015
ec115cb
Merge pull request #488 from mziccard/bigquery
aozarov Dec 18, 2015
6bc4f2c
Add integration test
mziccard Dec 18, 2015
e46ce4f
Add BigQuery module to main pom
mziccard Dec 18, 2015
ba8acf1
Few minor fixes and make java8 happy
mziccard Dec 18, 2015
7eee528
Minor fixes to RemoteBigQueryHelper
mziccard Dec 21, 2015
4899c27
Create packages for resource manager and outline spi layer.
Nov 2, 2015
3687cb1
Fixes to the ResourceManagerRpc layer, and also add resource manager …
Nov 3, 2015
3892eed
minor changes to ResourceManagerRpc
Nov 3, 2015
a60f7d1
Style updates to ResourceManagerRpc
Nov 3, 2015
c69af1a
add return values to delete, undelete, and setIamPolicy
Nov 3, 2015
249fae8
Remove spi result enums, change 'update/set' terminology to 'replace'
Nov 4, 2015
65a6240
Project, ProjectInfo, Policy, and ResourceId classes added.
Nov 12, 2015
9d6fbff
Fix style, simplify equals methods, fix tests, and add Project javadocs
Nov 17, 2015
e625c20
Add documentation and make resource ID type string
Nov 20, 2015
ebcac0b
Remove Policy and add docs
Nov 24, 2015
d800d1f
Added docs, removed policy-related methods from spi layer, fixed list…
Nov 25, 2015
a770e12
Remove parent and resource ID, add fields options
Nov 25, 2015
24edea2
Add exception handling, add back resource ID, and other cleanup
Nov 27, 2015
940aa92
Add list/get options serialization tests + other small fixes
Nov 30, 2015
57de95a
Add page size and page token options
Nov 30, 2015
e9359a0
fix paging docs
Nov 30, 2015
e6954ae
sync pom version to parent project
Nov 30, 2015
a50d770
Default spi layer implementation
Nov 30, 2015
918ab7b
Fix typo and remove non-retryable error code
Dec 1, 2015
3de4f8f
Initial commit of LocalResourceManagerHelper and tests
Dec 6, 2015
978fe27
Add filtering, make projects map a ConcurrentHashMap, and fix style i…
Dec 8, 2015
a670d21
Make error messages more informative, propagate all server exceptions…
Dec 10, 2015
19aa650
remove checkNotNull calls and minor fixes
Dec 10, 2015
4fdd477
minor fixes
Dec 11, 2015
937fe22
minor fix
Dec 11, 2015
ddf447f
ResourceManagerImpl + docs
Dec 2, 2015
8c12d67
Fix docs and return null if project not found by get.
Dec 16, 2015
a3bbbd2
Minor fixes
Dec 17, 2015
37b5efd
Adding ResourceManagerExample, update docs
Dec 17, 2015
b6bbf67
Include delete action + minor edits
Dec 18, 2015
1e7e152
Add retryable exceptions and fix checkstyle complaints
Dec 18, 2015
0eada88
minor fixes
Dec 18, 2015
ccbf4f4
more checkstyle fixes
Dec 19, 2015
bac6a07
minor fixes
Dec 19, 2015
b5d4bca
Update pom version in resource manager, remove noCredentials from Ser…
Dec 21, 2015
3781aa7
Merge pull request #492 from mziccard/bigquery
aozarov Dec 21, 2015
6c5a642
Minor fixes to Storage
mziccard Dec 21, 2015
b504340
Make checkstyle happy
mziccard Dec 21, 2015
637f156
Merge pull request #495 from ajkannan/merge-service
aozarov Dec 21, 2015
604b1c4
More style fixes to Storage module
mziccard Dec 21, 2015
bf6a3fe
Add BigQuery module README
mziccard Dec 21, 2015
5b1c443
Merge pull request #494 from mziccard/storage-minor
aozarov Dec 21, 2015
12a10b5
Synchronize LocalResourceManagerHelper
Dec 21, 2015
a87cd14
make protobuf methods package protected
Dec 21, 2015
62a2d71
Merge pull request #497 from ajkannan/synchronize-lrmh
ajkannan Dec 22, 2015
b2d181f
revert unnecessary changes in scope in BaseMarshaller
Dec 22, 2015
9bcebd3
Merge pull request #498 from ajkannan/hide-non-public-refs
aozarov Dec 22, 2015
6ee866a
Add troubleshooting section, fix line length, sort imports, remove un…
mziccard Dec 22, 2015
75a0ece
Merge pull request #496 from mziccard/bigquery
ajkannan Dec 22, 2015
862905f
Make BigQuery get/create/updated Table and Job methods generic
mziccard Dec 22, 2015
a0f5f1b
Merge pull request #500 from mziccard/bigquery
aozarov Dec 22, 2015
d299e06
Merge branch 'master' into bigquery
mziccard Dec 22, 2015
7b1b0dc
Add BigQuery to common README.md and TESTING.md
mziccard Dec 22, 2015
a1299c7
Merge pull request #502 from mziccard/bigquery
mziccard Dec 22, 2015
3f2799d
Merge pull request #503 from GoogleCloudPlatform/bigquery
ajkannan Dec 22, 2015
e0b0a66
Make FormatOptions.of(format) return CsvOptions if format is CSV
mziccard Dec 23, 2015
30fa22a
Minor style fixes to DatastoreExample and StorageExample
mziccard Dec 23, 2015
48acfef
Add bigquery module to gcloud-java pom
mziccard Dec 23, 2015
d5e4dba
Add BigQuery example
mziccard Dec 23, 2015
3ee27a6
Merge pull request #506 from mziccard/bigquery-example
mziccard Dec 28, 2015
d1c41f7
Update version to 0.1.1
mziccard Dec 28, 2015
e182661
Merge pull request #507 from mziccard/master
mziccard Dec 28, 2015
7a7f698
Updating version in README files. [ci skip]
Dec 28, 2015
15fb8df
Update version to 0.1.2-SNAPSHOT
mziccard Dec 28, 2015
af68f77
Merge pull request #508 from mziccard/master
mziccard Dec 28, 2015
b762fd7
Add shield, dependency code and link to BigQueryExample to bigquery R…
mziccard Dec 28, 2015
ab5ab13
Fix gradle dependency code in all gcloud-java modules
mziccard Dec 28, 2015
2530b3c
Speed up resource manager tests
Dec 28, 2015
869fed3
Merge pull request #510 from ajkannan/speed-up-tests
ajkannan Dec 28, 2015
ca0c265
Merge pull request #509 from mziccard/master
ajkannan Dec 28, 2015
329bd70
Minor fixes to READMEs and pom.xml
mziccard Dec 29, 2015
7e052da
Minor changes to gcloud-java-examples
mziccard Dec 29, 2015
f78da9d
Add checkNotNull to FormatOptions.of method
mziccard Dec 29, 2015
afe953d
Add example to BigQuery package-info
mziccard Dec 29, 2015
5e193c5
Fix indentation in Storage and ResourceManager package-info
mziccard Dec 29, 2015
acbd5c0
Add support for templateSuffix to BigQuery InsertAllRequest
mziccard Dec 29, 2015
dac9cbf
Merge pull request #513 from mziccard/bigquery-package-info
ajkannan Dec 29, 2015
45f5661
Merge pull request #514 from mziccard/bigquery-template-suffix
aozarov Dec 29, 2015
6af6db4
Add more info on BigQuery load's source file
mziccard Dec 30, 2015
823f0de
Merge pull request #512 from mziccard/fix-bigquery-example
ajkannan Dec 30, 2015
5e734ee
Add functional classes for BigQuery datasets jobs and tables
mziccard Dec 30, 2015
edfb470
Document generic types
Dec 30, 2015
42727c0
Merge pull request #501 from ajkannan/fix-non-public-javadoc-types
aozarov Dec 30, 2015
2da16c7
Add build/test documentation
Dec 30, 2015
645f381
Merge pull request #518 from ajkannan/contributing
aozarov Jan 1, 2016
16b451d
Check for null in Project.load
Jan 4, 2016
d75f1f4
Minor fixes to bigquery functional classes
mziccard Jan 4, 2016
2d1a368
Wait for table to be created in testInsertAllWithSuffix
mziccard Jan 4, 2016
2e152a3
add load null test
Jan 4, 2016
0fa9b51
Merge pull request #520 from ajkannan/check-null-load
ajkannan Jan 4, 2016
70b350c
Merge pull request #521 from mziccard/fix-template-suffix-test
ajkannan Jan 4, 2016
46f7958
Document delay in table creation when insertAll is used with template…
mziccard Jan 5, 2016
dce1231
Minor fixes to storage functional classes
mziccard Jan 4, 2016
d58930e
Add better tests for bigquery functional classes
mziccard Jan 5, 2016
4aa8a97
Add support for queryPlan to QueryStatistics
mziccard Jan 5, 2016
64114c1
Merge pull request #522 from mziccard/fix-template-suffix-test
ajkannan Jan 5, 2016
d8b1814
Merge pull request #516 from mziccard/bigquery-functional-classes
ajkannan Jan 5, 2016
65340bd
Make ResourceManagerImpl package protected
Jan 6, 2016
b8ce8d2
Merge pull request #524 from ajkannan/make-resourcemanagerimpl-packag…
aozarov Jan 6, 2016
0a59620
Add more factory methods to Load and ExtractJobInfo
mziccard Jan 6, 2016
c3e808d
Fix self reference in QueryJobInfo.Priority javadoc
mziccard Jan 6, 2016
7c0a746
Make infoIterable final in LazyBlobIterable and LazyTableIterable
mziccard Jan 6, 2016
8d37c32
Merge pull request #528 from mziccard/add-final-to-iterable
ajkannan Jan 6, 2016
5da46e8
Merge pull request #527 from mziccard/add-format-to-of
ajkannan Jan 6, 2016
13b1b0e
Minor fixes to QueryStage
mziccard Jan 6, 2016
ea21d23
Docs and code cleanup
Jan 6, 2016
b1ff62b
Merge pull request #523 from mziccard/support-query-plan
aozarov Jan 7, 2016
d03e5a7
Merge pull request #529 from ajkannan/docs-cleanup
aozarov Jan 7, 2016
0ae2be8
Add BigQueryError field to BigQueryException and tests
mziccard Jan 6, 2016
f1a5cec
Merge pull request #526 from mziccard/bigquery-error-exception
aozarov Jan 7, 2016
ce9b5c1
Refactor page fetchers
Jan 7, 2016
824c46c
Merge pull request #517 from ajkannan/basepagefetcher
aozarov Jan 8, 2016
9678371
mark bigquery and resource manager as alpha
aozarov Jan 8, 2016
1ab0ac5
Rename load to get in functional classes
mziccard Jan 8, 2016
701abb6
Fix failing test by removing check
mziccard Jan 8, 2016
ba5050b
Merge pull request #535 from mziccard/load-to-get
aozarov Jan 8, 2016
69caa42
Merge pull request #536 from mziccard/fix-bigquery-it
aozarov Jan 8, 2016
29628d7
Merge pull request #533 from aozarov/temp
ajkannan Jan 8, 2016
01d386a
Add a link to SparkJava demo from website and README
Jan 8, 2016
5a23e57
Merge pull request #538 from ajkannan/link-sparkjava
aozarov Jan 8, 2016
863c572
Create simple forceDelete that can be used on AppEngine
Jan 9, 2016
33f6ad8
Use runtime exceptions for DeleteBucketTask.call()
Jan 11, 2016
dc1f9e7
Add known issue for mvn test and gcloud SDK
Jan 11, 2016
1583312
Fixed #478 - Make DatastoreException informative.
mderka Jan 11, 2016
b62017c
Merge pull request #546 from mderka/exception-cause
ajkannan Jan 12, 2016
2d1e836
Set default retry strategy
Jan 12, 2016
560faa9
Merge pull request #542 from ajkannan/known-issue-gcd
aozarov Jan 12, 2016
b5dd44a
Merge pull request #539 from ajkannan/forcedelete-without-executor
aozarov Jan 12, 2016
3ddbcf1
ServiceOptions tests + fix for default retry params
Jan 12, 2016
b0d4c57
Fix ServiceOptions tests
Jan 12, 2016
e737516
Merge pull request #547 from ajkannan/default-retry-strategy
aozarov Jan 12, 2016
a2e60ab
Populate cursorAfter in datastore v1beta2
Jan 14, 2016
2219c82
minor fixes to afterCursor + test
Jan 14, 2016
ffbd3d7
Add link to bookshelf app
Jan 14, 2016
cdad97a
Merge pull request #551 from ajkannan/link-getting-started-apps
aozarov Jan 15, 2016
663e54b
clarify batching in docs
Jan 15, 2016
e4113c4
avoid calling hasNext from afterCursor
Jan 15, 2016
461f375
Minor style fixes
Jan 15, 2016
5d243ad
Merge pull request #549 from ajkannan/set-cursor
aozarov Jan 15, 2016
7655301
Release version to 0.1.2
Jan 16, 2016
669eb69
Merge pull request #556 from ajkannan/release-v0.1.2
ajkannan Jan 16, 2016
3eb3fe8
Updating version in README files. [ci skip]
Jan 16, 2016
d9ef14c
Update version to 0.1.3-SNAPSHOT
Jan 16, 2016
767c41f
Merge pull request #557 from ajkannan/update-pom-version-0.1.3-snapshot
ajkannan Jan 16, 2016
b32e4b9
Add support for BigQuery resumable uploads via a write channel
mziccard Jan 11, 2016
397b2c1
Merge pull request #540 from mziccard/bigquery-insert-writer
aozarov Jan 19, 2016
03d5d30
Refactor BaseServiceException
mziccard Jan 15, 2016
acf260c
Move exception handler and interceptor to BaseService class
mziccard Jan 15, 2016
67e5dfc
Rename translateAndThrow in BaseServiceException and make it package …
mziccard Jan 20, 2016
34e6806
Add throwable cause to DatastoreException
mziccard Jan 20, 2016
3c81f16
Move isRetryable method to BaseServiceException.Error
mziccard Jan 20, 2016
add5924
Merge pull request #554 from mziccard/refactor-exception
mziccard Jan 21, 2016
3026e77
Rename Storage.apply to Storage.submit
mziccard Jan 21, 2016
2e38f02
Add code to initialize BigQueryError in BigQueryException
mziccard Jan 21, 2016
2e8363f
Merge pull request #563 from mziccard/populate-bigquery-error
mziccard Jan 21, 2016
3521bf5
Add equals and hashCode to BaseTableInfo subclasses
mziccard Jan 21, 2016
483b4d8
Merge pull request #565 from mziccard/bigquery-table-hash
ajkannan Jan 21, 2016
9fba603
Merge pull request #562 from mziccard/rename-apply
ajkannan Jan 21, 2016
e27b5b3
Minor fixes to bigquery
mziccard Jan 21, 2016
555cc71
Run coveralls for PRs in branches
Jan 21, 2016
c027e47
Merge pull request #567 from mziccard/minor-bigquery-fixes
aozarov Jan 21, 2016
0c3e935
Merge pull request #568 from ajkannan/run-coveralls-in-branches
aozarov Jan 21, 2016
55ee5aa
Add location() and debugInfo() to BaseServiceException
mziccard Jan 22, 2016
973639a
Add Acl.of method to storage module
mziccard Jan 22, 2016
c411b23
Add Acl.of method to bigquery module
mziccard Jan 22, 2016
1a18033
Merge pull request #571 from mziccard/acl-of
aozarov Jan 22, 2016
3f7626d
Merge pull request #570 from mziccard/add-info-to-exception
aozarov Jan 22, 2016
e1ddedb
Rename equals to baseEquals and hashCode to baseHashCode in BaseTable…
mziccard Jan 22, 2016
e11a5ae
Rename equals to baseEquals and hashCode to baseHashCode in JobInfo
mziccard Jan 22, 2016
0556813
Merge pull request #573 from mziccard/rename-equals
aozarov Jan 22, 2016
bbd3aad
Source IT env vars only when necessary
Jan 23, 2016
8c70155
Merge pull request #577 from ajkannan/source-only-when-necessary
aozarov Jan 23, 2016
f111953
remove check for valid utf-8 cursor
Jan 25, 2016
03ca1bf
Simplify to/from url safe and fix access issue in workaround
Jan 25, 2016
c5bae84
Merge pull request #578 from ajkannan/fix-cursor
aozarov Jan 25, 2016
830d87c
Use pagination in DatastoreExample and fix readme bug and formatting
Jan 26, 2016
360e048
Increase limit on query size
Jan 26, 2016
d8bce91
Merge pull request #582 from ajkannan/test-paging-in-datastore-example
aozarov Jan 26, 2016
84402ac
Remove JobInfo hierarchy, add JobConfiguration hierarchy
mziccard Jan 26, 2016
f10fa96
adding gcloud-java-contrib module
jean-philippe-martin Jan 26, 2016
25692fc
Merge pull request #583 from jean-philippe-martin/add_contrib
jean-philippe-martin Jan 26, 2016
8ad3235
fix toBuilder()
Jan 26, 2016
f287462
Minor refactoring and javadoc fixes
Jan 27, 2016
48cb27f
Merge pull request #585 from ajkannan/fix-query-to-builder
aozarov Jan 27, 2016
ced28fa
Release version 0.1.3
Jan 27, 2016
b63c657
Merge pull request #588 from ajkannan/release-v0.1.3
ajkannan Jan 27, 2016
8571125
Updating version in README files. [ci skip]
Jan 27, 2016
1cc4eac
update version to 0.1.4-SNAPSHOT
Jan 27, 2016
c5f50e0
Merge pull request #589 from ajkannan/update-version-0.1.4-SNAPSHOT
ajkannan Jan 27, 2016
a2c8b39
Fix comments. Make JobConfiguration an abstract class
mziccard Jan 27, 2016
f09410d
Document that input stream is closed in storage.create(BlobInfo, Inpu…
Jan 27, 2016
70ee77c
Move setProjectId from BigQueryImpl to entity objects
mziccard Jan 28, 2016
44a1533
Merge pull request #591 from ajkannan/add-close-comment
mziccard Jan 28, 2016
05d6c57
Update README and package-info to use JobConfiguration
mziccard Jan 28, 2016
68eed9e
Minor style fixes
mziccard Jan 28, 2016
ec57eb2
Merge changes from upstream/master
Jan 29, 2016
71d91aa
Fixed missed merge conflict
Jan 29, 2016
73250ea
Fix access-related issues
mziccard Jan 29, 2016
b4bddff
Merge pull request #584 from mziccard/bigquery-hierachies
aozarov Jan 29, 2016
c4bf7ad
Add note to update java-docs-samples and public documentation for rel…
Jan 29, 2016
4cf793e
Merge pull request #601 from ajkannan/releasing-doc
aozarov Jan 29, 2016
a76e6c4
Make Project a subclass of ProjectInfo
Jan 22, 2016
d3abf25
Merge pull request #572 from ajkannan/project-extends-projectinfo
ajkannan Jan 30, 2016
fbe5a1d
Merge remote-tracking branch 'upstream/master' into update-datastore
Feb 2, 2016
d27d567
Fix ServiceOptions merge bug, remove unnecessary protected modifier f…
Feb 2, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ before_install:
install: mvn install -DskipTests=true -Dgpg.skip=true
script:
- utilities/verify.sh
branches:
only:
- master
after_success:
- utilities/after_success.sh
env:
Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ Using maven for build/test
After you cloned the repository use Maven for building and running the tests.
Maven 3.0+ is required.

When downloading the source, we recommend you obtain service account credentials.
These credentials will allow you to run integration tests using `mvn verify` in command line.
Follow step 2 of the [authentication instructions](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) to generate and use JSON service account credentials.

It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere.
To run tests on different platforms, try deploying the apps available on the [gcloud-java-examples](https://github.com/GoogleCloudPlatform/gcloud-java-examples) repository.
End-to-end tests should ensure that gcloud-java works when running on the

* App Engine production environment (see the docs for [uploading your app to production App Engine](https://cloud.google.com/appengine/docs/java/tools/maven#uploading_your_app_to_production_app_engine))
* App Engine development server (see the docs for [testing your app with the development server](https://cloud.google.com/appengine/docs/java/tools/maven#testing_your_app_with_the_development_server))
* Compute Engine (see the [Getting Started Guide](https://cloud.google.com/compute/docs/quickstart), and be sure to [enable the appropriate APIs](https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication#on-google-compute-engine))
* Your desktop (using `mvn exec:java`, for example)

When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) and [project ID docs](https://github.com/GoogleCloudPlatform/gcloud-java#specifying-a-project-id).

Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated.

Adding Features
---------------
Expand Down
180 changes: 167 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,152 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.

This client supports the following Google Cloud Platform services:

- [Google Cloud BigQuery] (#google-cloud-bigquery-alpha) (Alpha)
- [Google Cloud Datastore] (#google-cloud-datastore)
- [Google Cloud Resource Manager] (#google-cloud-resource-manager-alpha) (Alpha)
- [Google Cloud Storage] (#google-cloud-storage)

> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.

Quickstart
----------
Add this to your pom.xml file
If you are using Maven, add this to your pom.xml file
```xml
<dependency>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java</artifactId>
<version>0.0.10</version>
<version>0.1.3</version>
</dependency>
```
If you are using Gradle, add this to your dependencies
```Groovy
compile 'com.google.gcloud:gcloud-java:0.1.3'
```
If you are using SBT, add this to your dependencies
```Scala
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.3"
```

Example Applications
--------------------

- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf) - An App Engine app that manages a virtual bookshelf.
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
- [`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
- [`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managedvms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
- Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managedvms/sparkjava#how-does-it-work).
- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).

Specifying a Project ID
-----------------------

Most `gcloud-java` libraries require a project ID. There are multiple ways to specify this project ID.

1. When using `gcloud-java` libraries from within Compute/App Engine, there's no need to specify a project ID. It is automatically inferred from the production environment.
2. When using `gcloud-java` elsewhere, you can do one of the following:
* Supply the project ID when building the service options. For example, to use Datastore from a project with ID "PROJECT_ID", you can write:

```java
Datastore datastore = DatastoreOptions.builder().projectId("PROJECT_ID").build().service();
```
* Specify the environment variable `GCLOUD_PROJECT` to be your desired project ID.
* Set the project ID using the [Google Cloud SDK](https://cloud.google.com/sdk/?hl=en). To use the SDK, [download the SDK](https://cloud.google.com/sdk/?hl=en) if you haven't already, and set the project ID from the command line. For example:

```
gcloud config set project PROJECT_ID
```

`gcloud-java` determines the project ID from the following sources in the listed order, stopping once it finds a value:

1. Project ID supplied when building the service options
2. Project ID specified by the environment variable `GCLOUD_PROJECT`
3. App Engine project ID
4. Google Cloud SDK project ID
5. Compute Engine project ID

Authentication
--------------

There are multiple ways to authenticate to use Google Cloud services.
First, ensure that the necessary Google Cloud APIs are enabled for your project. To do this, follow the instructions on the [authentication document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication) shared by all the gcloud language libraries.

Next, choose a method for authenticating API requests from within your project:

1. When using `gcloud-java` libraries from within Compute/App Engine, no additional authentication steps are necessary.
2. When using `gcloud-java` libraries elsewhere, there are two options:
* [Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts). Supply a path to the downloaded JSON credentials file when building the options supplied to datastore/storage constructor.
* If running locally for development/testing, you can use use [Google Cloud SDK](https://cloud.google.com/sdk/?hl=en). To use the SDK authentication, [download the SDK](https://cloud.google.com/sdk/?hl=en) if you haven't already. Then login using the SDK (`gcloud auth login` in command line), and set your current project using `gcloud config set project PROJECT_ID`.
* [Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts). After downloading that key, you must do one of the following:
* Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key. For example:
```bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json
```
* Supply the JSON credentials file when building the service options. For example, this Storage object has the necessary permissions to interact with your Google Cloud Storage data:
```java
Storage storage = StorageOptions.builder()
.authCredentials(AuthCredentials.createForJson(new FileInputStream("/path/to/my/key.json"))
.build()
.service();
```
* If running locally for development/testing, you can use use Google Cloud SDK. Download the SDK if you haven't already, then login using the SDK (`gcloud auth login` in command line). Be sure to set your project ID as described above.

`gcloud-java` looks for credentials in the following order, stopping once it finds credentials:

1. Credentials supplied when building the service options
2. App Engine credentials
3. Key file pointed to by the GOOGLE_APPLICATION_CREDENTIALS environment variable
4. Google Cloud SDK credentials
5. Compute Engine credentials

Google Cloud BigQuery (Alpha)
----------------------

- [API Documentation][bigquery-api]
- [Official Documentation][cloud-bigquery-docs]

#### Preview

Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.

```java
import com.google.gcloud.bigquery.BaseTableInfo;
import com.google.gcloud.bigquery.BigQuery;
import com.google.gcloud.bigquery.BigQueryOptions;
import com.google.gcloud.bigquery.Field;
import com.google.gcloud.bigquery.JobStatus;
import com.google.gcloud.bigquery.JobInfo;
import com.google.gcloud.bigquery.Schema;
import com.google.gcloud.bigquery.TableId;
import com.google.gcloud.bigquery.TableInfo;

BigQuery bigquery = BigQueryOptions.defaultInstance().service();
TableId tableId = TableId.of("dataset", "table");
BaseTableInfo info = bigquery.getTable(tableId);
if (info == null) {
System.out.println("Creating table " + tableId);
Field integerField = Field.of("fieldName", Field.Type.integer());
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
} else {
System.out.println("Loading data into table " + tableId);
LoadJobConfiguration configuration = LoadJobConfiguration.of(tableId, "gs://bucket/path");
JobInfo loadJob = JobInfo.of(configuration);
loadJob = bigquery.create(loadJob);
while (loadJob.status().state() != JobStatus.State.DONE) {
Thread.sleep(1000L);
loadJob = bigquery.getJob(loadJob.jobId());
}
if (loadJob.status().error() != null) {
System.out.println("Job completed with errors");
} else {
System.out.println("Job succeeded");
}
}
```

Google Cloud Datastore
----------------------
Expand All @@ -61,14 +173,13 @@ Here is a code snippet showing a simple usage example from within Compute/App En

```java
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreFactory;
import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.datastore.DateTime;
import com.google.gcloud.datastore.Entity;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.KeyFactory;

Datastore datastore = DatastoreFactory.instance().get(DatastoreOptions.getDefaultInstance());
Datastore datastore = DatastoreOptions.defaultInstance().service();
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
Key key = keyFactory.newKey(keyName);
Entity entity = datastore.get(key);
Expand All @@ -88,6 +199,39 @@ if (entity == null) {
}
```

Google Cloud Resource Manager (Alpha)
----------------------

- [API Documentation][resourcemanager-api]
- [Official Documentation][cloud-resourcemanager-docs]

#### Preview

Here is a code snippet showing a simple usage example. Note that you must supply Google SDK credentials for this service, not other forms of authentication listed in the [Authentication section](#authentication).

```java
import com.google.gcloud.resourcemanager.Project;
import com.google.gcloud.resourcemanager.ResourceManager;
import com.google.gcloud.resourcemanager.ResourceManagerOptions;

import java.util.Iterator;

ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
Project myProject = resourceManager.get("some-project-id"); // Use an existing project's ID
Project newProject = myProject.toBuilder()
.addLabel("launch-status", "in-development")
.build()
.replace();
System.out.println("Updated the labels of project " + newProject.projectId()
+ " to be " + newProject.labels());
// List all the projects you have permission to view.
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
System.out.println("Projects I can view:");
while (projectIterator.hasNext()) {
System.out.println(projectIterator.next().projectId());
}
```

Google Cloud Storage
----------------------

Expand All @@ -106,16 +250,14 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.gcloud.storage.Blob;
import com.google.gcloud.storage.BlobId;
import com.google.gcloud.storage.Storage;
import com.google.gcloud.storage.StorageFactory;
import com.google.gcloud.storage.StorageOptions;

import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;

StorageOptions options = StorageOptions.builder().projectId("project").build();
Storage storage = StorageFactory.instance().get(options);
Storage storage = StorageOptions.defaultInstance().service();
BlobId blobId = BlobId.of("bucket", "blob_name");
Blob blob = Blob.load(storage, blobId);
Blob blob = Blob.get(storage, blobId);
if (blob == null) {
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
Expand All @@ -129,6 +271,11 @@ if (blob == null) {
}
```

Troubleshooting
---------------

To get help, follow the `gcloud-java` links in the `gcloud-*` [shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting).

Java Versions
-------------

Expand All @@ -155,7 +302,7 @@ Contributing

Contributions to this library are always welcome and highly encouraged.

See [CONTRIBUTING] for more information on how to get started.
See `gcloud-java`'s [CONTRIBUTING] documentation and the `gcloud-*` [shared documentation](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information.

Expand All @@ -166,7 +313,7 @@ Apache 2.0 - See [LICENSE] for more information.


[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CODE_OF_CONDUCT.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[LICENSE]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/LICENSE
[TESTING]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/TESTING.md
[cloud-platform]: https://cloud.google.com/
Expand All @@ -183,3 +330,10 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
[cloud-storage-activation]: https://cloud.google.com/storage/docs/signup
[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/storage/package-summary.html

[resourcemanager-api]:http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/resourcemanager/package-summary.html
[cloud-resourcemanager-docs]:https://cloud.google.com/resource-manager/

[cloud-bigquery]: https://cloud.google.com/bigquery/
[cloud-bigquery-docs]: https://cloud.google.com/bigquery/docs/overview
[bigquery-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/bigquery/package-summary.html
Loading