pax_global_header00006660000000000000000000000064135065146430014521gustar00rootroot0000000000000052 comment=99f046cad6917e4cd47f06b2dbe29cc6f5845379 google-api-java-client-1.27.1/000077500000000000000000000000001350651464300160275ustar00rootroot00000000000000google-api-java-client-1.27.1/.github/000077500000000000000000000000001350651464300173675ustar00rootroot00000000000000google-api-java-client-1.27.1/.github/CODEOWNERS000066400000000000000000000000311350651464300207540ustar00rootroot00000000000000* @googleapis/yoshi-java google-api-java-client-1.27.1/.github/ISSUE_TEMPLATE.md000066400000000000000000000007621350651464300221010ustar00rootroot00000000000000Thanks for stopping by to let us know something could be better! Please be sure to include as much information as possible: #### Environment details - OS: - Java version: - google-api-java-client version: #### Steps to reproduce 1. ? 2. ? #### Stacktrace ``` Any relevant stacktrace here. ``` #### External references such as API reference guides used - ? #### Any additional information below Making sure to follow these steps will guarantee the quickest resolution possible. Thanks! google-api-java-client-1.27.1/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000002361350651464300231710ustar00rootroot00000000000000Fixes # (it's a good idea to open an issue first for discussion) - [ ] Tests pass - [ ] Appropriate docs were updated (if necessary) google-api-java-client-1.27.1/.gitignore000066400000000000000000000000671350651464300200220ustar00rootroot00000000000000target/ bin/ .classpath .settings .project *.iml .idea google-api-java-client-1.27.1/.kokoro/000077500000000000000000000000001350651464300174115ustar00rootroot00000000000000google-api-java-client-1.27.1/.kokoro/build.sh000077500000000000000000000016761350651464300210610ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail cd github/google-api-java-client/ # Print out Java java -version echo $JOB_TYPE # Skip android and assembly tests? Imported from Travis config sed -i 's/google-api-client-android<\/module>//' pom.xml sed -i 's/google-api-client-assembly<\/module>//' pom.xml mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V mvn test -B google-api-java-client-1.27.1/.kokoro/common.cfg000066400000000000000000000007221350651464300213630ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # All builds use the trampoline script to run in docker. build_file: "google-api-java-client/.kokoro/trampoline.sh" # Tell the trampoline which build file to use. env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/build.sh" } google-api-java-client-1.27.1/.kokoro/continuous/000077500000000000000000000000001350651464300216175ustar00rootroot00000000000000google-api-java-client-1.27.1/.kokoro/continuous/common.cfg000066400000000000000000000007771350651464300236030ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Build logs will be here action { define_artifacts { regex: "**/*sponge_log.xml" } } # Download trampoline resources. gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. build_file: "google-api-java-client/.kokoro/trampoline.sh" env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/build.sh" } env_vars: { key: "JOB_TYPE" value: "test" } google-api-java-client-1.27.1/.kokoro/continuous/java10.cfg000066400000000000000000000003111350651464300233550ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java10" } google-api-java-client-1.27.1/.kokoro/continuous/java7.cfg000066400000000000000000000003101350651464300233020ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java7" } google-api-java-client-1.27.1/.kokoro/continuous/java8.cfg000066400000000000000000000003101350651464300233030ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java8" } google-api-java-client-1.27.1/.kokoro/install_dependencies.sh000077500000000000000000000025031350651464300241240ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail # Install the android SDK mvn dependency:get -Dartifact=com.google.android:android:4.1.1.4 # Install the appengine SDK mvn dependency:get -Dartifact=com.google.appengine:appengine-api-1.0-sdk:1.9.65 # Install play services mvn dependency:get -Dartifact=com.google.android.google-play-services:google-play-services:1 -o -DremoteRepositories=file:~/.m2 || \ (wget https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar && \ unzip play-services-basement-8.3.0.aar && \ mvn install:install-file \ -Dfile=classes.jar \ -DgroupId=com.google.android.google-play-services \ -DartifactId=google-play-services \ -Dversion=1 \ -Dpackaging=jar) google-api-java-client-1.27.1/.kokoro/presubmit/000077500000000000000000000000001350651464300214235ustar00rootroot00000000000000google-api-java-client-1.27.1/.kokoro/presubmit/common.cfg000066400000000000000000000007771350651464300234070ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Build logs will be here action { define_artifacts { regex: "**/*sponge_log.xml" } } # Download trampoline resources. gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. build_file: "google-api-java-client/.kokoro/trampoline.sh" env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/build.sh" } env_vars: { key: "JOB_TYPE" value: "test" } google-api-java-client-1.27.1/.kokoro/presubmit/java10.cfg000066400000000000000000000003111350651464300231610ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java10" } google-api-java-client-1.27.1/.kokoro/presubmit/java7.cfg000066400000000000000000000003101350651464300231060ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java7" } google-api-java-client-1.27.1/.kokoro/presubmit/java8.cfg000066400000000000000000000003101350651464300231070ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java8" } google-api-java-client-1.27.1/.kokoro/presubmit/java9.cfg000066400000000000000000000003101350651464300231100ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java9" } google-api-java-client-1.27.1/.kokoro/release/000077500000000000000000000000001350651464300210315ustar00rootroot00000000000000google-api-java-client-1.27.1/.kokoro/release/common.cfg000066400000000000000000000020561350651464300230050ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Build logs will be here action { define_artifacts { regex: "**/*sponge_log.xml" } } # Download trampoline resources. gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. build_file: "google-api-java-client/.kokoro/trampoline.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java8" } before_action { fetch_keystore { keystore_resource { keystore_config_id: 70247 keyname: "maven-gpg-keyring" } } } before_action { fetch_keystore { keystore_resource { keystore_config_id: 70247 keyname: "maven-gpg-passphrase" } } } before_action { fetch_keystore { keystore_resource { keystore_config_id: 70247 keyname: "maven-gpg-pubkeyring" } } } before_action { fetch_keystore { keystore_resource { keystore_config_id: 70247 keyname: "sonatype-credentials" } } } google-api-java-client-1.27.1/.kokoro/release/common.sh000066400000000000000000000033541350651464300226620ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail # Get secrets from keystore and set and environment variables setup_environment_secrets() { export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) export GPG_TTY=$(tty) export GPG_HOMEDIR=/gpg mkdir $GPG_HOMEDIR mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') } create_settings_xml_file() { echo " ossrh ${SONATYPE_USERNAME} ${SONATYPE_PASSWORD} sonatype-nexus-staging ${SONATYPE_USERNAME} ${SONATYPE_PASSWORD} sonatype-nexus-snapshots ${SONATYPE_USERNAME} ${SONATYPE_PASSWORD} " > $1 } google-api-java-client-1.27.1/.kokoro/release/drop.cfg000066400000000000000000000003271350651464300224600ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Tell the trampoline which build file to use. env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/release/drop.sh" } google-api-java-client-1.27.1/.kokoro/release/drop.sh000077500000000000000000000014211350651464300223320ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail source $(dirname "$0")/common.sh pushd $(dirname "$0")/../../ setup_environment_secrets create_settings_xml_file "settings.xml" mvn nexus-staging:drop --settings=settings.xml google-api-java-client-1.27.1/.kokoro/release/promote.cfg000066400000000000000000000003321350651464300231750ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Tell the trampoline which build file to use. env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/release/promote.sh" } google-api-java-client-1.27.1/.kokoro/release/promote.sh000077500000000000000000000014521350651464300230570ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail source $(dirname "$0")/common.sh pushd $(dirname "$0")/../../ setup_environment_secrets create_settings_xml_file "settings.xml" mvn nexus-staging:release -DperformRelease=true --settings=settings.xml google-api-java-client-1.27.1/.kokoro/release/stage.cfg000066400000000000000000000003301350651464300226110ustar00rootroot00000000000000# Format: //devtools/kokoro/config/proto/build.proto # Tell the trampoline which build file to use. env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/release/stage.sh" } google-api-java-client-1.27.1/.kokoro/release/stage.sh000077500000000000000000000017061350651464300224770ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail source $(dirname "$0")/common.sh source $(dirname "$0")/../install_dependencies.sh pushd $(dirname "$0")/../../ setup_environment_secrets create_settings_xml_file "settings.xml" mvn clean install deploy \ --settings settings.xml \ -DperformRelease=true \ -Dgpg.executable=gpg \ -Dgpg.passphrase=${GPG_PASSPHRASE} \ -Dgpg.homedir=${GPG_HOMEDIR} google-api-java-client-1.27.1/.kokoro/trampoline.sh000066400000000000000000000016131350651464300221200ustar00rootroot00000000000000#!/bin/bash # Copyright 2018 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. set -eo pipefail # Always run the cleanup script, regardless of the success of bouncing into # the container. function cleanup() { chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh echo "cleanup"; } trap cleanup EXIT python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" google-api-java-client-1.27.1/.travis.yml000066400000000000000000000003521350651464300201400ustar00rootroot00000000000000language: java notifications: email: false jdk: - oraclejdk8 - openjdk7 before_install: - sed -i 's/google-api-client-android<\/module>//' pom.xml - sed -i 's/google-api-client-assembly<\/module>//' pom.xml google-api-java-client-1.27.1/CODE_OF_CONDUCT.md000066400000000000000000000036751350651464300206410ustar00rootroot00000000000000# Contributor Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery * Personal attacks * Trolling or insulting/derogatory comments * Public or private harassment * Publishing other's private information, such as physical or electronic addresses, without explicit permission * Other unethical or unprofessional conduct. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) google-api-java-client-1.27.1/LICENSE000066400000000000000000000261341350651464300170420ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} 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. google-api-java-client-1.27.1/README.md000066400000000000000000000272501350651464300173140ustar00rootroot00000000000000# Google APIs Client Library for Java - [Library maintenance](#maintenance) - [Overview](#Overview) - [Highlighted Features](#Highlighted_Features) - [Dependencies](#Dependencies) - [Important Warnings](#Beta) - [@Beta](#Beta) - [Deprecations](#Deprecations) - [Documentation](#Documentation) - [Links](#Links) ## Library maintenance These client libraries are official supported by Google. However, these libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features. If you're working with **Google Cloud Platform** APIs such as Datastore, Pub/Sub and many others, consider using the [Cloud Client Libraries for Java](https://github.com/GoogleCloudPlatform/google-cloud-java) instead. These are the new and idiomatic Java libraries targeted specifically at Google Cloud Platform Services. ## Building locally ##### One time setup ``` mkdir /tmp/foo && cd /tmp/foo wget https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/8.3.0/play-services-basement-8.3.0.aar unzip play-services-basement-8.3.0.aar mvn install:install-file \ -Dfile=classes.jar \ -DgroupId=com.google.android.google-play-services \ -DartifactId=google-play-services \ -Dversion=1 \ -Dpackaging=jar cd - # we need the google-http-java-client jar cached locally git clone https://github.com/google/google-http-java-client.git cd google-http-java-client && mvn compile && mvn install && cd .. # we need the google-oauth-java-client jar cached locally git clone https://github.com/google/google-oauth-java-client.git cd google-oauth-java-client && mvn compile && mvn install ``` ##### Building And Testing ``` mvn install ``` ## Overview The Google APIs Client Library for Java is a flexible, efficient, and powerful Java client library for accessing any HTTP-based API on the web, not just Google APIs. The library has the following features: - A powerful [OAuth 2.0](https://developers.google.com/api-client-library/java/google-api-java-client/oauth2) library with a consistent interface. - Lightweight, efficient XML and JSON data models that support any data schema. - Support for [protocol buffers](https://github.com/google/protobuf/). - A set of [generated libraries for Google APIs](https://developers.google.com/api-client-library/java/apis/). ### Accessing Google APIs To use Google's Java client libraries to call any Google API, you need two libraries: - The core Google APIs Client Library for Java (google-api-java-client), which is the generic runtime library described here. This library provides functionality common to all APIs, for example HTTP transport, error handling, authentication, JSON parsing, media download/upload, and batching. - An auto-generated Java library for the API you are accessing, for example the [generated Java library for the BigQuery API](https://github.com/google/google-api-java-client-samples/tree/master/bigquery-appengine-sample/src/main/java/com/google/api/client/sample/bigquery/appengine/dashboard). These generated libraries include API-specific information such as the root URL, and classes that represent entities in the context of the API. These classes are useful for making conversions between JSON objects and Java objects. To find the generated library for a Google API, visit [Google APIs Client Library for Java](https://developers.google.com/api-client-library/java/apis/). The API-specific Java packages include both the core google-api-java-client and the client-specific libraries. If you are using the old GData library, you need to [migrate](https://github.com/google/gdata-java-client/blob/wiki/MigratingToGoogleApiJavaClient.md). ### Developing for Android If you are developing for Android and the Google API you want to use is included in the [Google Play Services library](https://developer.android.com/google/play-services/index.html), you should use that library for the best performance and experience. To access other Google APIs, you can use the Google APIs Client Library for Java, which supports [Android 4.0 (Ice Cream Sandwich) (or higher)](https://developers.google.com/api-client-library/java/google-api-java-client/android). ### Other Java environments - Java 6 (or higher) - Android 1.6 (or higher) - [Google App Engine](https://developers.google.com/api-client-library/java/google-api-java-client/app-engine) ## Highlighted Features - **The library makes it simple to call Google APIs.** You can call Google APIs using Google service-specific generated libraries with the Google APIs Client Library for Java. Here's an example that makes a call to the [Google Calendar API](https://developers.google.com/google-apps/calendar/): ```java // Show events on user's calendar. View.header("Show Calendars"); CalendarList feed = client.calendarList().list().execute(); View.display(feed); ``` - **The library makes authentication easier.** The authentication library can reduce the amount of code needed to handle [OAuth 2.0](https://developers.google.com/api-client-library/java/google-api-java-client/oauth2), and sometimes a few lines is all you need. For example: ```java /** Authorizes the installed application to access user's protected data. */ private static Credential authorize() throws Exception { // load client secrets GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(CalendarSample.class.getResourceAsStream("/client_secrets.json"))); // set up authorization code flow GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, JSON_FACTORY, clientSecrets, Collections.singleton(CalendarScopes.CALENDAR)).setDataStoreFactory(dataStoreFactory) .build(); // authorize return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user"); } ``` - **The library makes batching and media upload/download easier.** The library offers helper classes for [batching](https://developers.google.com/api-client-library/java/google-api-java-client/batch), [media upload](https://developers.google.com/api-client-library/java/google-api-java-client/media-upload), and [media download](https://developers.google.com/api-client-library/java/google-api-java-client/media-download). - **The library runs on Google App Engine.** [App Engine-specific helpers](https://developers.google.com/api-client-library/java/google-api-java-client/app-engine) make quick work of authenticated calls to APIs, and you do not need to worry about exchanging code for tokens. For example: ```java @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { AppIdentityCredential credential = new AppIdentityCredential(Arrays.asList(UrlshortenerScopes.URLSHORTENER)); Urlshortener shortener = new Urlshortener.Builder(new UrlFetchTransport(), new JacksonFactory(), credential) .build(); UrlHistory history = shortener.URL().list().execute(); ... } ``` - **The library runs on [Android (@Beta)](#@Beta).** If you are developing for Android and the Google API you want to use is included in the [Google Play Services library](https://developer.android.com/google/play-services/index.html), you should use that library for the best performance and experience. To access other Google APIs, you can use the Google Client Library for Java's Android-specific helper classes, which are are well-integrated with [Android AccountManager](http://developer.android.com/reference/android/accounts/AccountManager.html). For example: ```java @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Google Accounts credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS)); SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); // Tasks client service = new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential) .setApplicationName("Google-TasksAndroidSample/1.0").build(); } ``` - **The library is easy to install.** The Google APIs Client Library for Java is easy to install, and you can download the binary directly from the [Downloads page](https://developers.google.com/api-client-library/java/google-api-java-client/download), or you can use Maven or Gradle. To use Maven, add the following lines to your pom.xml file: [//]: # ({x-version-update-start:google-api-client:released}) ```maven com.google.api-client google-api-client 1.27.1 ``` To use Gradle, add the following lines to your build.gradle file: ```gradle repositories { mavenCentral() } dependencies { compile 'com.google.api-client:google-api-client:1.27.1' } ``` [//]: # ({x-version-update-end}) ## CI Status Java Version | Status ------------ | ------ Java 7 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.html) Java 8 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.html) Java 10 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java10.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java10.html) ## Dependencies This library is built on top of two common libraries, also built by Google, and also designed to work with any HTTP service on the web: - [Google HTTP Client Library for Java](https://github.com/google/google-http-java-client) - [Google OAuth Client Library for Java](https://github.com/google/google-oauth-java-client) ## Important Warnings ### @Beta Features marked with the @Beta annotation at the class or method level are subject to change. They might be modified in any way, or even removed, in any major release. You should not use beta features if your code is a library itself (that is, if your code is used on the CLASSPATH of users outside your own control). ### Deprecations Deprecated non-beta features will be removed eighteen months after the release in which they are first deprecated. You must fix your usages before this time. If you don't, any type of breakage might result, and you are not guaranteed a compilation error. ## Documentation - [Developer's Guide](https://developers.google.com/api-client-library/java/google-api-java-client/dev-guide) - [Libraries and Samples](https://developers.google.com/api-client-library/java/apis/) - [JavaDoc](https://developers.google.com/api-client-library/java/google-api-java-client/reference/index) - [Get Help](https://developers.google.com/api-client-library/java/google-api-java-client/support) ## Links - [API Announcements](http://googledevelopers.blogspot.com/) - [Discuss](https://groups.google.com/forum/#!forum/google-api-java-client) ## Notice: Ending Java 6 Support Please note: since Java 6 extended support is being ended this December by Oracle, we will begin ending Java 6 support in early 2019, with release 1.28.0 as a tentative goal. Users may stay still use these libraries in Java 6 projects for some time, but going forward we will not ensure that these libraries work in such an environment. After 1.28.0, our supported versions will include Java 7 and onward. For Android users, we will continue our 4.0 support. For questions or concerns, please file an issue in the GitHub repository. google-api-java-client-1.27.1/checkstyle-suppressions.xml000066400000000000000000000020351350651464300234620ustar00rootroot00000000000000 google-api-java-client-1.27.1/checkstyle.xml000066400000000000000000000260411350651464300207120ustar00rootroot00000000000000 google-api-java-client-1.27.1/clirr-ignored-differences.xml000066400000000000000000000002401350651464300235600ustar00rootroot00000000000000 google-api-java-client-1.27.1/findbugs-exclude.xml000066400000000000000000000107341350651464300220060ustar00rootroot00000000000000 google-api-java-client-1.27.1/google-api-client-android/000077500000000000000000000000001350651464300227445ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/AndroidManifest.xml000066400000000000000000000005201350651464300265320ustar00rootroot00000000000000 google-api-java-client-1.27.1/google-api-client-android/pom.xml000066400000000000000000000040161350651464300242620ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-android Android Platform Extensions to the Google APIs Client Library for Java. maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-source-plugin source-jar compile jar com.google.android android 4.1.1.4 provided com.google.api-client google-api-client com.google.http-client google-http-client-android com.google.android.google-play-services google-play-services provided google-api-java-client-1.27.1/google-api-client-android/project.properties000066400000000000000000000000221350651464300265220ustar00rootroot00000000000000target=android-18 google-api-java-client-1.27.1/google-api-client-android/src/000077500000000000000000000000001350651464300235335ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/000077500000000000000000000000001350651464300244575ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/000077500000000000000000000000001350651464300254005ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/000077500000000000000000000000001350651464300261565ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/000077500000000000000000000000001350651464300274325ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/000077500000000000000000000000001350651464300302035ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300314615ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300335335ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/clientextensions/000077500000000000000000000000001350651464300357325ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapisandroid/000077500000000000000000000000001350651464300373525ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensionsaccounts/000077500000000000000000000000001350651464300411715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/androidGoogleAccountManager.java000066400000000000000000000052331350651464300460630ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/* * Copyright 2012 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.api.client.googleapis.extensions.android.accounts; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; /** * {@link Beta}
* Account manager wrapper for Google accounts. * * @since 1.11 * @author Yaniv Inbar */ @Beta public final class GoogleAccountManager { /** Google account type. */ public static final String ACCOUNT_TYPE = "com.google"; /** Account manager. */ private final AccountManager manager; /** * @param accountManager account manager */ public GoogleAccountManager(AccountManager accountManager) { this.manager = Preconditions.checkNotNull(accountManager); } /** * @param context context from which to retrieve the account manager */ public GoogleAccountManager(Context context) { this(AccountManager.get(context)); } /** * Returns the account manager. * * @since 1.8 */ public AccountManager getAccountManager() { return manager; } /** * Returns all Google accounts. * * @return array of Google accounts */ public Account[] getAccounts() { return manager.getAccountsByType("com.google"); } /** * Returns the Google account of the given {@link Account#name}. * * @param accountName Google account name or {@code null} for {@code null} result * @return Google account or {@code null} for none found or for {@code null} input */ public Account getAccountByName(String accountName) { if (accountName != null) { for (Account account : getAccounts()) { if (accountName.equals(account.name)) { return account; } } } return null; } /** * Invalidates the given Google auth token by removing it from the account manager's cache (if * necessary) for example if the auth token has expired or otherwise become invalid. * * @param authToken auth token */ public void invalidateAuthToken(String authToken) { manager.invalidateAuthToken(ACCOUNT_TYPE, authToken); } } package-info.java000066400000000000000000000015601350651464300443620ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/accounts/* * Copyright 2012 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. */ /** * {@link com.google.api.client.util.Beta}
* Utilities for Account Manager for Google accounts on Android Eclair (SDK 2.1) and later. * * @since 1.11 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.android.accounts; gms/000077500000000000000000000000001350651464300401405ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/androidauth/000077500000000000000000000000001350651464300411015ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gmsGoogleAccountCredential.java000066400000000000000000000226571350651464300465040ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/* * 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.api.client.googleapis.extensions.android.gms.auth; import android.accounts.Account; import android.content.Context; import android.content.Intent; import com.google.android.gms.auth.GoogleAuthException; import com.google.android.gms.auth.GoogleAuthUtil; import com.google.android.gms.auth.GooglePlayServicesAvailabilityException; import com.google.android.gms.auth.UserRecoverableAuthException; import com.google.android.gms.common.AccountPicker; import com.google.api.client.googleapis.extensions.android.accounts.GoogleAccountManager; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.util.BackOff; import com.google.api.client.util.BackOffUtils; import com.google.api.client.util.Beta; import com.google.api.client.util.ExponentialBackOff; import com.google.api.client.util.Joiner; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Sleeper; import java.io.IOException; import java.util.Collection; /** * {@link Beta}
* Manages authorization and account selection for Google accounts. * *

* When fetching a token, any thrown {@link GoogleAuthException} would be wrapped: *

    *
  • {@link GooglePlayServicesAvailabilityException} would be wrapped inside of * {@link GooglePlayServicesAvailabilityIOException}
  • *
  • {@link UserRecoverableAuthException} would be wrapped inside of * {@link UserRecoverableAuthIOException}
  • *
  • {@link GoogleAuthException} when be wrapped inside of {@link GoogleAuthIOException}
  • *
*

* *

* Upgrade warning: in prior version 1.14 exponential back-off was enabled by default when I/O * exception was thrown inside {@link #getToken}, but starting with version 1.15 you need to call * {@link #setBackOff} with {@link ExponentialBackOff} to enable it. *

* * @since 1.12 * @author Yaniv Inbar */ @Beta public class GoogleAccountCredential implements HttpRequestInitializer { /** Context. */ final Context context; /** Scope to use on {@link GoogleAuthUtil#getToken}. */ final String scope; /** Google account manager. */ private final GoogleAccountManager accountManager; /** * Selected Google account name (e-mail address), for example {@code "johndoe@gmail.com"}, or * {@code null} for none. */ private String accountName; /** Selected Google account or {@code null} for none. */ private Account selectedAccount; /** Sleeper. */ private Sleeper sleeper = Sleeper.DEFAULT; /** * Back-off policy which is used when an I/O exception is thrown inside {@link #getToken} or * {@code null} for none. */ private BackOff backOff; /** * @param context context * @param scope scope to use on {@link GoogleAuthUtil#getToken} */ public GoogleAccountCredential(Context context, String scope) { accountManager = new GoogleAccountManager(context); this.context = context; this.scope = scope; } /** * Constructs a new instance using OAuth 2.0 scopes. * * @param context context * @param scopes non empty OAuth 2.0 scope list * @return new instance * * @since 1.15 */ public static GoogleAccountCredential usingOAuth2(Context context, Collection scopes) { Preconditions.checkArgument(scopes != null && scopes.iterator().hasNext()); String scopesStr = "oauth2: " + Joiner.on(' ').join(scopes); return new GoogleAccountCredential(context, scopesStr); } /** * Sets the audience scope to use with Google Cloud Endpoints. * * @param context context * @param audience audience * @return new instance */ public static GoogleAccountCredential usingAudience(Context context, String audience) { Preconditions.checkArgument(audience.length() != 0); return new GoogleAccountCredential(context, "audience:" + audience); } /** * Sets the selected Google account name (e-mail address) -- for example * {@code "johndoe@gmail.com"} -- or {@code null} for none. */ public final GoogleAccountCredential setSelectedAccountName(String accountName) { selectedAccount = accountManager.getAccountByName(accountName); // check if account has been deleted this.accountName = selectedAccount == null ? null : accountName; return this; } /** * Sets the selected Google {@link Account} or {@code null} for none. * *

* Caller must ensure the given Google account exists. *

*/ public final GoogleAccountCredential setSelectedAccount(Account selectedAccount) { this.selectedAccount = selectedAccount; this.accountName = selectedAccount == null ? null : selectedAccount.name; return this; } @Override public void initialize(HttpRequest request) { RequestHandler handler = new RequestHandler(); request.setInterceptor(handler); request.setUnsuccessfulResponseHandler(handler); } /** Returns the context. */ public final Context getContext() { return context; } /** Returns the scope to use on {@link GoogleAuthUtil#getToken}. */ public final String getScope() { return scope; } /** Returns the Google account manager. */ public final GoogleAccountManager getGoogleAccountManager() { return accountManager; } /** Returns all Google accounts or {@code null} for none. */ public final Account[] getAllAccounts() { return accountManager.getAccounts(); } /** Returns the selected Google account or {@code null} for none. */ public final Account getSelectedAccount() { return selectedAccount; } /** * Returns the back-off policy which is used when an I/O exception is thrown inside * {@link #getToken} or {@code null} for none. * * @since 1.15 */ public BackOff getBackOff() { return backOff; } /** * Sets the back-off policy which is used when an I/O exception is thrown inside {@link #getToken} * or {@code null} for none. * * @since 1.15 */ public GoogleAccountCredential setBackOff(BackOff backOff) { this.backOff = backOff; return this; } /** * Returns the sleeper. * * @since 1.15 */ public final Sleeper getSleeper() { return sleeper; } /** * Sets the sleeper. The default value is {@link Sleeper#DEFAULT}. * * @since 1.15 */ public final GoogleAccountCredential setSleeper(Sleeper sleeper) { this.sleeper = Preconditions.checkNotNull(sleeper); return this; } /** * Returns the selected Google account name (e-mail address), for example * {@code "johndoe@gmail.com"}, or {@code null} for none. */ public final String getSelectedAccountName() { return accountName; } /** * Returns an intent to show the user to select a Google account, or create a new one if there are * none on the device yet. * *

* Must be run from the main UI thread. *

*/ public final Intent newChooseAccountIntent() { return AccountPicker.newChooseAccountIntent(selectedAccount, null, new String[] {GoogleAccountManager.ACCOUNT_TYPE}, true, null, null, null, null); } /** * Returns an OAuth 2.0 access token. * *

* Must be run from a background thread, not the main UI thread. *

*/ public String getToken() throws IOException, GoogleAuthException { if (backOff != null) { backOff.reset(); } while (true) { try { return GoogleAuthUtil.getToken(context, accountName, scope); } catch (IOException e) { // network or server error, so retry using back-off policy try { if (backOff == null || !BackOffUtils.next(sleeper, backOff)) { throw e; } } catch (InterruptedException e2) { // ignore } } } } @Beta class RequestHandler implements HttpExecuteInterceptor, HttpUnsuccessfulResponseHandler { /** Whether we've received a 401 error code indicating the token is invalid. */ boolean received401; String token; @Override public void intercept(HttpRequest request) throws IOException { try { token = getToken(); request.getHeaders().setAuthorization("Bearer " + token); } catch (GooglePlayServicesAvailabilityException e) { throw new GooglePlayServicesAvailabilityIOException(e); } catch (UserRecoverableAuthException e) { throw new UserRecoverableAuthIOException(e); } catch (GoogleAuthException e) { throw new GoogleAuthIOException(e); } } @Override public boolean handleResponse( HttpRequest request, HttpResponse response, boolean supportsRetry) { if (response.getStatusCode() == 401 && !received401) { received401 = true; GoogleAuthUtil.invalidateToken(context, token); return true; } return false; } } } GoogleAuthIOException.java000066400000000000000000000027251350651464300461170ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/* * 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.api.client.googleapis.extensions.android.gms.auth; import com.google.android.gms.auth.GoogleAuthException; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import java.io.IOException; /** * {@link Beta}
* Wraps a {@link GoogleAuthException} into an {@link IOException} so it can be caught directly. * *

* Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}. *

* * @since 1.12 * @author Yaniv Inbar */ @Beta public class GoogleAuthIOException extends IOException { private static final long serialVersionUID = 1L; /** * @param wrapped wrapped {@link GoogleAuthException} * @since 1.21.0 */ public GoogleAuthIOException(GoogleAuthException wrapped) { initCause(Preconditions.checkNotNull(wrapped)); } @Override public GoogleAuthException getCause() { return (GoogleAuthException) super.getCause(); } } GooglePlayServicesAvailabilityIOException.java000066400000000000000000000045421350651464300521610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/* * 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.api.client.googleapis.extensions.android.gms.auth; import android.app.Activity; import com.google.android.gms.auth.GooglePlayServicesAvailabilityException; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Wraps a {@link GooglePlayServicesAvailabilityException} into an {@link IOException} so it can be * caught directly. * *

* Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use * {@link #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example * usage: *

* *
    } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
      myActivity.runOnUiThread(new Runnable() {
        public void run() {
          Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
              availabilityException.getConnectionStatusCode(),
              myActivity,
              MyActivity.REQUEST_GOOGLE_PLAY_SERVICES);
          dialog.show();
        }
      });
 * 
* * @since 1.12 * @author Yaniv Inbar */ @Beta public class GooglePlayServicesAvailabilityIOException extends UserRecoverableAuthIOException { private static final long serialVersionUID = 1L; /** * @since 1.21.0 */ public GooglePlayServicesAvailabilityIOException( GooglePlayServicesAvailabilityException wrapped) { super(wrapped); } @Override public GooglePlayServicesAvailabilityException getCause() { return (GooglePlayServicesAvailabilityException) super.getCause(); } /** * Returns the error code to use with * {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)}. */ public final int getConnectionStatusCode() { return getCause().getConnectionStatusCode(); } } UserRecoverableAuthIOException.java000066400000000000000000000040021350651464300477610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/* * 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.api.client.googleapis.extensions.android.gms.auth; import android.app.Activity; import android.content.Intent; import com.google.android.gms.auth.UserRecoverableAuthException; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Wraps a {@link UserRecoverableAuthException} into an {@link IOException} so it can be caught * directly. * *

* Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use * {@link #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage: *

* *
    } catch (UserRecoverableAuthIOException userRecoverableException) {
      myActivity.startActivityForResult(
          userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION);
    }
 * 
* * @since 1.12 * @author Yaniv Inbar */ @Beta public class UserRecoverableAuthIOException extends GoogleAuthIOException { private static final long serialVersionUID = 1L; /** * @since 1.21.0 */ public UserRecoverableAuthIOException(UserRecoverableAuthException wrapped) { super(wrapped); } @Override public UserRecoverableAuthException getCause() { return (UserRecoverableAuthException) super.getCause(); } /** * Returns the {@link Intent} that when supplied to * {@link Activity#startActivityForResult(Intent, int)} will allow user intervention. */ public final Intent getIntent() { return getCause().getIntent(); } } package-info.java000066400000000000000000000015541350651464300442750ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/* * 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. */ /** * {@link com.google.api.client.util.Beta}
* Utilities based on Google * Play services. * * @since 1.12 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.android.gms.auth; google-api-java-client-1.27.1/google-api-client-appengine/000077500000000000000000000000001350651464300232725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/pom.xml000066400000000000000000000100551350651464300246100ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-appengine Google App Engine extensions to the Google API Client Library for Java. maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://cloud.google.com/appengine/docs/standard/java/javadoc/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ https://googleapis.github.io/google-oauth-java-client/releases/${project.oauth.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar org.codehaus.mojo animal-sniffer-maven-plugin org.codehaus.mojo.signature java17 1.0 com.google.appengine appengine-api-1.0-sdk provided com.google.oauth-client google-oauth-client-appengine com.google.api-client google-api-client com.google.api-client google-api-client-servlet com.google.http-client google-http-client-appengine junit junit test com.google.appengine appengine-testing test com.google.appengine appengine-api-labs test com.google.appengine appengine-api-stubs test com.google.http-client google-http-client-jackson2 test com.google.guava guava test google-api-java-client-1.27.1/google-api-client-appengine/src/000077500000000000000000000000001350651464300240615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/000077500000000000000000000000001350651464300250055ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/000077500000000000000000000000001350651464300257265ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/000077500000000000000000000000001350651464300265045ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/000077500000000000000000000000001350651464300277605ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/000077500000000000000000000000001350651464300305315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300320075ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300340615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/clientextensions/000077500000000000000000000000001350651464300362605ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapisappengine/000077500000000000000000000000001350651464300402265ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensionsauth/000077500000000000000000000000001350651464300411675ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengineoauth2/000077500000000000000000000000001350651464300423715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/authAppIdentityCredential.java000066400000000000000000000215641350651464300474710ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.extensions.appengine.auth.oauth2; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import com.google.appengine.api.appidentity.AppIdentityService; import com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult; import com.google.appengine.api.appidentity.AppIdentityServiceFactory; import java.io.IOException; import java.util.Collection; import java.util.Collections; /** * OAuth 2.0 credential in which a client Google App Engine application needs to access data that it * owns, based on Asserting Identity to Google APIs * *

* Intercepts the request by using the access token obtained from * {@link AppIdentityService#getAccessToken(Iterable)}. *

* *

* Sample usage: *

* *
  public static HttpRequestFactory createRequestFactory(
      HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) {
    return transport.createRequestFactory(
        new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener"));
  }
 * 
* *

* Implementation is immutable and thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class AppIdentityCredential implements HttpRequestInitializer, HttpExecuteInterceptor { /** App Identity Service that provides the access token. */ private final AppIdentityService appIdentityService; /** OAuth scopes (unmodifiable). */ private final Collection scopes; /** * @param scopes OAuth scopes * @since 1.15 */ public AppIdentityCredential(Collection scopes) { this(new Builder(scopes)); } /** * @param builder builder * * @since 1.14 */ protected AppIdentityCredential(Builder builder) { // Lazily retrieved rather than setting as the default value in order to not add runtime // dependencies on AppIdentityServiceFactory unless it is actually being used. appIdentityService = builder.appIdentityService == null ? AppIdentityServiceFactory.getAppIdentityService() : builder.appIdentityService; scopes = builder.scopes; } @Override public void initialize(HttpRequest request) throws IOException { request.setInterceptor(this); } @Override public void intercept(HttpRequest request) throws IOException { String accessToken = appIdentityService.getAccessToken(scopes).getAccessToken(); BearerToken.authorizationHeaderAccessMethod().intercept(request, accessToken); } /** * Gets the App Identity Service that provides the access token. * * @since 1.12 */ public final AppIdentityService getAppIdentityService() { return appIdentityService; } /** * Gets the OAuth scopes (unmodifiable). * * @since 1.12 */ public final Collection getScopes() { return scopes; } /** * Builder for {@link AppIdentityCredential}. * *

* Implementation is not thread-safe. *

* * @since 1.12 */ public static class Builder { /** * App Identity Service that provides the access token or {@code null} to use * {@link AppIdentityServiceFactory#getAppIdentityService()}. */ AppIdentityService appIdentityService; /** OAuth scopes (unmodifiable). */ final Collection scopes; /** * Returns an instance of a new builder. * * @param scopes OAuth scopes * @since 1.15 */ public Builder(Collection scopes) { this.scopes = Collections.unmodifiableCollection(scopes); } /** * Returns the App Identity Service that provides the access token or {@code null} to use * {@link AppIdentityServiceFactory#getAppIdentityService()}. * * @since 1.14 */ public final AppIdentityService getAppIdentityService() { return appIdentityService; } /** * Sets the App Identity Service that provides the access token or {@code null} to use * {@link AppIdentityServiceFactory#getAppIdentityService()}. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setAppIdentityService(AppIdentityService appIdentityService) { this.appIdentityService = appIdentityService; return this; } /** * Returns a new {@link AppIdentityCredential}. */ public AppIdentityCredential build() { return new AppIdentityCredential(this); } /** * Returns the OAuth scopes (unmodifiable). * * @since 1.14 */ public final Collection getScopes() { return scopes; } } /** * {@link Beta}
* Credential wrapper for application identity that inherits from GoogleCredential. */ @Beta public static class AppEngineCredentialWrapper extends GoogleCredential { private final AppIdentityCredential appIdentity; private final boolean scopesRequired; /** * Constructs the wrapper using the default AppIdentityService. * * @param transport the transport for Http calls. * @param jsonFactory the factory for Json parsing and formatting. * @throws IOException if the credential cannot be created for the current environment, * such as when the AppIndentityService is not available. */ public AppEngineCredentialWrapper(HttpTransport transport, JsonFactory jsonFactory) throws IOException { // May be called via reflection to test whether running on App Engine, so fail even if // the type can be loaded but the service is not available. this(getCheckedAppIdentityCredential(), Preconditions.checkNotNull(transport), Preconditions.checkNotNull(jsonFactory)); } AppEngineCredentialWrapper( AppIdentityCredential appIdentity, HttpTransport transport, JsonFactory jsonFactory) { super(new GoogleCredential.Builder() .setRequestInitializer(appIdentity) .setTransport(transport) .setJsonFactory(jsonFactory)); this.appIdentity = appIdentity; Collection scopes = appIdentity.getScopes(); scopesRequired = (scopes == null || scopes.isEmpty()); } private static AppIdentityCredential getCheckedAppIdentityCredential() throws IOException { Collection emptyScopes = Collections.emptyList(); AppIdentityCredential appIdentity = new AppIdentityCredential(emptyScopes); // May be called via reflection to test whether running on App Engine, so fail even if // the type can be loaded but the service is not available. if (appIdentity.getAppIdentityService() == null) { throw new IOException("AppIdentityService not available."); } return appIdentity; } @Override public void intercept(HttpRequest request) throws IOException { appIdentity.intercept(request); } public boolean createScopedRequired() { return scopesRequired; } public GoogleCredential createScoped(Collection scopes) { return new AppEngineCredentialWrapper( new AppIdentityCredential.Builder(scopes) .setAppIdentityService(appIdentity.getAppIdentityService()) .build(), getTransport(), getJsonFactory()); } @Override protected TokenResponse executeRefreshToken() throws IOException { GetAccessTokenResult tokenResult = appIdentity.getAppIdentityService() .getAccessToken(appIdentity.getScopes()); TokenResponse response = new TokenResponse(); response.setAccessToken(tokenResult.getAccessToken()); long expiresInSeconds = (tokenResult.getExpirationTime().getTime() - System.currentTimeMillis()) / 1000; response.setExpiresInSeconds(expiresInSeconds); return response; } } } package-info.java000066400000000000000000000014051350651464300455600ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/* * Copyright 2012 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. */ /** * Google App Engine utilities for OAuth 2.0 for Google APIs. * * @since 1.7 * @author Yaniv Inbar */ package com.google.api.client.googleapis.extensions.appengine.auth.oauth2; notifications/000077500000000000000000000000001350651464300430775ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengineAppEngineNotificationServlet.java000066400000000000000000000055061350651464300515320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/* * Copyright 2013 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.api.client.googleapis.extensions.appengine.notifications; import com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory; import com.google.api.client.googleapis.extensions.servlet.notifications.WebhookUtils; import com.google.api.client.util.Beta; import com.google.api.client.util.store.DataStoreFactory; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * {@link Beta}
* Thread-safe Webhook App Engine Servlet to receive notifications. * *

* In order to use this servlet you need to register the servlet in your web.xml. You may optionally * extend {@link AppEngineNotificationServlet} with custom behavior. *

* *

* It is a simple wrapper around {@link WebhookUtils#processWebhookNotification(HttpServletRequest, * HttpServletResponse, DataStoreFactory)} that uses * {@link AppEngineDataStoreFactory#getDefaultInstance()}, so you may alternatively call that method * instead from your {@link HttpServlet#doPost} with no loss of functionality. *

* * Sample web.xml setup: * *
  {@literal <}servlet{@literal >}
      {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.appengine.notifications.AppEngineNotificationServlet{@literal <}/servlet-class{@literal >}
  {@literal <}/servlet{@literal >}
  {@literal <}servlet-mapping{@literal >}
      {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >}
  {@literal <}/servlet-mapping{@literal >}
 * 
* * @author Yaniv Inbar * @since 1.16 */ @Beta public class AppEngineNotificationServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebhookUtils.processWebhookNotification( req, resp, AppEngineDataStoreFactory.getDefaultInstance()); } } package-info.java000066400000000000000000000015701350651464300462710ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Support for subscribing to topics and receiving notifications on servlet-based platforms. * * @since 1.16 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.appengine.notifications; testing/000077500000000000000000000000001350651464300417035ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengineauth/000077500000000000000000000000001350651464300426445ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testingoauth2/000077500000000000000000000000001350651464300440465ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/authMockAppIdentityService.java000066400000000000000000000047431350651464300513060ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/* * Copyright 2014 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.api.client.googleapis.extensions.appengine.testing.auth.oauth2; import com.google.api.client.util.Beta; import com.google.appengine.api.appidentity.AppIdentityService; import com.google.appengine.api.appidentity.AppIdentityServiceFailureException; import com.google.appengine.api.appidentity.PublicCertificate; import java.util.Collection; import java.util.Date; /** * {@link Beta}
* Mock implementation of AppIdentityService interface for testing. * * @since 1.19 */ @Beta public class MockAppIdentityService implements AppIdentityService { private int getAccessTokenCallCount = 0; private String accessTokenText = null; public MockAppIdentityService() { } public int getGetAccessTokenCallCount() { return getAccessTokenCallCount; } public String getAccessTokenText() { return accessTokenText; } public void setAccessTokenText(String text) { accessTokenText = text; } @Override public SigningResult signForApp(byte[] signBlob) { return null; } @Override public Collection getPublicCertificatesForApp() { return null; } @Override public GetAccessTokenResult getAccessToken(Iterable scopes) { getAccessTokenCallCount++; int scopeCount = 0; for (String scope : scopes) { if (scope != null) { scopeCount++; } } if (scopeCount == 0) { throw new AppIdentityServiceFailureException("No scopes specified."); } return new GetAccessTokenResult(accessTokenText, new Date(System.currentTimeMillis() + 3600000)); } @Override public GetAccessTokenResult getAccessTokenUncached(Iterable scopes) { return null; } @Override public String getServiceAccountName() { return null; } @Override public ParsedAppId parseFullAppId(String fullAppId) { return null; } @Override public String getDefaultGcsBucketName() { return null; } } package-info.java000066400000000000000000000015721350651464300472420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/testing/auth/oauth2/* * Copyright 2014 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.extensions.appengine.auth.oauth2} * package. * * @since 1.19 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.appengine.testing.auth.oauth2; google-api-java-client-1.27.1/google-api-client-appengine/src/test/000077500000000000000000000000001350651464300250405ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/000077500000000000000000000000001350651464300257615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/000077500000000000000000000000001350651464300265375ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/000077500000000000000000000000001350651464300300135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/000077500000000000000000000000001350651464300305645ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/000077500000000000000000000000001350651464300320425ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300341145ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/clientextensions/000077500000000000000000000000001350651464300363135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/googleapisappengine/000077500000000000000000000000001350651464300402615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensionsauth/000077500000000000000000000000001350651464300412225ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengineoauth2/000077500000000000000000000000001350651464300424245ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/authAppIdentityCredentialTest.java000066400000000000000000000133331350651464300503570ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-appengine/src/test/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/* * Copyright 2013 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.api.client.googleapis.extensions.appengine.auth.oauth2; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.extensions.appengine.testing.auth.oauth2.MockAppIdentityService; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import junit.framework.TestCase; /** * Tests {@link AppIdentityCredential}. * * @author Yaniv Inbar */ public class AppIdentityCredentialTest extends TestCase { private static final Collection SCOPES = Collections.unmodifiableCollection(Arrays.asList("scope1", "scope2")); public void testBuilder() { String[] scopes = SCOPES.toArray(new String[SCOPES.size()]); AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(SCOPES); scopes[1] = "somethingelse"; assertTrue(Arrays.deepEquals(SCOPES.toArray(), builder.getScopes().toArray())); AppIdentityCredential credential = builder.build(); assertTrue(Arrays.deepEquals(SCOPES.toArray(), credential.getScopes().toArray())); } public void testUsesAppIdentityService() throws IOException { final String expectedAccessToken = "ExpectedAccessToken"; MockAppIdentityService appIdentity = new MockAppIdentityService(); appIdentity.setAccessTokenText(expectedAccessToken); AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(SCOPES); builder.setAppIdentityService(appIdentity); AppIdentityCredential appCredential = builder.build(); HttpTransport transport = new MockHttpTransport(); HttpRequest request = transport.createRequestFactory().buildRequest( "get", null, null); appCredential.intercept(request); assertEquals(1, appIdentity.getGetAccessTokenCallCount()); HttpHeaders headers = request.getHeaders(); String authHeader = headers.getAuthorization(); Boolean headerContainsToken = authHeader.contains(expectedAccessToken); assertTrue(headerContainsToken); } public void testAppEngineCredentialWrapper() throws IOException { final String expectedAccessToken = "ExpectedAccessToken"; final Collection emptyScopes = Collections.emptyList(); HttpTransport transport = new MockHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); MockAppIdentityService appIdentity = new MockAppIdentityService(); appIdentity.setAccessTokenText(expectedAccessToken); AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(emptyScopes); builder.setAppIdentityService(appIdentity); AppIdentityCredential appCredential = builder.build(); GoogleCredential wrapper = new AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory); HttpRequest request = transport.createRequestFactory().buildRequest("get", null, null); assertTrue(wrapper.createScopedRequired()); try { wrapper.intercept(request); fail("Should not be able to use credential without scopes."); } catch (Exception expected) { } assertEquals(1, appIdentity.getGetAccessTokenCallCount()); GoogleCredential scopedWrapper = wrapper.createScoped(SCOPES); assertNotSame(wrapper, scopedWrapper); scopedWrapper.intercept(request); assertEquals(2, appIdentity.getGetAccessTokenCallCount()); HttpHeaders headers = request.getHeaders(); String authHeader = headers.getAuthorization(); assertTrue(authHeader.contains(expectedAccessToken)); } public void testAppEngineCredentialWrapperGetAccessToken() throws IOException { final String expectedAccessToken = "ExpectedAccessToken"; HttpTransport transport = new MockHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); MockAppIdentityService appIdentity = new MockAppIdentityService(); appIdentity.setAccessTokenText(expectedAccessToken); AppIdentityCredential.Builder builder = new AppIdentityCredential.Builder(SCOPES); builder.setAppIdentityService(appIdentity); AppIdentityCredential appCredential = builder.build(); GoogleCredential wrapper = new AppIdentityCredential.AppEngineCredentialWrapper(appCredential, transport, jsonFactory); assertTrue(wrapper.refreshToken()); assertEquals(expectedAccessToken, wrapper.getAccessToken()); } public void testAppEngineCredentialWrapperNullTransportThrows() throws IOException { JsonFactory jsonFactory = new JacksonFactory(); try { new AppIdentityCredential.AppEngineCredentialWrapper(null, jsonFactory); fail(); } catch (NullPointerException expected) { } } public void testAppEngineCredentialWrapperNullJsonFactoryThrows() throws IOException { HttpTransport transport = new MockHttpTransport(); try { new AppIdentityCredential.AppEngineCredentialWrapper(transport, null); fail(); } catch (NullPointerException expected) { } } } google-api-java-client-1.27.1/google-api-client-assembly/000077500000000000000000000000001350651464300231435ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/LICENSE.txt000066400000000000000000000261361350651464300247760ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. google-api-java-client-1.27.1/google-api-client-assembly/android-properties/000077500000000000000000000000001350651464300267555ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/android-properties/gson-2.1.jar.properties000066400000000000000000000000751350651464300331140ustar00rootroot00000000000000src=../libs-sources/gson-${project.gson.version}-sources.jar jackson-core-2.9.2.jar.properties000066400000000000000000000001161350651464300346110ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/android-propertiessrc=../libs-sources/jackson-core-${project.jackson-core2.version}-sources.jar jackson-core-asl-1.9.11.jar.properties000066400000000000000000000001251350651464300354450ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/android-propertiessrc=../libs-sources/jackson-core-asl-${project.jackson-core-asl.version}-sources.jar protobuf-java-2.4.1.jar.properties000066400000000000000000000001171350651464300350050ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/android-propertiessrc=../libs-sources/protobuf-java-${project.protobuf-java.version}-sources.jar google-api-java-client-1.27.1/google-api-client-assembly/assembly.xml000066400000000000000000000136451350651464300255150ustar00rootroot00000000000000 ${project.version} false zip LICENSE.txt google-api-java-client classpath-include true google-api-java-client proguard-google-api-client.txt google-api-java-client readme.html true google-api-java-client properties/google-api-client.jar.properties google-api-client-${project.version}.jar.properties google-api-java-client/libs true properties/google-api-client-android.jar.properties google-api-client-android-${project.version}.jar.properties google-api-java-client/libs true properties/google-api-client-gson.jar.properties google-api-client-gson-${project.version}.jar.properties google-api-java-client/libs true properties/google-api-client-jackson2.jar.properties google-api-client-jackson2-${project.version}.jar.properties google-api-java-client/libs true properties/google-api-client-protobuf.jar.properties google-api-client-protobuf-${project.version}.jar.properties google-api-java-client/libs true properties/google-api-client-xml.jar.properties google-api-client-xml-${project.version}.jar.properties google-api-java-client/libs true properties/google-http-client.jar.properties google-http-client-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-android.jar.properties google-http-client-android-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-gson.jar.properties google-http-client-gson-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-jackson.jar.properties google-http-client-jackson-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-jackson2.jar.properties google-http-client-jackson2-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-jdo.jar.properties google-http-client-jdo-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-protobuf.jar.properties google-http-client-protobuf-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-http-client-xml.jar.properties google-http-client-xml-${project.http.version}.jar.properties google-api-java-client/libs true properties/google-oauth-client.jar.properties google-oauth-client-${project.oauth.version}.jar.properties google-api-java-client/libs true dependencies google-api-java-client/dependencies true target/libs *.pom google-api-java-client/libs android-properties google-api-java-client/libs true target/libs-sources google-api-java-client/libs-sources google-api-java-client-1.27.1/google-api-client-assembly/classpath-include000066400000000000000000000136311350651464300264750ustar00rootroot00000000000000 google-api-java-client-1.27.1/google-api-client-assembly/dependencies/000077500000000000000000000000001350651464300255715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies/APACHE-LICENSE.txt000066400000000000000000000264501350651464300303420ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. google-api-java-client-1.27.1/google-api-client-assembly/dependencies/BSD-LICENSE.txt000066400000000000000000000027411350651464300300260ustar00rootroot00000000000000BSD License Copyright 2000-2006, www.hamcrest.org All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Hamcrest nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. google-api-java-client-1.27.1/google-api-client-assembly/dependencies/CDDL-LICENSE.txt000066400000000000000000000406161350651464300301270ustar00rootroot00000000000000COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 1. Definitions. 1.1. Contributor means each individual or entity that creates or contributes to the creation of Modifications. 1.2. Contributor Version means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. 1.3. Covered Software means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. 1.4. Executable means the Covered Software in any form other than Source Code. 1.5. Initial Developer means the individual or entity that first makes Original Software available under this License. 1.6. Larger Work means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. 1.7. License means this document. 1.8. Licensable means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9. Modifications means the Source Code and Executable form of any of the following: A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; B. Any new file that contains any part of the Original Software or previous Modification; or C. Any new file that is contributed or otherwise made available under the terms of this License. 1.10. Original Software means the Source Code and Executable form of computer software code that is originally released under this License. 1.11. Patent Claims means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.12. Source Code means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. 1.13. You (or Your) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, You includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, control means (a)áthe power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b)áownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants. 2.1. The Initial Developer Grant. Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). (c) The licenses granted in Sectionsá2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. (d) Notwithstanding Sectioná2.1(b) above, no patent license is granted: (1)áfor code that You delete from the Original Software, or (2)áfor infringements caused by: (i)áthe modification of the Original Software, or (ii)áthe combination of the Original Software with other software or devices. 2.2. Contributor Grant. Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1)áModifications made by that Contributor (or portions thereof); and (2)áthe combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) The licenses granted in Sectionsá2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. (d) Notwithstanding Sectioná2.2(b) above, no patent license is granted: (1)áfor any code that Contributor has deleted from the Contributor Version; (2)áfor infringements caused by: (i)áthird party modifications of Contributor Version, or (ii)áthe combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3)áunder Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1. Availability of Source Code. Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. 3.2. Modifications. The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. 3.3. Required Notices. You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. 3.4. Application of Additional Terms. You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.5. Distribution of Executable Versions. You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipients rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 3.6. Larger Works. You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. 4. Versions of the License. 4.1. New Versions. Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. 4.2. Effect of New Versions. You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. 4.3. Modified Versions. When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a)árename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b)áotherwise make it clear that the license contains terms which differ from this License. 5. DISCLAIMER OF WARRANTY. COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 6. TERMINATION. 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as Participant) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sectionsá2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. 6.3. In the event of termination under Sectionsá6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. 7. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 8. U.S. GOVERNMENT END USERS. The Covered Software is a commercial item, as that term is defined in 48áC.F.R.á2.101 (Oct. 1995), consisting of commercial computer software (as that term is defined at 48 C.F.R. á252.227-7014(a)(1)) and commercial computer software documentation as such terms are used in 48áC.F.R.á12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. 9. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictions conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. 10. RESPONSIBILITY FOR CLAIMS. As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) The GlassFish code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. google-api-java-client-1.27.1/google-api-client-assembly/dependencies/css/000077500000000000000000000000001350651464300263615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies/css/maven-base.css000066400000000000000000000046361350651464300311220ustar00rootroot00000000000000body { margin: 0px; padding: 0px; } img { border:none; } table { padding:0px; width: 100%; margin-left: -2px; margin-right: -2px; } acronym { cursor: help; border-bottom: 1px dotted #feb; } table.bodyTable th, table.bodyTable td { padding: 2px 4px 2px 4px; vertical-align: top; } div.clear{ clear:both; visibility: hidden; } div.clear hr{ display: none; } #bannerLeft, #bannerRight { font-size: xx-large; font-weight: bold; } #bannerLeft img, #bannerRight img { margin: 0px; } .xleft, #bannerLeft img { float:left; } .xright, #bannerRight { float:right; } #banner { padding: 0px; } #banner img { border: none; } #breadcrumbs { padding: 3px 10px 3px 10px; } #leftColumn { width: 170px; float:left; overflow: auto; } #bodyColumn { margin-right: 1.5em; margin-left: 197px; } #legend { padding: 8px 0 8px 0; } #navcolumn { padding: 8px 4px 0 8px; } #navcolumn h5 { margin: 0; padding: 0; font-size: small; } #navcolumn ul { margin: 0; padding: 0; font-size: small; } #navcolumn li { list-style-type: none; background-image: none; background-repeat: no-repeat; background-position: 0 0.4em; padding-left: 16px; list-style-position: outside; line-height: 1.2em; font-size: smaller; } #navcolumn li.expanded { background-image: url(../images/expanded.gif); } #navcolumn li.collapsed { background-image: url(../images/collapsed.gif); } #poweredBy { text-align: center; } #navcolumn img { margin-top: 10px; margin-bottom: 3px; } #poweredBy img { display:block; margin: 20px 0 20px 17px; } #search img { margin: 0px; display: block; } #search #q, #search #btnG { border: 1px solid #999; margin-bottom:10px; } #search form { margin: 0px; } #lastPublished { font-size: x-small; } .navSection { margin-bottom: 2px; padding: 8px; } .navSectionHead { font-weight: bold; font-size: x-small; } .section { padding: 4px; } #footer { padding: 3px 10px 3px 10px; font-size: x-small; } #breadcrumbs { font-size: x-small; margin: 0pt; } .source { padding: 12px; margin: 1em 7px 1em 7px; } .source pre { margin: 0px; padding: 0px; } #navcolumn img.imageLink, .imageLink { padding-left: 0px; padding-bottom: 0px; padding-top: 0px; padding-right: 2px; border: 0px; margin: 0px; } google-api-java-client-1.27.1/google-api-client-assembly/dependencies/css/maven-theme.css000066400000000000000000000053611350651464300313060ustar00rootroot00000000000000body { padding: 0px 0px 10px 0px; } body, td, select, input, li{ font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; } code{ font-family: Courier, monospace; font-size: 13px; } a { text-decoration: none; } a:link { color:#36a; } a:visited { color:#47a; } a:active, a:hover { color:#69c; } #legend li.externalLink { background: url(../images/external.png) left top no-repeat; padding-left: 18px; } a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { background: url(../images/external.png) right center no-repeat; padding-right: 18px; } #legend li.newWindow { background: url(../images/newwindow.png) left top no-repeat; padding-left: 18px; } a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { background: url(../images/newwindow.png) right center no-repeat; padding-right: 18px; } h2 { padding: 4px 4px 4px 6px; border: 1px solid #999; color: #900; background-color: #ddd; font-weight:900; font-size: x-large; } h3 { padding: 4px 4px 4px 6px; border: 1px solid #aaa; color: #900; background-color: #eee; font-weight: normal; font-size: large; } h4 { padding: 4px 4px 4px 6px; border: 1px solid #bbb; color: #900; background-color: #fff; font-weight: normal; font-size: large; } h5 { padding: 4px 4px 4px 6px; color: #900; font-size: normal; } p { line-height: 1.3em; font-size: small; } #breadcrumbs { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; background-color: #ccc; } #leftColumn { margin: 10px 0 0 5px; border: 1px solid #999; background-color: #eee; } #navcolumn h5 { font-size: smaller; border-bottom: 1px solid #aaaaaa; padding-top: 2px; color: #000; } table.bodyTable th { color: white; background-color: #bbb; text-align: left; font-weight: bold; } table.bodyTable th, table.bodyTable td { font-size: 1em; } table.bodyTable tr.a { background-color: #ddd; } table.bodyTable tr.b { background-color: #eee; } .source { border: 1px solid #999; } dl { padding: 4px 4px 4px 6px; border: 1px solid #aaa; background-color: #ffc; } dt { color: #900; } #organizationLogo img, #projectLogo img, #projectLogo span{ margin: 8px; } #banner { border-bottom: 1px solid #fff; } .errormark, .warningmark, .donemark, .infomark { background: url(../images/icon_error_sml.gif) no-repeat; } .warningmark { background-image: url(../images/icon_warning_sml.gif); } .donemark { background-image: url(../images/icon_success_sml.gif); } .infomark { background-image: url(../images/icon_info_sml.gif); } google-api-java-client-1.27.1/google-api-client-assembly/dependencies/css/print.css000066400000000000000000000003361350651464300302310ustar00rootroot00000000000000#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { display: none !important; } #bodyColumn, body.docs div.docs { margin: 0 !important; border: none !important } google-api-java-client-1.27.1/google-api-client-assembly/dependencies/css/site.css000066400000000000000000000000651350651464300300400ustar00rootroot00000000000000/* You can override this file with your own styles */google-api-client-android-dependencies.html000066400000000000000000001100211350651464300357340ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-android ${project.http.version} jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.android android 4.1.1.4 jar Apache 2.0
com.google.android.google-play-services google-play-services 1 jar -

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.1.1 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
org.json json 20080701 jar provided without support or warranty
org.khronos opengl-api gl1.1-android-2.1_r1 jar Apache 2.0
xerces xmlParserAPIs 2.6.2 jar -
xpp3 xpp3 1.1.4c jar Indiana University Extreme! Lab Software License, vesion 1.1.1-Public Domain-Apache Software License, version 1.1

Project Dependency Graph

Dependency Tree

Licenses

Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Unknown: google-play-services, xmlParserAPIs

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

provided without support or warranty: JSON (JavaScript Object Notation)

Apache 2.0: Google Android Java ME Library (Khronos), Google Android Library

The Apache Software License, Version 2.0: Android Platform Extensions to the Google APIs Client Library for Java., Android Platform Extensions to the Google HTTP Client Library for Java., Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core

Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
android-4.1.1.4.jar 12.35 MB 7,264 1,698 71 1.5 debug
google-play-services-1.jar 836.03 kB 808 776 21 1.6 release
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-android-${project.http.version}.jar 11.86 kB 21 11 3 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.1.1.jar 59.26 kB 42 28 2 1.1 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
json-20080701.jar 36.99 kB 26 17 1 1.3 debug
opengl-api-gl1.1-android-2.1_r1.jar 18.06 kB 25 13 2 1.5 debug
xmlParserAPIs-2.6.2.jar 121.80 kB 238 207 17 1.1 release
xpp3-1.1.4c.jar 117.25 kB 78 56 13 1.1 debug
Total Size Entries Classes Packages JDK Rev Debug
19 18.01 MB 12,007 5,945 252 1.6 17
compile: 13 compile: 4.56 MB compile: 3,568 compile: 3,178 compile: 127 - compile: 13
provided: 6 provided: 13.45 MB provided: 8,439 provided: 2,767 provided: 125 - provided: 4

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.android:android:jar:4.1.1.4 - - -
com.google.android.google-play-services:google-play-services:jar:1 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-android:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.1.1 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
org.json:json:jar:20080701 - - -
org.khronos:opengl-api:jar:gl1.1-android-2.1_r1 - - -
xerces:xmlParserAPIs:jar:2.6.2 - - -
xpp3:xpp3:jar:1.1.4c - - -
Total apache.snapshots sonatype-nexus-snapshots central
19 (compile: 13, provided: 6) 0 0 0

google-api-client-appengine-dependencies.html000066400000000000000000001317351350651464300363010ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.api-client google-api-client-servlet ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-appengine ${project.http.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client-appengine ${project.oauth.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-labs 1.7.7 jar Google App Engine Terms of Service
com.google.appengine appengine-api-stubs 1.7.7 jar Google App Engine Terms of Service
com.google.appengine appengine-testing 1.7.7 jar Google App Engine Terms of Service
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-1.0-sdk 1.7.7 jar Google App Engine Terms of Service

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jdo ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client-servlet ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
javax.jdo jdo2-api 2.3-eb jar Apache 2
javax.servlet servlet-api 2.5 jar -
javax.transaction transaction-api 1.1 jar -
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Google App Engine Terms of Service: appengine-api-1.0-sdk, appengine-api-labs, appengine-api-stubs, appengine-testing

Apache 2: JDO2 API

Unknown: servlet-api, transaction-api

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google App Engine extensions to the Google API Client Library for Java., Google App Engine extensions to the Google HTTP Client Library for Java., Google App Engine extensions to the Google OAuth Client Library for Java., Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Servlet and JDO extensions to the Google API Client Library for Java., Servlet and JDO extensions to the Google OAuth Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
google-api-client-servlet-${project.version}.jar 6.69 kB 14 4 1 1.6 debug
appengine-api-1.0-sdk-1.7.7.jar 30.66 MB 6,566 6,044 86 1.6 debug
appengine-api-labs-1.7.7.jar 10.94 MB 1,448 1,374 10 1.6 debug
appengine-api-stubs-1.7.7.jar 12.16 MB 3,098 2,785 167 1.6 debug
appengine-testing-1.7.7.jar 10.32 MB 2,293 2,265 26 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-appengine-${project.http.version}.jar 15.81 kB 21 11 2 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
google-http-client-jdo-${project.http.version}.jar 8.08 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
google-oauth-client-appengine-${project.oauth.version}.jar 8.37 kB 17 7 2 1.6 debug
google-oauth-client-servlet-${project.oauth.version}.jar 22.92 kB 24 11 4 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
jdo2-api-2.3-eb.jar 188.18 kB 226 182 7 1.5 debug
servlet-api-2.5.jar 102.65 kB 68 42 2 1.5 debug
transaction-api-1.1.jar 14.72 kB 24 18 2 1.3 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
25 69.21 MB 17,626 16,145 464 1.6 25
compile: 17 compile: 2.27 MB compile: 1,967 compile: 1,523 compile: 115 - compile: 17
test: 7 test: 36.28 MB test: 9,093 test: 8,578 test: 263 - test: 7
provided: 1 provided: 30.66 MB provided: 6,566 provided: 6,044 provided: 86 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.api-client:google-api-client-servlet:jar:${project.version} - - -
com.google.appengine:appengine-api-1.0-sdk:jar:1.7.7 - - -
com.google.appengine:appengine-api-labs:jar:1.7.7 - - -
com.google.appengine:appengine-api-stubs:jar:1.7.7 - - -
com.google.appengine:appengine-testing:jar:1.7.7 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-appengine:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jdo:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
com.google.oauth-client:google-oauth-client-appengine:jar:${project.oauth.version} - - -
com.google.oauth-client:google-oauth-client-servlet:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
javax.jdo:jdo2-api:jar:2.3-eb - - -
javax.servlet:servlet-api:jar:2.5 - - -
javax.transaction:transaction-api:jar:1.1 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
25 (compile: 17, test: 7, provided: 1) 0 0 0

google-api-client-dependencies.html000066400000000000000000000775751350651464300343500ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client-gson ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-protobuf ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.code.gson gson 2.1 jar The Apache Software License, Version 2.0
com.google.protobuf protobuf-java 2.6.1 jar New BSD license

Project Dependency Graph

Dependency Tree

Licenses

New BSD license: Protocol Buffer Java API

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, GSON extensions to the Google HTTP Client Library for Java., Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Gson, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Protocol Buffer extensions to the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
gson-2.1.jar 175.89 kB 158 148 6 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-gson-${project.http.version}.jar 8.40 kB 14 6 1 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
google-http-client-protobuf-${project.http.version}.jar 5.17 kB 14 5 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
protobuf-java-2.6.1.jar 582.66 kB 286 276 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
16 5.29 MB 4,125 3,706 142 1.6 16
compile: 10 compile: 4.09 MB compile: 3,168 compile: 2,965 compile: 96 - compile: 10
test: 5 test: 1,003.90 kB test: 739 test: 665 test: 40 - test: 5
provided: 1 provided: 227.32 kB provided: 218 provided: 76 provided: 6 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.code.gson:gson:jar:2.1 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-gson:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.http-client:google-http-client-protobuf:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
com.google.protobuf:protobuf-java:jar:2.6.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
16 (compile: 10, test: 5, provided: 1) 0 0 0

google-api-client-gson-dependencies.html000066400000000000000000000672111350651464300352760ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-gson ${project.http.version} jar The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.code.gson gson 2.1 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, GSON extensions to the Google APIs Client Library for Java, GSON extensions to the Google HTTP Client Library for Java., Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Gson, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
gson-2.1.jar 175.89 kB 158 148 6 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-gson-${project.http.version}.jar 8.40 kB 14 6 1 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
14 4.73 MB 3,719 3,321 131 1.6 14
compile: 14 compile: 4.73 MB compile: 3,719 compile: 3,321 compile: 131 - compile: 14

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.code.gson:gson:jar:2.1 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-gson:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
14 (compile: 14) 0 0 0

google-api-client-jackson2-dependencies.html000066400000000000000000000614361350651464300360450ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google APIs Client Library for Java, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
12 4.55 MB 3,547 3,167 124 1.6 12
compile: 12 compile: 4.55 MB compile: 3,547 compile: 3,167 compile: 124 - compile: 12

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
12 (compile: 12) 0 0 0

google-api-client-java6-dependencies.html000066400000000000000000000704411350651464300353360ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client-java6 ${project.oauth.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Java 6 (and higher) Extensions to the Google API Client Library for Java., Java 6 (and higher) extensions to the Google OAuth Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
google-oauth-client-java6-${project.oauth.version}.jar 12.66 kB 18 8 1 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
14 4.79 MB 3,832 3,405 155 1.6 14
compile: 13 compile: 4.56 MB compile: 3,565 compile: 3,175 compile: 125 - compile: 13
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
com.google.oauth-client:google-oauth-client-java6:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
14 (compile: 13, test: 1) 0 0 0

google-api-client-protobuf-dependencies.html000066400000000000000000000732471350651464300361760ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-protobuf ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
com.google.protobuf protobuf-java 2.6.1 jar New BSD license
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

New BSD license: Protocol Buffer Java API

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Protocol Buffer extensions to the Google APIs Client Library for Java, Protocol Buffer extensions to the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
google-http-client-protobuf-${project.http.version}.jar 5.17 kB 14 5 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
protobuf-java-2.6.1.jar 582.66 kB 286 276 1 1.5 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
15 5.35 MB 4,114 3,678 157 1.6 15
compile: 14 compile: 5.13 MB compile: 3,847 compile: 3,448 compile: 127 - compile: 14
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.http-client:google-http-client-protobuf:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
com.google.protobuf:protobuf-java:jar:2.6.1 - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
15 (compile: 14, test: 1) 0 0 0

google-api-client-servlet-dependencies.html000066400000000000000000001021541350651464300360100ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client-servlet ${project.oauth.version} jar The Apache Software License, Version 2.0
javax.jdo jdo2-api 2.3-eb jar Apache 2
javax.servlet servlet-api 2.5 jar -

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jdo ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
javax.transaction transaction-api 1.1 jar -
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache 2: JDO2 API

Unknown: servlet-api, transaction-api

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Servlet and JDO extensions to the Google API Client Library for Java., Servlet and JDO extensions to the Google OAuth Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
google-http-client-jdo-${project.http.version}.jar 8.08 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
google-oauth-client-servlet-${project.oauth.version}.jar 22.92 kB 24 11 4 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
jdo2-api-2.3-eb.jar 188.18 kB 226 182 7 1.5 debug
servlet-api-2.5.jar 102.65 kB 68 42 2 1.5 debug
transaction-api-1.1.jar 14.72 kB 24 18 2 1.3 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
18 5.11 MB 4,169 3,655 170 1.6 18
compile: 17 compile: 4.88 MB compile: 3,902 compile: 3,425 compile: 140 - compile: 17
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jdo:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
com.google.oauth-client:google-oauth-client-servlet:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
javax.jdo:jdo2-api:jar:2.3-eb - - -
javax.servlet:servlet-api:jar:2.5 - - -
javax.transaction:transaction-api:jar:1.1 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
Total apache.snapshots sonatype-nexus-snapshots central
18 (compile: 17, test: 1) 0 0 0

google-api-client-xml-dependencies.html000066400000000000000000000746361350651464300351410ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.api-client google-api-client ${project.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-xml ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson2 ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.10 jar Apache License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.5 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.9 jar Apache License, Version 2.0
xpp3 xpp3 1.1.4c jar Indiana University Extreme! Lab Software License, vesion 1.1.1-Public Domain-Apache Software License, version 1.1

Project Dependency Graph

Dependency Tree

Licenses

Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Apache License, Version 2.0: Apache Commons Codec, Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, FindBugs-jsr305, Google APIs Client Library for Java, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, XML extensions to the Google APIs Client Library for Java, XML extensions to the Google HTTP Client Library for Java.

Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
google-api-client-${project.version}.jar 199.67 kB 141 110 22 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson2-${project.http.version}.jar 6.58 kB 13 5 1 1.6 debug
google-http-client-xml-${project.http.version}.jar 28.52 kB 28 17 4 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.10.jar 277.52 kB 238 92 6 1.6 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.5.jar 748.17 kB 508 467 24 1.6 debug
httpcore-4.4.9.jar 317.87 kB 282 252 17 1.6 debug
xpp3-1.1.4c.jar 117.25 kB 78 56 13 1.1 debug
Total Size Entries Classes Packages JDK Rev Debug
15 4.92 MB 3,920 3,470 171 1.6 15
compile: 14 compile: 4.69 MB compile: 3,653 compile: 3,240 compile: 141 - compile: 14
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.api-client:google-api-client:jar:${project.version} - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson2:jar:${project.http.version} - - -
com.google.http-client:google-http-client-xml:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.10 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.5 - - -
org.apache.httpcomponents:httpcore:jar:4.4.9 - - -
xpp3:xpp3:jar:1.1.4c - - -
Total apache.snapshots sonatype-nexus-snapshots central
15 (compile: 14, test: 1) 0 0 0

google-http-client-android-dependencies.html000066400000000000000000000630001350651464300361460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.android android 4.1.1.4 jar Apache 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.1.1 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
org.json json 20080701 jar provided without support or warranty
org.khronos opengl-api gl1.1-android-2.1_r1 jar Apache 2.0
xerces xmlParserAPIs 2.6.2 jar -
xpp3 xpp3 1.1.4c jar Indiana University Extreme! Lab Software License, vesion 1.1.1-Public Domain-Apache Software License, version 1.1

Project Dependency Graph

Dependency Tree

Licenses

Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Unknown: xmlParserAPIs

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

provided without support or warranty: JSON (JavaScript Object Notation)

Apache 2.0: Google Android Java ME Library (Khronos), Google Android Library

The Apache Software License, Version 2.0: Android Platform Extensions to the Google HTTP Client Library for Java., Commons Codec, Commons Logging, FindBugs-jsr305, Google HTTP Client Library for Java, J2ObjC Annotations

Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
android-4.1.1.4.jar 12.35 MB 7,264 1,698 71 1.5 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.1.1.jar 59.26 kB 42 28 2 1.1 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
json-20080701.jar 36.99 kB 26 17 1 1.3 debug
opengl-api-gl1.1-android-2.1_r1.jar 18.06 kB 25 13 2 1.5 debug
xmlParserAPIs-2.6.2.jar 121.80 kB 238 207 17 1.1 release
xpp3-1.1.4c.jar 117.25 kB 78 56 13 1.1 debug
Total Size Entries Classes Packages JDK Rev Debug
12 14.22 MB 8,972 3,060 173 1.6 11
compile: 7 compile: 1.58 MB compile: 1,341 compile: 1,069 compile: 69 - compile: 7
provided: 5 provided: 12.64 MB provided: 7,631 provided: 1,991 provided: 104 - provided: 4

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.android:android:jar:4.1.1.4 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.1.1 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
org.json:json:jar:20080701 - - -
org.khronos:opengl-api:jar:gl1.1-android-2.1_r1 - - -
xerces:xmlParserAPIs:jar:2.6.2 - - -
xpp3:xpp3:jar:1.1.4c - - -
Total apache.snapshots sonatype-nexus-snapshots central
12 (compile: 7, provided: 5) 0 0 0

google-http-client-appengine-dependencies.html000066400000000000000000000655661350651464300365170ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-stubs 1.7.7 jar Google App Engine Terms of Service
com.google.appengine appengine-testing 1.7.7 jar Google App Engine Terms of Service
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-test ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-1.0-sdk 1.7.7 jar Google App Engine Terms of Service

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Google App Engine Terms of Service: appengine-api-1.0-sdk, appengine-api-stubs, appengine-testing

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google App Engine extensions to the Google HTTP Client Library for Java., Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
appengine-api-1.0-sdk-1.7.7.jar 30.66 MB 6,566 6,044 86 1.6 debug
appengine-api-stubs-1.7.7.jar 12.16 MB 3,098 2,785 167 1.6 debug
appengine-testing-1.7.7.jar 10.32 MB 2,293 2,265 26 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-test-${project.http.version}.jar 51.73 kB 59 49 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
13 57.33 MB 15,468 14,256 398 1.6 13
compile: 7 compile: 1.59 MB compile: 1,341 compile: 1,069 compile: 69 - compile: 7
test: 5 test: 25.08 MB test: 7,561 test: 7,143 test: 243 - test: 5
provided: 1 provided: 30.66 MB provided: 6,566 provided: 6,044 provided: 86 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.appengine:appengine-api-1.0-sdk:jar:1.7.7 - - -
com.google.appengine:appengine-api-stubs:jar:1.7.7 - - -
com.google.appengine:appengine-testing:jar:1.7.7 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-test:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
Total apache.snapshots sonatype-nexus-snapshots central
13 (compile: 7, test: 5, provided: 1) 0 0 0

google-http-client-dependencies.html000066400000000000000000001006561350651464300345410ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava-testlib 20.0 jar The Apache Software License, Version 2.0
com.google.truth truth 0.40 jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0
org.mockito mockito-all 1.9.0 jar The MIT License

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.android android 1.5_r4 jar Apache 2.0
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
commons-logging commons-logging 1.1.1 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.errorprone error_prone_annotations 2.0.12 jar Apache 2.0
com.googlecode.java-diff-utils diffutils 1.3.0 jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
org.khronos opengl-api gl1.1-android-2.1_r1 jar Apache 2.0
xerces xmlParserAPIs 2.6.2 jar -
xpp3 xpp3 1.1.4c jar Indiana University Extreme! Lab Software License, vesion 1.1.1-Public Domain-Apache Software License, version 1.1

Project Dependency Graph

Dependency Tree

Licenses

Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Unknown: xmlParserAPIs

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

Apache 2.0: Google Android Java ME Library (Khronos), Google Android Library, error-prone annotations

The Apache Software License, Version 2.0: Commons Codec, Commons Logging, FindBugs-jsr305, Google HTTP Client Library for Java, Guava Testing Library, Guava: Google Core Libraries for Java, J2ObjC Annotations, Truth Core, java-diff-utils

The MIT License: Mockito

Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
android-1.5_r4.jar 2.04 MB 1,894 965 41 1.5 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
error_prone_annotations-2.0.12.jar 10.06 kB 28 16 2 1.6 release
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
guava-testlib-20.0.jar 748.27 kB 595 574 7 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
truth-0.40.jar 196.26 kB 150 139 1 1.6 debug
diffutils-1.3.0.jar 33.33 kB 35 26 2 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.1.1.jar 59.26 kB 42 28 2 1.1 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
opengl-api-gl1.1-android-2.1_r1.jar 18.06 kB 25 13 2 1.5 debug
mockito-all-1.9.0.jar 1.43 MB 1,279 654 66 1.5 debug
xmlParserAPIs-2.6.2.jar 121.80 kB 238 207 17 1.1 release
xpp3-1.1.4c.jar 117.25 kB 78 56 13 1.1 debug
Total Size Entries Classes Packages JDK Rev Debug
17 8.56 MB 7,551 5,563 252 1.6 15
compile: 5 compile: 1.11 MB compile: 900 compile: 793 compile: 47 - compile: 5
test: 6 test: 2.62 MB test: 2,354 test: 1,639 test: 108 - test: 5
provided: 6 provided: 4.84 MB provided: 4,297 provided: 3,131 provided: 97 - provided: 5

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.android:android:jar:1.5_r4 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.errorprone:error_prone_annotations:jar:2.0.12 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.guava:guava-testlib:jar:20.0 - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.truth:truth:jar:0.40 - - -
com.googlecode.java-diff-utils:diffutils:jar:1.3.0 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.1.1 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
org.khronos:opengl-api:jar:gl1.1-android-2.1_r1 - - -
org.mockito:mockito-all:jar:1.9.0 - - -
xerces:xmlParserAPIs:jar:2.6.2 - - -
xpp3:xpp3:jar:1.1.4c - - -
Total apache.snapshots sonatype-nexus-snapshots central
17 (compile: 5, test: 6, provided: 6) 0 0 0

google-http-client-gson-dependencies.html000066400000000000000000000561721350651464300355100ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.gson gson 2.1 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-test ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, GSON extensions to the Google HTTP Client Library for Java., Google HTTP Client Library for Java, Gson, Guava: Google Core Libraries for Java, J2ObjC Annotations, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
gson-2.1.jar 175.89 kB 158 148 6 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-test-${project.http.version}.jar 51.73 kB 59 49 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
11 4.36 MB 3,669 3,310 125 1.6 11
compile: 8 compile: 1.76 MB compile: 1,499 compile: 1,217 compile: 75 - compile: 8
test: 3 test: 2.61 MB test: 2,170 test: 2,093 test: 50 - test: 3

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.code.gson:gson:jar:2.1 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-test:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
Total apache.snapshots sonatype-nexus-snapshots central
11 (compile: 8, test: 3) 0 0 0

google-http-client-jackson-dependencies.html000066400000000000000000000563321350651464300361700ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
org.codehaus.jackson jackson-core-asl 1.9.11 jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-test ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson, Jackson extensions to the Google HTTP Client Library for Java., Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-test-${project.http.version}.jar 51.73 kB 59 49 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
jackson-core-asl-1.9.11.jar 226.69 kB 137 121 8 1.5 debug
Total Size Entries Classes Packages JDK Rev Debug
11 4.41 MB 3,648 3,283 127 1.6 11
compile: 8 compile: 1.81 MB compile: 1,478 compile: 1,190 compile: 77 - compile: 8
test: 3 test: 2.61 MB test: 2,170 test: 2,093 test: 50 - test: 3

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-test:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
org.codehaus.jackson:jackson-core-asl:jar:1.9.11 - - -
Total apache.snapshots sonatype-nexus-snapshots central
11 (compile: 8, test: 3) 0 0 0

google-http-client-jackson2-dependencies.html000066400000000000000000000564451350651464300362570ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.fasterxml.jackson.core jackson-core 2.9.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-test ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jackson-core-2.9.2.jar 313.71 kB 130 105 11 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-test-${project.http.version}.jar 51.73 kB 59 49 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
11 4.50 MB 3,641 3,267 130 1.6 11
compile: 8 compile: 1.89 MB compile: 1,471 compile: 1,174 compile: 80 - compile: 8
test: 3 test: 2.61 MB test: 2,170 test: 2,093 test: 50 - test: 3

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.fasterxml.jackson.core:jackson-core:jar:2.9.2 - - -
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-test:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
Total apache.snapshots sonatype-nexus-snapshots central
11 (compile: 8, test: 3) 0 0 0

google-http-client-jdo-dependencies.html000066400000000000000000000742631350651464300353170ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
javax.jdo jdo2-api 2.3-eb jar Apache 2

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-test ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0
mysql mysql-connector-java 5.1.18 jar The GNU General Public License, Version 2
org.datanucleus datanucleus-api-jdo 3.2.1 jar The Apache Software License, Version 2.0
org.datanucleus datanucleus-core 3.2.2 jar The Apache Software License, Version 2.0
org.datanucleus datanucleus-rdbms 3.2.1 jar The Apache Software License, Version 2.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
javax.transaction transaction-api 1.1 jar -
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache 2: JDO2 API

Unknown: transaction-api

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, DataNucleus Core, DataNucleus JDO API plugin, DataNucleus RDBMS, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.

The GNU General Public License, Version 2: MySQL Connector/J

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-test-${project.http.version}.jar 51.73 kB 59 49 2 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
jdo2-api-2.3-eb.jar 188.18 kB 226 182 7 1.5 debug
transaction-api-1.1.jar 14.72 kB 24 18 2 1.3 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
mysql-connector-java-5.1.18.jar 771.37 kB 279 245 12 1.6 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
datanucleus-api-jdo-3.2.1.jar 329.11 kB 180 126 6 1.5 debug
datanucleus-core-3.2.2.jar 1.72 MB 943 841 50 1.5 debug
datanucleus-rdbms-3.2.1.jar 1.69 MB 768 715 29 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
16 8.87 MB 5,931 5,289 225 1.6 16
compile: 9 compile: 1.78 MB compile: 1,591 compile: 1,269 compile: 78 - compile: 9
test: 7 test: 7.09 MB test: 4,340 test: 4,020 test: 147 - test: 7

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
DN_M2_Repo http://www.datanucleus.org/downloads/maven2/ Yes -
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots DN_M2_Repo central
com.google.code.findbugs:jsr305:jar:3.0.2 - - - -
com.google.guava:guava:jar:20.0 - - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - - -
com.google.http-client:google-http-client-test:jar:${project.http.version} - - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - - -
commons-codec:commons-codec:jar:1.6 - - - -
commons-logging:commons-logging:jar:1.2 - - - -
javax.jdo:jdo2-api:jar:2.3-eb - - Found at http://www.datanucleus.org/downloads/maven2/ -
javax.transaction:transaction-api:jar:1.1 - - - -
junit:junit:jar:4.8.2 - - - -
mysql:mysql-connector-java:jar:5.1.18 - - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - - -
org.datanucleus:datanucleus-api-jdo:jar:3.2.1 - - - -
org.datanucleus:datanucleus-core:jar:3.2.2 - - - -
org.datanucleus:datanucleus-rdbms:jar:3.2.1 - - - -
Total apache.snapshots sonatype-nexus-snapshots DN_M2_Repo central
16 (compile: 9, test: 7) 0 0 1 0

google-http-client-protobuf-dependencies.html000066400000000000000000000502141350651464300363710ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.protobuf protobuf-java 2.6.1 jar New BSD license

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

New BSD license: Protocol Buffer Java API

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, J2ObjC Annotations, Protocol Buffer extensions to the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
protobuf-java-2.6.1.jar 582.66 kB 286 276 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
9 2.38 MB 1,894 1,575 100 1.6 9
compile: 8 compile: 2.15 MB compile: 1,627 compile: 1,345 compile: 70 - compile: 8
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.protobuf:protobuf-java:jar:2.6.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
Total apache.snapshots sonatype-nexus-snapshots central
9 (compile: 8, test: 1) 0 0 0

google-http-client-xml-dependencies.html000066400000000000000000000546361350651464300353450ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
xpp3 xpp3 1.1.4c jar Indiana University Extreme! Lab Software License, vesion 1.1.1-Public Domain-Apache Software License, version 1.1

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, XML extensions to the Google HTTP Client Library for Java.

Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
xpp3-1.1.4c.jar 117.25 kB 78 56 13 1.1 debug
Total Size Entries Classes Packages JDK Rev Debug
10 4.26 MB 3,530 3,169 130 1.6 10
compile: 8 compile: 1.70 MB compile: 1,419 compile: 1,125 compile: 82 - compile: 8
test: 2 test: 2.56 MB test: 2,111 test: 2,044 test: 48 - test: 2

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
xpp3:xpp3:jar:1.1.4c - - -
Total apache.snapshots sonatype-nexus-snapshots central
10 (compile: 8, test: 2) 0 0 0

google-oauth-client-appengine-dependencies.html000066400000000000000000001065501350651464300366450ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client-appengine ${project.http.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client-servlet ${project.oauth.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-stubs 1.7.7 jar Google App Engine Terms of Service
com.google.appengine appengine-testing 1.7.7 jar Google App Engine Terms of Service
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
com.google.appengine appengine-api-1.0-sdk 1.7.7 jar Google App Engine Terms of Service
javax.servlet servlet-api 2.5 jar -

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jdo ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
javax.jdo jdo2-api 2.3-eb jar Apache 2
javax.transaction transaction-api 1.1 jar -
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Google App Engine Terms of Service: appengine-api-1.0-sdk, appengine-api-stubs, appengine-testing

Apache 2: JDO2 API

Unknown: servlet-api, transaction-api

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google App Engine extensions to the Google HTTP Client Library for Java., Google App Engine extensions to the Google OAuth Client Library for Java., Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Servlet and JDO extensions to the Google OAuth Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
appengine-api-1.0-sdk-1.7.7.jar 30.66 MB 6,566 6,044 86 1.6 debug
appengine-api-stubs-1.7.7.jar 12.16 MB 3,098 2,785 167 1.6 debug
appengine-testing-1.7.7.jar 10.32 MB 2,293 2,265 26 1.6 debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-appengine-${project.http.version}.jar 15.81 kB 21 11 2 1.6 debug
google-http-client-jdo-${project.http.version}.jar 8.08 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
google-oauth-client-servlet-${project.oauth.version}.jar 22.92 kB 24 11 4 1.6 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
jdo2-api-2.3-eb.jar 188.18 kB 226 182 7 1.5 debug
servlet-api-2.5.jar 102.65 kB 68 42 2 1.5 debug
transaction-api-1.1.jar 14.72 kB 24 18 2 1.3 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
19 57.68 MB 15,842 14,523 417 1.6 19
compile: 12 compile: 1.67 MB compile: 1,488 compile: 1,267 compile: 82 - compile: 12
test: 4 test: 25.03 MB test: 7,502 test: 7,094 test: 241 - test: 4
provided: 3 provided: 30.98 MB provided: 6,852 provided: 6,162 provided: 94 - provided: 3

Dependency Repository Locations

Repo ID URL Release Snapshot Blacklisted
apache.snapshots http://repository.apache.org/snapshots - Yes -
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes Yes
central https://repo.maven.apache.org/maven2 Yes - -

Repository locations for each of the Dependencies.

Artifact apache.snapshots central
com.google.appengine:appengine-api-1.0-sdk:jar:1.7.7 - -
com.google.appengine:appengine-api-stubs:jar:1.7.7 - -
com.google.appengine:appengine-testing:jar:1.7.7 - -
com.google.code.findbugs:jsr305:jar:3.0.2 - -
com.google.guava:guava:jar:20.0 - -
com.google.http-client:google-http-client:jar:${project.http.version} - -
com.google.http-client:google-http-client-appengine:jar:${project.http.version} - -
com.google.http-client:google-http-client-jdo:jar:${project.http.version} - -
com.google.j2objc:j2objc-annotations:jar:1.1 - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - -
com.google.oauth-client:google-oauth-client-servlet:jar:${project.oauth.version} - -
commons-codec:commons-codec:jar:1.6 - -
commons-logging:commons-logging:jar:1.2 - -
javax.jdo:jdo2-api:jar:2.3-eb - -
javax.servlet:servlet-api:jar:2.5 - -
javax.transaction:transaction-api:jar:1.1 - -
junit:junit:jar:4.8.2 - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - -
Total apache.snapshots central
19 (compile: 12, test: 4, provided: 3) 0 0

google-oauth-client-dependencies.html000066400000000000000000000604041350651464300346760ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
org.codehaus.jackson jackson-core-asl 1.9.11 jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson, Jackson extensions to the Google HTTP Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson-${project.http.version}.jar 6.27 kB 12 4 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
jackson-core-asl-1.9.11.jar 226.69 kB 137 121 8 1.5 debug
Total Size Entries Classes Packages JDK Rev Debug
11 4.37 MB 3,601 3,238 126 1.6 11
compile: 6 compile: 1.36 MB compile: 1,123 compile: 993 compile: 63 - compile: 6
test: 4 test: 2.78 MB test: 2,260 test: 2,169 test: 57 - test: 4
provided: 1 provided: 227.32 kB provided: 218 provided: 76 provided: 6 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
org.codehaus.jackson:jackson-core-asl:jar:1.9.11 - - -
Total apache.snapshots sonatype-nexus-snapshots central
11 (compile: 6, test: 4, provided: 1) 0 0 0

google-oauth-client-java6-dependencies.html000066400000000000000000000637161350651464300357140ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client-jackson ${project.http.version} jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
org.codehaus.jackson jackson-core-asl 1.9.11 jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson, Jackson extensions to the Google HTTP Client Library for Java., Java 6 (and higher) extensions to the Google OAuth Client Library for Java.

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jackson-${project.http.version}.jar 6.27 kB 12 4 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
jackson-core-asl-1.9.11.jar 226.69 kB 137 121 8 1.5 debug
Total Size Entries Classes Packages JDK Rev Debug
12 4.43 MB 3,658 3,285 129 1.6 12
compile: 7 compile: 1.42 MB compile: 1,180 compile: 1,040 compile: 66 - compile: 7
test: 4 test: 2.78 MB test: 2,260 test: 2,169 test: 57 - test: 4
provided: 1 provided: 227.32 kB provided: 218 provided: 76 provided: 6 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots central
com.google.code.findbugs:jsr305:jar:3.0.2 - - -
com.google.guava:guava:jar:20.0 - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - -
com.google.http-client:google-http-client-jackson:jar:${project.http.version} - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - -
commons-codec:commons-codec:jar:1.6 - - -
commons-logging:commons-logging:jar:1.2 - - -
junit:junit:jar:4.8.2 - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - -
org.codehaus.jackson:jackson-core-asl:jar:1.9.11 - - -
Total apache.snapshots sonatype-nexus-snapshots central
12 (compile: 7, test: 4, provided: 1) 0 0 0

google-oauth-client-jetty-dependencies.html000066400000000000000000000705041350651464300360350ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.oauth-client google-oauth-client-java6 ${project.oauth.version} jar The Apache Software License, Version 2.0
org.mortbay.jetty jetty 6.1.26 jar Apache Software License - Version 2.0-Eclipse Public License - Version 1.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
junit junit 4.8.2 jar Common Public License Version 1.0

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0
org.mortbay.jetty jetty-util 6.1.26 jar Apache Software License - Version 2.0-Eclipse Public License - Version 1.0
org.mortbay.jetty servlet-api 2.5-20081211 jar Apache License Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Eclipse Public License - Version 1.0: Jetty Server, Jetty Utilities

Apache Software License - Version 2.0: Jetty Server, Jetty Utilities

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Google OAuth Client Library for Java, J2ObjC Annotations, Java 6 (and higher) extensions to the Google OAuth Client Library for Java., Jetty extensions to the Google OAuth Client Library for Java.

Apache License Version 2.0: Servlet Specification API

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
google-oauth-client-java6-${project.oauth.version}.jar 12.66 kB 18 8 1 1.6 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
jetty-6.1.26.jar 527.26 kB 267 237 14 1.4 debug
jetty-util-6.1.26.jar 172.98 kB 120 105 6 1.4 debug
servlet-api-2.5-20081211.jar 130.99 kB 79 42 2 1.4 debug
Total Size Entries Classes Packages JDK Rev Debug
13 2.70 MB 2,149 1,738 125 1.6 13
compile: 11 compile: 2.25 MB compile: 1,664 compile: 1,432 compile: 89 - compile: 11
test: 1 test: 231.78 kB test: 267 test: 230 test: 30 - test: 1
provided: 1 provided: 227.32 kB provided: 218 provided: 76 provided: 6 - provided: 1

Dependency Repository Locations

Repo ID URL Release Snapshot Blacklisted
codehaus.org http://snapshots.repository.codehaus.org - Yes Yes
apache.snapshots http://repository.apache.org/snapshots - Yes -
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes -
java.net http://download.java.net/maven/2 Yes - -
m1.java.net http://download.java.net/maven/1 Yes - -
central https://repo.maven.apache.org/maven2 Yes - -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots java.net m1.java.net central
com.google.code.findbugs:jsr305:jar:3.0.2 - - - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - - - -
com.google.oauth-client:google-oauth-client-java6:jar:${project.oauth.version} - - - - -
commons-codec:commons-codec:jar:1.6 - - - - -
commons-logging:commons-logging:jar:1.2 - - - - -
junit:junit:jar:4.8.2 - - - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - - - -
org.mortbay.jetty:jetty:jar:6.1.26 - - - - -
org.mortbay.jetty:jetty-util:jar:6.1.26 - - - - -
org.mortbay.jetty:servlet-api:jar:2.5-20081211 - - - - -
Total apache.snapshots sonatype-nexus-snapshots java.net m1.java.net central
13 (compile: 11, test: 1, provided: 1) 0 0 0 0 0

google-oauth-client-servlet-dependencies.html000066400000000000000000001035221350651464300363570ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies Project Dependencies

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.http-client google-http-client-jdo ${project.http.version} jar The Apache Software License, Version 2.0
com.google.oauth-client google-oauth-client ${project.oauth.version} jar The Apache Software License, Version 2.0
javax.jdo jdo2-api 2.3-eb jar Apache 2

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupId ArtifactId Version Type License
com.google.guava guava 20.0 jar The Apache Software License, Version 2.0
junit junit 4.8.2 jar Common Public License Version 1.0
mysql mysql-connector-java 5.1.18 jar The GNU General Public License, Version 2
org.datanucleus datanucleus-api-jdo 3.2.1 jar The Apache Software License, Version 2.0
org.datanucleus datanucleus-core 3.2.2 jar The Apache Software License, Version 2.0
org.datanucleus datanucleus-rdbms 3.2.1 jar The Apache Software License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
javax.servlet servlet-api 2.5 jar -

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupId ArtifactId Version Type License
com.google.code.findbugs jsr305 3.0.2 jar The Apache Software License, Version 2.0
com.google.http-client google-http-client ${project.http.version} jar The Apache Software License, Version 2.0
com.google.j2objc j2objc-annotations 1.1 jar The Apache Software License, Version 2.0
commons-logging commons-logging 1.2 jar The Apache Software License, Version 2.0
javax.transaction transaction-api 1.1 jar -
org.apache.httpcomponents httpclient 4.5.3 jar Apache License, Version 2.0
org.apache.httpcomponents httpcore 4.4.6 jar Apache License, Version 2.0

provided

The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:

GroupId ArtifactId Version Type License
commons-codec commons-codec 1.6 jar The Apache Software License, Version 2.0

Project Dependency Graph

Dependency Tree

Licenses

Apache 2: JDO2 API

Unknown: servlet-api, transaction-api

Apache License, Version 2.0: Apache HttpClient, Apache HttpCore

Common Public License Version 1.0: JUnit

The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, DataNucleus Core, DataNucleus JDO API plugin, DataNucleus RDBMS, FindBugs-jsr305, Google HTTP Client Library for Java, Google OAuth Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Servlet and JDO extensions to the Google OAuth Client Library for Java.

The GNU General Public License, Version 2: MySQL Connector/J

Dependency File Details

Filename Size Entries Classes Packages JDK Rev Debug
jsr305-3.0.2.jar 19.47 kB 46 35 3 1.5 debug
guava-20.0.jar 2.33 MB 1,844 1,814 18 1.6 debug
google-http-client-${project.http.version}.jar 261.81 kB 223 200 16 1.6 debug
google-http-client-jdo-${project.http.version}.jar 8.08 kB 13 5 1 1.6 debug
j2objc-annotations-1.1.jar 8.58 kB 23 12 1 1.5 debug
google-oauth-client-${project.oauth.version}.jar 61.64 kB 57 47 3 1.6 debug
commons-codec-1.6.jar 227.32 kB 218 76 6 1.5 debug
commons-logging-1.2.jar 60.38 kB 42 28 2 1.2 debug
jdo2-api-2.3-eb.jar 188.18 kB 226 182 7 1.5 debug
servlet-api-2.5.jar 102.65 kB 68 42 2 1.5 debug
transaction-api-1.1.jar 14.72 kB 24 18 2 1.3 debug
junit-4.8.2.jar 231.78 kB 267 230 30 1.5 debug
mysql-connector-java-5.1.18.jar 771.37 kB 279 245 12 1.6 debug
httpclient-4.5.3.jar 730.27 kB 507 466 24 1.6 debug
httpcore-4.4.6.jar 316.23 kB 282 252 17 1.6 debug
datanucleus-api-jdo-3.2.1.jar 329.11 kB 180 126 6 1.5 debug
datanucleus-core-3.2.2.jar 1.72 MB 943 841 50 1.5 debug
datanucleus-rdbms-3.2.1.jar 1.69 MB 768 715 29 1.6 debug
Total Size Entries Classes Packages JDK Rev Debug
18 8.99 MB 6,010 5,334 229 1.6 18
compile: 10 compile: 1.63 MB compile: 1,443 compile: 1,245 compile: 76 - compile: 10
test: 6 test: 7.04 MB test: 4,281 test: 3,971 test: 145 - test: 6
provided: 2 provided: 329.96 kB provided: 286 provided: 118 provided: 8 - provided: 2

Dependency Repository Locations

Repo ID URL Release Snapshot
apache.snapshots http://repository.apache.org/snapshots - Yes
sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots - Yes
DN_M2_Repo http://www.datanucleus.org/downloads/maven2/ Yes -
central https://repo.maven.apache.org/maven2 Yes -

Repository locations for each of the Dependencies.

Artifact apache.snapshots sonatype-nexus-snapshots DN_M2_Repo central
com.google.code.findbugs:jsr305:jar:3.0.2 - - - -
com.google.guava:guava:jar:20.0 - - - -
com.google.http-client:google-http-client:jar:${project.http.version} - - - -
com.google.http-client:google-http-client-jdo:jar:${project.http.version} - - - -
com.google.j2objc:j2objc-annotations:jar:1.1 - - - -
com.google.oauth-client:google-oauth-client:jar:${project.oauth.version} - - - -
commons-codec:commons-codec:jar:1.6 - - - -
commons-logging:commons-logging:jar:1.2 - - - -
javax.jdo:jdo2-api:jar:2.3-eb - - Found at http://www.datanucleus.org/downloads/maven2/ -
javax.servlet:servlet-api:jar:2.5 - - - -
javax.transaction:transaction-api:jar:1.1 - - - -
junit:junit:jar:4.8.2 - - - -
mysql:mysql-connector-java:jar:5.1.18 - - - -
org.apache.httpcomponents:httpclient:jar:4.5.3 - - - -
org.apache.httpcomponents:httpcore:jar:4.4.6 - - - -
org.datanucleus:datanucleus-api-jdo:jar:3.2.1 - - - -
org.datanucleus:datanucleus-core:jar:3.2.2 - - - -
org.datanucleus:datanucleus-rdbms:jar:3.2.1 - - - -
Total apache.snapshots sonatype-nexus-snapshots DN_M2_Repo central
18 (compile: 10, test: 6, provided: 2) 0 0 1 0

google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/000077500000000000000000000000001350651464300270365ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/close.gif000066400000000000000000000004271350651464300306350ustar00rootroot00000000000000GIF89a¥ÿÿÿðððïïïàààßßßÐÐÐÏÏÏÀÀÀ¿¿¿°°°¯¯¯   ŸŸŸ€€€pppooo```___PPPOOO@@@???000/// ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,<@€pH,Šˆ¤r©„™Ð¤™‰–VéS™EtS¦õ Þb¯Ë𙬮¢¿mr·mšëZdÏï÷Ç€A;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/collapsed.gif000066400000000000000000000000651350651464300314740ustar00rootroot00000000000000GIF89a€!ù , DŽ`ºçžcŠ5 ;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/expanded.gif000066400000000000000000000000641350651464300313150ustar00rootroot00000000000000GIF89a€!ù , „j œ´Î;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/external.png000066400000000000000000000003461350651464300313710ustar00rootroot00000000000000‰PNG  IHDR Óº&gAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< PLTEuuuÿÿÿ™ÿÿÿÑðPtRNSÿÿÿ@*©ôPIDATxÚb`&& @ P6#@ `ÀÄÄäX˜Ć2™Ê« ›‰d@AÔ3ƒ (± *‡½ÜtIEND®B`‚google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/icon_error_sml.gif000066400000000000000000000017621350651464300325470ustar00rootroot00000000000000GIF89a÷ÿÿÿ ²±«£ q x v m¸;@’GJf46éÒÓ_ Á· œ › ‚ i [ ¾½¹·«¦ ˜ — – “ Š ˆ ~ } s q p n X V L ž  … ƒ  v l ¾~ ®Â"±",¢9?‚6;{6:Ždfå³¶ðàáÂ$¿'¿)©OWͱ³ÞÐÑÅ-Å/«*Ç"4À"3Øs}ôÖÙñÕØðÖÙúðñûòóÇ%8Ç&:È(=È*@È+AÃ*?É5H½=MÀM\ùñòÄ+BÉ.FÉ/GÉ0IË2MË3OÈ2NÇ%9J.F¯p«±r®N3O²v´³x·µ{»@-EL6RO8V08G3O1:bGm3=4>7 C5AgOx?2ME7TmW†|d™}gŽu²š„Á^Vƒøððèààöððýýýûûûúúúôôôÿÿÿ!ù,Ï; H° AJýéÃg’ÁN’Þ´YcŒ—* FrÃM™/]¨HI‚h $5iÎŒ³å “%B€øéTÉ ™0P8ÁÒ$À“2,Êã…‹•,Z(µ¤D‡ŒðL‰¢É¥¨@¡€¢;GŒÉák$<Hd‡ >`ê'‘!\2ƒ†?v°hp‰‡  uÚ@‹ .¨Xñà = q˜0 )f$Tp„"F¼ˆQƒ´ÁGrểCÇÁ€;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/icon_info_sml.gif000066400000000000000000000011361350651464300323440ustar00rootroot00000000000000GIF89aæÿÿÿýýþùúüøùûÚàërƒžÑÙæÕÜè×ÞéÖÝè 'SG]}]y¢Vp–OgŠLc…J`EYxCWtI^~FZyeªh„¬gƒ«j…­l‡®mˆ¯pаXl‹t²v´dy˜w´|”·~•¸w­€—¹uŠ©nž„š»ƒ™º…›¼zŽ¬ŠŸ¿w‰¤‹ ¿¡À¤Â…—²™¬Ç˜«Æ‚’©’¢º†•«¡²Ë¦¶Î©¹Ð­¼Ò¬»ÑŸ¬À±¿Ô°¾ÓµÂ֏Ũ¼ÈÚÁÌÝÃÎÞÂÍݲ¼ËÉÓâÆÐßËÔâÍÖäÌÕãÓÛçÒÚæÈÏÙéíóãçíõ÷úôöùóõø@TpAUqyŽ«}ަ•©Åž°É§´Å¹ÆØÀÉÕàæîßåíáçïåêñäéððó÷ïòöÝäíÜãìÛâëçìòæëñìðõëïôêîóØßçâèïñô÷öøúûüýúûüþþþÿÿÿ!ùr,»€r‚ƒ„…‚`fg`l\d LGƒ^qqopnQmbj.‡™MObhNg r\oP6 [igŒ%‚d›mE4k_^eL‚ PRah YcHB‚ËjfV ‚FØ`\- 5Z=97‚D`] I' 1ì30‚@KICA@,¨"‹éøcÇ $X ñA‚ ?tàÀrå…Š!8h 2è† @ Pa†b ;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/icon_success_sml.gif000066400000000000000000000017361350651464300330670ustar00rootroot00000000000000GIF89a÷ÿÿÿ„™º¦¶Î§·Î¼ÈÚÇÑà¿ÈÕc~¢¡±Çßåíw¬™´¦¸Ë—®¿³Ã©½ËSq‚*/‚¡­%(#8='*!37,/(CH'AF&>B/2*,)FI"!Prkœ¼´¢À¸j•†„¬œtœ‹¢Å²FcOƒ­7G;ÅÖÈÈ£¬Ö©·Û´¸ß²2B.²á¥³â¦·ã«¸ä¬¸ä­ºå¯¼å±Â€¶ã©²à¢²à£œÎˆ¬Þ˜«Ü™©Ù—«Û—]•BÎ…¢Ô‹©Û‘Í„­Õ—]”>¡Ô„çñሻf“Çr¿mˆ¶jÐæÂøûöbœ7Jw*U‡0WŠ2•ÑiÔäÈmª;Ag$r³?o¬=ež8fž8b›7ZŽ2YŠ1S‚.Jt)Qy1‰ËW…½Yu¤Qe‹FcˆE—¹{›½{“h­Î×Çîóê„ÊGv·@uµ?k¥:hž7`’3Jr(ÃE^‘3Q|,S~-Dh%}¼DEi&‹ÎQ²Å¢ÖàÍÏ×ÈãëÜIm&Qx+Ot)Mo(êïåLl&Ig%Gc$õ÷òþþþûûû÷÷÷ÿÿÿ!ù‹,» H° A!,X E aCF5pAÆ *01#†"NT0è‡A˜ ¡ =†Y²&€ NR¤I’1ÅÁbà€JðÃ'À:oŒ8bŠ˜3‡ˆ-ÃeË“‹„у™>Ô|‰Â¥ (ØÌq£Å‹•4häÔ±(Ћm®TÉ"Jž;*d(Å"4l¨p ,Pø°( ;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/icon_warning_sml.gif000066400000000000000000000011001350651464300330450ustar00rootroot00000000000000GIF89aæÿÿÿ¸œ§º¡«b`awr}“ޤ˜ º¡¨¿¬²Æ~ް„’²j| £¯ÇfsŠ„™º§·Î·Ä×ÄÏßËÔ⣴ÌÜãì[M@Kƒ? àk®T£N ”G J$ùwñsïrêpÛi×fÖfÔeÎcÍbÇ_¿[¼Z°T©Q¤OšJ E D E ƒ? i2 çnämÃ]¹X·WµV•H ‰A €= h2 ]-Ëbùzù{ìz&«Z¿i&×iù(Ëj&ùƒ1ùƒ2ú†7Ìm-D2%Ìp4úŠBúŽIØ|DÌu@ú”Yú˜aæ\Ì}R׈[¦v[úmI:2̓`û¡vû¤û§ƒÙ‘s=.()ûª‹+*û­‘ç ….!Ó—<,&é¤5&!:*%²‡y*Švp묜*,-¨‡‚š~zÇŸžÿÿÿ!ùv,€v‚ƒ„…† †…oae‹ƒd][s’v iT ‹u^PW†\Z¥MI…gXU¥GAD„SRQ¥?4ƒVONK¥)#C‚nJHFE0=7'6*v B@%¥+8, l !5"9¥.:/Lt"$&(-3:øc‡ Yìø‚f3càÄ‘#¦ ;;google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/logos/000077500000000000000000000000001350651464300301615ustar00rootroot00000000000000build-by-maven-black.png000066400000000000000000000043661350651464300345060ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/logos‰PNG  IHDRZ#ž/ pHYs.#.#x¥?vtIME×úļ•IDATXÃíXiLTY>ï½* ( ±J¶BZ@–€Š›ˆ†%‚‡?hÆ?"jb‚Qd~(„d\ÆA $ &Œ2™¸1 ›€ »‘"R`UJ-¼Zîü8Ìm„žîÎ4É´NêÇ©sÏ}ïÞï~ïœsÀš¬É𬒤¦¦ÖÔÔÔÔÔTWWzxx¬ôQ(‡bY¶¤¤ÄÕÕU&“‰Å⥣¹¹¹ßÄfÙ_ôغu+!¤ªªª¶¶6<<¼¼¼|¥ÏÜÜÜøø8˲™™™NNNçÎKMM¥£~~~1118`rrR©T¶¶¶ÖÔÔ@II‰D"€ôôô¤¤$www???tÞ¶m[JJJ^^µÀúõë¯_¿^__Ÿ””ÄqÜ… eáááÇ …çÏŸ_J¨ß5‰‰‰gÏž---­¨¨(++€ýû÷;;;@TTTxxx@@Àž={Ðùýû÷ÝÝݳ³³K¿¸ºººòòòêêjOOOooï´´4ÈÍÍ%„0 # ¿vhµÚáááööö“'Or÷3Î&“É`0LOOó>þÕ«W‹¥¹¹ùÒ¥K·oߎãöíÛçääô °czz:;;;>>¦¦¦<¸°°PQQQUU¥ÑhZ[[ggg ÃÄÄ!dppÐn·777·µµ€Á`P*•>ôðð¸|ùòÔÔܽ{÷ðáà  :;;—~_ߘ–ý¯äZ9Äqœ@ð#úiii•••ke@~~~___ppðïma̯ôsvvvssC]¯×B‚‚‚<==­Vëàààüü<ùøø2 £R©&''†Y‡Ãáp|«çyæÌÜ€ÕjÝ»wï³gÏìv;!„2<<ìçç'•J¯^½j2™Ðh2™²²²þ°ônllÄ}Z­V£ÑH¾–G-3~;ðue·H¹/A„”“:3Ëø‚‚ù{‘º CíK7lسk×®àààeC,Ë¢?G®®®[¶l‰ˆˆXÍ´%ÆÇÇé>5MSSÓ‡–nÞh4>}ú´»»›ZL&“H$Â'ämsžøóúù<©-_fË—Yóe†¤ÿø^âïÆâz{{µZ­V«MNN¦ï½xñ"ëëë¦ÈÈÈÐó°ÙlCCCééétJQQN¹víÚéÓ§ÕjµÃá°ÛíoÞ¼ùî»ïV???‡Ã+¸qã^.ÂÂÂèÎ{{{7n܈)“ÒD§ÓÑüÒô½X8*CthnnÆYGŽAKPPÐüü~ü6›Íf³¡q``€Ë·ZûÁ~ñ­Ö‰þ¦õ¼¡«z»X¤†x,Öû£££¨ÈårTŠ‹‹÷ÊÊʾ¾¾ºº:±X<33£P(¶o߈e‹H$ÊÎÎÆr122§÷ôô;vìèÑ£´hÆ[…"=..³Ùüöí[Ô#""¨CWW½¹Ò‹,5Àé—&r1»}ƒ@.f‹à¾7Ø…B‘““ƒE`II œ:uÊÝÝjkkœœ°c€F ‘Éd Óéñ0ÒÓÓ322@¥R­2£££z½uÚ „tww£Fó1…Ãß=©pÉ ròwc™¯3{‡Æ¶–eKKK1øÎÍ͉D"Ú@)(((((X¶BäæÎ;‘Å”˜¾¾¾¨tvv® ÃÄÆÆRÒ×PŒT*ÕÌÌÌ2#…#̃{šå.³Ð3ck›²M|¶ĸø¸² üccc‡ƒeY¹\¾{÷n<Ï—/_ÖÕÕ€D"Á]Y,–'OžB–-òñãÇþU*•”­´Ø£Æß$¡¡¡4åååÑ\£R©ÐØÐÐ@oݺ…F­V‹ukŸFÍ¿'‰9`ƒ3cøAŠaUâÄÐuùò…¢V«ÛÚÚ!<ÏÓíyyya™c4×­[·l…Ø+á8n``ßN/– 42 ³ ¡tåcõéïᅩ„ÇEGG£Ž—e Æk‘€½Ÿìv, ‰… ¼ÓÚ¾ð„¶±]äë뛀1‚ž§^¯Ÿ˜˜À:¢²²™Â²lllìµk×JKKÀÓÓsóæÍØCèééÁ‰;vì ÔXɩ߇^¯Y™k(F2™ D„€~aq‰®ÿÚï>œëñ×Ý‹M@ú¥, 0;;[TTDÿò<_VV†ûÉÉÉQ«ÕƒÁb±tuuåååõ÷÷c,Ãp344DåW{{ûêô; Ïó<Ï¿{÷îóçÏhŒŽŽFãüüüëׯi——Îó  VD„Oj© ´½÷ìG>»’ø|aÒ?æÎ™3÷ÎïÌ™™sJ!„`&‰^€`Ž/ƒãùóç&)--­»»{¶ŽÑhÌÈÈ€üüüW¯^1 óîÝ;2j0²²²~!pô÷÷wtt>|øÐ¡C"‘h÷îݳuø|~`` |8::ZRR‚•%É–-[ÂÃÃW¬XA,hµÚÀÀÀœœœÜÜÜššš¦‹ŠŠ ªªJ¯×ÛÙÙY­Ö¯^ææ ‡£££R©ô÷÷ß°aÃ¥K—ŒFãg”íìì\]]¥R©D"!ÂÕ«WÇÇÇûùù%&&VWWïÚµëîÝ»¡[·n%$$À±cÇ”Jå×…Ã~Žzr¹<66óuuuµµµ€slll.„B!fx<EQnnnµµµ­­­*•êËØ€€‰DÒÙÙi³Ù***fëS5>>>]ÒÔÔÔÝÝm±X***Ö­[ )))ÑÑÑ)FóöíÛo‰DÂ0L\\\\\ÜÙ³góóó ERRRaaáúõë—.]êééÉãñüýýÀÇÇG,‡„„ÔÔÔTVV’º£V«=„áØ¹sg{{û¾}û°Î•+WH2þj„¾€l6›Ífû±Q–e9Ž›!™˜˜ }}}aaa3t¾.Á×zqUUU``à½{÷Ðω¨/©mcccÃÃÃ|>ßÅÅ…¢(,´Z­ƒ¢(™Lfoÿ£©šã8Žã>£ðsß,¥¥¥A“ÔÖÖ–žžîææ†óÂÞ½{ÇÇÇ-ËåË—hš¦i:44´«« }Sô?À‘œœLªÆì!55uãÆ$F0ÅÆÆÎ2á 3{l–/ùnƒ&“é'S˲ ÃÌ1CÍŽãBCC§7Z …ÂÁÁaFquww—J¥Dâáá1e¡ö{6w‡íO+lô¶ð´¥úÚþº«.@¬ !ôæÍ›èèh•Jc6›ÉKU*•J¥*..ÆB­V»gϹ\.‹%‰R©ÌÌÌ$z||\­V«Tªèè覦¦'Nxzz:99)•ÊŠŠŠyƒÃd2‘3&&w†„ƒR©Ôh4V«upp âëë;U†þ¼ÎvT6ûÇÕN·oooßÝݧ”——cû^^^&“ !tîÜ9‡¡wtt$¸9rOimm¥ihš–ÉdÓWËÅÅeddd~ਫ«#vËË˱°§§ÇÎÎ O:E–çؾ}ûdp³÷qÿ¾Ä½~‚Þ¾â^ü‡ýËz û}2VY¾|9žU__×9(({^RR‚º~ý:v5** CVSS#ÀÁÁãUPP@zß­[·ž>}:22’D´N§›8rss?ôm4Ý×ׇ…ÓÏì·o߯B½^OúñÌÌÌ÷± 1îM+×vŸ-øÝ8nŸÅƒjµÏ*++C]¼x?nÞ¼™ã8³ÙìããƒýÔjµ}“„¡'®8pÏ:sæ 6‹Ïø”`4?ïæ\ë\}}=f¼¼¼/^Lún’5BBB0ÿôéSÒž!{¹šBÔúOêÖúQÆñú fHtôõõ™L&|]$ ÏŸ?OQTcc#îY­Vë”ÙIâñx2™Œã8Ÿñ€¡¡!²s§çµÿÿDzlcc#æW­ZEš…ÇcÆÓÓ“`D€ãóù+W®Ôó„ûûoad( ܃)_ƒØý+l°ãQ+±¾ŸŸfôz}^^^OO¤¤¤à*†ïVÀÝÝGH¡PH¥Òþþþ®®.Œ¬¡¡3áááós¢5/^¼À<©/V«µ¹¹y†p:ÞÞÞ#ôS02”ú;z〢ÑëfTõ7€_yƒÄuFt444`# …"--¼3QQQ7nܘÝ:@ss3Ìàà`±XŒG=z4w8æt„klldYv†çƒƒƒ¯_¿þiŒ&FQÿ³©}AÑ`³ úb@(ï©°÷ññÁqWUUe4)ŠÊÎÎ&åŒÜ$•––a·M&ÓÍ›7###ñõ-¹|#ž›Íæ––ÌGDDÌOthµZ̈D"òYÓ1Z³f fzzzôzýGpØóAà£Fà ÷Snè0†)¦àX¶l™H$b/µZ­Þ±cˆˆØ´iSee¥ÅbÙ¿ÿÁƒE"Ñèè(BhÉ’% …â“pèt:|i “ÉÈfüÒèÐétb±X,“lôäÉ,tvvÆÂ––¡Pˆå0²ãÑ[¿¾`ì=Ò?£"~2w°€½¼C§§C???@ œ³³³qY%e²¸¸8)) ·,ËŽŒŒP%—Ë?Ž¡££C …BGCCŸÏk×®Ñ1’æt„{ÿþ½ÅbÁÙÑÉÉ GFFpÄÒ4íââBu£££¤í™òçÝÔ÷x"Êc%ˆóÞ,à´¦}¥Á`˜˜˜Àиºº~òc C{{»Á`îîî¾¾¾¸®s700€Ëœ\.ÇÎ3 Ã0 ˆÅâE‹Í ;-À±@ÿ§wýí¿ƒIEND®B`‚google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/logos/maven-feather.png000066400000000000000000000064021350651464300334130ustar00rootroot00000000000000‰PNG  IHDRZ#ž/ pHYs.#.#x¥?vgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅF xIDATxÚb`H €øÿÿÿ£ FF€blnÚ³gÏ÷ïß!ìß¿?xüä8û÷ïߟ?´¶ €XˆQtãÆ®®.[LL,##CAAMÍû÷ï'Ož\WW7eÊooo g„„„ ²oß¾1cFuu5A»øøøBCCýýý£££&ì=q†ñߟß7¿j›%ôó7£™»¾º€¾§²<· Õƒ €ˆJÏŸ?¿yófZZZJJ ''gpp0¦666mmm cß¾}oÞ¼Ù°aCoo/\öÛ·oÀh'Æ.33³ ­366^½zõ›W¯ž<{sbá‘['>>¿ðú׌}ßÒ'|vJzdt9&çî’Ÿ^=§bp±™E@@ÀÂÂÂÊÊ*;;ûÉ“'@‘Ù³g_¿~ȸzõêÂ… 1y÷î]ˆâ>½´uëÖcÇŽÁMøóçO}}½¯¯ïâÅ‹¥Õ¤I“._¾ ÿüùsUUÕß¿ÉçÖ­[@`Ê&F ™Ë–-›ÒѼ}ãªÝOžïgU:̪¾•Mú›øÍŸ"oo3².?ÚÕþÌ)ôJzÖU ßݽýÿÿ? ƒ €XˆTwçÎÖÖV £8P^^2”••555¡søða`d–••¥xyy½¼¼€Ztuuá&œ>}:77˜¢¢¢ää䘘˜€îééÙµk׳gϘ™™ /Ô²&&&ÁÑ «7lxóàÉž›[ÿ1òK3+J2‰>eggaýÿAýï3ÁŸœ|×~‹Þ9ùgñÑÇš3«©ý7Va××ááã–•eçæáæ$)8ˆØààááQWW:èî9sæ$&&âQ T#** Ì2Àp XXÔ ÊÔÔT`vww¯[·...( ,¸b`¨\¸|åç¿á1Ñúg]¾±ã*ËŸÓ ïþy|÷?';#?ûFAvVN=–Ï\JýýÌzñŸäõK_÷ß`ý¸ö×ï÷r|ÿy9ÿëè y™0É*°rˆ ÉK±rpã÷&@!!!ö‰'Ž= ¯¡á~ÀÁÁa°²²«4)))`šÌ2ööö˜õ¿ž¶–¢œÜ?†ÿ?ï­ÿs;èày>•Íìò/~ýþø÷Å“ßOÖÿ}ÉÈÀ´•]މ_ŒEÒœé;ëqÖ,² _¾~ù÷å:»ÜïZGÜÙpùàY¡GLºÂL"¼R&¬œŒŒX €"68~þüùâÅ X@= ¥¥Œy`VúdóæÍ@ïaÖá?~ü@9wî܃€¡T_\\ ‰ŒŒ,**rtt„„° QUU&+¨ËXX@V%=ú÷yúµgO}þ{ýãï;v¡ïìo¾ÿþ÷öü¿ï/þ¾½ÿëìq†?ŒŒ‚BŒüŒlߘ$¤™lÙYßþ[÷ÞÀéïÃ{ßEïüÐT8÷ºðÒu/NWÍÿ‚*†üÒpGQÁô9°ÀÖŠX•*))S{zzúòåËXÁXŽ nnnSSÓ &ìܹÓÝÝRïkßœœ`1±³³  æ©S§Bl™?~rr2<8à€]>5ó½¯çûƒ[¥Vï×:rùínŽ_ìŸþ³²³ü÷bz΢øŸUæ1Ãÿwÿ¾?ÿÿëÝ`ûäþ­¿ÿÿÿõ‘‘Møÿ¡Íÿ¿=þ%æËðòòC.‘»¿¬Å?2~øûñÍ3Öoûï=ãc°“SòçÚ@µJ%+¤¤À* l71‚²°~ „ ` L˜‰ »uÿþ}ýòñãÝóßoÿ³ü—ãï½ïØt˜þúýå?#+'3Ã'&.&¶L,Ϲÿ1ü8Ä .Êð‘õß÷Ûÿ9˜þ}øÏ$ðë,»fì.qfIvvF†ÿ~þäÒõŠ™t@ X#}÷îÝ………ÀšÅÃÃT½¿ÿüùöéãßï~ðëùß½çî¾öÿÝŽŸ‹ýá~ø‡…õϯŸ9¿ü}ÃÆñô¿€îï·¹9Y¿þüÍÎÅõó÷/A®2Ìì‘L?M¹þ}aüøƒ]XÂÅÒ!DQp Q`ÛÀÖ'<†õ%° ä ó?.½ÿÀ"ÐñÀTóû÷/†ÿÿ|ÿñíÝ›¿?~þ{ûö˯ÿ‡nþåÿ÷—‡ùïN%A†/Œllßò‰sÈÊ1üøóçý‡?ÊÜl¼¼\\<À4t3@AM$¬]»V€M/`› X.BÊ`kXpþúõkÞ¼yÀR– €íË{÷îý:è€"!8€Å¼Ö¶AÐb Ø6sssC+€u3†1ÿþÿüöÿû§ÿ~QâtHüøñ#0‰áW ,à€õAeà bƒh0¶‘ZÀÊ…‹‹ ­r•••6çá"À–„£‹þNôÿS£û§TñO‰üŸr•?]ÎÿÌþÿ÷PöñãÇÀXm»ºº;8pKm6{0X±bDغ ¶ƒ€õ°ÊFLKK °‘&R`T4 Xµ—””ÈËËkC 2`O08ˆØàƼ‰ t1°Å¬#+ }@.0Ò^¾| ¸ Úíþäc¢‡æ"›,M€Íˆ–7BÌv  €"ÀôÀ†2<Ülˆ`›˜O!Í|`á…[ÀîË—/øƒ €ˆ `Kn.ЕÁGÁkY`×¥2üüü`‰ûÇß™1ÿÎù÷ðÂÿ×÷ÿÝ>ò·Ó eC”Û`]§N‚Ä3°‚øØŠ,]ºâUH:tØ*ŠÓ)$¼€KxÛ×Çǧ¡¡ÁÚÚž¢Ý(üÁ@ÄÇĉá«§OŸB‘ûì[¶l[ðö80£æã?ÿ?¿ý÷øò¿«{þÎŽƒÇ–6ˆ$0‘CtmذÈ9s&„ ¬‰A ÌAÀÄŸÀüò A÷jRRDWcc#ÄXHÒKxÿþ=þà bë9`ŒAÀt+&&owÃK `3¾rå ¼ydxÿ”).ï`xó€áïo”GÁ€§ 'Q ì@CülÝÍ?{ö,d˜ÆÂ0Œ€YjðT iø°' ϹÈåV@,D¶>®°ŒŒà…“'OBÀâ Fð€VÀ Ô÷è¿é _ÞƒAVQÎ[èÿÞ) ~10³2Ê@Ô«©©Á[«“&MæD Ø©Ôb± –Öð€ƒ`¹ôêóçÏU;$tàAvæÌÃÒÒ’ Oˆ¨à¦±Û·oÃG«àÍ­óçÏ£ "‡¢¢"$Œþ¯¯…0!xW2¹002ýxþÿ®~"E^Q´ÔôÄ '+**àÖAÀ‚cÙ²eh-1HRº’0õôô€õDöøñãÄ@5Lî ²Ï5ÈÇ ‡ÑϯÿŸ_Gä `·Øâ8µ‚ìFED² t·k×.`3° ¯Îà#IÀÖàÂ… !Þæ©U«V ËàáeøàÜçÀçÒ¥K¶••AŸQ©XtAœœœpg!‡‘¹¹9„LáÀ¤Ž,l ì< _߃æs¥´þ¿ºÃðù-4€”Á!##4Ød‚D5°dõ÷÷‡Ë=ì »ÈÀ¶oBB°ï TüõëW bqqq`:ÂÀòõõë×@°dgF< €ˆJ@C¹Á˜á¥Ñ…  ‚‚‚‚@qˆ 0*€…DF̬L>• lœàNΧÿÏ®3ZÅ3Ë2°°ƒ¢rqt1;Í& Hµ ¯&-±ÔÔTHsÀF0Ûcyyy„póæM ^ àÁÌwÀ" (hkkKL¿ €ˆêÂ}úô 'ÒØÂƒ]I±@GÃ'€:`ŒÁ›=ÿ¼{üÿé`Tprò3|~É, |â H®¶»íKHÐ`|ÀÕ\»v H= ,Võ¤^V+*HA<ÿ € `ôðóóœv ÑY8”à ¦ÑP@4ŠP@€„Z¤':ævrIEND®B`‚google-api-java-client-1.27.1/google-api-client-assembly/dependencies/images/newwindow.png000066400000000000000000000003341350651464300315650ustar00rootroot00000000000000‰PNG  IHDR Óº&gAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< PLTEuuu™ÿÿÿÿÿÿ€8ÉÙtRNSÿÿÿ@*©ôFIDATxÚb`fff„f€b±™@€‘ €€Æ „8@!³™ @`6Ô€±L€Ø& ±´Â^IEND®B`‚google-api-java-client-1.27.1/google-api-client-assembly/dependencies/xpp3_LICENSE.txt000066400000000000000000000041761350651464300303760ustar00rootroot00000000000000Indiana University Extreme! Lab Software License Version 1.1.1 Copyright 2002 Extreme! Lab, Indiana University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Indiana University Extreme! Lab (http://www.extreme.indiana.edu/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact http://www.extreme.indiana.edu/. 5. Products derived from this software may not use "Indiana Univeristy" name nor may "Indiana Univeristy" appear in their name, without prior written permission of the Indiana University. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. google-api-java-client-1.27.1/google-api-client-assembly/pom.xml000066400000000000000000000105241350651464300244620ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml com.google.api-client google-api-client-assembly pom Assembly for the Google APIs Client Library for Java com.google.http-client google-http-client-assembly pom com.google.oauth-client google-oauth-client-assembly pom com.google.api-client google-api-client com.google.api-client google-api-client-appengine com.google.api-client google-api-client-servlet com.google.api-client google-api-client-android com.google.api-client google-api-client-gson com.google.api-client google-api-client-jackson2 com.google.api-client google-api-client-java6 com.google.api-client google-api-client-protobuf com.google.api-client google-api-client-xml maven-assembly-plugin assembly.xml google-api-java-client maven-dependency-plugin dependencies prepare-package copy-dependencies false ${project.build.directory}/libs android,opengl-api,google-collections,xmlParserAPIs,servlet-api,commons-codec,json,google-play-services src-dependencies prepare-package copy-dependencies sources false ${project.build.directory}/libs-sources android,opengl-api,google-collections,xmlParserAPIs,servlet-api,commons-codec,json,google-play-services maven-assembly-plugin make-assembly package single google-api-java-client-1.27.1/google-api-client-assembly/proguard-google-api-client.txt000066400000000000000000000013361350651464300310270ustar00rootroot00000000000000# ProGuard Configuration file # # See http://proguard.sourceforge.net/index.html#manual/usage.html # Needed to keep generic types and @Key annotations accessed via reflection -keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault -keepclassmembers class * { @com.google.api.client.util.Key ; } # Needed by google-http-client-android when linking against an older platform version -dontwarn com.google.api.client.extensions.android.** # Needed by google-api-client-android when linking against an older platform version -dontwarn com.google.api.client.googleapis.extensions.android.** # Needed by google-play-services when linking against an older platform version -dontwarn com.google.android.gms.** google-api-java-client-1.27.1/google-api-client-assembly/properties/000077500000000000000000000000001350651464300253375ustar00rootroot00000000000000google-api-client-android.jar.properties000066400000000000000000000001151350651464300350630ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-api-client-android-${project.version}-sources.jar google-api-client-gson.jar.properties000066400000000000000000000001161350651464300344120ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-api-client-gson-${project.api.version}-sources.jar google-api-client-jackson2.jar.properties000066400000000000000000000001221350651464300351530ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-api-client-jackson2-${project.api.version}-sources.jar google-api-client-protobuf.jar.properties000066400000000000000000000001161350651464300353040ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-api-client-protobuf-${project.version}-sources.jar google-api-client-xml.jar.properties000066400000000000000000000001111350651464300342370ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-api-client-xml-${project.version}-sources.jar google-api-java-client-1.27.1/google-api-client-assembly/properties/google-api-client.jar.properties000066400000000000000000000001051350651464300335230ustar00rootroot00000000000000src=../libs-sources/google-api-client-${project.version}-sources.jar google-http-client-android.jar.properties000066400000000000000000000001231350651464300352700ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-android-${project.http.version}-sources.jar google-http-client-gson.jar.properties000066400000000000000000000001201350651464300346130ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-gson-${project.http.version}-sources.jar google-http-client-jackson.jar.properties000066400000000000000000000001231350651464300353000ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-jackson-${project.http.version}-sources.jar google-http-client-jackson2.jar.properties000066400000000000000000000001241350651464300353630ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-jackson2-${project.http.version}-sources.jar google-http-client-jdo.jar.properties000066400000000000000000000001121350651464300344220ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-jdo-${project.version}-sources.jar google-http-client-protobuf.jar.properties000066400000000000000000000001241350651464300355110ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-protobuf-${project.http.version}-sources.jar google-http-client-xml.jar.properties000066400000000000000000000001121350651464300344460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-xml-${project.version}-sources.jar google-http-client.jar.properties000066400000000000000000000001131350651464300336510ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-http-client-${project.http.version}-sources.jar google-oauth-client.jar.properties000066400000000000000000000001151350651464300340140ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-assembly/propertiessrc=../libs-sources/google-oauth-client-${project.oauth.version}-sources.jar google-api-java-client-1.27.1/google-api-client-assembly/readme.html000066400000000000000000000230121350651464300252640ustar00rootroot00000000000000 ${project.name} ${project.version}

${project.name} ${project.version}

Overview

High-level details about this library can be found at http://code.google.com/p/google-api-java-client

Dependencies and Licenses

The license can be found here.
Dependent jars can be found in the libs folder and the corresponding source jars can be found in the libs-sources folder.

The dependency structure and licenses for the different libraries can be found here:

Maven Usage

For information on how to add these libraries to your Maven project please see http://code.google.com/p/google-api-java-client/wiki/Setup#Maven.

Eclipse

A .classpath file snippet that can be included in your project's .classpath has been provided here. Please only use the classpathentry's you actually need (see below for details).

ProGuard

A ProGuard configuration file proguard-google-api-client.txt is included for common settings for using the library. On Android projects, you may want to add a reference to proguard-google-api-client.txt in the project.properties file under the proguard.config property.

Please read Setup ProGuard for more details.

Dependencies for all Platforms

The following are the jars from the libs folder needed for applications on all platform:
  • google-api-client-${project.version}.jar
  • google-oauth-client-${project.oauth.version}.jar
  • google-http-client-${project.http.version}.jar
  • jsr305-${project.jsr305.version}.jar
  • google-api-client-protobuf-${project.api.version}.jar (when using protobuf-java)
    • google-http-client-protobuf-${project.http.version}.jar
    • protobuf-java-${project.protobuf-java.version}.jar
  • google-api-client-gson-${project.api.version}.jar (when using GSON)
    • google-http-client-gson-${project.http.version}.jar
    • gson-${project.gson.version}.jar
  • google-api-client-jackson2-${project.api.version}.jar (when using Jackson 2)
    • google-http-client-jackson2-${project.http.version}.jar
    • jackson-core-${project.jackson-core2.version}.jar
  • google-http-client-jackson-${project.http.version}.jar (when using Jackson 1)
    • jackson-core-asl-${project.jackson-core-asl.version}.jar
  • google-api-client-xml-${project.version}.jar (when using XML)
    • google-http-client-xml-${project.version}.jar
    • xpp3-${project.xpp3.version}.jar (when NOT on Android)

Android Dependencies

The following are the jars from the libs folder required for Android applications:
  • google-api-client-android-${project.version}.jar (for SDK >= 2.1)
  • google-http-client-android-${project.http.version}.jar
The libs folder also contains properties files that specify the location of source jars for Android projects in Eclipse.
Please see the Android wiki for the Android Developer's Guide.

Google App Engine Dependencies

The following are the jars from the libs folder required for Google App Engine applications or a newer compatible version:
  • google-api-client-appengine-${project.version}.jar
  • google-api-client-servlet-${project.version}.jar
  • google-oauth-client-appengine-${project.oauth.version}.jar
  • google-oauth-client-servlet-${project.oauth.version}.jar
  • google-http-client-appengine-${project.http.version}.jar
  • jdo2-api-${project.jdo2-api.version}.jar
  • transaction-api-${project.transaction-api.version}.jar
Please see the GoogleAppEngine wiki for the Google App Engine Developer's Guide.

Servlet Dependencies

The following are the jars from the libs folder required for Servlet applications or a newer compatible version:
  • google-api-client-servlet-${project.version}.jar
  • google-oauth-client-servlet-${project.oauth.version}.jar
  • commons-logging-${project.commons-logging.version}.jar
  • httpclient-${project.httpclient.version}.jar
  • httpcore-${project.httpcore.version}.jar
  • jdo2-api-${project.jdo2-api.version}.jar
  • transaction-api-${project.transaction-api.version}.jar

General Purpose Java 5 Environment Dependencies

The following are the jars from the libs folder required for general purpose Java 5 applications or a newer compatible version:
  • google-api-client-java6-${project.version}.jar
  • google-oauth-client-java6-${project.oauth.version}.jar (for JDK >= 6)
    • google-oauth-client-jetty-${project.oauth.version}.jar (for Jetty 6)
      • jetty-${project.jetty.version}.jar
      • jetty-util-${project.jetty.version}.jar
  • google-oauth-client-java7-${project.version}.jar (for JDK >= 7)
  • commons-logging-${project.commons-logging.version}.jar
  • httpclient-${project.httpclient.version}.jar
  • httpcore-${project.httpcore.version}.jar
google-api-java-client-1.27.1/google-api-client-bom/000077500000000000000000000000001350651464300221015ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-bom/README.md000066400000000000000000000014221350651464300233570ustar00rootroot00000000000000# Google API Client Library Bill of Materials The `google-api-client-bom` module is a pom that can be used to import consistent versions of `google-api-client` components. To use it in Maven, add the following to your `pom.xml`: [//]: # ({x-version-update-start:google-api-client:released}) ```xml com.google.api-client google-api-client-bom 1.27.1 pom import ``` [//]: # ({x-version-update-end}) ## License Apache 2.0 - See [LICENSE] for more information. [LICENSE]: https://github.com/googleapis/google-api-java-client/blob/master/LICENSE google-api-java-client-1.27.1/google-api-client-bom/pom.xml000066400000000000000000000135171350651464300234250ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-bom 1.27.1 pom Google API Client Library for Java BOM https://github.com/googleapis/google-api-java-client/tree/master/google-api-client-bom BOM for Google API Client Library for Java Google LLC chingor13 Jeff Ching chingor@google.com Google LLC Developer scm:git:https://github.com/googleapis/google-api-java-client.git scm:git:git@github.com:googleapis/google-api-java-client.git https://github.com/googleapis/google-api-java-client sonatype-nexus-snapshots https://oss.sonatype.org/content/repositories/snapshots sonatype-nexus-staging https://oss.sonatype.org/service/local/staging/deploy/maven2/ github-pages-site Deployment through GitHub's site deployment plugin site/google-cloud-bom The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo com.google.api-client google-api-client 1.27.1 com.google.api-client google-api-client-android 1.27.1 com.google.api-client google-api-client-appengine 1.27.1 com.google.api-client google-api-client-assembly 1.27.1 com.google.api-client google-api-client-gson 1.27.1 com.google.api-client google-api-client-jackson2 1.27.1 com.google.api-client google-api-client-java6 1.27.1 com.google.api-client google-api-client-protobuf 1.27.1 com.google.api-client google-api-client-servlet 1.27.1 com.google.api-client google-api-client-xml 1.27.1 org.sonatype.plugins nexus-staging-maven-plugin 1.6.6 true sonatype-nexus-staging https://oss.sonatype.org/ false release-sign-artifacts performRelease true org.apache.maven.plugins maven-gpg-plugin 1.6 sign-artifacts verify sign --pinentry-mode loopback google-api-java-client-1.27.1/google-api-client-gson/000077500000000000000000000000001350651464300222725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/pom.xml000066400000000000000000000040671350651464300236160ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-gson GSON extensions to the Google APIs Client Library for Java maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar com.google.api-client google-api-client com.google.http-client google-http-client-gson google-api-java-client-1.27.1/google-api-client-gson/src/000077500000000000000000000000001350651464300230615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/000077500000000000000000000000001350651464300240055ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/000077500000000000000000000000001350651464300247265ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/000077500000000000000000000000001350651464300255045ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/000077500000000000000000000000001350651464300267605ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/000077500000000000000000000000001350651464300275315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300310075ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapis/000077500000000000000000000000001350651464300331405ustar00rootroot00000000000000notifications/000077500000000000000000000000001350651464300357325ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapisjson/000077500000000000000000000000001350651464300367035ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notificationsgson/000077500000000000000000000000001350651464300376515ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/jsonGsonNotificationCallback.java000066400000000000000000000046351350651464300454160ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/* * Copyright 2013 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.api.client.googleapis.notifications.json.gson; import com.google.api.client.googleapis.notifications.TypedNotificationCallback; import com.google.api.client.googleapis.notifications.json.JsonNotificationCallback; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.util.Beta; /** * {@link Beta}
* A {@link TypedNotificationCallback} which uses an JSON content encoding with * {@link GsonFactory#getDefaultInstance()}. * *

* Must NOT be implemented in form of an anonymous class as this will break serialization. *

* *

* Implementation should be thread-safe. *

* * Example usage: * *
  static class MyNotificationCallback
      extends GsonNotificationCallback{@literal <}ListResponse{@literal >} {

    private static final long serialVersionUID = 1L;

    {@literal @}Override
    protected void onNotification(
        StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) {
      ListResponse content = notification.getContent();
      switch (notification.getResourceState()) {
        case ResourceStates.SYNC:
          break;
        case ResourceStates.EXISTS:
          break;
        case ResourceStates.NOT_EXISTS:
          break;
      }
    }

    {@literal @}Override
    protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
      return ListResponse.class;
    }
  }
 * 
* * @param Type of the data contained within a notification * @author Yaniv Inbar * @since 1.16 */ @Beta public abstract class GsonNotificationCallback extends JsonNotificationCallback { private static final long serialVersionUID = 1L; @Override protected JsonFactory getJsonFactory() { return GsonFactory.getDefaultInstance(); } } package-info.java000066400000000000000000000016101350651464300430360ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Notification channel handling based on the GSON JSON library. * * @author Yaniv Inbar * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.notifications.json.gson; google-api-java-client-1.27.1/google-api-client-jackson2/000077500000000000000000000000001350651464300230365ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/pom.xml000066400000000000000000000060301350651464300243520ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-jackson2 Jackson 2 extensions to the Google APIs Client Library for Java maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true org.apache.felix maven-bundle-plugin 2.5.4 bundle-manifest process-classes manifest https://developers.google.com/api-client-library/java/google-http-java-client/reference/1.20.0/jdiff/Google_HTTP_Client_Library_for_Java_1.19.0/com/google/api/client/json/jackson2/package-summary Low-level implementation of the JSON parser library based on the Jackson 2 JSON library. com.google.api.client.jackson2 maven-source-plugin source-jar compile jar com.google.api-client google-api-client com.google.http-client google-http-client-jackson2 google-api-java-client-1.27.1/google-api-client-jackson2/src/000077500000000000000000000000001350651464300236255ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/000077500000000000000000000000001350651464300245515ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/000077500000000000000000000000001350651464300254725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/000077500000000000000000000000001350651464300262505ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/000077500000000000000000000000001350651464300275245ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/000077500000000000000000000000001350651464300302755ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300315535ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300336255ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/clientnotifications/000077500000000000000000000000001350651464300364765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/googleapisjson/000077500000000000000000000000001350651464300374475ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/googleapis/notificationsjackson2/000077500000000000000000000000001350651464300411615ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/googleapis/notifications/jsonJacksonNotificationCallback.java000066400000000000000000000046611350651464300474070ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/googleapis/notifications/json/jackson2/* * Copyright 2013 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.api.client.googleapis.notifications.json.jackson2; import com.google.api.client.googleapis.notifications.TypedNotificationCallback; import com.google.api.client.googleapis.notifications.json.JsonNotificationCallback; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.Beta; /** * {@link Beta}
* A {@link TypedNotificationCallback} which uses an JSON content encoding with * {@link JacksonFactory#getDefaultInstance()}. * *

* Must NOT be implemented in form of an anonymous class as this will break serialization. *

* *

* Implementation should be thread-safe. *

* * Example usage: * *
  static class MyNotificationCallback
      extends GsonNotificationCallback{@literal <}ListResponse{@literal >} {

    private static final long serialVersionUID = 1L;

    {@literal @}Override
    protected void onNotification(
        StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) {
      ListResponse content = notification.getContent();
      switch (notification.getResourceState()) {
        case ResourceStates.SYNC:
          break;
        case ResourceStates.EXISTS:
          break;
        case ResourceStates.NOT_EXISTS:
          break;
      }
    }

    {@literal @}Override
    protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
      return ListResponse.class;
    }
  }
 * 
* * @param Type of the data contained within a notification * @author Yaniv Inbar * @since 1.16 */ @Beta public abstract class JacksonNotificationCallback extends JsonNotificationCallback { private static final long serialVersionUID = 1L; @Override protected JsonFactory getJsonFactory() { return JacksonFactory.getDefaultInstance(); } } package-info.java000066400000000000000000000016261350651464300443550ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-jackson2/src/main/java/com/google/api/client/googleapis/notifications/json/jackson2/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Notification channel handling based on the Jackson 2 JSON library. * * @author Yaniv Inbar * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.notifications.json.jackson2; google-api-java-client-1.27.1/google-api-client-java6/000077500000000000000000000000001350651464300223335ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/pom.xml000066400000000000000000000051531350651464300236540ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-java6 Java 6 (and higher) Extensions to the Google API Client Library for Java. maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar org.codehaus.mojo animal-sniffer-maven-plugin org.codehaus.mojo.signature java16 1.0 com.google.api-client google-api-client com.google.oauth-client google-oauth-client-java6 junit junit test google-api-java-client-1.27.1/google-api-client-java6/src/000077500000000000000000000000001350651464300231225ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/000077500000000000000000000000001350651464300240465ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/000077500000000000000000000000001350651464300247675ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/000077500000000000000000000000001350651464300255455ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/000077500000000000000000000000001350651464300270215ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/000077500000000000000000000000001350651464300275725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300310505ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300331225ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/clientextensions/000077500000000000000000000000001350651464300353215ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapisjava6/000077500000000000000000000000001350651464300363305ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapis/extensionsauth/000077500000000000000000000000001350651464300372715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapis/extensions/java6oauth2/000077500000000000000000000000001350651464300404735ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapis/extensions/java6/authGooglePromptReceiver.java000066400000000000000000000023471350651464300454470ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapis/extensions/java6/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.extensions.java6.auth.oauth2; import com.google.api.client.extensions.java6.auth.oauth2.AbstractPromptReceiver; import com.google.api.client.googleapis.auth.oauth2.GoogleOAuthConstants; import java.io.IOException; /** * Google OAuth 2.0 abstract verification code receiver that prompts user to paste the code copied * from the browser. * *

* Implementation is thread-safe. *

* * @since 1.11 * @author Yaniv Inbar */ public class GooglePromptReceiver extends AbstractPromptReceiver { @Override public String getRedirectUri() throws IOException { return GoogleOAuthConstants.OOB_REDIRECT_URI; } } package-info.java000066400000000000000000000014261350651464300436650ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-java6/src/main/java/com/google/api/client/googleapis/extensions/java6/auth/oauth2/* * Copyright 2012 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. */ /** * Google OAuth 2.0 utilities that help simplify the authorization flow on Java 6. * * @since 1.11 * @author Yaniv Inbar */ package com.google.api.client.googleapis.extensions.java6.auth.oauth2; google-api-java-client-1.27.1/google-api-client-protobuf/000077500000000000000000000000001350651464300231645ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/pom.xml000066400000000000000000000056441350651464300245120ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-protobuf Protocol Buffer extensions to the Google APIs Client Library for Java kr.motd.maven os-maven-plugin 1.4.0.Final maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar com.google.protobuf.tools maven-protoc-plugin 0.4.2 com.google.protobuf:protoc:${project.protobuf-java.version}-build2:exe:${os.detected.classifier} test-compile com.google.http-client google-http-client-protobuf com.google.api-client google-api-client junit junit test google-api-java-client-1.27.1/google-api-client-protobuf/src/000077500000000000000000000000001350651464300237535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/000077500000000000000000000000001350651464300246775ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/000077500000000000000000000000001350651464300256205ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/000077500000000000000000000000001350651464300263765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/000077500000000000000000000000001350651464300276525ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/000077500000000000000000000000001350651464300304235ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300317015ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300337535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/clientservices/000077500000000000000000000000001350651464300355765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapisprotobuf/000077500000000000000000000000001350651464300374365ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/servicesAbstractGoogleProtoClient.java000066400000000000000000000073031350651464300453670ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/* * Copyright 2013 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.api.client.googleapis.services.protobuf; import com.google.api.client.googleapis.services.AbstractGoogleClient; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.protobuf.ProtoObjectParser; import com.google.api.client.util.Beta; /** * {@link Beta}
* Thread-safe Google protocol buffer client. * * @since 1.16 * @author Yaniv Inbar */ @Beta public abstract class AbstractGoogleProtoClient extends AbstractGoogleClient { /** * @param builder builder */ protected AbstractGoogleProtoClient(Builder builder) { super(builder); } @Override public ProtoObjectParser getObjectParser() { return (ProtoObjectParser) super.getObjectParser(); } /** * {@link Beta}
* Builder for {@link AbstractGoogleProtoClient}. * *

* Implementation is not thread-safe. *

* @since 1.16 */ @Beta public abstract static class Builder extends AbstractGoogleClient.Builder { /** * @param transport HTTP transport * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none */ protected Builder(HttpTransport transport, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer) { super(transport, rootUrl, servicePath, new ProtoObjectParser(), httpRequestInitializer); } @Override public final ProtoObjectParser getObjectParser() { return (ProtoObjectParser) super.getObjectParser(); } @Override public abstract AbstractGoogleProtoClient build(); @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } } } AbstractGoogleProtoClientRequest.java000066400000000000000000000101541350651464300467360ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/* * Copyright 2013 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.api.client.googleapis.services.protobuf; import com.google.api.client.googleapis.batch.BatchCallback; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.UriTemplate; import com.google.api.client.http.protobuf.ProtoHttpContent; import com.google.api.client.util.Beta; import com.google.protobuf.MessageLite; import java.io.IOException; /** * {@link Beta}
* Google protocol buffer request for a {@link AbstractGoogleProtoClient}. * *

* Implementation is not thread-safe. *

* * @param type of the response * @since 1.16 * @author Yaniv Inbar */ @Beta public abstract class AbstractGoogleProtoClientRequest extends AbstractGoogleClientRequest { /** Message to serialize or {@code null} for none. */ private final MessageLite message; /** * @param abstractGoogleProtoClient Google protocol buffer client * @param requestMethod HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param message message to serialize or {@code null} for none * @param responseClass response class to parse into */ protected AbstractGoogleProtoClientRequest(AbstractGoogleProtoClient abstractGoogleProtoClient, String requestMethod, String uriTemplate, MessageLite message, Class responseClass) { super(abstractGoogleProtoClient, requestMethod, uriTemplate, message == null ? null : new ProtoHttpContent(message), responseClass); this.message = message; } @Override public AbstractGoogleProtoClient getAbstractGoogleClient() { return (AbstractGoogleProtoClient) super.getAbstractGoogleClient(); } @Override public AbstractGoogleProtoClientRequest setDisableGZipContent(boolean disableGZipContent) { return (AbstractGoogleProtoClientRequest) super.setDisableGZipContent(disableGZipContent); } @Override public AbstractGoogleProtoClientRequest setRequestHeaders(HttpHeaders headers) { return (AbstractGoogleProtoClientRequest) super.setRequestHeaders(headers); } /** * Queues the request into the specified batch request container. * *

* Batched requests are then executed when {@link BatchRequest#execute()} is called. *

*

* Example usage: *

* *
   *
    request.queue(batchRequest, new BatchCallback{@literal <}SomeResponseType, Void{@literal >}() {

      public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) {
        log("Success");
      }

      public void onFailure(Void unused, HttpHeaders responseHeaders) {
        log(e.getMessage());
      }
    });
   * 
* * * @param batchRequest batch request container * @param callback batch callback */ public final void queue(BatchRequest batchRequest, BatchCallback callback) throws IOException { super.queue(batchRequest, Void.class, callback); } /** Returns the message to serialize or {@code null} for none. */ public Object getMessage() { return message; } @Override public AbstractGoogleProtoClientRequest set(String fieldName, Object value) { return (AbstractGoogleProtoClientRequest) super.set(fieldName, value); } } CommonGoogleProtoClientRequestInitializer.java000066400000000000000000000071061350651464300506320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/* * Copyright 2013 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.api.client.googleapis.services.protobuf; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.googleapis.services.CommonGoogleClientRequestInitializer; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Google protocol buffer client request initializer implementation for setting properties like key * and userIp. * *

* The simplest usage is to use it to set the key parameter: *

* *
  public static final GoogleClientRequestInitializer KEY_INITIALIZER =
      new CommonGoogleProtoClientRequestInitializer(KEY);
 * 
* *

* There is also a constructor to set both the key and userIp parameters: *

* *
  public static final GoogleClientRequestInitializer INITIALIZER =
      new CommonGoogleProtoClientRequestInitializer(KEY, USER_IP);
 * 
* *

* If you want to implement custom logic, extend it like this: *

* *
  public static class MyRequestInitializer extends CommonGoogleProtoClientRequestInitializer {

    {@literal @}Override
    public void initialize(AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request)
        throws IOException {
      // custom logic
    }
  }
 * 
* *

* Finally, to set the key and userIp parameters and insert custom logic, extend it like this: *

* *
  public static class MyKeyRequestInitializer extends CommonGoogleProtoClientRequestInitializer {

    public MyKeyRequestInitializer() {
      super(KEY, USER_IP);
    }

    {@literal @}Override
    public void initializeProtoRequest(
        AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request) throws IOException {
      // custom logic
    }
  }
 * 
* *

* Subclasses should be thread-safe. *

* * @since 1.16 * @author Yaniv Inbar */ @Beta public class CommonGoogleProtoClientRequestInitializer extends CommonGoogleClientRequestInitializer { public CommonGoogleProtoClientRequestInitializer() { super(); } /** * @param key API key or {@code null} to leave it unchanged */ public CommonGoogleProtoClientRequestInitializer(String key) { super(key); } /** * @param key API key or {@code null} to leave it unchanged * @param userIp user IP or {@code null} to leave it unchanged */ public CommonGoogleProtoClientRequestInitializer(String key, String userIp) { super(key, userIp); } @Override public final void initialize(AbstractGoogleClientRequest request) throws IOException { super.initialize(request); initializeProtoRequest((AbstractGoogleProtoClientRequest) request); } /** * Initializes a Google protocol buffer client request. * *

* Default implementation does nothing. Called from * {@link #initialize(AbstractGoogleClientRequest)}. *

* * @throws IOException I/O exception */ protected void initializeProtoRequest(AbstractGoogleProtoClientRequest request) throws IOException { } } package-info.java000066400000000000000000000015531350651464300426310ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Contains the basis for the generated service-specific libraries based on the Protobuf format. * * @since 1.16 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.services.protobuf; testing/000077500000000000000000000000001350651464300354305ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapisservices/000077500000000000000000000000001350651464300372535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/testingprotobuf/000077500000000000000000000000001350651464300411135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/testing/servicesMockGoogleProtoClient.java000066400000000000000000000075151350651464300461770ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/testing/services/protobuf/* * Copyright 2013 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.api.client.googleapis.testing.services.protobuf; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.api.client.googleapis.services.protobuf.AbstractGoogleProtoClient; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.util.Beta; /** * {@link Beta}
* Thread-safe mock Google protocol buffer client. * * @since 1.16 * @author Yaniv Inbar */ @Beta public class MockGoogleProtoClient extends AbstractGoogleProtoClient { /** * @param builder builder */ protected MockGoogleProtoClient(Builder builder) { super(builder); } /** * @param transport HTTP transport * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none */ public MockGoogleProtoClient(HttpTransport transport, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer) { this(new Builder(transport, rootUrl, servicePath, httpRequestInitializer)); } /** * {@link Beta}
* Builder for {@link MockGoogleProtoClient}. * *

* Implementation is not thread-safe. *

*/ @Beta public static class Builder extends AbstractGoogleProtoClient.Builder { /** * @param transport HTTP transport * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none */ public Builder(HttpTransport transport, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer) { super(transport, rootUrl, servicePath, httpRequestInitializer); } @Override public MockGoogleProtoClient build() { return new MockGoogleProtoClient(this); } @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } } } MockGoogleProtoClientRequest.java000066400000000000000000000047601350651464300475470ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/testing/services/protobuf/* * Copyright 2013 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.api.client.googleapis.testing.services.protobuf; import com.google.api.client.googleapis.services.protobuf.AbstractGoogleProtoClient; import com.google.api.client.googleapis.services.protobuf.AbstractGoogleProtoClientRequest; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.UriTemplate; import com.google.api.client.util.Beta; import com.google.protobuf.MessageLite; /** * {@link Beta}
* Thread-safe mock Google protocol buffer request. * * @param type of the response * @since 1.16 * @author Yaniv Inbar */ @Beta public class MockGoogleProtoClientRequest extends AbstractGoogleProtoClientRequest { /** * @param client Google client * @param method HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param message message to serialize or {@code null} for none * @param responseClass response class to parse into */ public MockGoogleProtoClientRequest(AbstractGoogleProtoClient client, String method, String uriTemplate, MessageLite message, Class responseClass) { super(client, method, uriTemplate, message, responseClass); } @Override public MockGoogleProtoClient getAbstractGoogleClient() { return (MockGoogleProtoClient) super.getAbstractGoogleClient(); } @Override public MockGoogleProtoClientRequest setDisableGZipContent(boolean disableGZipContent) { return (MockGoogleProtoClientRequest) super.setDisableGZipContent(disableGZipContent); } @Override public MockGoogleProtoClientRequest setRequestHeaders(HttpHeaders headers) { return (MockGoogleProtoClientRequest) super.setRequestHeaders(headers); } } package-info.java000066400000000000000000000015471350651464300443110ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/testing/services/protobuf/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.protobuf} package. * * @since 1.16 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.services.protobuf; google-api-java-client-1.27.1/google-api-client-protobuf/src/test/000077500000000000000000000000001350651464300247325ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/000077500000000000000000000000001350651464300256535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/000077500000000000000000000000001350651464300264315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/000077500000000000000000000000001350651464300277055ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/000077500000000000000000000000001350651464300304565ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/client/000077500000000000000000000000001350651464300317345ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300340065ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/clientservices/000077500000000000000000000000001350651464300356315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/client/googleapisprotobuf/000077500000000000000000000000001350651464300374715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/client/googleapis/servicesCommonGoogleProtoClientRequestInitializerTest.java000066400000000000000000000037431350651464300515300ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/java/com/google/api/client/googleapis/services/protobuf/* * Copyright 2013 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.api.client.googleapis.services.protobuf; import com.google.api.client.googleapis.testing.services.protobuf.MockGoogleProtoClient; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.util.Key; import com.google.protobuf.MessageLite; import junit.framework.TestCase; /** * Tests {@link CommonGoogleProtoClientRequestInitializer}. * * @author Yaniv Inbar */ public class CommonGoogleProtoClientRequestInitializerTest extends TestCase { public static class MyRequest extends AbstractGoogleProtoClientRequest { @Key String key; protected MyRequest(MockGoogleProtoClient client, String method, String uriTemplate, MessageLite message, Class responseClass) { super(client, method, uriTemplate, message, responseClass); } } public void testInitialize() throws Exception { CommonGoogleProtoClientRequestInitializer key = new CommonGoogleProtoClientRequestInitializer("foo"); MockGoogleProtoClient client = new MockGoogleProtoClient.Builder(new MockHttpTransport(), HttpTesting.SIMPLE_URL, "test/", null).setApplicationName("Test Application").build(); MyRequest request = new MyRequest(client, "GET", "", null, String.class); assertNull(request.key); key.initialize(request); assertEquals("foo", request.key); } } google-api-java-client-1.27.1/google-api-client-protobuf/src/test/proto/000077500000000000000000000000001350651464300260755ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-protobuf/src/test/proto/simple_proto.proto000066400000000000000000000015631350651464300317030ustar00rootroot00000000000000/* * Copyright 2013 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. */ syntax = "proto2"; option optimize_for = LITE_RUNTIME; option java_package = "com.google.api.client.googleapis.services.protobuf"; message TestMessage { required TestStatus status = 1; required string name = 2; required int64 value = 3; } enum TestStatus { SUCCESS = 1; FAILURE = 2; }google-api-java-client-1.27.1/google-api-client-servlet/000077500000000000000000000000001350651464300230105ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/pom.xml000066400000000000000000000050501350651464300243250ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-servlet Servlet and JDO extensions to the Google API Client Library for Java. maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ https://googleapis.github.io/google-oauth-java-client/releases/${project.oauth.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar com.google.oauth-client google-oauth-client-servlet com.google.api-client google-api-client junit junit test javax.servlet servlet-api javax.jdo jdo2-api google-api-java-client-1.27.1/google-api-client-servlet/src/000077500000000000000000000000001350651464300235775ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/000077500000000000000000000000001350651464300245235ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/000077500000000000000000000000001350651464300254445ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/000077500000000000000000000000001350651464300262225ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/000077500000000000000000000000001350651464300274765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/000077500000000000000000000000001350651464300302475ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300315255ustar00rootroot00000000000000googleapis/000077500000000000000000000000001350651464300335775ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/clientextensions/000077500000000000000000000000001350651464300357765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapisservlet/000077500000000000000000000000001350651464300374625ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensionsnotifications/000077500000000000000000000000001350651464300423335ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servletNotificationServlet.java000066400000000000000000000120071350651464300471710ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/* * Copyright 2013 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.api.client.googleapis.extensions.servlet.notifications; import com.google.api.client.googleapis.notifications.StoredChannel; import com.google.api.client.util.Beta; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.DataStoreFactory; import com.google.api.client.util.store.MemoryDataStoreFactory; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * {@link Beta}
* Thread-safe Webhook Servlet to receive notifications. * *

* In order to use this servlet you should create a class inheriting from * {@link NotificationServlet} and register the servlet in your web.xml. *

* *

* It is a simple wrapper around {@link WebhookUtils#processWebhookNotification}, so if you you may * alternatively call that method instead from your {@link HttpServlet#doPost} with no loss of * functionality. *

* * Example usage: * *
  public class MyNotificationServlet extends NotificationServlet {

    private static final long serialVersionUID = 1L;

    public MyNotificationServlet() throws IOException {
      super(new SomeDataStoreFactory());
    }
  }
 * 
* * Sample web.xml setup: * *
  {@literal <}servlet{@literal >}
      {@literal <}servlet-name{@literal >}MyNotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}servlet-class{@literal >}com.mypackage.MyNotificationServlet{@literal <}/servlet-class{@literal >}
  {@literal <}/servlet{@literal >}
  {@literal <}servlet-mapping{@literal >}
      {@literal <}servlet-name{@literal >}MyNotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >}
  {@literal <}/servlet-mapping{@literal >}
 * 
* *

* WARNING: by default it uses {@link MemoryDataStoreFactory#getDefaultInstance()} which means it * will NOT persist the notification channels when the servlet process dies, so it is a BAD CHOICE * for a production application. But it is a convenient choice when testing locally, in which case * you don't need to override it, and can simply reference it directly in your web.xml file. For * example: *

* *
  {@literal <}servlet{@literal >}
      {@literal <}servlet-name{@literal >}NotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.servlet.notificationsNotificationServlet{@literal <}/servlet-class{@literal >}
  {@literal <}/servlet{@literal >}
  {@literal <}servlet-mapping{@literal >}
      {@literal <}servlet-name{@literal >}NotificationServlet{@literal <}/servlet-name{@literal >}
      {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >}
  {@literal <}/servlet-mapping{@literal >}
 * 
* * @author Yaniv Inbar * @since 1.16 */ @Beta public class NotificationServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** Notification channel data store. */ private final transient DataStore channelDataStore; /** * Constructor to be used for testing and demo purposes that uses * {@link MemoryDataStoreFactory#getDefaultInstance()} which means it will NOT persist the * notification channels when the servlet process dies, so it is a bad choice for a production * application. */ public NotificationServlet() throws IOException { this(MemoryDataStoreFactory.getDefaultInstance()); } /** * Constructor which uses {@link StoredChannel#getDefaultDataStore(DataStoreFactory)} on the given * data store factory, which is the normal use case. * * @param dataStoreFactory data store factory */ protected NotificationServlet(DataStoreFactory dataStoreFactory) throws IOException { this(StoredChannel.getDefaultDataStore(dataStoreFactory)); } /** * Constructor that allows a specific notification data store to be specified. * * @param channelDataStore notification channel data store */ protected NotificationServlet(DataStore channelDataStore) { this.channelDataStore = channelDataStore; } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebhookUtils.processWebhookNotification(req, resp, channelDataStore); } } WebhookHeaders.java000066400000000000000000000044411350651464300460730ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/* * Copyright 2013 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.api.client.googleapis.extensions.servlet.notifications; import com.google.api.client.googleapis.notifications.ResourceStates; import com.google.api.client.util.Beta; /** * {@link Beta}
* Headers for Webhook notifications. * * @author Yaniv Inbar * @since 1.16 */ @Beta public final class WebhookHeaders { /** Name of header for the message number (a monotonically increasing value starting with 1). */ public static final String MESSAGE_NUMBER = "X-Goog-Message-Number"; /** Name of header for the {@link ResourceStates resource state}. */ public static final String RESOURCE_STATE = "X-Goog-Resource-State"; /** * Name of header for the opaque ID for the watched resource that is stable across API versions. */ public static final String RESOURCE_ID = "X-Goog-Resource-ID"; /** * Name of header for the opaque ID (in the form of a canonicalized URI) for the watched resource * that is sensitive to the API version. */ public static final String RESOURCE_URI = "X-Goog-Resource-URI"; /** * Name of header for the notification channel UUID provided by the client in the watch request. */ public static final String CHANNEL_ID = "X-Goog-Channel-ID"; /** Name of header for the notification channel expiration time. */ public static final String CHANNEL_EXPIRATION = "X-Goog-Channel-Expiration"; /** * Name of header for the notification channel token (an opaque string) provided by the client in * the watch request. */ public static final String CHANNEL_TOKEN = "X-Goog-Channel-Token"; /** Name of header for the type of change performed on the resource. */ public static final String CHANGED = "X-Goog-Changed"; private WebhookHeaders() { } } WebhookUtils.java000066400000000000000000000160731350651464300456240ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/* * Copyright 2013 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.api.client.googleapis.extensions.servlet.notifications; import com.google.api.client.googleapis.notifications.StoredChannel; import com.google.api.client.googleapis.notifications.UnparsedNotification; import com.google.api.client.googleapis.notifications.UnparsedNotificationCallback; import com.google.api.client.util.Beta; import com.google.api.client.util.LoggingInputStream; import com.google.api.client.util.Preconditions; import com.google.api.client.util.StringUtils; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.DataStoreFactory; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * {@link Beta}
* Utilities for Webhook notifications. * * @author Yaniv Inbar * @since 1.16 */ @Beta public final class WebhookUtils { static final Logger LOGGER = Logger.getLogger(WebhookUtils.class.getName()); /** Webhook notification channel type to use in the watch request. */ public static final String TYPE = "web_hook"; /** * Utility method to process the webhook notification from {@link HttpServlet#doPost} by finding * the notification channel in the given data store factory. * *

* It is a wrapper around * {@link #processWebhookNotification(HttpServletRequest, HttpServletResponse, DataStore)} that * uses the data store from {@link StoredChannel#getDefaultDataStore(DataStoreFactory)}. *

* * @param req an {@link HttpServletRequest} object that contains the request the client has made * of the servlet * @param resp an {@link HttpServletResponse} object that contains the response the servlet sends * to the client * @param dataStoreFactory data store factory * @exception IOException if an input or output error is detected when the servlet handles the * request * @exception ServletException if the request for the POST could not be handled */ public static void processWebhookNotification( HttpServletRequest req, HttpServletResponse resp, DataStoreFactory dataStoreFactory) throws ServletException, IOException { processWebhookNotification(req, resp, StoredChannel.getDefaultDataStore(dataStoreFactory)); } /** * Utility method to process the webhook notification from {@link HttpServlet#doPost}. * *

* The {@link HttpServletRequest#getInputStream()} is closed in a finally block inside this * method. If it is not detected to be a webhook notification, an * {@link HttpServletResponse#SC_BAD_REQUEST} error will be displayed. If the notification channel * is found in the given notification channel data store, it will call * {@link UnparsedNotificationCallback#onNotification} for the registered notification callback * method. *

* * @param req an {@link HttpServletRequest} object that contains the request the client has made * of the servlet * @param resp an {@link HttpServletResponse} object that contains the response the servlet sends * to the client * @param channelDataStore notification channel data store * @exception IOException if an input or output error is detected when the servlet handles the * request * @exception ServletException if the request for the POST could not be handled */ public static void processWebhookNotification( HttpServletRequest req, HttpServletResponse resp, DataStore channelDataStore) throws ServletException, IOException { Preconditions.checkArgument("POST".equals(req.getMethod())); InputStream contentStream = req.getInputStream(); try { // log headers if (LOGGER.isLoggable(Level.CONFIG)) { StringBuilder builder = new StringBuilder(); Enumeration e = req.getHeaderNames(); if (e != null) { while (e.hasMoreElements()) { Object nameObj = e.nextElement(); if (nameObj instanceof String) { String name = (String) nameObj; Enumeration ev = req.getHeaders(name); if (ev != null) { while (ev.hasMoreElements()) { builder.append(name) .append(": ").append(ev.nextElement()).append(StringUtils.LINE_SEPARATOR); } } } } } LOGGER.config(builder.toString()); contentStream = new LoggingInputStream(contentStream, LOGGER, Level.CONFIG, 0x4000); // TODO(yanivi): allow to override logging content limit } // parse the relevant headers, and create a notification Long messageNumber; try { messageNumber = Long.valueOf(req.getHeader(WebhookHeaders.MESSAGE_NUMBER)); } catch (NumberFormatException e) { messageNumber = null; } String resourceState = req.getHeader(WebhookHeaders.RESOURCE_STATE); String resourceId = req.getHeader(WebhookHeaders.RESOURCE_ID); String resourceUri = req.getHeader(WebhookHeaders.RESOURCE_URI); String channelId = req.getHeader(WebhookHeaders.CHANNEL_ID); String channelExpiration = req.getHeader(WebhookHeaders.CHANNEL_EXPIRATION); String channelToken = req.getHeader(WebhookHeaders.CHANNEL_TOKEN); String changed = req.getHeader(WebhookHeaders.CHANGED); if (messageNumber == null || resourceState == null || resourceId == null || resourceUri == null || channelId == null) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Notification did not contain all required information."); return; } UnparsedNotification notification = new UnparsedNotification(messageNumber, resourceState, resourceId, resourceUri, channelId).setChannelExpiration(channelExpiration) .setChannelToken(channelToken) .setChanged(changed) .setContentType(req.getContentType()) .setContentStream(contentStream); // check if we know about the channel, hand over the notification to the notification callback StoredChannel storedChannel = channelDataStore.get(notification.getChannelId()); if (storedChannel != null) { storedChannel.getNotificationCallback().onNotification(storedChannel, notification); } } finally { contentStream.close(); } } private WebhookUtils() { } } package-info.java000066400000000000000000000015661350651464300455320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Support for subscribing to topics and receiving notifications on servlet-based platforms. * * @author Yaniv Inbar * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.extensions.servlet.notifications; google-api-java-client-1.27.1/google-api-client-xml/000077500000000000000000000000001350651464300221245ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/pom.xml000066400000000000000000000042651350651464300234500ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client-xml XML extensions to the Google APIs Client Library for Java maven-javadoc-plugin http://download.oracle.com/javase/6/docs/api/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true maven-source-plugin source-jar compile jar com.google.api-client google-api-client com.google.http-client google-http-client-xml junit junit test google-api-java-client-1.27.1/google-api-client-xml/src/000077500000000000000000000000001350651464300227135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/000077500000000000000000000000001350651464300236375ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/000077500000000000000000000000001350651464300245605ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/000077500000000000000000000000001350651464300253365ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/000077500000000000000000000000001350651464300266125ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/000077500000000000000000000000001350651464300273635ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300306415ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/000077500000000000000000000000001350651464300327725ustar00rootroot00000000000000xml/000077500000000000000000000000001350651464300335135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapisatom/000077500000000000000000000000001350651464300344535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xmlAtomPatchContent.java000066400000000000000000000037541350651464300405420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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.api.client.googleapis.xml.atom; import com.google.api.client.http.HttpMediaType; import com.google.api.client.http.xml.atom.AtomContent; import com.google.api.client.util.Beta; import com.google.api.client.xml.Xml; import com.google.api.client.xml.XmlNamespaceDictionary; /** * {@link Beta}
* Serializes Atom XML PATCH HTTP content based on the data key/value mapping object for an Atom * entry. * *

* Default value for {@link #getType()} is {@link Xml#MEDIA_TYPE}. *

* *

* Sample usage: *

* *
 *
  static void setContent(
      HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object patchEntry) {
    request.setContent(new AtomPatchContent(namespaceDictionary, patchEntry));
  }
 * 
 * 
* *

* Implementation is not thread-safe. *

* * @since 1.0 * @author Yaniv Inbar */ @Beta public final class AtomPatchContent extends AtomContent { /** * @param namespaceDictionary XML namespace dictionary * @param patchEntry key/value pair data for the Atom PATCH entry * @since 1.5 */ public AtomPatchContent(XmlNamespaceDictionary namespaceDictionary, Object patchEntry) { super(namespaceDictionary, patchEntry, true); setMediaType(new HttpMediaType(Xml.MEDIA_TYPE)); } @Override public AtomPatchContent setMediaType(HttpMediaType mediaType) { super.setMediaType(mediaType); return this; } } AtomPatchRelativeToOriginalContent.java000066400000000000000000000060441350651464300442210ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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.api.client.googleapis.xml.atom; import com.google.api.client.http.HttpMediaType; import com.google.api.client.http.xml.AbstractXmlHttpContent; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import com.google.api.client.xml.XmlNamespaceDictionary; import com.google.api.client.xml.atom.Atom; import java.io.IOException; import java.util.Map; import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
* Serializes an optimal Atom XML PATCH HTTP content based on the data key/value mapping object for * an Atom entry, by comparing the original value to the patched value. * *

* Sample usage: *

* *
 * 
  static void setContent(HttpRequest request, XmlNamespaceDictionary namespaceDictionary,
      Object originalEntry, Object patchedEntry) {
    request.setContent(
        new AtomPatchRelativeToOriginalContent(namespaceDictionary, originalEntry, patchedEntry));
  }
 * 
 * 
* * @since 1.0 * @author Yaniv Inbar */ @Beta public final class AtomPatchRelativeToOriginalContent extends AbstractXmlHttpContent { /** Key/value pair data for the updated/patched Atom entry. */ private final Object patchedEntry; /** Key/value pair data for the original unmodified Atom entry. */ private final Object originalEntry; /** * @param namespaceDictionary XML namespace dictionary * @since 1.5 */ public AtomPatchRelativeToOriginalContent( XmlNamespaceDictionary namespaceDictionary, Object originalEntry, Object patchedEntry) { super(namespaceDictionary); this.originalEntry = Preconditions.checkNotNull(originalEntry); this.patchedEntry = Preconditions.checkNotNull(patchedEntry); } @Override protected void writeTo(XmlSerializer serializer) throws IOException { Map patch = GoogleAtom.computePatch(patchedEntry, originalEntry); getNamespaceDictionary().serialize(serializer, Atom.ATOM_NAMESPACE, "entry", patch); } @Override public AtomPatchRelativeToOriginalContent setMediaType(HttpMediaType mediaType) { super.setMediaType(mediaType); return this; } /** * Returns the data key name/value pairs for the updated/patched Atom entry. * * @since 1.5 */ public final Object getPatchedEntry() { return patchedEntry; } /** * Returns the data key name/value pairs for the original unmodified Atom entry. * * @since 1.5 */ public final Object getOriginalEntry() { return originalEntry; } } GoogleAtom.java000066400000000000000000000230051350651464300373530ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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.api.client.googleapis.xml.atom; import com.google.api.client.util.ArrayMap; import com.google.api.client.util.Beta; import com.google.api.client.util.ClassInfo; import com.google.api.client.util.Data; import com.google.api.client.util.FieldInfo; import com.google.api.client.util.GenericData; import com.google.api.client.util.Types; import java.util.Collection; import java.util.Map; import java.util.TreeSet; /** * {@link Beta}
* Utilities for working with the Atom XML of Google Data APIs. * * @since 1.0 * @author Yaniv Inbar */ @Beta public class GoogleAtom { /** * GData namespace. * * @since 1.0 */ public static final String GD_NAMESPACE = "http://schemas.google.com/g/2005"; /** * Content type used on an error formatted in XML. * * @since 1.5 */ public static final String ERROR_CONTENT_TYPE = "application/vnd.google.gdata.error+xml"; // TODO(yanivi): require XmlNamespaceDictory and include xmlns declarations since there is no // guarantee that there is a match between Google's mapping and the one used by client /** * Returns the fields mask to use for the given data class of key/value pairs. It cannot be a * {@link Map}, {@link GenericData} or a {@link Collection}. * * @param dataClass data class of key/value pairs */ public static String getFieldsFor(Class dataClass) { StringBuilder fieldsBuf = new StringBuilder(); appendFieldsFor(fieldsBuf, dataClass, new int[1]); return fieldsBuf.toString(); } /** * Returns the fields mask to use for the given data class of key/value pairs for the feed class * and for the entry class. This should only be used if the feed class does not contain the entry * class as a field. The data classes cannot be a {@link Map}, {@link GenericData} or a * {@link Collection}. * * @param feedClass feed data class * @param entryClass entry data class */ public static String getFeedFields(Class feedClass, Class entryClass) { StringBuilder fieldsBuf = new StringBuilder(); appendFeedFields(fieldsBuf, feedClass, entryClass); return fieldsBuf.toString(); } private static void appendFieldsFor( StringBuilder fieldsBuf, Class dataClass, int[] numFields) { if (Map.class.isAssignableFrom(dataClass) || Collection.class.isAssignableFrom(dataClass)) { throw new IllegalArgumentException( "cannot specify field mask for a Map or Collection class: " + dataClass); } ClassInfo classInfo = ClassInfo.of(dataClass); for (String name : new TreeSet(classInfo.getNames())) { FieldInfo fieldInfo = classInfo.getFieldInfo(name); if (fieldInfo.isFinal()) { continue; } if (++numFields[0] != 1) { fieldsBuf.append(','); } fieldsBuf.append(name); // TODO(yanivi): handle Java arrays? Class fieldClass = fieldInfo.getType(); if (Collection.class.isAssignableFrom(fieldClass)) { // TODO(yanivi): handle Java collection of Java collection or Java map? fieldClass = (Class) Types.getIterableParameter(fieldInfo.getField().getGenericType()); } // TODO(yanivi): implement support for map when server implements support for *:* if (fieldClass != null) { if (fieldInfo.isPrimitive()) { if (name.charAt(0) != '@' && !name.equals("text()")) { // TODO(yanivi): wait for bug fix from server to support text() -- already fixed??? // buf.append("/text()"); } } else if (!Collection.class.isAssignableFrom(fieldClass) && !Map.class.isAssignableFrom(fieldClass)) { int[] subNumFields = new int[1]; int openParenIndex = fieldsBuf.length(); fieldsBuf.append('('); // TODO(yanivi): abort if found cycle to avoid infinite loop appendFieldsFor(fieldsBuf, fieldClass, subNumFields); updateFieldsBasedOnNumFields(fieldsBuf, openParenIndex, subNumFields[0]); } } } } private static void appendFeedFields( StringBuilder fieldsBuf, Class feedClass, Class entryClass) { int[] numFields = new int[1]; appendFieldsFor(fieldsBuf, feedClass, numFields); if (numFields[0] != 0) { fieldsBuf.append(","); } fieldsBuf.append("entry("); int openParenIndex = fieldsBuf.length() - 1; numFields[0] = 0; appendFieldsFor(fieldsBuf, entryClass, numFields); updateFieldsBasedOnNumFields(fieldsBuf, openParenIndex, numFields[0]); } private static void updateFieldsBasedOnNumFields( StringBuilder fieldsBuf, int openParenIndex, int numFields) { switch (numFields) { case 0: fieldsBuf.deleteCharAt(openParenIndex); break; case 1: fieldsBuf.setCharAt(openParenIndex, '/'); break; default: fieldsBuf.append(')'); } } /** * Compute the patch object of key/value pairs from the given original and patched objects, adding * a {@code @gd:fields} key for the fields mask. * * @param patched patched object * @param original original object * @return patch object of key/value pairs */ public static Map computePatch(Object patched, Object original) { FieldsMask fieldsMask = new FieldsMask(); ArrayMap result = computePatchInternal(fieldsMask, patched, original); if (fieldsMask.numDifferences != 0) { result.put("@gd:fields", fieldsMask.buf.toString()); } return result; } private static ArrayMap computePatchInternal( FieldsMask fieldsMask, Object patchedObject, Object originalObject) { ArrayMap result = ArrayMap.create(); Map patchedMap = Data.mapOf(patchedObject); Map originalMap = Data.mapOf(originalObject); TreeSet fieldNames = new TreeSet(); fieldNames.addAll(patchedMap.keySet()); fieldNames.addAll(originalMap.keySet()); for (String name : fieldNames) { Object originalValue = originalMap.get(name); Object patchedValue = patchedMap.get(name); if (originalValue == patchedValue) { continue; } Class type = originalValue == null ? patchedValue.getClass() : originalValue.getClass(); if (Data.isPrimitive(type)) { if (originalValue != null && originalValue.equals(patchedValue)) { continue; } fieldsMask.append(name); // TODO(yanivi): wait for bug fix from server // if (!name.equals("text()") && name.charAt(0) != '@') { // fieldsMask.buf.append("/text()"); // } if (patchedValue != null) { result.add(name, patchedValue); } } else if (Collection.class.isAssignableFrom(type)) { if (originalValue != null && patchedValue != null) { @SuppressWarnings("unchecked") Collection originalCollection = (Collection) originalValue; @SuppressWarnings("unchecked") Collection patchedCollection = (Collection) patchedValue; int size = originalCollection.size(); if (size == patchedCollection.size()) { int i; for (i = 0; i < size; i++) { FieldsMask subFieldsMask = new FieldsMask(); computePatchInternal(subFieldsMask, patchedValue, originalValue); if (subFieldsMask.numDifferences != 0) { break; } } if (i == size) { continue; } } } // TODO(yanivi): implement throw new UnsupportedOperationException( "not yet implemented: support for patching collections"); } else { if (originalValue == null) { // TODO(yanivi): test fieldsMask.append(name); result.add(name, Data.mapOf(patchedValue)); } else if (patchedValue == null) { // TODO(yanivi): test fieldsMask.append(name); } else { FieldsMask subFieldsMask = new FieldsMask(); ArrayMap patch = computePatchInternal(subFieldsMask, patchedValue, originalValue); int numDifferences = subFieldsMask.numDifferences; if (numDifferences != 0) { fieldsMask.append(name, subFieldsMask); result.add(name, patch); } } } } return result; } static class FieldsMask { int numDifferences; StringBuilder buf = new StringBuilder(); void append(String name) { StringBuilder buf = this.buf; if (++numDifferences != 1) { buf.append(','); } buf.append(name); } void append(String name, FieldsMask subFields) { append(name); StringBuilder buf = this.buf; boolean isSingle = subFields.numDifferences == 1; if (isSingle) { buf.append('/'); } else { buf.append('('); } buf.append(subFields.buf); if (!isSingle) { buf.append(')'); } } } private GoogleAtom() { } } MultiKindFeedParser.java000066400000000000000000000107351350651464300411650ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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.api.client.googleapis.xml.atom; import com.google.api.client.http.HttpResponse; import com.google.api.client.util.Beta; import com.google.api.client.util.ClassInfo; import com.google.api.client.util.FieldInfo; import com.google.api.client.util.Types; import com.google.api.client.xml.Xml; import com.google.api.client.xml.XmlNamespaceDictionary; import com.google.api.client.xml.atom.AbstractAtomFeedParser; import com.google.api.client.xml.atom.Atom; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; import java.util.HashMap; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /** * {@link Beta}
* GData Atom feed pull parser when the entry class can be computed from the kind. * * @param feed type * * @since 1.0 * @author Yaniv Inbar */ @Beta public final class MultiKindFeedParser extends AbstractAtomFeedParser { private final HashMap> kindToEntryClassMap = new HashMap>(); /** * @param namespaceDictionary XML namespace dictionary * @param parser XML pull parser to use * @param inputStream input stream to read * @param feedClass feed class to parse */ MultiKindFeedParser(XmlNamespaceDictionary namespaceDictionary, XmlPullParser parser, InputStream inputStream, Class feedClass) { super(namespaceDictionary, parser, inputStream, feedClass); } /** Sets the entry classes to use when parsing. */ public void setEntryClasses(Class... entryClasses) { int numEntries = entryClasses.length; HashMap> kindToEntryClassMap = this.kindToEntryClassMap; for (int i = 0; i < numEntries; i++) { Class entryClass = entryClasses[i]; ClassInfo typeInfo = ClassInfo.of(entryClass); Field field = typeInfo.getField("@gd:kind"); if (field == null) { throw new IllegalArgumentException("missing @gd:kind field for " + entryClass.getName()); } Object entry = Types.newInstance(entryClass); String kind = (String) FieldInfo.getFieldValue(field, entry); if (kind == null) { throw new IllegalArgumentException( "missing value for @gd:kind field in " + entryClass.getName()); } kindToEntryClassMap.put(kind, entryClass); } } @Override protected Object parseEntryInternal() throws IOException, XmlPullParserException { XmlPullParser parser = getParser(); String kind = parser.getAttributeValue(GoogleAtom.GD_NAMESPACE, "kind"); Class entryClass = this.kindToEntryClassMap.get(kind); if (entryClass == null) { throw new IllegalArgumentException("unrecognized kind: " + kind); } Object result = Types.newInstance(entryClass); Xml.parseElement(parser, result, getNamespaceDictionary(), null); return result; } /** * Parses the given HTTP response using the given feed class and entry classes. * * @param feed type * @param entry type * @param response HTTP response * @param namespaceDictionary XML namespace dictionary * @param feedClass feed class * @param entryClasses entry class * @return Atom multi-kind feed pull parser * @throws IOException I/O exception * @throws XmlPullParserException XML pull parser exception */ public static MultiKindFeedParser create(HttpResponse response, XmlNamespaceDictionary namespaceDictionary, Class feedClass, Class... entryClasses) throws IOException, XmlPullParserException { InputStream content = response.getContent(); try { Atom.checkContentType(response.getContentType()); XmlPullParser parser = Xml.createParser(); parser.setInput(content, null); MultiKindFeedParser result = new MultiKindFeedParser(namespaceDictionary, parser, content, feedClass); result.setEntryClasses(entryClasses); return result; } finally { content.close(); } } } package-info.java000066400000000000000000000234551350651464300376530ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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. */ /** * {@link com.google.api.client.util.Beta}
* Utilities for Google's Atom XML implementation (see detailed package specification). * *

Package Specification

* *

* User-defined Partial XML data models allow you to defined Plain Old Java Objects (POJO's) to * define how the library should parse/serialize XML. Each field that should be included must have * an @{@link com.google.api.client.util.Key} annotation. The field can be of any visibility * (private, package private, protected, or public) and must not be static. *

* *

* The optional value parameter of this @{@link com.google.api.client.util.Key} annotation specifies * the XPath name to use to represent the field. For example, an XML attribute a has an * XPath name of @a, an XML element <a> has an XPath name of *a * , and an XML text content has an XPath name of text(). These are named based * on their usage with the partial * response/update syntax for Google API's. If the @{@link com.google.api.client.util.Key} * annotation is missing, the default is to use the Atom XML namespace and the Java field's name as * the local XML name. By default, the field name is used as the JSON key. Any unrecognized XML is * normally simply ignored and not stored. If the ability to store unknown keys is important, use * {@link com.google.api.client.xml.GenericXml}. *

* *

* Let's take a look at a typical partial Atom XML album feed from the Picasa Web Albums Data API: *

* *

<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gphoto='http://schemas.google.com/photos/2007'>
  <link rel='http://schemas.google.com/g/2005#post'
    type='application/atom+xml'
    href='http://picasaweb.google.com/data/feed/api/user/liz' />
  <author>
    <name>Liz</name>
  </author>
  <openSearch:totalResults>1</openSearch:totalResults>
  <entry gd:etag='"RXY8fjVSLyp7ImA9WxVVGE8KQAE."'>
    <category scheme='http://schemas.google.com/g/2005#kind'
      term='http://schemas.google.com/photos/2007#album' />
    <title>lolcats</title>
    <summary>Hilarious Felines</summary>
    <gphoto:access>public</gphoto:access>
  </entry>
</feed>
* *

* Here's one possible way to design the Java data classes for this (each class in its own Java * file): *

* *

import com.google.api.client.util.*;
import java.util.List;

  public class Link {

    @Key("@href")
    public String href;

    @Key("@rel")
    public String rel;

    public static String find(List<Link> links, String rel) {
      if (links != null) {
        for (Link link : links) {
          if (rel.equals(link.rel)) {
            return link.href;
          }
        }
      }
      return null;
    }
  }

  public class Category {

    @Key("@scheme")
    public String scheme;

    @Key("@term")
    public String term;

    public static Category newKind(String kind) {
      Category category = new Category();
      category.scheme = "http://schemas.google.com/g/2005#kind";
      category.term = "http://schemas.google.com/photos/2007#" + kind;
      return category;
    }
  }

  public class AlbumEntry {

    @Key
    public String summary;

    @Key
    public String title;

    @Key("gphoto:access")
    public String access;

    public Category category = newKind("album");

    private String getEditLink() {
      return Link.find(links, "edit");
    }
  }

  public class Author {

    @Key
    public String name;
  }

  public class AlbumFeed {

    @Key
    public Author author;

    @Key("openSearch:totalResults")
    public int totalResults;

    @Key("entry")
    public List<AlbumEntry> photos;

    @Key("link")
    public List<Link> links;

    private String getPostLink() {
      return Link.find(links, "http://schemas.google.com/g/2005#post");
    }
  }
* *

* You can also use the @{@link com.google.api.client.util.Key} annotation to defined query * parameters for a URL. For example: *

* *

public class PicasaUrl extends GoogleUrl {

  @Key("max-results")
  public Integer maxResults;

  @Key
  public String kinds;

  public PicasaUrl(String url) {
    super(url);
  }

  public static PicasaUrl fromRelativePath(String relativePath) {
    PicasaUrl result = new PicasaUrl(PicasaWebAlbums.ROOT_URL);
    result.path += relativePath;
    return result;
  }
}
* *

* To work with a Google API, you first need to set up the * {@link com.google.api.client.http.HttpTransport}. For example: *

* *

  private static HttpTransport setUpTransport() throws IOException {
    HttpTransport result = new NetHttpTransport();
    GoogleUtils.useMethodOverride(result);
    HttpHeaders headers = new HttpHeaders();
    headers.setApplicationName("Google-PicasaSample/1.0");
    headers.gdataVersion = "2";
    AtomParser parser = new AtomParser();
    parser.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
    transport.addParser(parser);
    // insert authentication code...
    return transport;
  }
* *

* Now that we have a transport, we can execute a partial GET request to the Picasa Web Albums API * and parse the result: *

* *

  public static AlbumFeed executeGet(HttpTransport transport, PicasaUrl url)
      throws IOException {
    url.fields = GoogleAtom.getFieldsFor(AlbumFeed.class);
    url.kinds = "photo";
    url.maxResults = 5;
    HttpRequest request = transport.buildGetRequest();
    request.url = url;
    return request.execute().parseAs(AlbumFeed.class);
  }
* *

* If the server responds with an error the {@link com.google.api.client.http.HttpRequest#execute} * method will throw an {@link com.google.api.client.http.HttpResponseException}, which has an * {@link com.google.api.client.http.HttpResponse} field which can be parsed the same way as a * success response inside of a catch block. For example: *

* *

    try {
...
    } catch (HttpResponseException e) {
      if (e.response.getParser() != null) {
        Error error = e.response.parseAs(Error.class);
        // process error response
      } else {
        String errorContentString = e.response.parseAsString();
        // process error response as string
      }
      throw e;
    }
* *

* To update an album, we use the transport to execute an efficient partial update request using the * PATCH method to the Picasa Web Albums API: *

* *

  public AlbumEntry executePatchRelativeToOriginal(HttpTransport transport,
      AlbumEntry original) throws IOException {
    HttpRequest request = transport.buildPatchRequest();
    request.setUrl(getEditLink());
    request.headers.ifMatch = etag;
    AtomPatchRelativeToOriginalContent content =
        new AtomPatchRelativeToOriginalContent();
    content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
    content.originalEntry = original;
    content.patchedEntry = this;
    request.content = content;
    return request.execute().parseAs(AlbumEntry.class);
  }

  private static AlbumEntry updateTitle(HttpTransport transport,
      AlbumEntry album) throws IOException {
    AlbumEntry patched = album.clone();
    patched.title = "An alternate title";
    return patched.executePatchRelativeToOriginal(transport, album);
  }
* *

* To insert an album, we use the transport to execute a POST request to the Picasa Web Albums API: *

* *

  public AlbumEntry insertAlbum(HttpTransport transport, AlbumEntry entry)
      throws IOException {
    HttpRequest request = transport.buildPostRequest();
    request.setUrl(getPostLink());
    AtomContent content = new AtomContent();
    content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
    content.entry = entry;
    request.content = content;
    return request.execute().parseAs(AlbumEntry.class);
  }
* *

* To delete an album, we use the transport to execute a DELETE request to the Picasa Web Albums * API: *

* *

  public void executeDelete(HttpTransport transport) throws IOException {
    HttpRequest request = transport.buildDeleteRequest();
    request.setUrl(getEditLink());
    request.headers.ifMatch = etag;
    request.execute().ignore();
  }
* *

* NOTE: As you might guess, the library uses reflection to populate the user-defined data model. * It's not quite as fast as writing the wire format parsing code yourself can potentially be, but * it's a lot easier. *

* *

* NOTE: If you prefer to use your favorite XML parsing library instead (there are many of them), * that's supported as well. Just call {@link com.google.api.client.http.HttpRequest#execute()} and * parse the returned byte stream. *

* * @since 1.0 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.xml.atom; google-api-java-client-1.27.1/google-api-client-xml/src/test/000077500000000000000000000000001350651464300236725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/000077500000000000000000000000001350651464300246135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/000077500000000000000000000000001350651464300253715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/000077500000000000000000000000001350651464300266455ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/000077500000000000000000000000001350651464300274165ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/client/000077500000000000000000000000001350651464300306745ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/client/googleapis/000077500000000000000000000000001350651464300330255ustar00rootroot00000000000000xml/000077500000000000000000000000001350651464300335465ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/client/googleapisatom/000077500000000000000000000000001350651464300345065ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/client/googleapis/xmlGoogleAtomTest.java000066400000000000000000000026371350651464300402560ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client-xml/src/test/java/com/google/api/client/googleapis/xml/atom/* * Copyright 2010 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.api.client.googleapis.xml.atom; import com.google.api.client.util.Key; import com.google.api.client.xml.GenericXml; import junit.framework.TestCase; /** * Tests {@link GoogleAtom}. * * @author Yaniv Inbar */ public class GoogleAtomTest extends TestCase { public GoogleAtomTest() { super(); } public GoogleAtomTest(String name) { super(name); } class A { @Key int x; @Key B b; @Key C c; @Key G g; } class B { @Key int y; } class C { @Key int z; @Key GenericXml generic; @Key B b; } class G extends GenericXml { @Key int something; } public void testGetFieldsFor() { assertEquals("", GoogleAtom.getFieldsFor(Object.class)); assertEquals("b/y,c(b/y,generic,z),g,x", GoogleAtom.getFieldsFor(A.class)); } } google-api-java-client-1.27.1/google-api-client/000077500000000000000000000000001350651464300213265ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/pom.xml000066400000000000000000000112531350651464300226450ustar00rootroot00000000000000 4.0.0 com.google.api-client google-api-client-parent 1.27.1 ../pom.xml google-api-client Google APIs Client Library for Java kr.motd.maven os-maven-plugin 1.4.0.Final maven-javadoc-plugin https://docs.oracle.com/javase/6/docs/api/ https://cloud.google.com/appengine/docs/standard/java/javadoc/ https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ https://googleapis.github.io/google-oauth-java-client/releases/${project.oauth.version}/javadoc/ ${project.name} ${project.version} ${project.artifactId} ${project.version} maven-jar-plugin true ${project.build.outputDirectory}/META-INF/MANIFEST.MF org.apache.felix maven-bundle-plugin 2.5.4 bundle-manifest process-classes manifest https://developers.google.com/api-client-library/java/ The Google API Client Library for Java provides functionality common to all Google APIs; for example HTTP transport, error handling, authentication, JSON parsing, media download/upload, and batching. com.google.api.client.googleapis maven-source-plugin source-jar jar com.google.protobuf.tools maven-protoc-plugin 0.4.2 com.google.protobuf:protoc:${project.protobuf-java.version}-build2:exe:${os.detected.classifier} test-compile com.google.oauth-client google-oauth-client com.google.http-client google-http-client-jackson2 com.google.http-client google-http-client-gson test com.google.http-client google-http-client-protobuf test junit junit test commons-codec commons-codec provided 1.6 com.google.guava guava google-api-java-client-1.27.1/google-api-client/src/000077500000000000000000000000001350651464300221155ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/000077500000000000000000000000001350651464300230415ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/000077500000000000000000000000001350651464300237625ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/000077500000000000000000000000001350651464300245405ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/000077500000000000000000000000001350651464300260145ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/000077500000000000000000000000001350651464300265655ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/000077500000000000000000000000001350651464300300435ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/000077500000000000000000000000001350651464300321745ustar00rootroot00000000000000GoogleUtils.java000066400000000000000000000046241350651464300352230ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/* * Copyright 2013 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.api.client.googleapis; import com.google.api.client.util.SecurityUtils; import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.KeyStore; /** * Utility class for the Google API Client Library. * * @since 1.12 * @author rmistry@google.com (Ravi Mistry) */ public final class GoogleUtils { // NOTE: Integer instead of int so compiler thinks it isn't a constant, so it won't inline it /** * Major part of the current release version. * * @since 1.14 */ public static final Integer MAJOR_VERSION = 1; /** * Minor part of the current release version. * * @since 1.14 */ public static final Integer MINOR_VERSION = 27; /** * Bug fix part of the current release version. * * @since 1.14 */ public static final Integer BUGFIX_VERSION = 1; /** Current release version. */ // NOTE: toString() so compiler thinks it isn't a constant, so it won't inline it public static final String VERSION = (MAJOR_VERSION + "." + MINOR_VERSION + "." + BUGFIX_VERSION + "-SNAPSHOT").toString(); /** Cached value for {@link #getCertificateTrustStore()}. */ static KeyStore certTrustStore; /** * Returns the key store for trusted root certificates to use for Google APIs. * *

* Value is cached, so subsequent access is fast. *

* * @since 1.14 */ public static synchronized KeyStore getCertificateTrustStore() throws IOException, GeneralSecurityException { if (certTrustStore == null) { certTrustStore = SecurityUtils.getJavaKeyStore(); InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks"); SecurityUtils.loadKeyStore(certTrustStore, keyStoreStream, "notasecret"); } return certTrustStore; } private GoogleUtils() { } } MethodOverride.java000066400000000000000000000124011350651464300356760ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/* * Copyright 2010 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.api.client.googleapis; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.UrlEncodedContent; import java.io.IOException; /** * Thread-safe HTTP request execute interceptor for Google API's that wraps HTTP requests inside of * a POST request and uses {@link #HEADER} header to specify the actual HTTP method. * *

* Use this for example for an HTTP transport that doesn't support PATCH like * {@code NetHttpTransport} or {@code UrlFetchTransport}. By default, only the methods not supported * by the transport will be overridden. When running behind a firewall that does not support certain * verbs like PATCH, use the {@link MethodOverride.Builder#setOverrideAllMethods(boolean)} * constructor instead to specify to override all methods. POST is never overridden. *

* *

* This class also allows GET requests with a long URL (> 2048 chars) to be instead sent using * method override as a POST request. *

* *

* Sample usage, taking advantage that this class implements {@link HttpRequestInitializer}: *

* *
  public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
    return transport.createRequestFactory(new MethodOverride());
  }
 * 
* *

* If you have a custom request initializer, take a look at the sample usage for * {@link HttpExecuteInterceptor}, which this class also implements. *

* * @since 1.4 * @author Yaniv Inbar */ public final class MethodOverride implements HttpExecuteInterceptor, HttpRequestInitializer { /** * Name of the method override header. * * @since 1.13 */ public static final String HEADER = "X-HTTP-Method-Override"; /** Maximum supported URL length. */ static final int MAX_URL_LENGTH = 2048; /** * Whether to allow all methods (except GET and POST) to be overridden regardless of whether the * transport supports them. */ private final boolean overrideAllMethods; /** Only overrides HTTP methods that the HTTP transport does not support. */ public MethodOverride() { this(false); } MethodOverride(boolean overrideAllMethods) { this.overrideAllMethods = overrideAllMethods; } public void initialize(HttpRequest request) { request.setInterceptor(this); } public void intercept(HttpRequest request) throws IOException { if (overrideThisMethod(request)) { String requestMethod = request.getRequestMethod(); request.setRequestMethod(HttpMethods.POST); request.getHeaders().set(HEADER, requestMethod); if (requestMethod.equals(HttpMethods.GET)) { // take the URI query part and put it into the HTTP body request.setContent(new UrlEncodedContent(request.getUrl().clone())); // remove query parameters from URI request.getUrl().clear(); } else if (request.getContent() == null) { // Google servers will fail to process a POST unless the Content-Length header is specified request.setContent(new EmptyContent()); } } } private boolean overrideThisMethod(HttpRequest request) throws IOException { String requestMethod = request.getRequestMethod(); if (requestMethod.equals(HttpMethods.POST)) { return false; } if (requestMethod.equals(HttpMethods.GET) ? request.getUrl().build().length() > MAX_URL_LENGTH : overrideAllMethods) { return true; } return !request.getTransport().supportsMethod(requestMethod); } /** * Builder for {@link MethodOverride}. * * @since 1.12 * @author Yaniv Inbar */ public static final class Builder { /** * Whether to allow all methods (except GET and POST) to be overridden regardless of whether the * transport supports them. */ private boolean overrideAllMethods; /** Builds the {@link MethodOverride}. */ public MethodOverride build() { return new MethodOverride(overrideAllMethods); } /** * Returns whether to allow all methods (except GET and POST) to be overridden regardless of * whether the transport supports them. */ public boolean getOverrideAllMethods() { return overrideAllMethods; } /** * Sets whether to allow all methods (except GET and POST) to be overridden regardless of * whether the transport supports them. * *

* Default is {@code false}. *

*/ public Builder setOverrideAllMethods(boolean overrideAllMethods) { this.overrideAllMethods = overrideAllMethods; return this; } } } apache/000077500000000000000000000000001350651464300333365ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisGoogleApacheHttpTransport.java000066400000000000000000000030521350651464300412740ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/apache/* * Copyright 2013 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.api.client.googleapis.apache; import com.google.api.client.googleapis.GoogleUtils; import com.google.api.client.http.apache.ApacheHttpTransport; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.KeyStore; /** * Utilities for Google APIs based on {@link ApacheHttpTransport}. * * @since 1.14 * @author Yaniv Inbar */ public final class GoogleApacheHttpTransport { /** * Returns a new instance of {@link ApacheHttpTransport} that uses * {@link GoogleUtils#getCertificateTrustStore()} for the trusted certificates using * {@link com.google.api.client.http.apache.ApacheHttpTransport.Builder#trustCertificates(KeyStore)}. */ public static ApacheHttpTransport newTrustedTransport() throws GeneralSecurityException, IOException { return new ApacheHttpTransport.Builder().trustCertificates( GoogleUtils.getCertificateTrustStore()).build(); } private GoogleApacheHttpTransport() { } } package-info.java000066400000000000000000000013471350651464300365320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/apache/* * Copyright 2013 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. */ /** * Google API's support based on the Apache HTTP Client. * * @since 1.14 * @author Yaniv Inbar */ package com.google.api.client.googleapis.apache; google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/000077500000000000000000000000001350651464300331355ustar00rootroot00000000000000clientlogin/000077500000000000000000000000001350651464300353655ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/authAuthKeyValueParser.java000066400000000000000000000122421350651464300417550ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/clientlogin/* * Copyright (c) 2010 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.api.client.googleapis.auth.clientlogin; import com.google.api.client.http.HttpResponse; import com.google.api.client.util.Beta; import com.google.api.client.util.ClassInfo; import com.google.api.client.util.FieldInfo; import com.google.api.client.util.GenericData; import com.google.api.client.util.ObjectParser; import com.google.api.client.util.Types; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.nio.charset.Charset; import java.util.Map; /** * {@link Beta}
* HTTP parser for Google response to an Authorization request. * * @since 1.10 * @author Yaniv Inbar */ @Beta final class AuthKeyValueParser implements ObjectParser { /** Singleton instance. */ public static final AuthKeyValueParser INSTANCE = new AuthKeyValueParser(); public String getContentType() { return "text/plain"; } public T parse(HttpResponse response, Class dataClass) throws IOException { response.setContentLoggingLimit(0); InputStream content = response.getContent(); try { return parse(content, dataClass); } finally { content.close(); } } public T parse(InputStream content, Class dataClass) throws IOException { ClassInfo classInfo = ClassInfo.of(dataClass); T newInstance = Types.newInstance(dataClass); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); while (true) { String line = reader.readLine(); if (line == null) { break; } int equals = line.indexOf('='); String key = line.substring(0, equals); String value = line.substring(equals + 1); // get the field from the type information Field field = classInfo.getField(key); if (field != null) { Class fieldClass = field.getType(); Object fieldValue; if (fieldClass == boolean.class || fieldClass == Boolean.class) { fieldValue = Boolean.valueOf(value); } else { fieldValue = value; } FieldInfo.setFieldValue(field, newInstance, fieldValue); } else if (GenericData.class.isAssignableFrom(dataClass)) { GenericData data = (GenericData) newInstance; data.set(key, value); } else if (Map.class.isAssignableFrom(dataClass)) { @SuppressWarnings("unchecked") Map map = (Map) newInstance; map.put(key, value); } } return newInstance; } private AuthKeyValueParser() { } public T parseAndClose(InputStream in, Charset charset, Class dataClass) throws IOException { Reader reader = new InputStreamReader(in, charset); return parseAndClose(reader, dataClass); } public Object parseAndClose(InputStream in, Charset charset, Type dataType) { throw new UnsupportedOperationException( "Type-based parsing is not yet supported -- use Class instead"); } public T parseAndClose(Reader reader, Class dataClass) throws IOException { try { ClassInfo classInfo = ClassInfo.of(dataClass); T newInstance = Types.newInstance(dataClass); BufferedReader breader = new BufferedReader(reader); while (true) { String line = breader.readLine(); if (line == null) { break; } int equals = line.indexOf('='); String key = line.substring(0, equals); String value = line.substring(equals + 1); // get the field from the type information Field field = classInfo.getField(key); if (field != null) { Class fieldClass = field.getType(); Object fieldValue; if (fieldClass == boolean.class || fieldClass == Boolean.class) { fieldValue = Boolean.valueOf(value); } else { fieldValue = value; } FieldInfo.setFieldValue(field, newInstance, fieldValue); } else if (GenericData.class.isAssignableFrom(dataClass)) { GenericData data = (GenericData) newInstance; data.set(key, value); } else if (Map.class.isAssignableFrom(dataClass)) { @SuppressWarnings("unchecked") Map map = (Map) newInstance; map.put(key, value); } } return newInstance; } finally { reader.close(); } } public Object parseAndClose(Reader reader, Type dataType) { throw new UnsupportedOperationException( "Type-based parsing is not yet supported -- use Class instead"); } } ClientLogin.java000066400000000000000000000150371350651464300404450ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/clientlogin/* * Copyright (c) 2010 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.api.client.googleapis.auth.clientlogin; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpResponseException; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.UrlEncodedContent; import com.google.api.client.util.Beta; import com.google.api.client.util.Key; import com.google.api.client.util.StringUtils; import com.google.api.client.util.Strings; import java.io.IOException; /** * {@link Beta}
* Client Login authentication method as described in ClientLogin for * Installed Applications. * * @since 1.0 * @author Yaniv Inbar */ @Beta public final class ClientLogin { /** * HTTP transport required for executing request in {@link #authenticate()}. * * @since 1.3 */ public HttpTransport transport; /** * URL for the Client Login authorization server. * *

* By default this is {@code "https://www.google.com"}, but it may be overridden for testing * purposes. *

* * @since 1.3 */ public GenericUrl serverUrl = new GenericUrl("https://www.google.com"); /** * Short string identifying your application for logging purposes of the form: * "companyName-applicationName-versionID". */ @Key("source") public String applicationName; /** * Name of the Google service you're requesting authorization for, for example {@code "cl"} for * Google Calendar. */ @Key("service") public String authTokenType; /** User's full email address. */ @Key("Email") public String username; /** User's password. */ @Key("Passwd") public String password; /** * Type of account to request authorization for. Possible values are: * *
    *
  • GOOGLE (get authorization for a Google account only)
  • *
  • HOSTED (get authorization for a hosted account only)
  • *
  • HOSTED_OR_GOOGLE (get authorization first for a hosted account; if attempt fails, get * authorization for a Google account)
  • *
* * Use HOSTED_OR_GOOGLE if you're not sure which type of account you want authorization for. If * the user information matches both a hosted and a Google account, only the hosted account is * authorized. * * @since 1.1 */ @Key public String accountType; /** (optional) Token representing the specific CAPTCHA challenge. */ @Key("logintoken") public String captchaToken; /** (optional) String entered by the user as an answer to a CAPTCHA challenge. */ @Key("logincaptcha") public String captchaAnswer; /** * Key/value data to parse a success response. * *

* Sample usage, taking advantage that this class implements {@link HttpRequestInitializer}: *

* *
    public static HttpRequestFactory createRequestFactory(
        HttpTransport transport, Response response) {
      return transport.createRequestFactory(response);
    }
   * 
* *

* If you have a custom request initializer, take a look at the sample usage for * {@link HttpExecuteInterceptor}, which this class also implements. *

*/ public static final class Response implements HttpExecuteInterceptor, HttpRequestInitializer { /** Authentication token. */ @Key("Auth") public String auth; /** Returns the authorization header value to use based on the authentication token. */ public String getAuthorizationHeaderValue() { return ClientLogin.getAuthorizationHeaderValue(auth); } public void initialize(HttpRequest request) { request.setInterceptor(this); } public void intercept(HttpRequest request) { request.getHeaders().setAuthorization(getAuthorizationHeaderValue()); } } /** Key/value data to parse an error response. */ public static final class ErrorInfo { @Key("Error") public String error; @Key("Url") public String url; @Key("CaptchaToken") public String captchaToken; @Key("CaptchaUrl") public String captchaUrl; } /** * Authenticates based on the provided field values. * * @throws ClientLoginResponseException if the authentication response has an error code, such as * for a CAPTCHA challenge. */ public Response authenticate() throws IOException { GenericUrl url = serverUrl.clone(); url.appendRawPath("/accounts/ClientLogin"); HttpRequest request = transport.createRequestFactory().buildPostRequest(url, new UrlEncodedContent(this)); request.setParser(AuthKeyValueParser.INSTANCE); request.setContentLoggingLimit(0); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); // check for an HTTP success response (2xx) if (response.isSuccessStatusCode()) { return response.parseAs(Response.class); } HttpResponseException.Builder builder = new HttpResponseException.Builder( response.getStatusCode(), response.getStatusMessage(), response.getHeaders()); // On error, throw a ClientLoginResponseException with the parsed error details ErrorInfo details = response.parseAs(ErrorInfo.class); String detailString = details.toString(); StringBuilder message = HttpResponseException.computeMessageBuffer(response); if (!Strings.isNullOrEmpty(detailString)) { message.append(StringUtils.LINE_SEPARATOR).append(detailString); builder.setContent(detailString); } builder.setMessage(message.toString()); throw new ClientLoginResponseException(builder, details); } /** * Returns Google Login {@code "Authorization"} header value based on the given authentication * token. * * @since 1.13 */ public static String getAuthorizationHeaderValue(String authToken) { return "GoogleLogin auth=" + authToken; } } ClientLoginResponseException.java000066400000000000000000000032541350651464300440410ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/clientlogin/* * Copyright (c) 2011 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.api.client.googleapis.auth.clientlogin; import com.google.api.client.googleapis.auth.clientlogin.ClientLogin.ErrorInfo; import com.google.api.client.http.HttpResponseException; import com.google.api.client.util.Beta; /** * {@link Beta}
* Exception thrown when an error status code is detected in an HTTP response to a Google * ClientLogin request in {@link ClientLogin} . * *

* To get the structured details, use {@link #getDetails()}. *

* * @since 1.7 * @author Yaniv Inbar */ @Beta public class ClientLoginResponseException extends HttpResponseException { private static final long serialVersionUID = 4974317674023010928L; /** Error details or {@code null} for none. */ private final transient ErrorInfo details; /** * @param builder builder * @param details error details or {@code null} for none */ ClientLoginResponseException(Builder builder, ErrorInfo details) { super(builder); this.details = details; } /** Return the error details or {@code null} for none. */ public final ErrorInfo getDetails() { return details; } } package-info.java000066400000000000000000000017211350651464300405550ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/clientlogin/* * Copyright (c) 2010 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. */ /** * {@link com.google.api.client.util.Beta}
* Google's legacy ClientLogin authentication method as described in ClientLogin for * Installed Applications. * * @since 1.0 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.auth.clientlogin; oauth2/000077500000000000000000000000001350651464300342605ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/authCloudShellCredential.java000066400000000000000000000072411350651464300411600ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2015, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.google.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.json.JsonFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.util.Collection; import java.util.LinkedList; import java.util.List; /** * OAuth2 credentials representing the built-in service account for Google Cloud Shell. * * @since 1.21.0 */ public class CloudShellCredential extends GoogleCredential { private static final int ACCESS_TOKEN_INDEX = 2; private static final int READ_TIMEOUT_MS = 5000; /** * The Cloud Shell back authorization channel uses serialized * Javascript Protobufers, preceeded by the message lengeth and a * new line character. However, the request message has no content, * so a token request consists of an empty JsPb, and its 2 character * lenth prefix. */ protected static final String GET_AUTH_TOKEN_REQUEST = "2\n[]"; private final int authPort; private final JsonFactory jsonFactory; public CloudShellCredential(int authPort, JsonFactory jsonFactory) { this.authPort = authPort; this.jsonFactory = jsonFactory; } protected int getAuthPort() { return this.authPort; } @Override protected TokenResponse executeRefreshToken() throws IOException { Socket socket = new Socket("localhost", this.getAuthPort()); socket.setSoTimeout(READ_TIMEOUT_MS); TokenResponse token = new TokenResponse(); try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(GET_AUTH_TOKEN_REQUEST); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Ignore the size line input.readLine(); Collection messageArray = jsonFactory.createJsonParser(input) .parseArray(LinkedList.class, Object.class); String accessToken = ((List) messageArray).get(ACCESS_TOKEN_INDEX).toString(); token.setAccessToken(accessToken); } finally { socket.close(); } return token; } } DefaultCredentialProvider.java000066400000000000000000000353311350651464300422220ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2014 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.util.Beta; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessControlException; import java.util.Locale; /** * {@link Beta}
* Provides a default credential available from the host or from an environment variable. * *

An instance represents the per-process state used to get and cache the credential and * allows overriding the state and environment for testing purposes. */ @Beta class DefaultCredentialProvider extends SystemEnvironmentProvider { static final String CREDENTIAL_ENV_VAR = "GOOGLE_APPLICATION_CREDENTIALS"; static final String WELL_KNOWN_CREDENTIALS_FILE = "application_default_credentials.json"; static final String CLOUDSDK_CONFIG_DIRECTORY = "gcloud"; static final String HELP_PERMALINK = "https://developers.google.com/accounts/docs/application-default-credentials"; static final String APP_ENGINE_CREDENTIAL_CLASS = "com.google.api.client.googleapis.extensions.appengine.auth.oauth2" + ".AppIdentityCredential$AppEngineCredentialWrapper"; static final String CLOUD_SHELL_ENV_VAR = "DEVSHELL_CLIENT_PORT"; private static enum Environment { UNKNOWN, ENVIRONMENT_VARIABLE, WELL_KNOWN_FILE, CLOUD_SHELL, APP_ENGINE, COMPUTE_ENGINE, } // These variables should only be accessed inside a synchronized block private GoogleCredential cachedCredential = null; private Environment detectedEnvironment = null; DefaultCredentialProvider() {} /** * {@link Beta}
* Returns the Application Default Credentials. * *

Returns the Application Default Credentials which are credentials that identify and * authorize the whole application. This is the built-in service account if running on Google * Compute Engine or the credentials file from the path in the environment variable * GOOGLE_APPLICATION_CREDENTIALS.

* * @param transport the transport for Http calls. * @param jsonFactory the factory for Json parsing and formatting. * @return the credential instance. * @throws IOException if the credential cannot be created in the current environment. */ final GoogleCredential getDefaultCredential(HttpTransport transport, JsonFactory jsonFactory) throws IOException { synchronized (this) { if (cachedCredential == null) { cachedCredential = getDefaultCredentialUnsynchronized(transport, jsonFactory); } if (cachedCredential != null) { return cachedCredential; } } throw new IOException(String.format( "The Application Default Credentials are not available. They are available if running " + "on Google App Engine, Google Compute Engine, or Google Cloud Shell. Otherwise, " + "the environment variable %s must be defined pointing to a file defining " + "the credentials. See %s for more information.", CREDENTIAL_ENV_VAR, HELP_PERMALINK)); } private final GoogleCredential getDefaultCredentialUnsynchronized( HttpTransport transport, JsonFactory jsonFactory) throws IOException { if (detectedEnvironment == null) { detectedEnvironment = detectEnvironment(transport); } switch (detectedEnvironment) { case ENVIRONMENT_VARIABLE: return getCredentialUsingEnvironmentVariable(transport, jsonFactory); case WELL_KNOWN_FILE: return getCredentialUsingWellKnownFile(transport, jsonFactory); case APP_ENGINE: return getAppEngineCredential(transport, jsonFactory); case CLOUD_SHELL: return getCloudShellCredential(jsonFactory); case COMPUTE_ENGINE: return getComputeCredential(transport, jsonFactory); default: return null; } } private final File getWellKnownCredentialsFile() { File cloudConfigPath = null; String os = getProperty("os.name", "").toLowerCase(Locale.US); if (os.indexOf("windows") >= 0) { File appDataPath = new File(getEnv("APPDATA")); cloudConfigPath = new File(appDataPath, CLOUDSDK_CONFIG_DIRECTORY); } else { File configPath = new File(getProperty("user.home", ""), ".config"); cloudConfigPath = new File(configPath, CLOUDSDK_CONFIG_DIRECTORY); } File credentialFilePath = new File(cloudConfigPath, WELL_KNOWN_CREDENTIALS_FILE); return credentialFilePath; } /** * Override in test code to isolate from environment. */ boolean fileExists(File file) { return file.exists() && !file.isDirectory(); } /** * Override in test code to isolate from environment. */ String getProperty(String property, String def) { return System.getProperty(property, def); } /** * Override in test code to isolate from environment. */ Class forName(String className) throws ClassNotFoundException { return Class.forName(className); } private final Environment detectEnvironment(HttpTransport transport) throws IOException { // First try the environment variable if (runningUsingEnvironmentVariable()) { return Environment.ENVIRONMENT_VARIABLE; // Then try the well-known file } else if (runningUsingWellKnownFile()) { return Environment.WELL_KNOWN_FILE; // Try App Engine } else if (useGAEStandardAPI()) { return Environment.APP_ENGINE; // Then try Cloud Shell. This must be done BEFORE checking // Compute Engine, as Cloud Shell runs on GCE VMs. } else if (runningOnCloudShell()) { return Environment.CLOUD_SHELL; // Then try Compute Engine } else if (OAuth2Utils.runningOnComputeEngine(transport, this)) { return Environment.COMPUTE_ENGINE; } return Environment.UNKNOWN; } private boolean runningUsingEnvironmentVariable() throws IOException { String credentialsPath = getEnv(CREDENTIAL_ENV_VAR); if (credentialsPath == null || credentialsPath.length() == 0) { return false; } try { File credentialsFile = new File(credentialsPath); if (!credentialsFile.exists() || credentialsFile.isDirectory()) { throw new IOException( String.format( "Error reading credential file from environment variable %s, value '%s': " + "File does not exist.", CREDENTIAL_ENV_VAR, credentialsPath)); } return true; } catch (AccessControlException expected) { // Exception querying file system is expected on App-Engine return false; } } private GoogleCredential getCredentialUsingEnvironmentVariable( HttpTransport transport, JsonFactory jsonFactory) throws IOException { String credentialsPath = getEnv(CREDENTIAL_ENV_VAR); InputStream credentialsStream = null; try { credentialsStream = new FileInputStream(credentialsPath); return GoogleCredential.fromStream(credentialsStream, transport, jsonFactory); } catch (IOException e) { // Although it is also the cause, the message of the caught exception can have very // important information for diagnosing errors, so include its message in the // outer exception message also throw OAuth2Utils.exceptionWithCause(new IOException(String.format( "Error reading credential file from environment variable %s, value '%s': %s", CREDENTIAL_ENV_VAR, credentialsPath, e.getMessage())), e); } finally { if (credentialsStream != null) { credentialsStream.close(); } } } private boolean runningUsingWellKnownFile() { File wellKnownFileLocation = getWellKnownCredentialsFile(); try { return fileExists(wellKnownFileLocation); } catch (AccessControlException expected) { // Exception querying file system is expected on App-Engine return false; } } private GoogleCredential getCredentialUsingWellKnownFile( HttpTransport transport, JsonFactory jsonFactory) throws IOException { File wellKnownFileLocation = getWellKnownCredentialsFile(); InputStream credentialsStream = null; try { credentialsStream = new FileInputStream(wellKnownFileLocation); return GoogleCredential.fromStream(credentialsStream, transport, jsonFactory); } catch (IOException e) { throw new IOException(String.format( "Error reading credential file from location %s: %s", wellKnownFileLocation, e.getMessage())); } finally { if (credentialsStream != null) { credentialsStream.close(); } } } private boolean useGAEStandardAPI() { Class systemPropertyClass = null; try { systemPropertyClass = forName("com.google.appengine.api.utils.SystemProperty"); } catch (ClassNotFoundException expected) { // SystemProperty will always be present on App Engine. return false; } Exception cause = null; Field environmentField; try { environmentField = systemPropertyClass.getField("environment"); Object environmentValue = environmentField.get(null); Class environmentType = environmentField.getType(); Method valueMethod = environmentType.getMethod("value"); Object environmentValueValue = valueMethod.invoke(environmentValue); return (environmentValueValue != null); } catch (NoSuchFieldException exception) { cause = exception; } catch (SecurityException exception) { cause = exception; } catch (IllegalArgumentException exception) { cause = exception; } catch (IllegalAccessException exception) { cause = exception; } catch (NoSuchMethodException exception) { cause = exception; } catch (InvocationTargetException exception) { cause = exception; } throw OAuth2Utils.exceptionWithCause(new RuntimeException(String.format( "Unexpcted error trying to determine if runnning on Google App Engine: %s", cause.getMessage())), cause); } private final GoogleCredential getAppEngineCredential( HttpTransport transport, JsonFactory jsonFactory) throws IOException { Exception innerException = null; try { Class credentialClass = forName(APP_ENGINE_CREDENTIAL_CLASS); Constructor constructor = credentialClass .getConstructor(HttpTransport.class, JsonFactory.class); return (GoogleCredential) constructor.newInstance(transport, jsonFactory); } catch (ClassNotFoundException e) { innerException = e; } catch (NoSuchMethodException e) { innerException = e; } catch (InstantiationException e) { innerException = e; } catch (IllegalAccessException e) { innerException = e; } catch (InvocationTargetException e) { innerException = e; } throw OAuth2Utils.exceptionWithCause(new IOException(String.format( "Application Default Credentials failed to create the Google App Engine service account" + " credentials class %s. Check that the component 'google-api-client-appengine' is" + " deployed.", APP_ENGINE_CREDENTIAL_CLASS)), innerException); } private boolean runningOnCloudShell() { // Check for well known environment variable return getEnv(CLOUD_SHELL_ENV_VAR) != null; } private GoogleCredential getCloudShellCredential(JsonFactory jsonFactory) { String port = getEnv(CLOUD_SHELL_ENV_VAR); return new CloudShellCredential(Integer.parseInt(port), jsonFactory); } private final GoogleCredential getComputeCredential( HttpTransport transport, JsonFactory jsonFactory) { return new ComputeGoogleCredential(transport, jsonFactory); } private static class ComputeGoogleCredential extends GoogleCredential { /** Metadata Service Account token server encoded URL. */ private static final String TOKEN_SERVER_ENCODED_URL = OAuth2Utils.getMetadataServerUrl() + "/computeMetadata/v1/instance/service-accounts/default/token"; ComputeGoogleCredential(HttpTransport transport, JsonFactory jsonFactory) { super(new GoogleCredential.Builder() .setTransport(transport) .setJsonFactory(jsonFactory) .setTokenServerEncodedUrl(TOKEN_SERVER_ENCODED_URL)); } @Override protected TokenResponse executeRefreshToken() throws IOException { GenericUrl tokenUrl = new GenericUrl(getTokenServerEncodedUrl()); HttpRequest request = getTransport().createRequestFactory().buildGetRequest(tokenUrl); JsonObjectParser parser = new JsonObjectParser(getJsonFactory()); request.setParser(parser); request.getHeaders().set("Metadata-Flavor", "Google"); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); int statusCode = response.getStatusCode(); if (statusCode == HttpStatusCodes.STATUS_CODE_OK) { InputStream content = response.getContent(); if (content == null) { // Throw explicitly rather than allow a later null reference as default mock // transports return success codes with empty contents. throw new IOException("Empty content from metadata token server request."); } return parser.parseAndClose(content, response.getContentCharset(), TokenResponse.class); } if (statusCode == HttpStatusCodes.STATUS_CODE_NOT_FOUND) { throw new IOException(String.format("Error code %s trying to get security access token from" + " Compute Engine metadata for the default service account. This may be because" + " the virtual machine instance does not have permission scopes specified.", statusCode)); } throw new IOException(String.format("Unexpected Error code %s trying to get security access" + " token from Compute Engine metadata for the default service account: %s", statusCode, response.parseAsString())); } } } GoogleAuthorizationCodeFlow.java000066400000000000000000000316011350651464300425440ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.AuthorizationCodeFlow; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.Credential.AccessMethod; import com.google.api.client.auth.oauth2.CredentialRefreshListener; import com.google.api.client.auth.oauth2.CredentialStore; import com.google.api.client.auth.oauth2.StoredCredential; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import com.google.api.client.util.Preconditions; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.DataStoreFactory; import java.io.IOException; import java.util.Collection; /** * Thread-safe Google OAuth 2.0 authorization code flow that manages and persists end-user * credentials. * *

* This is designed to simplify the flow in which an end-user authorizes the application to access * their protected data, and then the application has access to their data based on an access token * and a refresh token to refresh that access token when it expires. *

* *

* The first step is to call {@link #loadCredential(String)} based on the known user ID to check if * the end-user's credentials are already known. If not, call {@link #newAuthorizationUrl()} and * direct the end-user's browser to an authorization page. The web browser will then redirect to the * redirect URL with a {@code "code"} query parameter which can then be used to request an access * token using {@link #newTokenRequest(String)}. Finally, use * {@link #createAndStoreCredential(TokenResponse, String)} to store and obtain a credential for * accessing protected resources. *

* *

* The default for the {@code approval_prompt} and {@code access_type} parameters is {@code null}. * For web applications that means {@code "approval_prompt=auto&access_type=online"} and for * installed applications that means {@code "approval_prompt=force&access_type=offline"}. To * override the default, you need to explicitly call {@link Builder#setApprovalPrompt(String)} and * {@link Builder#setAccessType(String)}. *

* * @author Yaniv Inbar * @since 1.7 */ @SuppressWarnings("deprecation") public class GoogleAuthorizationCodeFlow extends AuthorizationCodeFlow { /** * Prompt for consent behavior ({@code "auto"} to request auto-approval or {@code "force"} to * force the approval UI to show) or {@code null} for the default behavior. */ private final String approvalPrompt; /** * Access type ({@code "online"} to request online access or {@code "offline"} to request offline * access) or {@code null} for the default behavior. */ private final String accessType; /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param clientId client identifier * @param clientSecret client secret * @param scopes collection of scopes to be joined by a space separator * * @since 1.15 */ public GoogleAuthorizationCodeFlow(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection scopes) { this(new Builder(transport, jsonFactory, clientId, clientSecret, scopes)); } /** * @param builder Google authorization code flow builder * * @since 1.14 */ protected GoogleAuthorizationCodeFlow(Builder builder) { super(builder); accessType = builder.accessType; approvalPrompt = builder.approvalPrompt; } @Override public GoogleAuthorizationCodeTokenRequest newTokenRequest(String authorizationCode) { // don't need to specify clientId & clientSecret because specifying clientAuthentication // don't want to specify redirectUri to give control of it to user of this class return new GoogleAuthorizationCodeTokenRequest(getTransport(), getJsonFactory(), getTokenServerEncodedUrl(), "", "", authorizationCode, "").setClientAuthentication( getClientAuthentication()) .setRequestInitializer(getRequestInitializer()).setScopes(getScopes()); } @Override public GoogleAuthorizationCodeRequestUrl newAuthorizationUrl() { // don't want to specify redirectUri to give control of it to user of this class return new GoogleAuthorizationCodeRequestUrl( getAuthorizationServerEncodedUrl(), getClientId(), "", getScopes()).setAccessType( accessType).setApprovalPrompt(approvalPrompt); } /** * Returns the approval prompt behavior ({@code "auto"} to request auto-approval or * {@code "force"} to force the approval UI to show) or {@code null} for the default behavior of * {@code "auto"}. */ public final String getApprovalPrompt() { return approvalPrompt; } /** * Returns the access type ({@code "online"} to request online access or {@code "offline"} to * request offline access) or {@code null} for the default behavior of {@code "online"}. */ public final String getAccessType() { return accessType; } /** * Google authorization code flow builder. * *

* Implementation is not thread-safe. *

*/ public static class Builder extends AuthorizationCodeFlow.Builder { /** * Prompt for consent behavior ({@code "auto"} to request auto-approval or {@code "force"} to * force the approval UI to show) or {@code null} for the default behavior. */ String approvalPrompt; /** * Access type ({@code "online"} to request online access or {@code "offline"} to request * offline access) or {@code null} for the default behavior. */ String accessType; /** * * @param transport HTTP transport * @param jsonFactory JSON factory * @param clientId client identifier * @param clientSecret client secret * @param scopes collection of scopes to be joined by a space separator (or a single value * containing multiple space-separated scopes) * * @since 1.15 */ public Builder(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection scopes) { super(BearerToken.authorizationHeaderAccessMethod(), transport, jsonFactory, new GenericUrl( GoogleOAuthConstants.TOKEN_SERVER_URL), new ClientParametersAuthentication( clientId, clientSecret), clientId, GoogleOAuthConstants.AUTHORIZATION_SERVER_URL); setScopes(scopes); } /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param clientSecrets Google client secrets * @param scopes collection of scopes to be joined by a space separator * * @since 1.15 */ public Builder(HttpTransport transport, JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, Collection scopes) { super(BearerToken.authorizationHeaderAccessMethod(), transport, jsonFactory, new GenericUrl( GoogleOAuthConstants.TOKEN_SERVER_URL), new ClientParametersAuthentication( clientSecrets.getDetails().getClientId(), clientSecrets.getDetails().getClientSecret()), clientSecrets.getDetails().getClientId(), GoogleOAuthConstants.AUTHORIZATION_SERVER_URL); setScopes(scopes); } @Override public GoogleAuthorizationCodeFlow build() { return new GoogleAuthorizationCodeFlow(this); } @Override public Builder setDataStoreFactory(DataStoreFactory dataStore) throws IOException { return (Builder) super.setDataStoreFactory(dataStore); } @Override public Builder setCredentialDataStore(DataStore typedDataStore) { return (Builder) super.setCredentialDataStore(typedDataStore); } @Override public Builder setCredentialCreatedListener( CredentialCreatedListener credentialCreatedListener) { return (Builder) super.setCredentialCreatedListener(credentialCreatedListener); } @Beta @Override @Deprecated public Builder setCredentialStore(CredentialStore credentialStore) { return (Builder) super.setCredentialStore(credentialStore); } @Override public Builder setRequestInitializer(HttpRequestInitializer requestInitializer) { return (Builder) super.setRequestInitializer(requestInitializer); } @Override public Builder setScopes(Collection scopes) { Preconditions.checkState(!scopes.isEmpty()); return (Builder) super.setScopes(scopes); } /** * @since 1.11 */ @Override public Builder setMethod(AccessMethod method) { return (Builder) super.setMethod(method); } /** * @since 1.11 */ @Override public Builder setTransport(HttpTransport transport) { return (Builder) super.setTransport(transport); } /** * @since 1.11 */ @Override public Builder setJsonFactory(JsonFactory jsonFactory) { return (Builder) super.setJsonFactory(jsonFactory); } /** * @since 1.11 */ @Override public Builder setTokenServerUrl(GenericUrl tokenServerUrl) { return (Builder) super.setTokenServerUrl(tokenServerUrl); } /** * @since 1.11 */ @Override public Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication) { return (Builder) super.setClientAuthentication(clientAuthentication); } /** * @since 1.11 */ @Override public Builder setClientId(String clientId) { return (Builder) super.setClientId(clientId); } /** * @since 1.11 */ @Override public Builder setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl) { return (Builder) super.setAuthorizationServerEncodedUrl(authorizationServerEncodedUrl); } /** * @since 1.11 */ @Override public Builder setClock(Clock clock) { return (Builder) super.setClock(clock); } @Override public Builder addRefreshListener(CredentialRefreshListener refreshListener) { return (Builder) super.addRefreshListener(refreshListener); } @Override public Builder setRefreshListeners(Collection refreshListeners) { return (Builder) super.setRefreshListeners(refreshListeners); } /** * Sets the approval prompt behavior ({@code "auto"} to request auto-approval or {@code "force"} * to force the approval UI to show) or {@code null} for the default behavior ({@code "auto"} * for web applications and {@code "force"} for installed applications). * *

* By default this has the value {@code null}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setApprovalPrompt(String approvalPrompt) { this.approvalPrompt = approvalPrompt; return this; } /** * Returns the approval prompt behavior ({@code "auto"} to request auto-approval or * {@code "force"} to force the approval UI to show) or {@code null} for the default behavior of * {@code "auto"}. */ public final String getApprovalPrompt() { return approvalPrompt; } /** * Sets the access type ({@code "online"} to request online access or {@code "offline"} to * request offline access) or {@code null} for the default behavior ({@code "online"} for web * applications and {@code "offline"} for installed applications). * *

* By default this has the value {@code null}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setAccessType(String accessType) { this.accessType = accessType; return this; } /** * Returns the access type ({@code "online"} to request online access or {@code "offline"} to * request offline access) or {@code null} for the default behavior of {@code "online"}. */ public final String getAccessType() { return accessType; } } } GoogleAuthorizationCodeRequestUrl.java000066400000000000000000000165531350651464300437610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl; import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl; import com.google.api.client.util.Key; import com.google.api.client.util.Preconditions; import java.util.Collection; /** * Google-specific implementation of the OAuth 2.0 URL builder for an authorization web page to * allow the end user to authorize the application to access their protected resources and that * returns an authorization code, as specified in Using OAuth 2.0 for Web Server * Applications. * *

* The default for {@link #getResponseTypes()} is {@code "code"}. Use * {@link AuthorizationCodeResponseUrl} to parse the redirect response after the end user * grants/denies the request. Using the authorization code in this response, use * {@link GoogleAuthorizationCodeTokenRequest} to request the access token. *

* *

* Sample usage for a web application: *

* *
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String url =
        new GoogleAuthorizationCodeRequestUrl("812741506391.apps.googleusercontent.com",
            "https://oauth2-login-demo.appspot.com/code", Arrays.asList(
                "https://www.googleapis.com/auth/userinfo.email",
                "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build();
    response.sendRedirect(url);
  }
 * 
* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleAuthorizationCodeRequestUrl extends AuthorizationCodeRequestUrl { /** * Prompt for consent behavior ({@code "auto"} to request auto-approval or {@code "force"} to * force the approval UI to show) or {@code null} for the default behavior. */ @Key("approval_prompt") private String approvalPrompt; /** * Access type ({@code "online"} to request online access or {@code "offline"} to request offline * access) or {@code null} for the default behavior. */ @Key("access_type") private String accessType; /** * @param clientId client identifier * @param redirectUri URI that the authorization server directs the resource owner's user-agent * back to the client after a successful authorization grant * @param scopes scopes (see {@link #setScopes(Collection)}) * * @since 1.15 */ public GoogleAuthorizationCodeRequestUrl( String clientId, String redirectUri, Collection scopes) { this(GoogleOAuthConstants.AUTHORIZATION_SERVER_URL, clientId, redirectUri, scopes); } /** * @param authorizationServerEncodedUrl authorization server encoded URL * @param clientId client identifier * @param redirectUri URI that the authorization server directs the resource owner's user-agent * back to the client after a successful authorization grant * @param scopes scopes (see {@link #setScopes(Collection)}) * * @since 1.15 */ public GoogleAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId, String redirectUri, Collection scopes) { super(authorizationServerEncodedUrl, clientId); setRedirectUri(redirectUri); setScopes(scopes); } /** * @param clientSecrets OAuth 2.0 client secrets JSON model as specified in * client_secrets.json file format * @param redirectUri URI that the authorization server directs the resource owner's user-agent * back to the client after a successful authorization grant * @param scopes scopes (see {@link #setScopes(Collection)}) * * @since 1.15 */ public GoogleAuthorizationCodeRequestUrl( GoogleClientSecrets clientSecrets, String redirectUri, Collection scopes) { this(clientSecrets.getDetails().getClientId(), redirectUri, scopes); } /** * Returns the approval prompt behavior ({@code "auto"} to request auto-approval or * {@code "force"} to force the approval UI to show) or {@code null} for the default behavior of * {@code "auto"}. */ public final String getApprovalPrompt() { return approvalPrompt; } /** * Sets the approval prompt behavior ({@code "auto"} to request auto-approval or {@code "force"} * to force the approval UI to show) or {@code null} for the default behavior of {@code "auto"}. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public GoogleAuthorizationCodeRequestUrl setApprovalPrompt(String approvalPrompt) { this.approvalPrompt = approvalPrompt; return this; } /** * Returns the access type ({@code "online"} to request online access or {@code "offline"} to * request offline access) or {@code null} for the default behavior of {@code "online"}. */ public final String getAccessType() { return accessType; } /** * Sets the access type ({@code "online"} to request online access or {@code "offline"} to request * offline access) or {@code null} for the default behavior of {@code "online"}. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public GoogleAuthorizationCodeRequestUrl setAccessType(String accessType) { this.accessType = accessType; return this; } @Override public GoogleAuthorizationCodeRequestUrl setResponseTypes(Collection responseTypes) { return (GoogleAuthorizationCodeRequestUrl) super.setResponseTypes(responseTypes); } @Override public GoogleAuthorizationCodeRequestUrl setRedirectUri(String redirectUri) { Preconditions.checkNotNull(redirectUri); return (GoogleAuthorizationCodeRequestUrl) super.setRedirectUri(redirectUri); } @Override public GoogleAuthorizationCodeRequestUrl setScopes(Collection scopes) { Preconditions.checkArgument(scopes.iterator().hasNext()); return (GoogleAuthorizationCodeRequestUrl) super.setScopes(scopes); } @Override public GoogleAuthorizationCodeRequestUrl setClientId(String clientId) { return (GoogleAuthorizationCodeRequestUrl) super.setClientId(clientId); } @Override public GoogleAuthorizationCodeRequestUrl setState(String state) { return (GoogleAuthorizationCodeRequestUrl) super.setState(state); } @Override public GoogleAuthorizationCodeRequestUrl set(String fieldName, Object value) { return (GoogleAuthorizationCodeRequestUrl) super.set(fieldName, value); } @Override public GoogleAuthorizationCodeRequestUrl clone() { return (GoogleAuthorizationCodeRequestUrl) super.clone(); } } GoogleAuthorizationCodeTokenRequest.java000066400000000000000000000145031350651464300442700ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.AuthorizationCodeTokenRequest; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.auth.oauth2.TokenResponseException; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.util.Collection; /** * Google-specific implementation of the OAuth 2.0 request for an access token based on an * authorization code (as specified in Using OAuth 2.0 for Web * Server Applications). * *

* Use {@link GoogleCredential} to access protected resources from the resource server using the * {@link TokenResponse} returned by {@link #execute()}. On error, it will instead throw * {@link TokenResponseException}. *

* *

* Sample usage: *

* *
  static void requestAccessToken() throws IOException {
    try {
      GoogleTokenResponse response =
          new GoogleAuthorizationCodeTokenRequest(new NetHttpTransport(), new JacksonFactory(),
              "812741506391.apps.googleusercontent.com", "{client_secret}",
              "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7", "https://oauth2-login-demo.appspot.com/code")
              .execute();
      System.out.println("Access token: " + response.getAccessToken());
    } catch (TokenResponseException e) {
      if (e.getDetails() != null) {
        System.err.println("Error: " + e.getDetails().getError());
        if (e.getDetails().getErrorDescription() != null) {
          System.err.println(e.getDetails().getErrorDescription());
        }
        if (e.getDetails().getErrorUri() != null) {
          System.err.println(e.getDetails().getErrorUri());
        }
      } else {
        System.err.println(e.getMessage());
      }
    }
  }
 * 
* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleAuthorizationCodeTokenRequest extends AuthorizationCodeTokenRequest { /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param clientId client identifier issued to the client during the registration process * @param clientSecret client secret * @param code authorization code generated by the authorization server * @param redirectUri redirect URL parameter matching the redirect URL parameter in the * authorization request (see {@link #setRedirectUri(String)} */ public GoogleAuthorizationCodeTokenRequest(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, String code, String redirectUri) { this(transport, jsonFactory, GoogleOAuthConstants.TOKEN_SERVER_URL, clientId, clientSecret, code, redirectUri); } /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param tokenServerEncodedUrl token server encoded URL * @param clientId client identifier issued to the client during the registration process * @param clientSecret client secret * @param code authorization code generated by the authorization server * @param redirectUri redirect URL parameter matching the redirect URL parameter in the * authorization request (see {@link #setRedirectUri(String)} * * @since 1.12 */ public GoogleAuthorizationCodeTokenRequest(HttpTransport transport, JsonFactory jsonFactory, String tokenServerEncodedUrl, String clientId, String clientSecret, String code, String redirectUri) { super(transport, jsonFactory, new GenericUrl(tokenServerEncodedUrl), code); setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret)); setRedirectUri(redirectUri); } @Override public GoogleAuthorizationCodeTokenRequest setRequestInitializer( HttpRequestInitializer requestInitializer) { return (GoogleAuthorizationCodeTokenRequest) super.setRequestInitializer(requestInitializer); } @Override public GoogleAuthorizationCodeTokenRequest setTokenServerUrl(GenericUrl tokenServerUrl) { return (GoogleAuthorizationCodeTokenRequest) super.setTokenServerUrl(tokenServerUrl); } @Override public GoogleAuthorizationCodeTokenRequest setScopes(Collection scopes) { return (GoogleAuthorizationCodeTokenRequest) super.setScopes(scopes); } @Override public GoogleAuthorizationCodeTokenRequest setGrantType(String grantType) { return (GoogleAuthorizationCodeTokenRequest) super.setGrantType(grantType); } @Override public GoogleAuthorizationCodeTokenRequest setClientAuthentication( HttpExecuteInterceptor clientAuthentication) { Preconditions.checkNotNull(clientAuthentication); return (GoogleAuthorizationCodeTokenRequest) super.setClientAuthentication( clientAuthentication); } @Override public GoogleAuthorizationCodeTokenRequest setCode(String code) { return (GoogleAuthorizationCodeTokenRequest) super.setCode(code); } @Override public GoogleAuthorizationCodeTokenRequest setRedirectUri(String redirectUri) { Preconditions.checkNotNull(redirectUri); return (GoogleAuthorizationCodeTokenRequest) super.setRedirectUri(redirectUri); } @Override public GoogleTokenResponse execute() throws IOException { return executeUnparsed().parseAs(GoogleTokenResponse.class); } @Override public GoogleAuthorizationCodeTokenRequest set(String fieldName, Object value) { return (GoogleAuthorizationCodeTokenRequest) super.set(fieldName, value); } } GoogleBrowserClientRequestUrl.java000066400000000000000000000126501350651464300431020ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.BrowserClientRequestUrl; import com.google.api.client.util.Key; import com.google.api.client.util.Preconditions; import java.util.Collection; /** * Google-specific implementation of the OAuth 2.0 URL builder for an authorization web page to * allow the end user to authorize the application to access their protected resources and that * returns the access token to a browser client using a scripting language such as JavaScript, as * specified in Using OAuth * 2.0 for Client-side Applications. * *

* The default for {@link #getResponseTypes()} is {@code "token"}. *

* *

* Sample usage for a web application: *

* *
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String url = new GoogleBrowserClientRequestUrl("812741506391.apps.googleusercontent.com",
        "https://oauth2-login-demo.appspot.com/oauthcallback", Arrays.asList(
            "https://www.googleapis.com/auth/userinfo.email",
            "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build();
    response.sendRedirect(url);
  }
 * 
* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleBrowserClientRequestUrl extends BrowserClientRequestUrl { /** * Prompt for consent behavior ({@code "auto"} to request auto-approval or {@code "force"} to * force the approval UI to show) or {@code null} for the default behavior. */ @Key("approval_prompt") private String approvalPrompt; /** * @param clientId client identifier * @param redirectUri URI that the authorization server directs the resource owner's user-agent * back to the client after a successful authorization grant * @param scopes scopes (see {@link #setScopes(Collection)}) * * @since 1.15 */ public GoogleBrowserClientRequestUrl( String clientId, String redirectUri, Collection scopes) { super(GoogleOAuthConstants.AUTHORIZATION_SERVER_URL, clientId); setRedirectUri(redirectUri); setScopes(scopes); } /** * @param clientSecrets OAuth 2.0 client secrets JSON model as specified in * client_secrets.json file format * @param redirectUri URI that the authorization server directs the resource owner's user-agent * back to the client after a successful authorization grant * @param scopes scopes (see {@link #setScopes(Collection)}) * * @since 1.15 */ public GoogleBrowserClientRequestUrl( GoogleClientSecrets clientSecrets, String redirectUri, Collection scopes) { this(clientSecrets.getDetails().getClientId(), redirectUri, scopes); } /** * Returns the approval prompt behavior ({@code "auto"} to request auto-approval or * {@code "force"} to force the approval UI to show) or {@code null} for the default behavior of * {@code "auto"}. */ public final String getApprovalPrompt() { return approvalPrompt; } /** * Sets the approval prompt behavior ({@code "auto"} to request auto-approval or {@code "force"} * to force the approval UI to show) or {@code null} for the default behavior of {@code "auto"}. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public GoogleBrowserClientRequestUrl setApprovalPrompt(String approvalPrompt) { this.approvalPrompt = approvalPrompt; return this; } @Override public GoogleBrowserClientRequestUrl setResponseTypes(Collection responseTypes) { return (GoogleBrowserClientRequestUrl) super.setResponseTypes(responseTypes); } @Override public GoogleBrowserClientRequestUrl setRedirectUri(String redirectUri) { return (GoogleBrowserClientRequestUrl) super.setRedirectUri(redirectUri); } @Override public GoogleBrowserClientRequestUrl setScopes(Collection scopes) { Preconditions.checkArgument(scopes.iterator().hasNext()); return (GoogleBrowserClientRequestUrl) super.setScopes(scopes); } @Override public GoogleBrowserClientRequestUrl setClientId(String clientId) { return (GoogleBrowserClientRequestUrl) super.setClientId(clientId); } @Override public GoogleBrowserClientRequestUrl setState(String state) { return (GoogleBrowserClientRequestUrl) super.setState(state); } @Override public GoogleBrowserClientRequestUrl set(String fieldName, Object value) { return (GoogleBrowserClientRequestUrl) super.set(fieldName, value); } @Override public GoogleBrowserClientRequestUrl clone() { return (GoogleBrowserClientRequestUrl) super.clone(); } } GoogleClientSecrets.java000066400000000000000000000116641350651464300410370ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Key; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.io.Reader; import java.util.List; /** * OAuth 2.0 client secrets JSON model as specified in client_secrets.json * file format. * *

* Sample usage: *

* *
  static GoogleClientSecrets loadClientSecretsResource(JsonFactory jsonFactory) throws IOException {
    return GoogleClientSecrets.load(
        jsonFactory,
        new InputStreamReader(
            SampleClass.class.getResourceAsStream("/client_secrets.json"), "UTF-8"));
  }
 * 
* * @since 1.7 * @author Yaniv Inbar */ public final class GoogleClientSecrets extends GenericJson { /** Details for installed applications. */ @Key private Details installed; /** Details for web applications. */ @Key private Details web; /** Returns the details for installed applications. */ public Details getInstalled() { return installed; } /** Sets the details for installed applications. */ public GoogleClientSecrets setInstalled(Details installed) { this.installed = installed; return this; } /** Returns the details for web applications. */ public Details getWeb() { return web; } /** Sets the details for web applications. */ public GoogleClientSecrets setWeb(Details web) { this.web = web; return this; } /** Returns the details for either installed or web applications. */ public Details getDetails() { // that web or installed, but not both Preconditions.checkArgument((web == null) != (installed == null)); return web == null ? installed : web; } /** Client credential details. */ public static final class Details extends GenericJson { /** Client ID. */ @Key("client_id") private String clientId; /** Client secret. */ @Key("client_secret") private String clientSecret; /** Redirect URIs. */ @Key("redirect_uris") private List redirectUris; /** Authorization server URI. */ @Key("auth_uri") private String authUri; /** Token server URI. */ @Key("token_uri") private String tokenUri; /** Returns the client ID. */ public String getClientId() { return clientId; } /** Sets the client ID. */ public Details setClientId(String clientId) { this.clientId = clientId; return this; } /** Returns the client secret. */ public String getClientSecret() { return clientSecret; } /** Sets the client secret. */ public Details setClientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } /** Returns the redirect URIs. */ public List getRedirectUris() { return redirectUris; } /** Sets the redirect URIs. */ public Details setRedirectUris(List redirectUris) { this.redirectUris = redirectUris; return this; } /** Returns the authorization server URI. */ public String getAuthUri() { return authUri; } /** Sets the authorization server URI. */ public Details setAuthUri(String authUri) { this.authUri = authUri; return this; } /** Returns the token server URI. */ public String getTokenUri() { return tokenUri; } /** Sets the token server URI. */ public Details setTokenUri(String tokenUri) { this.tokenUri = tokenUri; return this; } @Override public Details set(String fieldName, Object value) { return (Details) super.set(fieldName, value); } @Override public Details clone() { return (Details) super.clone(); } } @Override public GoogleClientSecrets set(String fieldName, Object value) { return (GoogleClientSecrets) super.set(fieldName, value); } @Override public GoogleClientSecrets clone() { return (GoogleClientSecrets) super.clone(); } /** * Loads the {@code client_secrets.json} file from the given reader. * * @since 1.15 */ public static GoogleClientSecrets load(JsonFactory jsonFactory, Reader reader) throws IOException { return jsonFactory.fromReader(reader, GoogleClientSecrets.class); } } GoogleCredential.java000066400000000000000000001015471350651464300403420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.auth.oauth2.CredentialRefreshListener; import com.google.api.client.auth.oauth2.DataStoreCredentialRefreshListener; import com.google.api.client.auth.oauth2.TokenRequest; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.Details; import com.google.api.client.googleapis.util.Utils; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.json.webtoken.JsonWebSignature; import com.google.api.client.json.webtoken.JsonWebToken; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import com.google.api.client.util.Joiner; import com.google.api.client.util.PemReader; import com.google.api.client.util.PemReader.Section; import com.google.api.client.util.Preconditions; import com.google.api.client.util.SecurityUtils; import com.google.api.client.util.store.DataStoreFactory; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; import java.security.GeneralSecurityException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Collection; import java.util.Collections; /** * Thread-safe Google-specific implementation of the OAuth 2.0 helper for accessing protected * resources using an access token, as well as optionally refreshing the access token when it * expires using a refresh token. * *

* There are three modes supported: access token only, refresh token flow, and service account flow * (with or without impersonating a user). *

* *

* If all you have is an access token, you simply pass the {@link TokenResponse} to the credential * using {@link Builder#setFromTokenResponse(TokenResponse)}. Google credential uses * {@link BearerToken#authorizationHeaderAccessMethod()} as the access method. Sample usage: *

* *
  public static GoogleCredential createCredentialWithAccessTokenOnly(TokenResponse tokenResponse) {
    return new GoogleCredential().setFromTokenResponse(tokenResponse);
  }
 * 
* *

* If you have a refresh token, it is similar to the case of access token only, but you additionally * need to pass the credential the client secrets using * {@link Builder#setClientSecrets(GoogleClientSecrets)} or * {@link Builder#setClientSecrets(String, String)}. Google credential uses * {@link GoogleOAuthConstants#TOKEN_SERVER_URL} as the token server URL, and * {@link ClientParametersAuthentication} with the client ID and secret as the client * authentication. Sample usage: *

* *
  public static GoogleCredential createCredentialWithRefreshToken(HttpTransport transport,
      JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, TokenResponse tokenResponse) {
    return new GoogleCredential.Builder().setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setClientSecrets(clientSecrets)
        .build()
        .setFromTokenResponse(tokenResponse);
  }
 * 
* *

* The service account * flow is used when you want to access data owned by your client application. You download the * private key in a {@code .p12} file from the Google APIs Console. Use * {@link Builder#setServiceAccountId(String)}, * {@link Builder#setServiceAccountPrivateKeyFromP12File(File)}, and * {@link Builder#setServiceAccountScopes(Collection)}. Sample usage: *

* *
  public static GoogleCredential createCredentialForServiceAccount(
      HttpTransport transport,
      JsonFactory jsonFactory,
      String serviceAccountId,
      Collection<String> serviceAccountScopes,
      File p12File) throws GeneralSecurityException, IOException {
    return new GoogleCredential.Builder().setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountId(serviceAccountId)
        .setServiceAccountScopes(serviceAccountScopes)
        .setServiceAccountPrivateKeyFromP12File(p12File)
        .build();
  }
 * 
* *

* You can also use the service account flow to impersonate a user in a domain that you own. This is * very similar to the service account flow above, but you additionally call * {@link Builder#setServiceAccountUser(String)}. Sample usage: *

* *
  public static GoogleCredential createCredentialForServiceAccountImpersonateUser(
      HttpTransport transport,
      JsonFactory jsonFactory,
      String serviceAccountId,
      Collection<String> serviceAccountScopes,
      File p12File,
      String serviceAccountUser) throws GeneralSecurityException, IOException {
    return new GoogleCredential.Builder().setTransport(transport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountId(serviceAccountId)
        .setServiceAccountScopes(serviceAccountScopes)
        .setServiceAccountPrivateKeyFromP12File(p12File)
        .setServiceAccountUser(serviceAccountUser)
        .build();
  }
 * 
* *

* If you need to persist the access token in a data store, use {@link DataStoreFactory} and * {@link Builder#addRefreshListener(CredentialRefreshListener)} with * {@link DataStoreCredentialRefreshListener}. *

* *

* If you have a custom request initializer, request execute interceptor, or unsuccessful response * handler, take a look at the sample usage for {@link HttpExecuteInterceptor} and * {@link HttpUnsuccessfulResponseHandler}, which are interfaces that this class also implements. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleCredential extends Credential { static final String USER_FILE_TYPE = "authorized_user"; static final String SERVICE_ACCOUNT_FILE_TYPE = "service_account"; @Beta private static DefaultCredentialProvider defaultCredentialProvider = new DefaultCredentialProvider(); /** * {@link Beta}
* Returns the Application Default Credentials. * *

Returns the Application Default Credentials which are credentials that identify and * authorize the whole application. This is the built-in service account if running on Google * Compute Engine or the credentials file from the path in the environment variable * GOOGLE_APPLICATION_CREDENTIALS.

* * @return the credential instance. * @throws IOException if the credential cannot be created in the current environment. */ @Beta public static GoogleCredential getApplicationDefault() throws IOException { return getApplicationDefault(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory()); } /** * {@link Beta}
* Returns the Application Default Credentials. * *

Returns the Application Default Credentials which are credentials that identify and * authorize the whole application. This is the built-in service account if running on Google * Compute Engine or the credentials file from the path in the environment variable * GOOGLE_APPLICATION_CREDENTIALS.

* * @param transport the transport for Http calls. * @param jsonFactory the factory for Json parsing and formatting. * @return the credential instance. * @throws IOException if the credential cannot be created in the current environment. */ @Beta public static GoogleCredential getApplicationDefault( HttpTransport transport, JsonFactory jsonFactory) throws IOException { Preconditions.checkNotNull(transport); Preconditions.checkNotNull(jsonFactory); return defaultCredentialProvider.getDefaultCredential(transport, jsonFactory); } /** * {@link Beta}
* Return a credential defined by a Json file. * * @param credentialStream the stream with the credential definition. * @return the credential defined by the credentialStream. * @throws IOException if the credential cannot be created from the stream. */ @Beta public static GoogleCredential fromStream(InputStream credentialStream) throws IOException { return fromStream( credentialStream, Utils.getDefaultTransport(), Utils.getDefaultJsonFactory()); } /** * {@link Beta}
* Return a credential defined by a Json file. * * @param credentialStream the stream with the credential definition. * @param transport the transport for Http calls. * @param jsonFactory the factory for Json parsing and formatting. * @return the credential defined by the credentialStream. * @throws IOException if the credential cannot be created from the stream. */ @Beta public static GoogleCredential fromStream(InputStream credentialStream, HttpTransport transport, JsonFactory jsonFactory) throws IOException { Preconditions.checkNotNull(credentialStream); Preconditions.checkNotNull(transport); Preconditions.checkNotNull(jsonFactory); JsonObjectParser parser = new JsonObjectParser(jsonFactory); GenericJson fileContents = parser.parseAndClose( credentialStream, OAuth2Utils.UTF_8, GenericJson.class); String fileType = (String) fileContents.get("type"); if (fileType == null) { throw new IOException("Error reading credentials from stream, 'type' field not specified."); } if (USER_FILE_TYPE.equals(fileType)) { return fromStreamUser(fileContents, transport, jsonFactory); } if (SERVICE_ACCOUNT_FILE_TYPE.equals(fileType)) { return fromStreamServiceAccount(fileContents, transport, jsonFactory); } throw new IOException(String.format( "Error reading credentials from stream, 'type' value '%s' not recognized." + " Expecting '%s' or '%s'.", fileType, USER_FILE_TYPE, SERVICE_ACCOUNT_FILE_TYPE)); } /** * Service account ID (typically an e-mail address) or {@code null} if not using the service * account flow. */ private String serviceAccountId; /** * Service account Project ID or {@code null} if not present, either because this is not using the * service account flow, or is using an older version of the service account configuration. */ private String serviceAccountProjectId; /** * Collection of OAuth scopes to use with the service account flow or {@code null} if not * using the service account flow. */ private Collection serviceAccountScopes; /** * Private key to use with the service account flow or {@code null} if not using the service * account flow. */ private PrivateKey serviceAccountPrivateKey; /** * ID of private key to use with the service account flow or {@code null} if not using the * service account flow. */ private String serviceAccountPrivateKeyId; /** * Email address of the user the application is trying to impersonate in the service account flow * or {@code null} for none or if not using the service account flow. */ private String serviceAccountUser; /** * Constructor with the ability to access protected resources, but not refresh tokens. * *

* To use with the ability to refresh tokens, use {@link Builder}. *

*/ public GoogleCredential() { this(new Builder()); } /** * @param builder Google credential builder * * @since 1.14 */ protected GoogleCredential(Builder builder) { super(builder); if (builder.serviceAccountPrivateKey == null) { Preconditions.checkArgument(builder.serviceAccountId == null && builder.serviceAccountScopes == null && builder.serviceAccountUser == null); } else { serviceAccountId = Preconditions.checkNotNull(builder.serviceAccountId); serviceAccountProjectId = builder.serviceAccountProjectId; serviceAccountScopes = (builder.serviceAccountScopes == null) ? Collections.emptyList() : Collections.unmodifiableCollection(builder.serviceAccountScopes); serviceAccountPrivateKey = builder.serviceAccountPrivateKey; serviceAccountPrivateKeyId = builder.serviceAccountPrivateKeyId; serviceAccountUser = builder.serviceAccountUser; } } @Override public GoogleCredential setAccessToken(String accessToken) { return (GoogleCredential) super.setAccessToken(accessToken); } @Override public GoogleCredential setRefreshToken(String refreshToken) { if (refreshToken != null) { Preconditions.checkArgument( getJsonFactory() != null && getTransport() != null && getClientAuthentication() != null, "Please use the Builder and call setJsonFactory, setTransport and setClientSecrets"); } return (GoogleCredential) super.setRefreshToken(refreshToken); } @Override public GoogleCredential setExpirationTimeMilliseconds(Long expirationTimeMilliseconds) { return (GoogleCredential) super.setExpirationTimeMilliseconds(expirationTimeMilliseconds); } @Override public GoogleCredential setExpiresInSeconds(Long expiresIn) { return (GoogleCredential) super.setExpiresInSeconds(expiresIn); } @Override public GoogleCredential setFromTokenResponse(TokenResponse tokenResponse) { return (GoogleCredential) super.setFromTokenResponse(tokenResponse); } @Override @Beta protected TokenResponse executeRefreshToken() throws IOException { if (serviceAccountPrivateKey == null) { return super.executeRefreshToken(); } // service accounts: no refresh token; instead use private key to request new access token JsonWebSignature.Header header = new JsonWebSignature.Header(); header.setAlgorithm("RS256"); header.setType("JWT"); header.setKeyId(serviceAccountPrivateKeyId); JsonWebToken.Payload payload = new JsonWebToken.Payload(); long currentTime = getClock().currentTimeMillis(); payload.setIssuer(serviceAccountId); payload.setAudience(getTokenServerEncodedUrl()); payload.setIssuedAtTimeSeconds(currentTime / 1000); payload.setExpirationTimeSeconds(currentTime / 1000 + 3600); payload.setSubject(serviceAccountUser); payload.put("scope", Joiner.on(' ').join(serviceAccountScopes)); try { String assertion = JsonWebSignature.signUsingRsaSha256( serviceAccountPrivateKey, getJsonFactory(), header, payload); TokenRequest request = new TokenRequest( getTransport(), getJsonFactory(), new GenericUrl(getTokenServerEncodedUrl()), "urn:ietf:params:oauth:grant-type:jwt-bearer"); request.put("assertion", assertion); return request.execute(); } catch (GeneralSecurityException exception) { IOException e = new IOException(); e.initCause(exception); throw e; } } /** * Returns the service account ID (typically an e-mail address) or {@code null} if not using the * service account flow. */ public final String getServiceAccountId() { return serviceAccountId; } /** * Returns the service account Project ID or {@code null} if not present, either because this is * not using the service account flow, or is using an older version of the service account * configuration. */ public final String getServiceAccountProjectId() { return serviceAccountProjectId; } /** * Returns a collection of OAuth scopes to use with the service account flow or {@code null} * if not using the service account flow. */ public final Collection getServiceAccountScopes() { return serviceAccountScopes; } /** * Returns the space-separated OAuth scopes to use with the service account flow or * {@code null} if not using the service account flow. * * @since 1.15 */ public final String getServiceAccountScopesAsString() { return serviceAccountScopes == null ? null : Joiner.on(' ').join(serviceAccountScopes); } /** * Returns the private key to use with the service account flow or {@code null} if not using * the service account flow. */ public final PrivateKey getServiceAccountPrivateKey() { return serviceAccountPrivateKey; } /** * {@link Beta}
* Returns the ID of the private key to use with the service account flow or {@code null} if * not using the service account flow. */ @Beta public final String getServiceAccountPrivateKeyId() { return serviceAccountPrivateKeyId; } /** * Returns the email address of the user the application is trying to impersonate in the service * account flow or {@code null} for none or if not using the service account flow. */ public final String getServiceAccountUser() { return serviceAccountUser; } /** * {@link Beta}
* Indicates whether the credential requires scopes to be specified by calling createScoped * before use. */ @Beta public boolean createScopedRequired() { if (serviceAccountPrivateKey == null) { return false; } return (serviceAccountScopes == null || serviceAccountScopes.isEmpty()); } /** * {@link Beta}
* For credentials that require scopes, creates a copy of the credential with the specified * scopes. */ @Beta public GoogleCredential createScoped(Collection scopes) { if (serviceAccountPrivateKey == null) { return this; } return toBuilder() .setServiceAccountScopes(scopes) .build(); } /** * {@link Beta}
* For service accounts that need to delegate to a specific user, create a * copy of the credential with the specified user. */ @Beta public GoogleCredential createDelegated(String user) { if (serviceAccountPrivateKey == null) { return this; } return toBuilder() .setServiceAccountUser(user) .build(); } /** * {@link Beta}
* Create a builder from this credential. */ @Beta public Builder toBuilder() { Builder builder = new GoogleCredential.Builder() .setServiceAccountPrivateKey(serviceAccountPrivateKey) .setServiceAccountPrivateKeyId(serviceAccountPrivateKeyId) .setServiceAccountId(serviceAccountId) .setServiceAccountProjectId(serviceAccountProjectId) .setServiceAccountUser(serviceAccountUser) .setServiceAccountScopes(serviceAccountScopes) .setTokenServerEncodedUrl(getTokenServerEncodedUrl()) .setTransport(getTransport()) .setJsonFactory(getJsonFactory()) .setClock(getClock()); builder.setClientAuthentication(getClientAuthentication()); return builder; } /** * Google credential builder. * *

* Implementation is not thread-safe. *

*/ public static class Builder extends Credential.Builder { /** Service account ID (typically an e-mail address) or {@code null} for none. */ String serviceAccountId; /** * Collection of OAuth scopes to use with the service account flow or {@code null} for none. */ Collection serviceAccountScopes; /** Private key to use with the service account flow or {@code null} for none. */ PrivateKey serviceAccountPrivateKey; /** Id of the private key to use with the service account flow or {@code null} for none. */ String serviceAccountPrivateKeyId; /** Project ID associated with the Service Account. */ String serviceAccountProjectId; /** * Email address of the user the application is trying to impersonate in the service account * flow or {@code null} for none. */ String serviceAccountUser; public Builder() { super(BearerToken.authorizationHeaderAccessMethod()); setTokenServerEncodedUrl(GoogleOAuthConstants.TOKEN_SERVER_URL); } @Override public GoogleCredential build() { return new GoogleCredential(this); } @Override public Builder setTransport(HttpTransport transport) { return (Builder) super.setTransport(transport); } @Override public Builder setJsonFactory(JsonFactory jsonFactory) { return (Builder) super.setJsonFactory(jsonFactory); } /** * @since 1.9 */ @Override public Builder setClock(Clock clock) { return (Builder) super.setClock(clock); } /** * Sets the client identifier and secret. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setClientSecrets(String clientId, String clientSecret) { setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret)); return this; } /** * Sets the client secrets. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setClientSecrets(GoogleClientSecrets clientSecrets) { Details details = clientSecrets.getDetails(); setClientAuthentication( new ClientParametersAuthentication(details.getClientId(), details.getClientSecret())); return this; } /** * Returns the service account ID (typically an e-mail address) or {@code null} for none. */ public final String getServiceAccountId() { return serviceAccountId; } /** * Sets the service account ID (typically an e-mail address) or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setServiceAccountId(String serviceAccountId) { this.serviceAccountId = serviceAccountId; return this; } /** * Returns the service account Project ID or {@code null} for none. */ public final String getServiceAccountProjectId() { return serviceAccountProjectId; } /** * Sets the service account Project ID or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setServiceAccountProjectId(String serviceAccountProjectId) { this.serviceAccountProjectId = serviceAccountProjectId; return this; } /** * Returns a collection of OAuth scopes to use with the service account flow or {@code null} * for none. */ public final Collection getServiceAccountScopes() { return serviceAccountScopes; } /** * Sets the space-separated OAuth scopes to use with the service account flow or * {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @param serviceAccountScopes collection of scopes to be joined by a space separator (or a * single value containing multiple space-separated scopes) * @since 1.15 */ public Builder setServiceAccountScopes(Collection serviceAccountScopes) { this.serviceAccountScopes = serviceAccountScopes; return this; } /** * Returns the private key to use with the service account flow or {@code null} for none. */ public final PrivateKey getServiceAccountPrivateKey() { return serviceAccountPrivateKey; } /** * Sets the private key to use with the service account flow or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setServiceAccountPrivateKey(PrivateKey serviceAccountPrivateKey) { this.serviceAccountPrivateKey = serviceAccountPrivateKey; return this; } /** * {@link Beta}
* Returns the id of the private key to use with the service account flow or {@code null} * for none. */ @Beta public final String getServiceAccountPrivateKeyId() { return serviceAccountPrivateKeyId; } /** * {@link Beta}
* Sets the id of the private key to use with the service account flow or {@code null} for * none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ @Beta public Builder setServiceAccountPrivateKeyId(String serviceAccountPrivateKeyId) { this.serviceAccountPrivateKeyId = serviceAccountPrivateKeyId; return this; } /** * Sets the private key to use with the service account flow or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @param p12File p12 file object */ public Builder setServiceAccountPrivateKeyFromP12File(File p12File) throws GeneralSecurityException, IOException { setServiceAccountPrivateKeyFromP12File(new FileInputStream(p12File)); return this; } /** * Sets the private key to use with the service account flow or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @param p12FileInputStream input stream to the p12 file. This file is closed at the end of * this method in a finally block. */ public Builder setServiceAccountPrivateKeyFromP12File(InputStream p12FileInputStream) throws GeneralSecurityException, IOException { serviceAccountPrivateKey = SecurityUtils.loadPrivateKeyFromKeyStore( SecurityUtils.getPkcs12KeyStore(), p12FileInputStream, "notasecret", "privatekey", "notasecret"); return this; } /** * {@link Beta}
* Sets the private key to use with the service account flow or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @param pemFile input stream to the PEM file (closed at the end of this method in a finally * block) * @since 1.13 */ @Beta public Builder setServiceAccountPrivateKeyFromPemFile(File pemFile) throws GeneralSecurityException, IOException { byte[] bytes = PemReader.readFirstSectionAndClose(new FileReader(pemFile), "PRIVATE KEY") .getBase64DecodedBytes(); serviceAccountPrivateKey = SecurityUtils.getRsaKeyFactory().generatePrivate(new PKCS8EncodedKeySpec(bytes)); return this; } /** * Returns the email address of the user the application is trying to impersonate in the service * account flow or {@code null} for none. */ public final String getServiceAccountUser() { return serviceAccountUser; } /** * Sets the email address of the user the application is trying to impersonate in the service * account flow or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setServiceAccountUser(String serviceAccountUser) { this.serviceAccountUser = serviceAccountUser; return this; } @Override public Builder setRequestInitializer(HttpRequestInitializer requestInitializer) { return (Builder) super.setRequestInitializer(requestInitializer); } @Override public Builder addRefreshListener(CredentialRefreshListener refreshListener) { return (Builder) super.addRefreshListener(refreshListener); } @Override public Builder setRefreshListeners(Collection refreshListeners) { return (Builder) super.setRefreshListeners(refreshListeners); } @Override public Builder setTokenServerUrl(GenericUrl tokenServerUrl) { return (Builder) super.setTokenServerUrl(tokenServerUrl); } @Override public Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl) { return (Builder) super.setTokenServerEncodedUrl(tokenServerEncodedUrl); } @Override public Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication) { return (Builder) super.setClientAuthentication(clientAuthentication); } } @Beta private static GoogleCredential fromStreamUser(GenericJson fileContents, HttpTransport transport, JsonFactory jsonFactory) throws IOException { String clientId = (String) fileContents.get("client_id"); String clientSecret = (String) fileContents.get("client_secret"); String refreshToken = (String) fileContents.get("refresh_token"); if (clientId == null || clientSecret == null || refreshToken == null) { throw new IOException("Error reading user credential from stream, " + " expecting 'client_id', 'client_secret' and 'refresh_token'."); } GoogleCredential credential = new GoogleCredential.Builder() .setClientSecrets(clientId, clientSecret) .setTransport(transport) .setJsonFactory(jsonFactory) .build(); credential.setRefreshToken(refreshToken); // Do a refresh so we can fail early rather than return an unusable credential credential.refreshToken(); return credential; } @Beta private static GoogleCredential fromStreamServiceAccount(GenericJson fileContents, HttpTransport transport, JsonFactory jsonFactory) throws IOException { String clientId = (String) fileContents.get("client_id"); String clientEmail = (String) fileContents.get("client_email"); String privateKeyPem = (String) fileContents.get("private_key"); String privateKeyId = (String) fileContents.get("private_key_id"); if (clientId == null || clientEmail == null || privateKeyPem == null || privateKeyId == null) { throw new IOException("Error reading service account credential from stream, " + "expecting 'client_id', 'client_email', 'private_key' and 'private_key_id'."); } PrivateKey privateKey = privateKeyFromPkcs8(privateKeyPem); Collection emptyScopes = Collections.emptyList(); Builder credentialBuilder = new GoogleCredential.Builder() .setTransport(transport) .setJsonFactory(jsonFactory) .setServiceAccountId(clientEmail) .setServiceAccountScopes(emptyScopes) .setServiceAccountPrivateKey(privateKey) .setServiceAccountPrivateKeyId(privateKeyId); String tokenUri = (String) fileContents.get("token_uri"); if (tokenUri != null) { credentialBuilder.setTokenServerEncodedUrl(tokenUri); } String projectId = (String) fileContents.get("project_id"); if (projectId != null) { credentialBuilder.setServiceAccountProjectId(projectId); } // Don't do a refresh at this point, as it will always fail before the scopes are added. return credentialBuilder.build(); } @Beta private static PrivateKey privateKeyFromPkcs8(String privateKeyPem) throws IOException { Reader reader = new StringReader(privateKeyPem); Section section = PemReader.readFirstSectionAndClose(reader, "PRIVATE KEY"); if (section == null) { throw new IOException("Invalid PKCS8 data."); } byte[] bytes = section.getBase64DecodedBytes(); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes); Exception unexpectedException = null; try { KeyFactory keyFactory = SecurityUtils.getRsaKeyFactory(); PrivateKey privateKey = keyFactory.generatePrivate(keySpec); return privateKey; } catch (NoSuchAlgorithmException exception) { unexpectedException = exception; } catch (InvalidKeySpecException exception) { unexpectedException = exception; } throw OAuth2Utils.exceptionWithCause( new IOException("Unexpected exception reading PKCS data"), unexpectedException); } } GoogleIdToken.java000066400000000000000000000225641350651464300376260ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.openidconnect.IdToken; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.webtoken.JsonWebSignature; import com.google.api.client.util.Beta; import com.google.api.client.util.Key; import java.io.IOException; import java.security.GeneralSecurityException; import java.util.List; /** * {@link Beta}
* Google ID tokens as specified in OpenID Connect. * *

* Google ID tokens contain useful information about the authorized end user. Google ID tokens are * signed and the signature must be verified using {@link #verify(GoogleIdTokenVerifier)}. *

* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ @SuppressWarnings("javadoc") @Beta public class GoogleIdToken extends IdToken { /** * Parses the given ID token string and returns the parsed {@link GoogleIdToken}. * * @param jsonFactory JSON factory * @param idTokenString ID token string * @return parsed Google ID token */ public static GoogleIdToken parse(JsonFactory jsonFactory, String idTokenString) throws IOException { JsonWebSignature jws = JsonWebSignature.parser(jsonFactory).setPayloadClass(Payload.class).parse(idTokenString); return new GoogleIdToken(jws.getHeader(), (Payload) jws.getPayload(), jws.getSignatureBytes(), jws.getSignedContentBytes()); } /** * @param header header * @param payload payload * @param signatureBytes bytes of the signature * @param signedContentBytes bytes of the signature content */ public GoogleIdToken( Header header, Payload payload, byte[] signatureBytes, byte[] signedContentBytes) { super(header, payload, signatureBytes, signedContentBytes); } /** * Verifies that this ID token is valid using {@link GoogleIdTokenVerifier#verify(GoogleIdToken)}. */ public boolean verify(GoogleIdTokenVerifier verifier) throws GeneralSecurityException, IOException { return verifier.verify(this); } @Override public Payload getPayload() { return (Payload) super.getPayload(); } /** * {@link Beta}
* Google ID token payload. */ @Beta public static class Payload extends IdToken.Payload { /** Hosted domain name if asserted user is a domain managed user or {@code null} for none. */ @Key("hd") private String hostedDomain; /** E-mail of the user or {@code null} if not requested. */ @Key("email") private String email; /** * {@code true} if the email is verified. * TODO(mwan): change the type of the field to Boolean and the handling in * {@link #getEmailVerified()} accordingly after Google OpenID Connect endpoint fixes the * type of the field in ID Token. */ @Key("email_verified") private Object emailVerified; public Payload() { } /** * Returns the obfuscated Google user id or {@code null} for none. * * @deprecated (scheduled to be removed in 1.18) Use {@link #getSubject()} instead. */ @Deprecated public String getUserId() { return getSubject(); } /** * Sets the obfuscated Google user id or {@code null} for none. * * @deprecated (scheduled to be removed in 1.18) Use {@link #setSubject(String)} instead. */ @Deprecated public Payload setUserId(String userId) { return setSubject(userId); } /** * Returns the client ID of issuee or {@code null} for none. * * @deprecated (scheduled to be removed in 1.18) Use {@link #getAuthorizedParty()} instead. */ @Deprecated public String getIssuee() { return getAuthorizedParty(); } /** * Sets the client ID of issuee or {@code null} for none. * * @deprecated (scheduled to be removed in 1.18) Use {@link #setAuthorizedParty(String)} * instead. */ @Deprecated public Payload setIssuee(String issuee) { return setAuthorizedParty(issuee); } /** * Returns the hosted domain name if asserted user is a domain managed user or {@code null} for * none. */ public String getHostedDomain() { return hostedDomain; } /** * Sets the hosted domain name if asserted user is a domain managed user or {@code null} for * none. */ public Payload setHostedDomain(String hostedDomain) { this.hostedDomain = hostedDomain; return this; } /** * Returns the e-mail address of the user or {@code null} if it was not requested. * *

* Requires the {@code "https://www.googleapis.com/auth/userinfo.email"} scope. *

* * @since 1.10 */ public String getEmail() { return email; } /** * Sets the e-mail address of the user or {@code null} if it was not requested. * *

* Used in conjunction with the {@code "https://www.googleapis.com/auth/userinfo.email"} scope. *

* * @since 1.10 */ public Payload setEmail(String email) { this.email = email; return this; } /** * Returns {@code true} if the users e-mail address has been verified by Google. * *

* Requires the {@code "https://www.googleapis.com/auth/userinfo.email"} scope. *

* * @since 1.10 * *

* Upgrade warning: in prior version 1.16 this method accessed {@code "verified_email"} * and returns a boolean, but starting with verison 1.17, it now accesses * {@code "email_verified"} and returns a Boolean. Previously, if this value was not * specified, this method would return {@code false}, but now it returns {@code null}. *

*/ public Boolean getEmailVerified() { if (emailVerified == null) { return null; } if (emailVerified instanceof Boolean) { return (Boolean) emailVerified; } return Boolean.valueOf((String) emailVerified); } /** * Sets whether the users e-mail address has been verified by Google or not. * *

* Used in conjunction with the {@code "https://www.googleapis.com/auth/userinfo.email"} scope. *

* * @since 1.10 * *

* Upgrade warning: in prior version 1.16 this method accessed {@code "verified_email"} and * required a boolean parameter, but starting with verison 1.17, it now accesses * {@code "email_verified"} and requires a Boolean parameter. *

*/ public Payload setEmailVerified(Boolean emailVerified) { this.emailVerified = emailVerified; return this; } @Override public Payload setAuthorizationTimeSeconds(Long authorizationTimeSeconds) { return (Payload) super.setAuthorizationTimeSeconds(authorizationTimeSeconds); } @Override public Payload setAuthorizedParty(String authorizedParty) { return (Payload) super.setAuthorizedParty(authorizedParty); } @Override public Payload setNonce(String nonce) { return (Payload) super.setNonce(nonce); } @Override public Payload setAccessTokenHash(String accessTokenHash) { return (Payload) super.setAccessTokenHash(accessTokenHash); } @Override public Payload setClassReference(String classReference) { return (Payload) super.setClassReference(classReference); } @Override public Payload setMethodsReferences(List methodsReferences) { return (Payload) super.setMethodsReferences(methodsReferences); } @Override public Payload setExpirationTimeSeconds(Long expirationTimeSeconds) { return (Payload) super.setExpirationTimeSeconds(expirationTimeSeconds); } @Override public Payload setNotBeforeTimeSeconds(Long notBeforeTimeSeconds) { return (Payload) super.setNotBeforeTimeSeconds(notBeforeTimeSeconds); } @Override public Payload setIssuedAtTimeSeconds(Long issuedAtTimeSeconds) { return (Payload) super.setIssuedAtTimeSeconds(issuedAtTimeSeconds); } @Override public Payload setIssuer(String issuer) { return (Payload) super.setIssuer(issuer); } @Override public Payload setAudience(Object audience) { return (Payload) super.setAudience(audience); } @Override public Payload setJwtId(String jwtId) { return (Payload) super.setJwtId(jwtId); } @Override public Payload setType(String type) { return (Payload) super.setType(type); } @Override public Payload setSubject(String subject) { return (Payload) super.setSubject(subject); } @Override public Payload set(String fieldName, Object value) { return (Payload) super.set(fieldName, value); } @Override public Payload clone() { return (Payload) super.clone(); } } } GoogleIdTokenVerifier.java000066400000000000000000000244121350651464300413140ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.openidconnect.IdToken; import com.google.api.client.auth.openidconnect.IdTokenVerifier; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.PublicKey; import java.util.Arrays; import java.util.Collection; import java.util.List; /** * {@link Beta}
* Thread-safe Google ID token verifier. * *

* Call {@link #verify(IdToken)} to verify a ID token. Use the constructor * {@link #GoogleIdTokenVerifier(HttpTransport, JsonFactory)} for the typical simpler case if your * application has only a single instance of {@link GoogleIdTokenVerifier}. Otherwise, ideally you * should use {@link #GoogleIdTokenVerifier(GooglePublicKeysManager)} with a shared global instance * of the {@link GooglePublicKeysManager} since that way the Google public keys are cached. Sample * usage: *

* *
    GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport, jsonFactory)
        .setAudience(Arrays.asList("myClientId"))
        .build();
    ...
    if (!verifier.verify(googleIdToken)) {...}
 * 
* * @since 1.7 */ @Beta public class GoogleIdTokenVerifier extends IdTokenVerifier { /** Google public keys manager. */ private final GooglePublicKeysManager publicKeys; /** * @param transport HTTP transport * @param jsonFactory JSON factory */ public GoogleIdTokenVerifier(HttpTransport transport, JsonFactory jsonFactory) { this(new Builder(transport, jsonFactory)); } /** * @param publicKeys Google public keys manager * * @since 1.17 */ public GoogleIdTokenVerifier(GooglePublicKeysManager publicKeys) { this(new Builder(publicKeys)); } /** * @param builder builder * * @since 1.14 */ protected GoogleIdTokenVerifier(Builder builder) { super(builder); publicKeys = builder.publicKeys; } /** * Returns the Google public keys manager. * * @since 1.17 */ public final GooglePublicKeysManager getPublicKeysManager() { return publicKeys; } /** * Returns the HTTP transport. * * @since 1.14 */ public final HttpTransport getTransport() { return publicKeys.getTransport(); } /** Returns the JSON factory. */ public final JsonFactory getJsonFactory() { return publicKeys.getJsonFactory(); } /** * Returns the public certificates encoded URL. * * @since 1.15 * @deprecated (scheduled to be removed in 1.18) Use {@link #getPublicKeysManager()} and * {@link GooglePublicKeysManager#getPublicCertsEncodedUrl()} instead. */ @Deprecated public final String getPublicCertsEncodedUrl() { return publicKeys.getPublicCertsEncodedUrl(); } /** * Returns the public keys. * *

* Upgrade warning: in prior version 1.16 it may return {@code null} and not throw any exceptions, * but starting with version 1.17 it cannot return {@code null} and may throw * {@link GeneralSecurityException} or {@link IOException}. *

* * @deprecated (scheduled to be removed in 1.18) Use {@link #getPublicKeysManager()} and * {@link GooglePublicKeysManager#getPublicKeys()} instead. */ @Deprecated public final List getPublicKeys() throws GeneralSecurityException, IOException { return publicKeys.getPublicKeys(); } /** * Returns the expiration time in milliseconds to be used with {@link Clock#currentTimeMillis()} * or {@code 0} for none. * * @deprecated (scheduled to be removed in 1.18) Use {@link #getPublicKeysManager()} and * {@link GooglePublicKeysManager#getExpirationTimeMilliseconds()} instead. */ @Deprecated public final long getExpirationTimeMilliseconds() { return publicKeys.getExpirationTimeMilliseconds(); } /** * Verifies that the given ID token is valid using the cached public keys. * * It verifies: * *
    *
  • The RS256 signature, which uses RSA and SHA-256 based on the public keys downloaded from * the public certificate endpoint.
  • *
  • The current time against the issued at and expiration time (allowing for a 5 minute clock * skew).
  • *
  • The issuer is {@code "accounts.google.com"} or {@code "https://accounts.google.com"}.
  • *
* * @param googleIdToken Google ID token * @return {@code true} if verified successfully or {@code false} if failed */ public boolean verify(GoogleIdToken googleIdToken) throws GeneralSecurityException, IOException { // check the payload if (!super.verify(googleIdToken)) { return false; } // verify signature, try all public keys in turn. for (PublicKey publicKey : publicKeys.getPublicKeys()) { if (googleIdToken.verifySignature(publicKey)) { return true; } } return false; } /** * Verifies that the given ID token is valid using {@link #verify(GoogleIdToken)} and returns the * ID token if succeeded. * * @param idTokenString Google ID token string * @return Google ID token if verified successfully or {@code null} if failed * @since 1.9 */ public GoogleIdToken verify(String idTokenString) throws GeneralSecurityException, IOException { GoogleIdToken idToken = GoogleIdToken.parse(getJsonFactory(), idTokenString); return verify(idToken) ? idToken : null; } /** * Downloads the public keys from the public certificates endpoint at * {@link #getPublicCertsEncodedUrl}. * *

* This method is automatically called if the public keys have not yet been initialized or if the * expiration time is very close, so normally this doesn't need to be called. Only call this * method explicitly to force the public keys to be updated. *

* * @deprecated (scheduled to be removed in 1.18) Use {@link #getPublicKeysManager()} and * {@link GooglePublicKeysManager#refresh()} instead. */ @Deprecated public GoogleIdTokenVerifier loadPublicCerts() throws GeneralSecurityException, IOException { publicKeys.refresh(); return this; } /** * {@link Beta}
* Builder for {@link GoogleIdTokenVerifier}. * *

* Implementation is not thread-safe. *

* * @since 1.9 */ @Beta public static class Builder extends IdTokenVerifier.Builder { /** Google public keys manager. */ GooglePublicKeysManager publicKeys; /** * @param transport HTTP transport * @param jsonFactory JSON factory */ public Builder(HttpTransport transport, JsonFactory jsonFactory) { this(new GooglePublicKeysManager(transport, jsonFactory)); } /** * @param publicKeys Google public keys manager * * @since 1.17 */ public Builder(GooglePublicKeysManager publicKeys) { this.publicKeys = Preconditions.checkNotNull(publicKeys); setIssuers(Arrays.asList("accounts.google.com", "https://accounts.google.com")); } /** Builds a new instance of {@link GoogleIdTokenVerifier}. */ @Override public GoogleIdTokenVerifier build() { return new GoogleIdTokenVerifier(this); } /** * Returns the Google public keys manager. * * @since 1.17 */ public final GooglePublicKeysManager getPublicCerts() { return publicKeys; } /** Returns the HTTP transport. */ public final HttpTransport getTransport() { return publicKeys.getTransport(); } /** Returns the JSON factory. */ public final JsonFactory getJsonFactory() { return publicKeys.getJsonFactory(); } /** * Returns the public certificates encoded URL. * * @since 1.15 * @deprecated (scheduled to be removed in 1.18) Use {@link #getPublicCerts()} and * {@link GooglePublicKeysManager#getPublicCertsEncodedUrl()} instead. */ @Deprecated public final String getPublicCertsEncodedUrl() { return publicKeys.getPublicCertsEncodedUrl(); } /** * Sets the public certificates encoded URL. * *

* The default value is {@link GoogleOAuthConstants#DEFAULT_PUBLIC_CERTS_ENCODED_URL}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @since 1.15 * @deprecated (scheduled to be removed in 1.18) Use * {@link GooglePublicKeysManager.Builder#setPublicCertsEncodedUrl(String)} instead. */ @Deprecated public Builder setPublicCertsEncodedUrl(String publicKeysEncodedUrl) { // TODO(yanivi): make publicKeys field final when this method is removed publicKeys = new GooglePublicKeysManager.Builder( getTransport(), getJsonFactory()).setPublicCertsEncodedUrl(publicKeysEncodedUrl) .setClock(publicKeys.getClock()).build(); return this; } @Override public Builder setIssuer(String issuer) { return (Builder) super.setIssuer(issuer); } /** * @since 1.21.0 */ @Override public Builder setIssuers(Collection issuers) { return (Builder) super.setIssuers(issuers); } @Override public Builder setAudience(Collection audience) { return (Builder) super.setAudience(audience); } @Override public Builder setAcceptableTimeSkewSeconds(long acceptableTimeSkewSeconds) { return (Builder) super.setAcceptableTimeSkewSeconds(acceptableTimeSkewSeconds); } @Override public Builder setClock(Clock clock) { return (Builder) super.setClock(clock); } } } GoogleOAuthConstants.java000066400000000000000000000032301350651464300411730ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.util.Beta; /** * Constants for Google's OAuth 2.0 implementation. * * @since 1.7 * @author Yaniv Inbar */ public class GoogleOAuthConstants { /** Encoded URL of Google's end-user authorization server. */ public static final String AUTHORIZATION_SERVER_URL = "https://accounts.google.com/o/oauth2/auth"; /** Encoded URL of Google's token server. */ public static final String TOKEN_SERVER_URL = "https://oauth2.googleapis.com/token"; /** * {@link Beta}
* Encoded URL of Google's public certificates. * * @since 1.15 */ @Beta public static final String DEFAULT_PUBLIC_CERTS_ENCODED_URL = "https://www.googleapis.com/oauth2/v1/certs"; /** * Redirect URI to use for an installed application as specified in Using OAuth 2.0 for * Installed Applications. */ public static final String OOB_REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob"; private GoogleOAuthConstants() { } } GooglePublicKeysManager.java000066400000000000000000000235351350651464300416350ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2013 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.api.client.googleapis.auth.oauth2; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonParser; import com.google.api.client.json.JsonToken; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import com.google.api.client.util.Preconditions; import com.google.api.client.util.SecurityUtils; import com.google.api.client.util.StringUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.PublicKey; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * {@link Beta}
* Thread-safe Google public keys manager. * *

* The public keys are loaded from the public certificates endpoint at * {@link #getPublicCertsEncodedUrl} and cached in this instance. Therefore, for maximum efficiency, * applications should use a single globally-shared instance of the {@link GooglePublicKeysManager}. *

* * @since 1.17 */ @Beta public class GooglePublicKeysManager { /** Number of milliseconds before expiration time to force a refresh. */ private static final long REFRESH_SKEW_MILLIS = 300000; /** Pattern for the max-age header element of Cache-Control. */ private static final Pattern MAX_AGE_PATTERN = Pattern.compile("\\s*max-age\\s*=\\s*(\\d+)\\s*"); /** JSON factory. */ private final JsonFactory jsonFactory; /** Unmodifiable view of the public keys or {@code null} for none. */ private List publicKeys; /** * Expiration time in milliseconds to be used with {@link Clock#currentTimeMillis()} or {@code 0} * for none. */ private long expirationTimeMilliseconds; /** HTTP transport. */ private final HttpTransport transport; /** Lock on the public keys. */ private final Lock lock = new ReentrantLock(); /** Clock to use for expiration checks. */ private final Clock clock; /** Public certificates encoded URL. */ private final String publicCertsEncodedUrl; /** * @param transport HTTP transport * @param jsonFactory JSON factory */ public GooglePublicKeysManager(HttpTransport transport, JsonFactory jsonFactory) { this(new Builder(transport, jsonFactory)); } /** * @param builder builder */ protected GooglePublicKeysManager(Builder builder) { transport = builder.transport; jsonFactory = builder.jsonFactory; clock = builder.clock; publicCertsEncodedUrl = builder.publicCertsEncodedUrl; } /** Returns the HTTP transport. */ public final HttpTransport getTransport() { return transport; } /** Returns the JSON factory. */ public final JsonFactory getJsonFactory() { return jsonFactory; } /** Returns the public certificates encoded URL. */ public final String getPublicCertsEncodedUrl() { return publicCertsEncodedUrl; } /** Returns the clock. */ public final Clock getClock() { return clock; } /** * Returns an unmodifiable view of the public keys. * *

* For efficiency, an in-memory cache of the public keys is used here. If this method is called * for the first time, or the certificates have expired since last time it has been called (or are * within 5 minutes of expiring), {@link #refresh()} will be called before returning the value. *

*/ public final List getPublicKeys() throws GeneralSecurityException, IOException { lock.lock(); try { if (publicKeys == null || clock.currentTimeMillis() + REFRESH_SKEW_MILLIS > expirationTimeMilliseconds) { refresh(); } return publicKeys; } finally { lock.unlock(); } } /** * Returns the expiration time in milliseconds to be used with {@link Clock#currentTimeMillis()} * or {@code 0} for none. */ public final long getExpirationTimeMilliseconds() { return expirationTimeMilliseconds; } /** * Forces a refresh of the public certificates downloaded from {@link #getPublicCertsEncodedUrl}. * *

* This method is automatically called from {@link #getPublicKeys()} if the public keys have not * yet been initialized or if the expiration time is very close, so normally this doesn't need to * be called. Only call this method to explicitly force the public keys to be updated. *

*/ public GooglePublicKeysManager refresh() throws GeneralSecurityException, IOException { lock.lock(); try { publicKeys = new ArrayList(); // HTTP request to public endpoint CertificateFactory factory = SecurityUtils.getX509CertificateFactory(); HttpResponse certsResponse = transport.createRequestFactory() .buildGetRequest(new GenericUrl(publicCertsEncodedUrl)).execute(); expirationTimeMilliseconds = clock.currentTimeMillis() + getCacheTimeInSec(certsResponse.getHeaders()) * 1000; // parse each public key in the JSON response JsonParser parser = jsonFactory.createJsonParser(certsResponse.getContent()); JsonToken currentToken = parser.getCurrentToken(); // token is null at start, so get next token if (currentToken == null) { currentToken = parser.nextToken(); } Preconditions.checkArgument(currentToken == JsonToken.START_OBJECT); try { while (parser.nextToken() != JsonToken.END_OBJECT) { parser.nextToken(); String certValue = parser.getText(); X509Certificate x509Cert = (X509Certificate) factory.generateCertificate( new ByteArrayInputStream(StringUtils.getBytesUtf8(certValue))); publicKeys.add(x509Cert.getPublicKey()); } publicKeys = Collections.unmodifiableList(publicKeys); } finally { parser.close(); } return this; } finally { lock.unlock(); } } /** * Gets the cache time in seconds. "max-age" in "Cache-Control" header and "Age" header are * considered. * * @param httpHeaders the http header of the response * @return the cache time in seconds or zero if the response should not be cached */ long getCacheTimeInSec(HttpHeaders httpHeaders) { long cacheTimeInSec = 0; if (httpHeaders.getCacheControl() != null) { for (String arg : httpHeaders.getCacheControl().split(",")) { Matcher m = MAX_AGE_PATTERN.matcher(arg); if (m.matches()) { cacheTimeInSec = Long.parseLong(m.group(1)); break; } } } if (httpHeaders.getAge() != null) { cacheTimeInSec -= httpHeaders.getAge(); } return Math.max(0, cacheTimeInSec); } /** * {@link Beta}
* Builder for {@link GooglePublicKeysManager}. * *

* Implementation is not thread-safe. *

* * @since 1.17 */ @Beta public static class Builder { /** Clock. */ Clock clock = Clock.SYSTEM; /** HTTP transport. */ final HttpTransport transport; /** JSON factory. */ final JsonFactory jsonFactory; /** Public certificates encoded URL. */ String publicCertsEncodedUrl = GoogleOAuthConstants.DEFAULT_PUBLIC_CERTS_ENCODED_URL; /** * Returns an instance of a new builder. * * @param transport HTTP transport * @param jsonFactory JSON factory */ public Builder(HttpTransport transport, JsonFactory jsonFactory) { this.transport = Preconditions.checkNotNull(transport); this.jsonFactory = Preconditions.checkNotNull(jsonFactory); } /** Builds a new instance of {@link GooglePublicKeysManager}. */ public GooglePublicKeysManager build() { return new GooglePublicKeysManager(this); } /** Returns the HTTP transport. */ public final HttpTransport getTransport() { return transport; } /** Returns the JSON factory. */ public final JsonFactory getJsonFactory() { return jsonFactory; } /** Returns the public certificates encoded URL. */ public final String getPublicCertsEncodedUrl() { return publicCertsEncodedUrl; } /** * Sets the public certificates encoded URL. * *

* The default value is {@link GoogleOAuthConstants#DEFAULT_PUBLIC_CERTS_ENCODED_URL}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setPublicCertsEncodedUrl(String publicCertsEncodedUrl) { this.publicCertsEncodedUrl = Preconditions.checkNotNull(publicCertsEncodedUrl); return this; } /** Returns the clock. */ public final Clock getClock() { return clock; } /** * Sets the clock. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setClock(Clock clock) { this.clock = Preconditions.checkNotNull(clock); return this; } } } GoogleRefreshTokenRequest.java000066400000000000000000000112241350651464300422300ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.auth.oauth2.RefreshTokenRequest; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.auth.oauth2.TokenResponseException; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import java.io.IOException; import java.util.Collection; /** * Google-specific implementation of the OAuth 2.0 request to refresh an access token using a * refresh token as specified in Refreshing * an Access Token. * *

* Use {@link GoogleCredential} to access protected resources from the resource server using the * {@link TokenResponse} returned by {@link #execute()}. On error, it will instead throw * {@link TokenResponseException}. *

* *

* Sample usage: *

* *
  static void refreshAccessToken() throws IOException {
    try {
      TokenResponse response =
          new GoogleRefreshTokenRequest(new NetHttpTransport(), new JacksonFactory(),
              "tGzv3JOkF0XG5Qx2TlKWIA", "s6BhdRkqt3", "7Fjfp0ZBr1KtDRbnfVdmIw").execute();
      System.out.println("Access token: " + response.getAccessToken());
    } catch (TokenResponseException e) {
      if (e.getDetails() != null) {
        System.err.println("Error: " + e.getDetails().getError());
        if (e.getDetails().getErrorDescription() != null) {
          System.err.println(e.getDetails().getErrorDescription());
        }
        if (e.getDetails().getErrorUri() != null) {
          System.err.println(e.getDetails().getErrorUri());
        }
      } else {
        System.err.println(e.getMessage());
      }
    }
  }
 * 
* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleRefreshTokenRequest extends RefreshTokenRequest { /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param refreshToken refresh token issued to the client * @param clientId client identifier issued to the client during the registration process * @param clientSecret client secret */ public GoogleRefreshTokenRequest(HttpTransport transport, JsonFactory jsonFactory, String refreshToken, String clientId, String clientSecret) { super(transport, jsonFactory, new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL), refreshToken); setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret)); } @Override public GoogleRefreshTokenRequest setRequestInitializer( HttpRequestInitializer requestInitializer) { return (GoogleRefreshTokenRequest) super.setRequestInitializer(requestInitializer); } @Override public GoogleRefreshTokenRequest setTokenServerUrl(GenericUrl tokenServerUrl) { return (GoogleRefreshTokenRequest) super.setTokenServerUrl(tokenServerUrl); } @Override public GoogleRefreshTokenRequest setScopes(Collection scopes) { return (GoogleRefreshTokenRequest) super.setScopes(scopes); } @Override public GoogleRefreshTokenRequest setGrantType(String grantType) { return (GoogleRefreshTokenRequest) super.setGrantType(grantType); } @Override public GoogleRefreshTokenRequest setClientAuthentication( HttpExecuteInterceptor clientAuthentication) { return (GoogleRefreshTokenRequest) super.setClientAuthentication(clientAuthentication); } @Override public GoogleRefreshTokenRequest setRefreshToken(String refreshToken) { return (GoogleRefreshTokenRequest) super.setRefreshToken(refreshToken); } @Override public GoogleTokenResponse execute() throws IOException { return executeUnparsed().parseAs(GoogleTokenResponse.class); } @Override public GoogleRefreshTokenRequest set(String fieldName, Object value) { return (GoogleRefreshTokenRequest) super.set(fieldName, value); } } GoogleTokenResponse.java000066400000000000000000000067451350651464300410730ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Beta; import com.google.api.client.util.Key; import com.google.api.client.util.Preconditions; import java.io.IOException; /** * Google OAuth 2.0 JSON model for a successful access token response as specified in Successful Response, including an ID * token as specified in OpenID * Connect Session Management 1.0. * *

* This response object is the result of {@link GoogleAuthorizationCodeTokenRequest#execute()} and * {@link GoogleRefreshTokenRequest#execute()}. Use {@link #parseIdToken()} to parse the * {@link GoogleIdToken} and then call {@link GoogleIdTokenVerifier#verify(GoogleIdToken)}. *

* *

* Implementation is not thread-safe. *

* * @since 1.7 * @author Yaniv Inbar */ public class GoogleTokenResponse extends TokenResponse { /** ID token. */ @Key("id_token") private String idToken; @Override public GoogleTokenResponse setAccessToken(String accessToken) { return (GoogleTokenResponse) super.setAccessToken(accessToken); } @Override public GoogleTokenResponse setTokenType(String tokenType) { return (GoogleTokenResponse) super.setTokenType(tokenType); } @Override public GoogleTokenResponse setExpiresInSeconds(Long expiresIn) { return (GoogleTokenResponse) super.setExpiresInSeconds(expiresIn); } @Override public GoogleTokenResponse setRefreshToken(String refreshToken) { return (GoogleTokenResponse) super.setRefreshToken(refreshToken); } @Override public GoogleTokenResponse setScope(String scope) { return (GoogleTokenResponse) super.setScope(scope); } /** * {@link Beta}
* Returns the ID token. */ @Beta public final String getIdToken() { return idToken; } /** * {@link Beta}
* Sets the ID token. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ @Beta public GoogleTokenResponse setIdToken(String idToken) { this.idToken = Preconditions.checkNotNull(idToken); return this; } /** * {@link Beta}
* Parses using {@link GoogleIdToken#parse(JsonFactory, String)} based on the {@link #getFactory() * JSON factory} and {@link #getIdToken() ID token}. */ @Beta public GoogleIdToken parseIdToken() throws IOException { return GoogleIdToken.parse(getFactory(), getIdToken()); } @Override public GoogleTokenResponse set(String fieldName, Object value) { return (GoogleTokenResponse) super.set(fieldName, value); } @Override public GoogleTokenResponse clone() { return (GoogleTokenResponse) super.clone(); } } OAuth2Utils.java000066400000000000000000000106061350651464300372510ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2014 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.api.client.googleapis.auth.oauth2; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.util.Beta; import java.io.IOException; import java.net.SocketTimeoutException; import java.nio.charset.Charset; import java.util.Collection; import java.util.logging.Level; import java.util.logging.Logger; /** * Utilities used by the com.google.api.client.googleapis.auth.oauth2 namespace. */ @Beta public class OAuth2Utils { static final Charset UTF_8 = Charset.forName("UTF-8"); private static final Logger LOGGER = Logger.getLogger(OAuth2Utils.class.getName()); // Note: the explicit IP address is used to avoid name server resolution issues. private static final String DEFAULT_METADATA_SERVER_URL = "http://169.254.169.254"; // Note: the explicit `timeout` and `tries` below is a workaround. The underlying // issue is that resolving an unknown host on some networks will take // 20-30 seconds; making this timeout short fixes the issue, but // could lead to false negatives in the event that we are on GCE, but // the metadata resolution was particularly slow. The latter case is // "unlikely" since the expected 4-nines time is about 0.5 seconds. // This allows us to limit the total ping maximum timeout to 1.5 seconds // for developer desktop scenarios. private static final int MAX_COMPUTE_PING_TRIES = 3; private static final int COMPUTE_PING_CONNECTION_TIMEOUT_MS = 500; static T exceptionWithCause(T exception, Throwable cause) { exception.initCause(cause); return exception; } static boolean headersContainValue(HttpHeaders headers, String headerName, String value) { Object values = headers.get(headerName); if (values instanceof Collection) { @SuppressWarnings("unchecked") Collection valuesList = (Collection) values; for (Object headerValue : valuesList) { if (headerValue instanceof String && ((String) headerValue).equals(value)) { return true; } } } return false; } static boolean runningOnComputeEngine(HttpTransport transport, SystemEnvironmentProvider environment) { // If the environment has requested that we do no GCE checks, return immediately. if (Boolean.parseBoolean(environment.getEnv("NO_GCE_CHECK"))) { return false; } GenericUrl tokenUrl = new GenericUrl(getMetadataServerUrl(environment)); for (int i = 1; i <= MAX_COMPUTE_PING_TRIES; ++i) { try { HttpRequest request = transport.createRequestFactory().buildGetRequest(tokenUrl); request.setConnectTimeout(COMPUTE_PING_CONNECTION_TIMEOUT_MS); HttpResponse response = request.execute(); try { HttpHeaders headers = response.getHeaders(); return headersContainValue(headers, "Metadata-Flavor", "Google"); } finally { response.disconnect(); } } catch (SocketTimeoutException expected) { // Ignore logging timeouts which is the expected failure mode in non GCE environments. } catch (IOException e) { LOGGER.log( Level.WARNING, "Failed to detect whether we are running on Google Compute Engine.", e); } } return false; } public static String getMetadataServerUrl() { return getMetadataServerUrl(SystemEnvironmentProvider.INSTANCE); } static String getMetadataServerUrl(SystemEnvironmentProvider environment) { String metadataServerAddress = environment.getEnv("GCE_METADATA_HOST"); if (metadataServerAddress != null) { return "http://" + metadataServerAddress; } return DEFAULT_METADATA_SERVER_URL; } } SystemEnvironmentProvider.java000066400000000000000000000022451350651464300423520ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2015 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.api.client.googleapis.auth.oauth2; /** * Abstraction which allows overriding of the system environment for tests. */ class SystemEnvironmentProvider { static final SystemEnvironmentProvider INSTANCE = new SystemEnvironmentProvider(); /** * Override in test code to isolate from environment. */ String getEnv(String name) { return System.getenv(name); } /** * Override in test code to isolate from environment. */ boolean getEnvEquals(String name, String value) { return System.getenv().containsKey(name) && System.getenv(name).equals(value); } } package-info.java000066400000000000000000000057611350651464300374600ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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. */ /** * Google's additions to OAuth 2.0 authorization as specified in Using OAuth 2.0 to Access Google * APIs. * *

* Before using this library, you must register your application at the APIs Console. The result of this * registration process is a set of values that are known to both Google and your application, such * as the "Client ID", "Client Secret", and "Redirect URIs". *

* *

* These are the typical steps of the web server flow based on an authorization code, as specified * in Using OAuth 2.0 for * Web Server Applications: *

    *
  • Redirect the end user in the browser to the authorization page using * {@link com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl} to grant * your application access to the end user's protected data.
  • *
  • Process the authorization response using * {@link com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl} to parse the authorization * code.
  • *
  • Request an access token and possibly a refresh token using * {@link com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest}.
  • *
  • Access protected resources using * {@link com.google.api.client.googleapis.auth.oauth2.GoogleCredential}. Expired access tokens will * automatically be refreshed using the refresh token (if applicable).
  • *
*

* *

* These are the typical steps of the the browser-based client flow specified in Using OAuth 2.0 for * Client-side Applications: *

    *
  • Redirect the end user in the browser to the authorization page using * {@link com.google.api.client.googleapis.auth.oauth2.GoogleBrowserClientRequestUrl} to grant your * browser application access to the end user's protected data.
  • *
  • Use the Google API Client * library for JavaScript to process the access token found in the URL fragment at the redirect * URI registered at the APIs Console. *
  • *
*

* * @since 1.7 * @author Yaniv Inbar */ package com.google.api.client.googleapis.auth.oauth2; batch/000077500000000000000000000000001350651464300331765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisBatchCallback.java000066400000000000000000000037351350651464300365070ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/* * Copyright 2012 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.api.client.googleapis.batch; import com.google.api.client.http.HttpHeaders; import java.io.IOException; /** * Callback for an individual batch response. * *

* Sample use: *

* *
   batch.queue(volumesList.buildHttpRequest(), Volumes.class, GoogleJsonErrorContainer.class,
       new BatchCallback<Volumes, GoogleJsonErrorContainer>() {

     public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) {
       log("Success");
       printVolumes(volumes.getItems());
     }

     public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) {
       log(e.getError().getMessage());
     }
   });
 * 
* * @param Type of the data model class * @param Type of the error data model class * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ public interface BatchCallback { /** * Called if the individual batch response is successful. * * @param t instance of the parsed data model class * @param responseHeaders Headers of the batch response */ void onSuccess(T t, HttpHeaders responseHeaders) throws IOException; /** * Called if the individual batch response is unsuccessful. * * @param e instance of data class representing the error response content * @param responseHeaders Headers of the batch response */ void onFailure(E e, HttpHeaders responseHeaders) throws IOException; } BatchRequest.java000066400000000000000000000270621350651464300364420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/* * Copyright 2012 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.api.client.googleapis.batch; import com.google.api.client.http.BackOffPolicy; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.http.MultipartContent; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Sleeper; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * An instance of this class represents a single batch of requests. * *

* Sample use: *

* *
   // client is a AbstractGoogleClient (e.g. com.google.api.services.books.Books)
   BatchRequest batch = client.batch(httpRequestInitializer);
   batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class,
       new BatchCallback<Volumes, GoogleJsonErrorContainer>() {

     public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) {
       log("Success");
       printVolumes(volumes.getItems());
     }

     public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) {
       log(e.getError().getMessage());
     }
   });
   batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class,
       new BatchCallback<Volumes, GoogleJsonErrorContainer>() {

     public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) {
       log("Success");
       printVolumes(volumes.getItems());
     }

     public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) {
       log(e.getError().getMessage());
     }
   });
   batch.execute();
 * 
* *

* The content of each individual response is stored in memory. There is thus a potential of * encountering an {@link OutOfMemoryError} for very large responses. *

* *

* Redirects are currently not followed in {@link BatchRequest}. *

* *

* Implementation is not thread-safe. *

* *

* Note: When setting an {@link HttpUnsuccessfulResponseHandler} by calling to * {@link HttpRequest#setUnsuccessfulResponseHandler}, the handler is called for each unsuccessful * part. As a result it's not recommended to use {@link HttpBackOffUnsuccessfulResponseHandler} on a * batch request, since the back-off policy is invoked for each unsuccessful part. *

* * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ @SuppressWarnings("deprecation") public final class BatchRequest { /** * The deprecated global batch endpoint. Users should actually use the per-service batch endpoint * declared by the service configuration. */ private static final String GLOBAL_BATCH_ENDPOINT = "https://www.googleapis.com/batch"; private static final String GLOBAL_BATCH_ENDPOINT_WARNING = "You are using the global batch " + "endpoint which will soon be shut down. Please instantiate your BatchRequest via your " + "service client's `batch(HttpRequestInitializer)` method. For an example, please see " + "https://github.com/googleapis/google-api-java-client#batching."; private static final Logger LOGGER = Logger.getLogger(BatchRequest.class.getName()); /** The URL where batch requests are sent. */ private GenericUrl batchUrl = new GenericUrl(GLOBAL_BATCH_ENDPOINT); /** The request factory for connections to the server. */ private final HttpRequestFactory requestFactory; /** The list of queued request infos. */ List> requestInfos = new ArrayList>(); /** Sleeper. */ private Sleeper sleeper = Sleeper.DEFAULT; /** A container class used to hold callbacks and data classes. */ static class RequestInfo { final BatchCallback callback; final Class dataClass; final Class errorClass; final HttpRequest request; RequestInfo(BatchCallback callback, Class dataClass, Class errorClass, HttpRequest request) { this.callback = callback; this.dataClass = dataClass; this.errorClass = errorClass; this.request = request; } } /** * Construct the {@link BatchRequest}. * * @param transport The transport to use for requests * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} or * {@code null} for none * @deprecated Please use AbstractGoogleClient#batch(HttpRequestInitializer) to instantiate your * batch request. */ @Deprecated public BatchRequest(HttpTransport transport, HttpRequestInitializer httpRequestInitializer) { this.requestFactory = httpRequestInitializer == null ? transport.createRequestFactory() : transport.createRequestFactory(httpRequestInitializer); } /** * Sets the URL that will be hit when {@link #execute()} is called. The default value is * {@code https://www.googleapis.com/batch}. */ public BatchRequest setBatchUrl(GenericUrl batchUrl) { this.batchUrl = batchUrl; return this; } /** Returns the URL that will be hit when {@link #execute()} is called. */ public GenericUrl getBatchUrl() { return batchUrl; } /** * Returns the sleeper. * * @since 1.15 */ public Sleeper getSleeper() { return sleeper; } /** * Sets the sleeper. The default value is {@link Sleeper#DEFAULT}. * * @since 1.15 */ public BatchRequest setSleeper(Sleeper sleeper) { this.sleeper = Preconditions.checkNotNull(sleeper); return this; } /** * Queues the specified {@link HttpRequest} for batched execution. Batched requests are executed * when {@link #execute()} is called. * * @param destination class type * @param error class type * @param httpRequest HTTP Request * @param dataClass Data class the response will be parsed into or {@code Void.class} to ignore * the content * @param errorClass Data class the unsuccessful response will be parsed into or * {@code Void.class} to ignore the content * @param callback Batch Callback * @return this Batch request * @throws IOException If building the HTTP Request fails */ public BatchRequest queue(HttpRequest httpRequest, Class dataClass, Class errorClass, BatchCallback callback) throws IOException { Preconditions.checkNotNull(httpRequest); // TODO(rmistry): Add BatchUnparsedCallback with onResponse(InputStream content, HttpHeaders). Preconditions.checkNotNull(callback); Preconditions.checkNotNull(dataClass); Preconditions.checkNotNull(errorClass); requestInfos.add(new RequestInfo(callback, dataClass, errorClass, httpRequest)); return this; } /** * Returns the number of queued requests in this batch request. */ public int size() { return requestInfos.size(); } /** * Executes all queued HTTP requests in a single call, parses the responses and invokes callbacks. * *

* Calling {@link #execute()} executes and clears the queued requests. This means that the * {@link BatchRequest} object can be reused to {@link #queue} and {@link #execute()} requests * again. *

*/ public void execute() throws IOException { boolean retryAllowed; Preconditions.checkState(!requestInfos.isEmpty()); // Log a warning if the user is using the global batch endpoint. In the future, we can turn this // into a preconditions check. if (GLOBAL_BATCH_ENDPOINT.equals(this.batchUrl.toString())) { LOGGER.log(Level.WARNING, GLOBAL_BATCH_ENDPOINT_WARNING); } HttpRequest batchRequest = requestFactory.buildPostRequest(this.batchUrl, null); // NOTE: batch does not support gzip encoding HttpExecuteInterceptor originalInterceptor = batchRequest.getInterceptor(); batchRequest.setInterceptor(new BatchInterceptor(originalInterceptor)); int retriesRemaining = batchRequest.getNumberOfRetries(); BackOffPolicy backOffPolicy = batchRequest.getBackOffPolicy(); if (backOffPolicy != null) { // Reset the BackOffPolicy at the start of each execute. backOffPolicy.reset(); } do { retryAllowed = retriesRemaining > 0; MultipartContent batchContent = new MultipartContent(); batchContent.getMediaType().setSubType("mixed"); int contentId = 1; for (RequestInfo requestInfo : requestInfos) { batchContent.addPart(new MultipartContent.Part( new HttpHeaders().setAcceptEncoding(null).set("Content-ID", contentId++), new HttpRequestContent(requestInfo.request))); } batchRequest.setContent(batchContent); HttpResponse response = batchRequest.execute(); BatchUnparsedResponse batchResponse; try { // Find the boundary from the Content-Type header. String boundary = "--" + response.getMediaType().getParameter("boundary"); // Parse the content stream. InputStream contentStream = response.getContent(); batchResponse = new BatchUnparsedResponse(contentStream, boundary, requestInfos, retryAllowed); while (batchResponse.hasNext) { batchResponse.parseNextResponse(); } } finally { response.disconnect(); } List> unsuccessfulRequestInfos = batchResponse.unsuccessfulRequestInfos; if (!unsuccessfulRequestInfos.isEmpty()) { requestInfos = unsuccessfulRequestInfos; // backOff if required. if (batchResponse.backOffRequired && backOffPolicy != null) { long backOffTime = backOffPolicy.getNextBackOffMillis(); if (backOffTime != BackOffPolicy.STOP) { try { sleeper.sleep(backOffTime); } catch (InterruptedException exception) { // ignore } } } } else { break; } retriesRemaining--; } while (retryAllowed); requestInfos.clear(); } /** * Batch HTTP request execute interceptor that loops through all individual HTTP requests and runs * their interceptors. */ class BatchInterceptor implements HttpExecuteInterceptor { private HttpExecuteInterceptor originalInterceptor; BatchInterceptor(HttpExecuteInterceptor originalInterceptor) { this.originalInterceptor = originalInterceptor; } public void intercept(HttpRequest batchRequest) throws IOException { if (originalInterceptor != null) { originalInterceptor.intercept(batchRequest); } for (RequestInfo requestInfo : requestInfos) { HttpExecuteInterceptor interceptor = requestInfo.request.getInterceptor(); if (interceptor != null) { interceptor.intercept(requestInfo.request); } } } } } BatchUnparsedResponse.java000066400000000000000000000332251350651464300403100ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/* * Copyright 2012 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.api.client.googleapis.batch; import com.google.api.client.googleapis.batch.BatchRequest.RequestInfo; import com.google.api.client.http.BackOffPolicy; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.util.ByteStreams; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; /** * The unparsed batch response. * * @author rmistry@google.com (Ravi Mistry) */ @SuppressWarnings("deprecation") final class BatchUnparsedResponse { /** The boundary used in the batch response to separate individual responses. */ private final String boundary; /** List of request infos. */ private final List> requestInfos; /** Input stream that contains the batch response. */ private final InputStream inputStream; /** Determines whether there are any responses to be parsed. */ boolean hasNext = true; /** List of unsuccessful HTTP requests that can be retried. */ List> unsuccessfulRequestInfos = new ArrayList>(); /** Indicates if back off is required before the next retry. */ boolean backOffRequired; /** The content Id the response is currently at. */ private int contentId = 0; /** Whether unsuccessful HTTP requests can be retried. */ private final boolean retryAllowed; /** * Construct the {@link BatchUnparsedResponse}. * * @param inputStream Input stream that contains the batch response * @param boundary The boundary of the batch response * @param requestInfos List of request infos * @param retryAllowed Whether unsuccessful HTTP requests can be retried */ BatchUnparsedResponse(InputStream inputStream, String boundary, List> requestInfos, boolean retryAllowed) throws IOException { this.boundary = boundary; this.requestInfos = requestInfos; this.retryAllowed = retryAllowed; this.inputStream = inputStream; // First line in the stream will be the boundary. checkForFinalBoundary(readLine()); } /** * Parses the next response in the queue if a data class and a {@link BatchCallback} is specified. * *

* This method closes the input stream if there are no more individual responses left. *

*/ void parseNextResponse() throws IOException { contentId++; // Extract the outer headers. String line; while ((line = readLine()) != null && !line.equals("")) { // Do nothing. } // Extract the status code. String statusLine = readLine(); String[] statusParts = statusLine.split(" "); int statusCode = Integer.parseInt(statusParts[1]); // Extract and store the inner headers. // TODO(rmistry): Handle inner headers that span multiple lines. More details here: // http://tools.ietf.org/html/rfc2616#section-2.2 List headerNames = new ArrayList(); List headerValues = new ArrayList(); long contentLength = -1L; while ((line = readLine()) != null && !line.equals("")) { String[] headerParts = line.split(": ", 2); String headerName = headerParts[0]; String headerValue = headerParts[1]; headerNames.add(headerName); headerValues.add(headerValue); if ("Content-Length".equalsIgnoreCase(headerName.trim())) { contentLength = Long.parseLong(headerValue); } } InputStream body; if (contentLength == -1) { // This isn't very efficient, but most respectable servers should set the Content-Length ByteArrayOutputStream buffer = new ByteArrayOutputStream(); while ((line = readRawLine()) != null && !line.startsWith(boundary)) { // Convert characters back to bytes: buffer.write(line.getBytes("ISO-8859-1")); } // Remove CRLF that separates body from boundary token body = trimCrlf(buffer.toByteArray()); // Remove CRLF from the boundary token (to match readLine) line = trimCrlf(line); } else { body = new FilterInputStream(ByteStreams.limit(inputStream, contentLength)) { @Override public void close() { // Don't allow the parser to close the underlying stream } }; } HttpResponse response = getFakeResponse(statusCode, body, headerNames, headerValues); parseAndCallback(requestInfos.get(contentId - 1), statusCode, response); // Consume any bytes that were not consumed by the parser while (body.skip(contentLength) > 0 || body.read() != -1) { } if (contentLength != -1) { line = readLine(); } else { // The line was already read } // Consume any blank lines that follow the response (not included in Content-Length) while ((line != null) && (line.length() == 0)) { line = readLine(); } checkForFinalBoundary(line); } /** * Parse an object into a new instance of the data class using * {@link HttpResponse#parseAs(java.lang.reflect.Type)}. */ private void parseAndCallback( RequestInfo requestInfo, int statusCode, HttpResponse response) throws IOException { BatchCallback callback = requestInfo.callback; HttpHeaders responseHeaders = response.getHeaders(); HttpUnsuccessfulResponseHandler unsuccessfulResponseHandler = requestInfo.request.getUnsuccessfulResponseHandler(); BackOffPolicy backOffPolicy = requestInfo.request.getBackOffPolicy(); // Reset backOff flag. backOffRequired = false; if (HttpStatusCodes.isSuccess(statusCode)) { if (callback == null) { // No point in parsing if there is no callback. return; } T parsed = getParsedDataClass(requestInfo.dataClass, response, requestInfo); callback.onSuccess(parsed, responseHeaders); } else { HttpContent content = requestInfo.request.getContent(); boolean retrySupported = retryAllowed && (content == null || content.retrySupported()); boolean errorHandled = false; boolean redirectRequest = false; if (unsuccessfulResponseHandler != null) { errorHandled = unsuccessfulResponseHandler.handleResponse( requestInfo.request, response, retrySupported); } if (!errorHandled) { if (requestInfo.request.handleRedirect(response.getStatusCode(), response.getHeaders())) { redirectRequest = true; } else if (retrySupported && backOffPolicy != null && backOffPolicy.isBackOffRequired(response.getStatusCode())) { backOffRequired = true; } } if (retrySupported && (errorHandled || backOffRequired || redirectRequest)) { unsuccessfulRequestInfos.add(requestInfo); } else { if (callback == null) { // No point in parsing if there is no callback. return; } E parsed = getParsedDataClass(requestInfo.errorClass, response, requestInfo); callback.onFailure(parsed, responseHeaders); } } } private A getParsedDataClass( Class dataClass, HttpResponse response, RequestInfo requestInfo) throws IOException { // TODO(yanivi): Remove the HttpResponse reference and directly parse the InputStream if (dataClass == Void.class) { return null; } return requestInfo.request.getParser().parseAndClose( response.getContent(), response.getContentCharset(), dataClass); } /** Create a fake HTTP response object populated with the partContent and the statusCode. */ private HttpResponse getFakeResponse(final int statusCode, final InputStream partContent, List headerNames, List headerValues) throws IOException { HttpRequest request = new FakeResponseHttpTransport( statusCode, partContent, headerNames, headerValues).createRequestFactory() .buildPostRequest(new GenericUrl("http://google.com/"), null); request.setLoggingEnabled(false); request.setThrowExceptionOnExecuteError(false); return request.execute(); } /** * Reads an HTTP response line (ISO-8859-1 encoding). * * @return The line that was read, including CRLF. */ private String readRawLine() throws IOException { int b = inputStream.read(); if (b == -1) { return null; } else { StringBuilder buffer = new StringBuilder(); for (; b != -1; b = inputStream.read()) { buffer.append((char) b); if (b == '\n') { break; } } return buffer.toString(); } } /** * Reads an HTTP response line (ISO-8859-1 encoding) *

* This method is similar to {@link java.io.BufferedReader#readLine()}, but handles newlines in a * way that is consistent with the HTTP RFC 2616. * * @return The line that was read, excluding CRLF. */ private String readLine() throws IOException { return trimCrlf(readRawLine()); } private static String trimCrlf(String input) { if (input.endsWith("\r\n")) { return input.substring(0, input.length() - 2); } else if (input.endsWith("\n")) { return input.substring(0, input.length() - 1); } else { return input; } } private static InputStream trimCrlf(byte[] bytes) { int length = bytes.length; if (length > 0 && bytes[length - 1] == '\n') { length--; } if (length > 0 && bytes[length - 1] == '\r') { length--; } return new ByteArrayInputStream(bytes, 0, length); } /** * If the boundary line consists of the boundary and "--" then there are no more individual * responses left to be parsed and the input stream is closed. */ private void checkForFinalBoundary(String boundaryLine) throws IOException { if (boundaryLine.equals(boundary + "--")) { hasNext = false; inputStream.close(); } } private static class FakeResponseHttpTransport extends HttpTransport { private int statusCode; private InputStream partContent; private List headerNames; private List headerValues; FakeResponseHttpTransport(int statusCode, InputStream partContent, List headerNames, List headerValues) { super(); this.statusCode = statusCode; this.partContent = partContent; this.headerNames = headerNames; this.headerValues = headerValues; } @Override protected LowLevelHttpRequest buildRequest(String method, String url) { return new FakeLowLevelHttpRequest(partContent, statusCode, headerNames, headerValues); } } private static class FakeLowLevelHttpRequest extends LowLevelHttpRequest { private InputStream partContent; private int statusCode; private List headerNames; private List headerValues; FakeLowLevelHttpRequest(InputStream partContent, int statusCode, List headerNames, List headerValues) { this.partContent = partContent; this.statusCode = statusCode; this.headerNames = headerNames; this.headerValues = headerValues; } @Override public void addHeader(String name, String value) { } @Override public LowLevelHttpResponse execute() { FakeLowLevelHttpResponse response = new FakeLowLevelHttpResponse( partContent, statusCode, headerNames, headerValues); return response; } } private static class FakeLowLevelHttpResponse extends LowLevelHttpResponse { private InputStream partContent; private int statusCode; private List headerNames = new ArrayList(); private List headerValues = new ArrayList(); FakeLowLevelHttpResponse(InputStream partContent, int statusCode, List headerNames, List headerValues) { this.partContent = partContent; this.statusCode = statusCode; this.headerNames = headerNames; this.headerValues = headerValues; } @Override public InputStream getContent() { return partContent; } @Override public int getStatusCode() { return statusCode; } @Override public String getContentEncoding() { return null; } @Override public long getContentLength() { return 0; } @Override public String getContentType() { return null; } @Override public String getStatusLine() { return null; } @Override public String getReasonPhrase() { return null; } @Override public int getHeaderCount() { return headerNames.size(); } @Override public String getHeaderName(int index) { return headerNames.get(index); } @Override public String getHeaderValue(int index) { return headerValues.get(index); } } } HttpRequestContent.java000066400000000000000000000051031350651464300376630ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/* * Copyright 2013 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.api.client.googleapis.batch; import com.google.api.client.http.AbstractHttpContent; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; /** * HTTP request wrapped as a content part of a multipart/mixed request. * * @author Yaniv Inbar */ class HttpRequestContent extends AbstractHttpContent { static final String NEWLINE = "\r\n"; /** HTTP request. */ private final HttpRequest request; private static final String HTTP_VERSION = "HTTP/1.1"; HttpRequestContent(HttpRequest request) { super("application/http"); this.request = request; } @Override public void writeTo(OutputStream out) throws IOException { Writer writer = new OutputStreamWriter(out, getCharset()); // write method and URL writer.write(request.getRequestMethod()); writer.write(" "); writer.write(request.getUrl().build()); writer.write(" "); writer.write(HTTP_VERSION); writer.write(NEWLINE); // write headers HttpHeaders headers = new HttpHeaders(); headers.fromHttpHeaders(request.getHeaders()); headers.setAcceptEncoding(null).setUserAgent(null) .setContentEncoding(null).setContentType(null).setContentLength(null); // analyze the content HttpContent content = request.getContent(); if (content != null) { headers.setContentType(content.getType()); // NOTE: batch does not support gzip encoding long contentLength = content.getLength(); if (contentLength != -1) { headers.setContentLength(contentLength); } } HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer); // HTTP headers are always terminated with an empty line; RFC 7230 §3 writer.write(NEWLINE); writer.flush(); // write content if (content != null) { content.writeTo(out); } } } json/000077500000000000000000000000001350651464300341475ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batchJsonBatchCallback.java000066400000000000000000000040621350651464300403040ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/* * Copyright 2012 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.api.client.googleapis.batch.json; import com.google.api.client.googleapis.batch.BatchCallback; import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonErrorContainer; import com.google.api.client.http.HttpHeaders; import java.io.IOException; /** * Callback for an individual batch JSON response. * *

* Sample use: *

* *
   batch.queue(volumesList.buildHttpRequest(), Volumes.class, GoogleJsonErrorContainer.class,
       new JsonBatchCallback<Volumes>() {

     public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) {
       log("Success");
       printVolumes(volumes.getItems());
     }

     public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
       log(e.getMessage());
     }
   });
 * 
* * @param Type of the data model class * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ public abstract class JsonBatchCallback implements BatchCallback { public final void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) throws IOException { onFailure(e.getError(), responseHeaders); } /** * Called if the individual batch response is unsuccessful. * * @param e Google JSON error response content * @param responseHeaders Headers of the batch response */ public abstract void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) throws IOException; } package-info.java000066400000000000000000000013211350651464300373330ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/* * Copyright 2012 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. */ /** * JSON batch for Google API's. * * @since 1.9 * @author Ravi Mistry */ package com.google.api.client.googleapis.batch.json; package-info.java000066400000000000000000000013071350651464300363660ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/batch/* * Copyright 2012 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. */ /** * Batch for Google API's. * * @since 1.9 * @author Ravi Mistry */ package com.google.api.client.googleapis.batch; compute/000077500000000000000000000000001350651464300335715ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisComputeCredential.java000066400000000000000000000123631350651464300400500ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/compute/* * Copyright 2013 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.api.client.googleapis.compute; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.auth.oauth2.CredentialRefreshListener; import com.google.api.client.auth.oauth2.TokenResponse; import com.google.api.client.googleapis.auth.oauth2.OAuth2Utils; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.util.Collection; /** * {@link Beta}
* Google Compute Engine service accounts OAuth 2.0 credential based on
Authenticating from Google * Compute Engine. * *

* Sample usage: *

* *
  public static HttpRequestFactory createRequestFactory(
      HttpTransport transport, JsonFactory jsonFactory) {
    return transport.createRequestFactory(new GoogleComputeCredential(transport, jsonFactory));
  }
 * 
* *

* Implementation is immutable and thread-safe. *

* * @since 1.15 * @author Yaniv Inbar */ @Beta public class ComputeCredential extends Credential { /** Metadata Service Account token server encoded URL. */ public static final String TOKEN_SERVER_ENCODED_URL = OAuth2Utils.getMetadataServerUrl() + "/computeMetadata/v1/instance/service-accounts/default/token"; /** * @param transport HTTP transport * @param jsonFactory JSON factory */ public ComputeCredential(HttpTransport transport, JsonFactory jsonFactory) { this(new Builder(transport, jsonFactory)); } /** * @param builder builder */ protected ComputeCredential(Builder builder) { super(builder); } @Override protected TokenResponse executeRefreshToken() throws IOException { GenericUrl tokenUrl = new GenericUrl(getTokenServerEncodedUrl()); HttpRequest request = getTransport().createRequestFactory().buildGetRequest(tokenUrl); request.setParser(new JsonObjectParser(getJsonFactory())); request.getHeaders().set("Metadata-Flavor", "Google"); return request.execute().parseAs(TokenResponse.class); } /** * {@link Beta}
* Google Compute Engine credential builder. * *

* Implementation is not thread-safe. *

*/ @Beta public static class Builder extends Credential.Builder { /** * @param transport HTTP transport * @param jsonFactory JSON factory */ public Builder(HttpTransport transport, JsonFactory jsonFactory) { super(BearerToken.authorizationHeaderAccessMethod()); setTransport(transport); setJsonFactory(jsonFactory); setTokenServerEncodedUrl(TOKEN_SERVER_ENCODED_URL); } @Override public ComputeCredential build() { return new ComputeCredential(this); } @Override public Builder setTransport(HttpTransport transport) { return (Builder) super.setTransport(Preconditions.checkNotNull(transport)); } @Override public Builder setClock(Clock clock) { return (Builder) super.setClock(clock); } @Override public Builder setJsonFactory(JsonFactory jsonFactory) { return (Builder) super.setJsonFactory(Preconditions.checkNotNull(jsonFactory)); } @Override public Builder setTokenServerUrl(GenericUrl tokenServerUrl) { return (Builder) super.setTokenServerUrl(Preconditions.checkNotNull(tokenServerUrl)); } @Override public Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl) { return (Builder) super.setTokenServerEncodedUrl( Preconditions.checkNotNull(tokenServerEncodedUrl)); } @Override public Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication) { Preconditions.checkArgument(clientAuthentication == null); return this; } @Override public Builder setRequestInitializer(HttpRequestInitializer requestInitializer) { return (Builder) super.setRequestInitializer(requestInitializer); } @Override public Builder addRefreshListener(CredentialRefreshListener refreshListener) { return (Builder) super.addRefreshListener(refreshListener); } @Override public Builder setRefreshListeners(Collection refreshListeners) { return (Builder) super.setRefreshListeners(refreshListeners); } } } package-info.java000066400000000000000000000015331350651464300367620ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/compute/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Support for Google Compute Engine. * * @since 1.15 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.compute; javanet/000077500000000000000000000000001350651464300335455ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisGoogleNetHttpTransport.java000066400000000000000000000042331350651464300410520ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/* * Copyright 2013 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.api.client.googleapis.javanet; import com.google.api.client.googleapis.GoogleUtils; import com.google.api.client.http.javanet.NetHttpTransport; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.KeyStore; /** * Utilities for Google APIs based on {@link NetHttpTransport}. * * @since 1.14 * @author Yaniv Inbar */ public class GoogleNetHttpTransport { /** * Returns a new instance of {@link NetHttpTransport} that uses * {@link GoogleUtils#getCertificateTrustStore()} for the trusted certificates using * {@link com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore)} * . * *

* This helper method doesn't provide for customization of the {@link NetHttpTransport}, such as * the ability to specify a proxy. To do use, use * {@link com.google.api.client.http.javanet.NetHttpTransport.Builder}, for example: *

* *
  static HttpTransport newProxyTransport() throws GeneralSecurityException, IOException {
    NetHttpTransport.Builder builder = new NetHttpTransport.Builder();
    builder.trustCertificates(GoogleUtils.getCertificateTrustStore());
    builder.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 3128)));
    return builder.build();
  }
   * 
*/ public static NetHttpTransport newTrustedTransport() throws GeneralSecurityException, IOException { return new NetHttpTransport.Builder().trustCertificates(GoogleUtils.getCertificateTrustStore()) .build(); } private GoogleNetHttpTransport() { } } package-info.java000066400000000000000000000013561350651464300367410ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/* * Copyright 2013 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. */ /** * Google API's support based on the {@code java.net} package. * * @since 1.14 * @author Yaniv Inbar */ package com.google.api.client.googleapis.javanet; google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/json/000077500000000000000000000000001350651464300331455ustar00rootroot00000000000000GoogleJsonError.java000066400000000000000000000154231350651464300370160ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/json/* * Copyright 2011 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.api.client.googleapis.json; import com.google.api.client.http.HttpResponse; import com.google.api.client.json.GenericJson; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.util.Data; import com.google.api.client.util.Key; import java.io.IOException; import java.util.Collections; import java.util.List; /** * Data class representing the Google JSON error response content, as documented for example in Error * responses. * * @since 1.4 * @author Yaniv Inbar */ public class GoogleJsonError extends GenericJson { /** * Parses the given error HTTP response using the given JSON factory. * * @param jsonFactory JSON factory * @param response HTTP response * @return new instance of the Google JSON error information * @throws IllegalArgumentException if content type is not {@link Json#MEDIA_TYPE} or if expected * {@code "data"} or {@code "error"} key is not found */ public static GoogleJsonError parse(JsonFactory jsonFactory, HttpResponse response) throws IOException { JsonObjectParser jsonObjectParser = new JsonObjectParser.Builder(jsonFactory).setWrapperKeys( Collections.singleton("error")).build(); return jsonObjectParser.parseAndClose( response.getContent(), response.getContentCharset(), GoogleJsonError.class); } static { // hack to force ProGuard to consider ErrorInfo used, since otherwise it would be stripped out // see http://code.google.com/p/google-api-java-client/issues/detail?id=527 Data.nullOf(ErrorInfo.class); } /** Detailed error information. */ public static class ErrorInfo extends GenericJson { /** Error classification or {@code null} for none. */ @Key private String domain; /** Error reason or {@code null} for none. */ @Key private String reason; /** Human readable explanation of the error or {@code null} for none. */ @Key private String message; /** * Location in the request that caused the error or {@code null} for none or {@code null} for * none. */ @Key private String location; /** Type of location in the request that caused the error or {@code null} for none. */ @Key private String locationType; /** * Returns the error classification or {@code null} for none. * * @since 1.8 */ public final String getDomain() { return domain; } /** * Sets the error classification or {@code null} for none. * * @since 1.8 */ public final void setDomain(String domain) { this.domain = domain; } /** * Returns the error reason or {@code null} for none. * * @since 1.8 */ public final String getReason() { return reason; } /** * Sets the error reason or {@code null} for none. * * @since 1.8 */ public final void setReason(String reason) { this.reason = reason; } /** * Returns the human readable explanation of the error or {@code null} for none. * * @since 1.8 */ public final String getMessage() { return message; } /** * Sets the human readable explanation of the error or {@code null} for none. * * @since 1.8 */ public final void setMessage(String message) { this.message = message; } /** * Returns the location in the request that caused the error or {@code null} for none or * {@code null} for none. * * @since 1.8 */ public final String getLocation() { return location; } /** * Sets the location in the request that caused the error or {@code null} for none or * {@code null} for none. * * @since 1.8 */ public final void setLocation(String location) { this.location = location; } /** * Returns the type of location in the request that caused the error or {@code null} for none. * * @since 1.8 */ public final String getLocationType() { return locationType; } /** * Sets the type of location in the request that caused the error or {@code null} for none. * * @since 1.8 */ public final void setLocationType(String locationType) { this.locationType = locationType; } @Override public ErrorInfo set(String fieldName, Object value) { return (ErrorInfo) super.set(fieldName, value); } @Override public ErrorInfo clone() { return (ErrorInfo) super.clone(); } } /** List of detailed errors or {@code null} for none. */ @Key private List errors; /** HTTP status code of this response or {@code null} for none. */ @Key private int code; /** Human-readable explanation of the error or {@code null} for none. */ @Key private String message; /** * Returns the list of detailed errors or {@code null} for none. * * @since 1.8 */ public final List getErrors() { return errors; } /** * Sets the list of detailed errors or {@code null} for none. * * @since 1.8 */ public final void setErrors(List errors) { this.errors = errors; } /** * Returns the HTTP status code of this response or {@code null} for none. * * @since 1.8 */ public final int getCode() { return code; } /** * Sets the HTTP status code of this response or {@code null} for none. * * @since 1.8 */ public final void setCode(int code) { this.code = code; } /** * Returns the human-readable explanation of the error or {@code null} for none. * * @since 1.8 */ public final String getMessage() { return message; } /** * Sets the human-readable explanation of the error or {@code null} for none. * * @since 1.8 */ public final void setMessage(String message) { this.message = message; } @Override public GoogleJsonError set(String fieldName, Object value) { return (GoogleJsonError) super.set(fieldName, value); } @Override public GoogleJsonError clone() { return (GoogleJsonError) super.clone(); } } GoogleJsonErrorContainer.java000066400000000000000000000026751350651464300406660ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/json/* * Copyright 2012 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.api.client.googleapis.json; import com.google.api.client.json.GenericJson; import com.google.api.client.util.Key; /** * Data class representing a container of {@link GoogleJsonError}. * * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ public class GoogleJsonErrorContainer extends GenericJson { @Key private GoogleJsonError error; /** Returns the {@link GoogleJsonError}. */ public final GoogleJsonError getError() { return error; } /** Sets the {@link GoogleJsonError}. */ public final void setError(GoogleJsonError error) { this.error = error; } @Override public GoogleJsonErrorContainer set(String fieldName, Object value) { return (GoogleJsonErrorContainer) super.set(fieldName, value); } @Override public GoogleJsonErrorContainer clone() { return (GoogleJsonErrorContainer) super.clone(); } } GoogleJsonResponseException.java000066400000000000000000000165351350651464300414070ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/json/* * Copyright 2011 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.api.client.googleapis.json; import com.google.api.client.http.HttpMediaType; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpResponseException; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonParser; import com.google.api.client.json.JsonToken; import com.google.api.client.util.Preconditions; import com.google.api.client.util.StringUtils; import java.io.IOException; /** * Exception thrown when an error status code is detected in an HTTP response to a Google API that * uses the JSON format, using the format specified in Error * Responses. * *

* To execute a request, call {@link #execute(JsonFactory, HttpRequest)}. This will throw a * {@link GoogleJsonResponseException} on an error response. To get the structured details, use * {@link #getDetails()}. *

* *
  static void executeShowingError(JsonFactory factory, HttpRequest request) throws IOException {
    try {
      GoogleJsonResponseException.execute(factory, request);
    } catch (GoogleJsonResponseException e) {
      System.err.println(e.getDetails());
    }
  }
 * 
* * @since 1.6 * @author Yaniv Inbar */ public class GoogleJsonResponseException extends HttpResponseException { private static final long serialVersionUID = 409811126989994864L; /** Google JSON error details or {@code null} for none (for example if response is not JSON). */ private final transient GoogleJsonError details; /** * @param builder builder * @param details Google JSON error details * @since 1.21.0 */ public GoogleJsonResponseException(Builder builder, GoogleJsonError details) { super(builder); this.details = details; } /** * Returns the Google JSON error details or {@code null} for none (for example if response is not * JSON). */ public final GoogleJsonError getDetails() { return details; } /** * Returns a new instance of {@link GoogleJsonResponseException}. * *

* If there is a JSON error response, it is parsed using {@link GoogleJsonError}, which can be * inspected using {@link #getDetails()}. Otherwise, the full response content is read and * included in the exception message. *

* * @param jsonFactory JSON factory * @param response HTTP response * @return new instance of {@link GoogleJsonResponseException} */ public static GoogleJsonResponseException from(JsonFactory jsonFactory, HttpResponse response) { HttpResponseException.Builder builder = new HttpResponseException.Builder( response.getStatusCode(), response.getStatusMessage(), response.getHeaders()); // details Preconditions.checkNotNull(jsonFactory); GoogleJsonError details = null; String detailString = null; try { if (!response.isSuccessStatusCode() && HttpMediaType.equalsIgnoreParameters(Json.MEDIA_TYPE, response.getContentType()) && response.getContent() != null) { JsonParser parser = null; try { parser = jsonFactory.createJsonParser(response.getContent()); JsonToken currentToken = parser.getCurrentToken(); // token is null at start, so get next token if (currentToken == null) { currentToken = parser.nextToken(); } // check for empty content if (currentToken != null) { // make sure there is an "error" key parser.skipToKey("error"); // in some cases (i.e. oauth), "error" can be a string, in most cases it's a // GoogleJsonError object if (parser.getCurrentToken() == JsonToken.VALUE_STRING) { detailString = parser.getText(); } else if (parser.getCurrentToken() == JsonToken.START_OBJECT) { details = parser.parseAndClose(GoogleJsonError.class); detailString = details.toPrettyString(); } } } catch (IOException exception) { // it would be bad to throw an exception while throwing an exception exception.printStackTrace(); } finally { if (parser == null) { response.ignore(); } else if (details == null) { parser.close(); } } } else { detailString = response.parseAsString(); } } catch (IOException exception) { // it would be bad to throw an exception while throwing an exception exception.printStackTrace(); } // message StringBuilder message = HttpResponseException.computeMessageBuffer(response); if (!com.google.api.client.util.Strings.isNullOrEmpty(detailString)) { message.append(StringUtils.LINE_SEPARATOR).append(detailString); builder.setContent(detailString); } builder.setMessage(message.toString()); // result return new GoogleJsonResponseException(builder, details); } /** * Executes an HTTP request using {@link HttpRequest#execute()}, but throws a * {@link GoogleJsonResponseException} on error instead of {@link HttpResponseException}. * *

* Callers should call {@link HttpResponse#disconnect} when the returned HTTP response object is * no longer needed. However, {@link HttpResponse#disconnect} does not have to be called if the * response stream is properly closed. Example usage: *

* *
     HttpResponse response = GoogleJsonResponseException.execute(jsonFactory, request);
     try {
       // process the HTTP response object
     } finally {
       response.disconnect();
     }
   * 
* * @param jsonFactory JSON factory * @param request HTTP request * @return HTTP response for an HTTP success code (or error code if * {@link HttpRequest#getThrowExceptionOnExecuteError()}) * @throws GoogleJsonResponseException for an HTTP error code (only if not * {@link HttpRequest#getThrowExceptionOnExecuteError()}) * @throws IOException some other kind of I/O exception * @since 1.7 */ public static HttpResponse execute(JsonFactory jsonFactory, HttpRequest request) throws GoogleJsonResponseException, IOException { Preconditions.checkNotNull(jsonFactory); boolean originalThrowExceptionOnExecuteError = request.getThrowExceptionOnExecuteError(); if (originalThrowExceptionOnExecuteError) { request.setThrowExceptionOnExecuteError(false); } HttpResponse response = request.execute(); request.setThrowExceptionOnExecuteError(originalThrowExceptionOnExecuteError); if (!originalThrowExceptionOnExecuteError || response.isSuccessStatusCode()) { return response; } throw GoogleJsonResponseException.from(jsonFactory, response); } } package-info.java000066400000000000000000000135211350651464300362570ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/json/* * Copyright 2010 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. */ /** * Google's JSON support (see detailed package specification). * *

Package Specification

* *

* User-defined Partial JSON data models allow you to defined Plain Old Java Objects (POJO's) to * define how the library should parse/serialize JSON. Each field that should be included must have * an @{@link com.google.api.client.util.Key} annotation. The field can be of any visibility * (private, package private, protected, or public) and must not be static. By default, the field * name is used as the JSON key. To override this behavior, simply specify the JSON key use the * optional value parameter of the annotation, for example {@code @Key("name")}. Any unrecognized * keys from the JSON are normally simply ignored and not stored. If the ability to store unknown * keys is important, use {@link com.google.api.client.json.GenericJson}. *

* *

* Let's take a look at a typical partial JSON-C video feed from the YouTube Data API (as specified * in YouTube * Developer's Guide: JSON-C / JavaScript) *

* *

 "data":{
    "updated":"2010-01-07T19:58:42.949Z",
    "totalItems":800,
    "startIndex":1,
    "itemsPerPage":1,
    "items":[
        {"id":"hYB0mn5zh2c",
         "updated":"2010-01-07T13:26:50.000Z",
         "title":"Google Developers Day US - Maps API Introduction",
         "description":"Google Maps API Introduction ...",
         "tags":[
            "GDD07","GDD07US","Maps"
         ],
         "player":{
            "default":"http://www.youtube.com/watch?v\u003dhYB0mn5zh2c"
         },
...
        }
    ]
 }
* *

* Here's one possible way to design the Java data classes for this (each class in its own Java * file): *

* *

import com.google.api.client.util.*;
import java.util.List;

  public class VideoFeed {
    @Key public int itemsPerPage;
    @Key public int startIndex;
    @Key public int totalItems;
    @Key public DateTime updated;
    @Key public List<Video> items;
  }

  public class Video {
    @Key public String id;
    @Key public String title;
    @Key public DateTime updated;
    @Key public String description;
    @Key public List<String> tags;
    @Key public Player player;
  }

  public class Player {
    // "default" is a Java keyword, so need to specify the JSON key manually
    @Key("default")
    public String defaultUrl;
  }
* *

* You can also use the @{@link com.google.api.client.util.Key} annotation to defined query * parameters for a URL. For example: *

* *

public class YouTubeUrl extends GoogleUrl {

  @Key
  public String author;

  @Key("max-results")
  public Integer maxResults;

  public YouTubeUrl(String encodedUrl) {
    super(encodedUrl);
    this.alt = "jsonc";
  }
* *

* To work with the YouTube API, you first need to set up the * {@link com.google.api.client.http.HttpTransport}. For example: *

* *

  private static HttpTransport setUpTransport() throws IOException {
    HttpTransport result = new NetHttpTransport();
    GoogleUtils.useMethodOverride(result);
    HttpHeaders headers = new HttpHeaders();
    headers.setApplicationName("Google-YouTubeSample/1.0");
    headers.gdataVersion = "2";
    JsonCParser parser = new JsonCParser();
    parser.jsonFactory = new JacksonFactory();
    transport.addParser(parser);
    // insert authentication code...
    return transport;
  }
* *

* Now that we have a transport, we can execute a request to the YouTube API and parse the result: *

* *

  public static VideoFeed list(HttpTransport transport, YouTubeUrl url)
      throws IOException {
    HttpRequest request = transport.buildGetRequest();
    request.url = url;
    return request.execute().parseAs(VideoFeed.class);
  }
* *

* If the server responds with an error the {@link com.google.api.client.http.HttpRequest#execute} * method will throw an {@link com.google.api.client.http.HttpResponseException}, which has an * {@link com.google.api.client.http.HttpResponse} field which can be parsed the same way as a * success response inside of a catch block. For example: *

* *

    try {
...
    } catch (HttpResponseException e) {
      if (e.response.getParser() != null) {
        Error error = e.response.parseAs(Error.class);
        // process error response
      } else {
        String errorContentString = e.response.parseAsString();
        // process error response as string
      }
      throw e;
    }
* *

* NOTE: As you might guess, the library uses reflection to populate the user-defined data model. * It's not quite as fast as writing the wire format parsing code yourself can potentially be, but * it's a lot easier. *

* *

* NOTE: If you prefer to use your favorite JSON parsing library instead (there are many of them * listed for example on json.org), that's supported as well. Just * call {@link com.google.api.client.http.HttpRequest#execute()} and parse the returned byte stream. *

* * @since 1.0 * @author Yaniv Inbar */ package com.google.api.client.googleapis.json; media/000077500000000000000000000000001350651464300331745ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisMediaHttpDownloader.java000066400000000000000000000367411350651464300377500ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2012 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.api.client.googleapis.media; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpBackOffIOExceptionHandler; import com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.util.IOUtils; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.io.OutputStream; /** * Media HTTP Downloader, with support for both direct and resumable media downloads. Documentation * is available here. * *

* Implementation is not thread-safe. *

* *

* Back-off is disabled by default. To enable it for an abnormal HTTP response and an I/O exception * you should call {@link HttpRequest#setUnsuccessfulResponseHandler} with a new * {@link HttpBackOffUnsuccessfulResponseHandler} instance and * {@link HttpRequest#setIOExceptionHandler} with {@link HttpBackOffIOExceptionHandler}. *

* *

* Upgrade warning: in prior version 1.14 exponential back-off was enabled by default for an * abnormal HTTP response. Starting with version 1.15 it's disabled by default. *

* * @since 1.9 * * @author rmistry@google.com (Ravi Mistry) */ @SuppressWarnings("deprecation") public final class MediaHttpDownloader { /** * Download state associated with the Media HTTP downloader. */ public enum DownloadState { /** The download process has not started yet. */ NOT_STARTED, /** Set after a media file chunk is downloaded. */ MEDIA_IN_PROGRESS, /** Set after the complete media file is successfully downloaded. */ MEDIA_COMPLETE } /** * Default maximum number of bytes that will be downloaded from the server in any single HTTP * request. Set to 32MB because that is the maximum App Engine request size. */ public static final int MAXIMUM_CHUNK_SIZE = 32 * MediaHttpUploader.MB; /** The request factory for connections to the server. */ private final HttpRequestFactory requestFactory; /** The transport to use for requests. */ private final HttpTransport transport; /** * Determines whether direct media download is enabled or disabled. If value is set to * {@code true} then a direct download will be done where the whole media content is downloaded in * a single request. If value is set to {@code false} then the download uses the resumable media * download protocol to download in data chunks. Defaults to {@code false}. */ private boolean directDownloadEnabled = false; /** * Progress listener to send progress notifications to or {@code null} for none. */ private MediaHttpDownloaderProgressListener progressListener; /** * Maximum size of individual chunks that will get downloaded by single HTTP requests. The default * value is {@link #MAXIMUM_CHUNK_SIZE}. */ private int chunkSize = MAXIMUM_CHUNK_SIZE; /** * The length of the HTTP media content or {@code 0} before it is initialized in * {@link #setMediaContentLength}. */ private long mediaContentLength; /** The current state of the downloader. */ private DownloadState downloadState = DownloadState.NOT_STARTED; /** The total number of bytes downloaded by this downloader. */ private long bytesDownloaded; /** * The last byte position of the media file we want to download, default value is {@code -1}. * *

* If its value is {@code -1} it means there is no upper limit on the byte position. *

*/ private long lastBytePos = -1; /** * Construct the {@link MediaHttpDownloader}. * * @param transport The transport to use for requests * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} or * {@code null} for none */ public MediaHttpDownloader( HttpTransport transport, HttpRequestInitializer httpRequestInitializer) { this.transport = Preconditions.checkNotNull(transport); this.requestFactory = httpRequestInitializer == null ? transport.createRequestFactory() : transport.createRequestFactory(httpRequestInitializer); } /** * Executes a direct media download or a resumable media download. * *

* This method does not close the given output stream. *

* *

* This method is not reentrant. A new instance of {@link MediaHttpDownloader} must be * instantiated before download called be called again. *

* * @param requestUrl The request URL where the download requests will be sent * @param outputStream destination output stream */ public void download(GenericUrl requestUrl, OutputStream outputStream) throws IOException { download(requestUrl, null, outputStream); } /** * Executes a direct media download or a resumable media download. * *

* This method does not close the given output stream. *

* *

* This method is not reentrant. A new instance of {@link MediaHttpDownloader} must be * instantiated before download called be called again. *

* * @param requestUrl request URL where the download requests will be sent * @param requestHeaders request headers or {@code null} to ignore * @param outputStream destination output stream * @since 1.12 */ public void download(GenericUrl requestUrl, HttpHeaders requestHeaders, OutputStream outputStream) throws IOException { Preconditions.checkArgument(downloadState == DownloadState.NOT_STARTED); requestUrl.put("alt", "media"); if (directDownloadEnabled) { updateStateAndNotifyListener(DownloadState.MEDIA_IN_PROGRESS); HttpResponse response = executeCurrentRequest(lastBytePos, requestUrl, requestHeaders, outputStream); // All required bytes have been downloaded from the server. mediaContentLength = response.getHeaders().getContentLength(); bytesDownloaded = mediaContentLength; updateStateAndNotifyListener(DownloadState.MEDIA_COMPLETE); return; } // Download the media content in chunks. while (true) { long currentRequestLastBytePos = bytesDownloaded + chunkSize - 1; if (lastBytePos != -1) { // If last byte position has been specified use it iff it is smaller than the chunksize. currentRequestLastBytePos = Math.min(lastBytePos, currentRequestLastBytePos); } HttpResponse response = executeCurrentRequest( currentRequestLastBytePos, requestUrl, requestHeaders, outputStream); String contentRange = response.getHeaders().getContentRange(); long nextByteIndex = getNextByteIndex(contentRange); setMediaContentLength(contentRange); if (mediaContentLength <= nextByteIndex) { // All required bytes have been downloaded from the server. bytesDownloaded = mediaContentLength; updateStateAndNotifyListener(DownloadState.MEDIA_COMPLETE); return; } bytesDownloaded = nextByteIndex; updateStateAndNotifyListener(DownloadState.MEDIA_IN_PROGRESS); } } /** * Executes the current request. * * @param currentRequestLastBytePos last byte position for current request * @param requestUrl request URL where the download requests will be sent * @param requestHeaders request headers or {@code null} to ignore * @param outputStream destination output stream * @return HTTP response */ private HttpResponse executeCurrentRequest(long currentRequestLastBytePos, GenericUrl requestUrl, HttpHeaders requestHeaders, OutputStream outputStream) throws IOException { // prepare the GET request HttpRequest request = requestFactory.buildGetRequest(requestUrl); // add request headers if (requestHeaders != null) { request.getHeaders().putAll(requestHeaders); } // set Range header (if necessary) if (bytesDownloaded != 0 || currentRequestLastBytePos != -1) { StringBuilder rangeHeader = new StringBuilder(); rangeHeader.append("bytes=").append(bytesDownloaded).append("-"); if (currentRequestLastBytePos != -1) { rangeHeader.append(currentRequestLastBytePos); } request.getHeaders().setRange(rangeHeader.toString()); } // execute the request and copy into the output stream HttpResponse response = request.execute(); try { IOUtils.copy(response.getContent(), outputStream); } finally { response.disconnect(); } return response; } /** * Returns the next byte index identifying data that the server has not yet sent out, obtained * from the HTTP Content-Range header (E.g a header of "Content-Range: 0-55/1000" would cause 56 * to be returned). null headers cause 0 to be returned. * * @param rangeHeader in the HTTP response * @return the byte index beginning where the server has yet to send out data */ private long getNextByteIndex(String rangeHeader) { if (rangeHeader == null) { return 0L; } return Long.parseLong( rangeHeader.substring(rangeHeader.indexOf('-') + 1, rangeHeader.indexOf('/'))) + 1; } /** * Sets the total number of bytes that have been downloaded of the media resource. * *

* If a download was aborted mid-way due to a connection failure then users can resume the * download from the point where it left off. *

* *

* Use {@link #setContentRange} if you need to specify both the bytes downloaded and the last byte * position. *

* * @param bytesDownloaded The total number of bytes downloaded */ public MediaHttpDownloader setBytesDownloaded(long bytesDownloaded) { Preconditions.checkArgument(bytesDownloaded >= 0); this.bytesDownloaded = bytesDownloaded; return this; } /** * Sets the content range of the next download request. Eg: bytes=firstBytePos-lastBytePos. * *

If a download was aborted mid-way due to a connection failure then users can resume the * download from the point where it left off. * *

Use {@link #setBytesDownloaded} if you only need to specify the first byte position. * * @param firstBytePos The first byte position in the content range string * @param lastBytePos The last byte position in the content range string. * @since 1.24 */ public MediaHttpDownloader setContentRange(long firstBytePos, long lastBytePos) { Preconditions.checkArgument(lastBytePos >= firstBytePos); setBytesDownloaded(firstBytePos); this.lastBytePos = lastBytePos; return this; } /** * @deprecated Use {@link #setContentRange(long, long)} instead. */ @Deprecated public MediaHttpDownloader setContentRange(long firstBytePos, int lastBytePos) { return setContentRange(firstBytePos, (long) lastBytePos); } /** * Sets the media content length from the HTTP Content-Range header (E.g a header of * "Content-Range: 0-55/1000" would cause 1000 to be set. null headers do not set * anything. * * @param rangeHeader in the HTTP response */ private void setMediaContentLength(String rangeHeader) { if (rangeHeader == null) { return; } if (mediaContentLength == 0) { mediaContentLength = Long.parseLong(rangeHeader.substring(rangeHeader.indexOf('/') + 1)); } } /** * Returns whether direct media download is enabled or disabled. If value is set to {@code true} * then a direct download will be done where the whole media content is downloaded in a single * request. If value is set to {@code false} then the download uses the resumable media download * protocol to download in data chunks. Defaults to {@code false}. */ public boolean isDirectDownloadEnabled() { return directDownloadEnabled; } /** * Returns whether direct media download is enabled or disabled. If value is set to {@code true} * then a direct download will be done where the whole media content is downloaded in a single * request. If value is set to {@code false} then the download uses the resumable media download * protocol to download in data chunks. Defaults to {@code false}. */ public MediaHttpDownloader setDirectDownloadEnabled(boolean directDownloadEnabled) { this.directDownloadEnabled = directDownloadEnabled; return this; } /** * Sets the progress listener to send progress notifications to or {@code null} for none. */ public MediaHttpDownloader setProgressListener( MediaHttpDownloaderProgressListener progressListener) { this.progressListener = progressListener; return this; } /** * Returns the progress listener to send progress notifications to or {@code null} for none. */ public MediaHttpDownloaderProgressListener getProgressListener() { return progressListener; } /** Returns the transport to use for requests. */ public HttpTransport getTransport() { return transport; } /** * Sets the maximum size of individual chunks that will get downloaded by single HTTP requests. * The default value is {@link #MAXIMUM_CHUNK_SIZE}. * *

* The maximum allowable value is {@link #MAXIMUM_CHUNK_SIZE}. *

*/ public MediaHttpDownloader setChunkSize(int chunkSize) { Preconditions.checkArgument(chunkSize > 0 && chunkSize <= MAXIMUM_CHUNK_SIZE); this.chunkSize = chunkSize; return this; } /** * Returns the maximum size of individual chunks that will get downloaded by single HTTP requests. * The default value is {@link #MAXIMUM_CHUNK_SIZE}. */ public int getChunkSize() { return chunkSize; } /** * Gets the total number of bytes downloaded by this downloader. * * @return the number of bytes downloaded */ public long getNumBytesDownloaded() { return bytesDownloaded; } /** * Gets the last byte position of the media file we want to download or {@code -1} if there is no * upper limit on the byte position. * * @return the last byte position * @since 1.13 */ public long getLastBytePosition() { return lastBytePos; } /** * Sets the download state and notifies the progress listener. * * @param downloadState value to set to */ private void updateStateAndNotifyListener(DownloadState downloadState) throws IOException { this.downloadState = downloadState; if (progressListener != null) { progressListener.progressChanged(this); } } /** * Gets the current download state of the downloader. * * @return the download state */ public DownloadState getDownloadState() { return downloadState; } /** * Gets the download progress denoting the percentage of bytes that have been downloaded, * represented between 0.0 (0%) and 1.0 (100%). * * @return the download progress */ public double getProgress() { return mediaContentLength == 0 ? 0 : (double) bytesDownloaded / mediaContentLength; } } MediaHttpDownloaderProgressListener.java000066400000000000000000000037351350651464300432000ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2012 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.api.client.googleapis.media; import java.io.IOException; /** * An interface for receiving progress notifications for downloads. * *

* Sample usage: *

* *
  public static class MyDownloadProgressListener implements MediaHttpDownloaderProgressListener {

    public void progressChanged(MediaHttpDownloader downloader) throws IOException {
      switch (downloader.getDownloadState()) {
        case MEDIA_IN_PROGRESS:
          System.out.println("Download in progress");
          System.out.println("Download percentage: " + downloader.getProgress());
          break;
        case MEDIA_COMPLETE:
          System.out.println("Download Completed!");
          break;
      }
    }
  }
 * 
* * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ public interface MediaHttpDownloaderProgressListener { /** * Called to notify that progress has been changed. * *

* This method is called multiple times depending on how many chunks are downloaded. Once the * download completes it is called one final time. *

* *

* The download state can be queried by calling {@link MediaHttpDownloader#getDownloadState} and * the progress by calling {@link MediaHttpDownloader#getProgress}. *

* * @param downloader Media HTTP downloader */ public void progressChanged(MediaHttpDownloader downloader) throws IOException; } MediaHttpUploader.java000066400000000000000000001055711350651464300374230ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2011 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.api.client.googleapis.media; import com.google.api.client.googleapis.MethodOverride; import com.google.api.client.http.AbstractInputStreamContent; import com.google.api.client.http.ByteArrayContent; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.GZipEncoding; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpBackOffIOExceptionHandler; import com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.MultipartContent; import com.google.api.client.util.Beta; import com.google.api.client.util.ByteStreams; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Sleeper; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; /** * Media HTTP Uploader, with support for both direct and resumable media uploads. Documentation is * available here. * *

* For resumable uploads, when the media content length is known, if the provided * {@link InputStream} has {@link InputStream#markSupported} as {@code false} then it is wrapped in * an {@link BufferedInputStream} to support the {@link InputStream#mark} and * {@link InputStream#reset} methods required for handling server errors. If the media content * length is unknown then each chunk is stored temporarily in memory. This is required to determine * when the last chunk is reached. *

* *

* See {@link #setDisableGZipContent(boolean)} for information on when content is gzipped and how to * control that behavior. *

* *

* Back-off is disabled by default. To enable it for an abnormal HTTP response and an I/O exception * you should call {@link HttpRequest#setUnsuccessfulResponseHandler} with a new * {@link HttpBackOffUnsuccessfulResponseHandler} instance and * {@link HttpRequest#setIOExceptionHandler} with {@link HttpBackOffIOExceptionHandler}. *

* *

* Upgrade warning: in prior version 1.14 exponential back-off was enabled by default for an * abnormal HTTP response and there was a regular retry (without back-off) when I/O exception was * thrown. Starting with version 1.15 back-off is disabled and there is no retry on I/O exception by * default. *

* *

* Upgrade warning: in prior version 1.16 {@link #serverErrorCallback} was public but starting with * version 1.17 it has been removed from the public API, and changed to be package private. *

* *

* Implementation is not thread-safe. *

* * @since 1.9 * * @author rmistry@google.com (Ravi Mistry) * @author peleyal@google.com (Eyal Peled) */ @SuppressWarnings("deprecation") public final class MediaHttpUploader { /** * Upload content type header. * * @since 1.13 */ public static final String CONTENT_LENGTH_HEADER = "X-Upload-Content-Length"; /** * Upload content length header. * * @since 1.13 */ public static final String CONTENT_TYPE_HEADER = "X-Upload-Content-Type"; /** * Upload state associated with the Media HTTP uploader. */ public enum UploadState { /** The upload process has not started yet. */ NOT_STARTED, /** Set before the initiation request is sent. */ INITIATION_STARTED, /** Set after the initiation request completes. */ INITIATION_COMPLETE, /** Set after a media file chunk is uploaded. */ MEDIA_IN_PROGRESS, /** Set after the complete media file is successfully uploaded. */ MEDIA_COMPLETE } /** The current state of the uploader. */ private UploadState uploadState = UploadState.NOT_STARTED; static final int MB = 0x100000; private static final int KB = 0x400; /** * Minimum number of bytes that can be uploaded to the server (set to 256KB). */ public static final int MINIMUM_CHUNK_SIZE = 256 * KB; /** * Default maximum number of bytes that will be uploaded to the server in any single HTTP request * (set to 10 MB). */ public static final int DEFAULT_CHUNK_SIZE = 10 * MB; /** The HTTP content of the media to be uploaded. */ private final AbstractInputStreamContent mediaContent; /** The request factory for connections to the server. */ private final HttpRequestFactory requestFactory; /** The transport to use for requests. */ private final HttpTransport transport; /** HTTP content metadata of the media to be uploaded or {@code null} for none. */ private HttpContent metadata; /** * The length of the HTTP media content. * *

* {@code 0} before it is lazily initialized in {@link #getMediaContentLength()} after which it * could still be {@code 0} for empty media content. Will be {@code < 0} if the media content * length has not been specified. *

*/ private long mediaContentLength; /** * Determines if media content length has been calculated yet in {@link #getMediaContentLength()}. */ private boolean isMediaContentLengthCalculated; /** * The HTTP method used for the initiation request. * *

* Can only be {@link HttpMethods#POST} (for media upload) or {@link HttpMethods#PUT} (for media * update). The default value is {@link HttpMethods#POST}. *

*/ private String initiationRequestMethod = HttpMethods.POST; /** The HTTP headers used in the initiation request. */ private HttpHeaders initiationHeaders = new HttpHeaders(); /** * The HTTP request object that is currently used to send upload requests or {@code null} before * {@link #upload}. */ private HttpRequest currentRequest; /** An Input stream of the HTTP media content or {@code null} before {@link #upload}. */ private InputStream contentInputStream; /** * Determines whether direct media upload is enabled or disabled. If value is set to {@code true} * then a direct upload will be done where the whole media content is uploaded in a single request * If value is set to {@code false} then the upload uses the resumable media upload protocol to * upload in data chunks. Defaults to {@code false}. */ private boolean directUploadEnabled; /** * Progress listener to send progress notifications to or {@code null} for none. */ private MediaHttpUploaderProgressListener progressListener; /** * The media content length is used in the "Content-Range" header. If we reached the end of the * stream, this variable will be set with the length of the stream. This value is used only in * resumable media upload. */ String mediaContentLengthStr = "*"; /** * The number of bytes the server received so far. This value will not be calculated for direct * uploads when the content length is not known in advance. */ // TODO(rmistry): Figure out a way to compute the content length using CountingInputStream. private long totalBytesServerReceived; /** * Maximum size of individual chunks that will get uploaded by single HTTP requests. The default * value is {@link #DEFAULT_CHUNK_SIZE}. */ private int chunkSize = DEFAULT_CHUNK_SIZE; /** * Used to cache a single byte when the media content length is unknown or {@code null} for none. */ private Byte cachedByte; /** * The number of bytes the client had sent to the server so far or {@code 0} for none. It is used * for resumable media upload when the media content length is not specified. */ private long totalBytesClientSent; /** * The number of bytes of the current chunk which was sent to the server or {@code 0} for none. * This value equals to chunk size for each chunk the client send to the server, except for the * ending chunk. */ private int currentChunkLength; /** * The content buffer of the current request or {@code null} for none. It is used for resumable * media upload when the media content length is not specified. It is instantiated for every * request in {@link #buildContentChunk()} and is set to {@code null} when the * request is completed in {@link #upload}. */ private byte currentRequestContentBuffer[]; /** * Whether to disable GZip compression of HTTP content. * *

* The default value is {@code false}. *

*/ private boolean disableGZipContent; /** Sleeper. **/ Sleeper sleeper = Sleeper.DEFAULT; /** * Construct the {@link MediaHttpUploader}. * *

* The input stream received by calling {@link AbstractInputStreamContent#getInputStream} is * closed when the upload process is successfully completed. For resumable uploads, when the media * content length is known, if the input stream has {@link InputStream#markSupported} as * {@code false} then it is wrapped in an {@link BufferedInputStream} to support the * {@link InputStream#mark} and {@link InputStream#reset} methods required for handling server * errors. If the media content length is unknown then each chunk is stored temporarily in memory. * This is required to determine when the last chunk is reached. *

* * @param mediaContent The Input stream content of the media to be uploaded * @param transport The transport to use for requests * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest} or * {@code null} for none */ public MediaHttpUploader(AbstractInputStreamContent mediaContent, HttpTransport transport, HttpRequestInitializer httpRequestInitializer) { this.mediaContent = Preconditions.checkNotNull(mediaContent); this.transport = Preconditions.checkNotNull(transport); this.requestFactory = httpRequestInitializer == null ? transport.createRequestFactory() : transport.createRequestFactory(httpRequestInitializer); } /** * Executes a direct media upload or resumable media upload conforming to the specifications * listed here. * *

* This method is not reentrant. A new instance of {@link MediaHttpUploader} must be instantiated * before upload called be called again. *

* *

* If an error is encountered during the request execution the caller is responsible for parsing * the response correctly. For example for JSON errors: *

* *
    if (!response.isSuccessStatusCode()) {
      throw GoogleJsonResponseException.from(jsonFactory, response);
    }
   * 
* *

* Callers should call {@link HttpResponse#disconnect} when the returned HTTP response object is * no longer needed. However, {@link HttpResponse#disconnect} does not have to be called if the * response stream is properly closed. Example usage: *

* *
     HttpResponse response = batch.upload(initiationRequestUrl);
     try {
       // process the HTTP response object
     } finally {
       response.disconnect();
     }
   * 
* * @param initiationRequestUrl The request URL where the initiation request will be sent * @return HTTP response */ public HttpResponse upload(GenericUrl initiationRequestUrl) throws IOException { Preconditions.checkArgument(uploadState == UploadState.NOT_STARTED); if (directUploadEnabled) { return directUpload(initiationRequestUrl); } return resumableUpload(initiationRequestUrl); } /** * Direct Uploads the media. * * @param initiationRequestUrl The request URL where the initiation request will be sent * @return HTTP response */ private HttpResponse directUpload(GenericUrl initiationRequestUrl) throws IOException { updateStateAndNotifyListener(UploadState.MEDIA_IN_PROGRESS); HttpContent content = mediaContent; if (metadata != null) { content = new MultipartContent().setContentParts(Arrays.asList(metadata, mediaContent)); initiationRequestUrl.put("uploadType", "multipart"); } else { initiationRequestUrl.put("uploadType", "media"); } HttpRequest request = requestFactory.buildRequest(initiationRequestMethod, initiationRequestUrl, content); request.getHeaders().putAll(initiationHeaders); // We do not have to do anything special here if media content length is unspecified because // direct media upload works even when the media content length == -1. HttpResponse response = executeCurrentRequest(request); boolean responseProcessed = false; try { if (isMediaLengthKnown()) { totalBytesServerReceived = getMediaContentLength(); } updateStateAndNotifyListener(UploadState.MEDIA_COMPLETE); responseProcessed = true; } finally { if (!responseProcessed) { response.disconnect(); } } return response; } /** * Uploads the media in a resumable manner. * * @param initiationRequestUrl The request URL where the initiation request will be sent * @return HTTP response */ private HttpResponse resumableUpload(GenericUrl initiationRequestUrl) throws IOException { // Make initial request to get the unique upload URL. HttpResponse initialResponse = executeUploadInitiation(initiationRequestUrl); if (!initialResponse.isSuccessStatusCode()) { // If the initiation request is not successful return it immediately. return initialResponse; } GenericUrl uploadUrl; try { uploadUrl = new GenericUrl(initialResponse.getHeaders().getLocation()); } finally { initialResponse.disconnect(); } // Convert media content into a byte stream to upload in chunks. contentInputStream = mediaContent.getInputStream(); if (!contentInputStream.markSupported() && isMediaLengthKnown()) { // If we know the media content length then wrap the stream into a Buffered input stream to // support the {@link InputStream#mark} and {@link InputStream#reset} methods required for // handling server errors. contentInputStream = new BufferedInputStream(contentInputStream); } HttpResponse response; // Upload the media content in chunks. while (true) { ContentChunk contentChunk = buildContentChunk(); currentRequest = requestFactory.buildPutRequest(uploadUrl, null); currentRequest.setContent(contentChunk.getContent()); currentRequest.getHeaders().setContentRange(contentChunk.getContentRange()); // set mediaErrorHandler as I/O exception handler and as unsuccessful response handler for // calling to serverErrorCallback on an I/O exception or an abnormal HTTP response new MediaUploadErrorHandler(this, currentRequest); if (isMediaLengthKnown()) { // TODO(rmistry): Support gzipping content for the case where media content length is // known (https://code.google.com/p/google-api-java-client/issues/detail?id=691). response = executeCurrentRequestWithoutGZip(currentRequest); } else { response = executeCurrentRequest(currentRequest); } boolean returningResponse = false; try { if (response.isSuccessStatusCode()) { totalBytesServerReceived = getMediaContentLength(); if (mediaContent.getCloseInputStream()) { contentInputStream.close(); } updateStateAndNotifyListener(UploadState.MEDIA_COMPLETE); returningResponse = true; return response; } if (response.getStatusCode() != 308) { returningResponse = true; return response; } // Check to see if the upload URL has changed on the server. String updatedUploadUrl = response.getHeaders().getLocation(); if (updatedUploadUrl != null) { uploadUrl = new GenericUrl(updatedUploadUrl); } // we check the amount of bytes the server received so far, because the server may process // fewer bytes than the amount of bytes the client had sent long newBytesServerReceived = getNextByteIndex(response.getHeaders().getRange()); // the server can receive any amount of bytes from 0 to current chunk length long currentBytesServerReceived = newBytesServerReceived - totalBytesServerReceived; Preconditions.checkState( currentBytesServerReceived >= 0 && currentBytesServerReceived <= currentChunkLength); long copyBytes = currentChunkLength - currentBytesServerReceived; if (isMediaLengthKnown()) { if (copyBytes > 0) { // If the server didn't receive all the bytes the client sent the current position of // the input stream is incorrect. So we should reset the stream and skip those bytes // that the server had already received. // Otherwise (the server got all bytes the client sent), the stream is in its right // position, and we can continue from there contentInputStream.reset(); long actualSkipValue = contentInputStream.skip(currentBytesServerReceived); Preconditions.checkState(currentBytesServerReceived == actualSkipValue); } } else if (copyBytes == 0) { // server got all the bytes, so we don't need to use this buffer. Otherwise, we have to // keep the buffer and copy part (or all) of its bytes to the stream we are sending to the // server currentRequestContentBuffer = null; } totalBytesServerReceived = newBytesServerReceived; updateStateAndNotifyListener(UploadState.MEDIA_IN_PROGRESS); } finally { if (!returningResponse) { response.disconnect(); } } } } /** * @return {@code true} if the media length is known, otherwise {@code false} */ private boolean isMediaLengthKnown() throws IOException { return getMediaContentLength() >= 0; } /** * Uses lazy initialization to compute the media content length. * *

* This is done to avoid throwing an {@link IOException} in the constructor. *

*/ private long getMediaContentLength() throws IOException { if (!isMediaContentLengthCalculated) { mediaContentLength = mediaContent.getLength(); isMediaContentLengthCalculated = true; } return mediaContentLength; } /** * This method sends a POST request with empty content to get the unique upload URL. * * @param initiationRequestUrl The request URL where the initiation request will be sent */ private HttpResponse executeUploadInitiation(GenericUrl initiationRequestUrl) throws IOException { updateStateAndNotifyListener(UploadState.INITIATION_STARTED); initiationRequestUrl.put("uploadType", "resumable"); HttpContent content = metadata == null ? new EmptyContent() : metadata; HttpRequest request = requestFactory.buildRequest(initiationRequestMethod, initiationRequestUrl, content); initiationHeaders.set(CONTENT_TYPE_HEADER, mediaContent.getType()); if (isMediaLengthKnown()) { initiationHeaders.set(CONTENT_LENGTH_HEADER, getMediaContentLength()); } request.getHeaders().putAll(initiationHeaders); HttpResponse response = executeCurrentRequest(request); boolean notificationCompleted = false; try { updateStateAndNotifyListener(UploadState.INITIATION_COMPLETE); notificationCompleted = true; } finally { if (!notificationCompleted) { response.disconnect(); } } return response; } /** * Executes the current request with some minimal common code. * * @param request current request * @return HTTP response */ private HttpResponse executeCurrentRequestWithoutGZip(HttpRequest request) throws IOException { // method override for non-POST verbs new MethodOverride().intercept(request); // don't throw an exception so we can let a custom Google exception be thrown request.setThrowExceptionOnExecuteError(false); // execute the request HttpResponse response = request.execute(); return response; } /** * Executes the current request with some common code that includes exponential backoff and GZip * encoding. * * @param request current request * @return HTTP response */ private HttpResponse executeCurrentRequest(HttpRequest request) throws IOException { // enable GZip encoding if necessary if (!disableGZipContent && !(request.getContent() instanceof EmptyContent)) { request.setEncoding(new GZipEncoding()); } // execute request HttpResponse response = executeCurrentRequestWithoutGZip(request); return response; } /** * Sets the HTTP media content chunk and the required headers that should be used in the upload * request. */ private ContentChunk buildContentChunk() throws IOException { int blockSize; if (isMediaLengthKnown()) { // We know exactly what the blockSize will be because we know the media content length. blockSize = (int) Math.min(chunkSize, getMediaContentLength() - totalBytesServerReceived); } else { // Use the chunkSize as the blockSize because we do know what what it is yet. blockSize = chunkSize; } AbstractInputStreamContent contentChunk; int actualBlockSize = blockSize; if (isMediaLengthKnown()) { // Mark the current position in case we need to retry the request. contentInputStream.mark(blockSize); InputStream limitInputStream = ByteStreams.limit(contentInputStream, blockSize); contentChunk = new InputStreamContent( mediaContent.getType(), limitInputStream).setRetrySupported(true) .setLength(blockSize).setCloseInputStream(false); mediaContentLengthStr = String.valueOf(getMediaContentLength()); } else { // If the media content length is not known we implement a custom buffered input stream that // enables us to detect the length of the media content when the last chunk is sent. We // accomplish this by always trying to read an extra byte further than the end of the current // chunk. int actualBytesRead; int bytesAllowedToRead; // amount of bytes which need to be copied from last chunk buffer int copyBytes = 0; if (currentRequestContentBuffer == null) { bytesAllowedToRead = cachedByte == null ? blockSize + 1 : blockSize; currentRequestContentBuffer = new byte[blockSize + 1]; if (cachedByte != null) { currentRequestContentBuffer[0] = cachedByte; } } else { // currentRequestContentBuffer is not null that means one of the following: // 1. This is a request to recover from a server error (e.g. 503) // or // 2. The server received less bytes than the amount of bytes the client had sent. For // example, the client sends bytes 100-199, but the server returns back status code 308, // and its "Range" header is "bytes=0-150". // In that case, the new request will be constructed from the previous request's byte buffer // plus new bytes from the stream. copyBytes = (int) (totalBytesClientSent - totalBytesServerReceived); // shift copyBytes bytes to the beginning - those are the bytes which weren't received by // the server in the last chunk. System.arraycopy(currentRequestContentBuffer, currentChunkLength - copyBytes, currentRequestContentBuffer, 0, copyBytes); if (cachedByte != null) { // add the last cached byte to the buffer currentRequestContentBuffer[copyBytes] = cachedByte; } bytesAllowedToRead = blockSize - copyBytes; } actualBytesRead = ByteStreams.read( contentInputStream, currentRequestContentBuffer, blockSize + 1 - bytesAllowedToRead, bytesAllowedToRead); if (actualBytesRead < bytesAllowedToRead) { actualBlockSize = copyBytes + Math.max(0, actualBytesRead); if (cachedByte != null) { actualBlockSize++; cachedByte = null; } if (mediaContentLengthStr.equals("*")) { // At this point we know we reached the media content length because we either read less // than the specified chunk size or there is no more data left to be read. mediaContentLengthStr = String.valueOf(totalBytesServerReceived + actualBlockSize); } } else { cachedByte = currentRequestContentBuffer[blockSize]; } contentChunk = new ByteArrayContent( mediaContent.getType(), currentRequestContentBuffer, 0, actualBlockSize); totalBytesClientSent = totalBytesServerReceived + actualBlockSize; } currentChunkLength = actualBlockSize; String contentRange; if (actualBlockSize == 0) { // No bytes to upload. Either zero content media being uploaded, or a server failure on the // last write, even though the write actually succeeded. Either way, // mediaContentLengthStr will contain the actual media length. contentRange = "bytes */" + mediaContentLengthStr; } else { contentRange = "bytes " + totalBytesServerReceived + "-" + (totalBytesServerReceived + actualBlockSize - 1) + "/" + mediaContentLengthStr; } return new ContentChunk(contentChunk, contentRange); } private static class ContentChunk { private final AbstractInputStreamContent content; private final String contentRange; ContentChunk(AbstractInputStreamContent content, String contentRange) { this.content = content; this.contentRange = contentRange; } AbstractInputStreamContent getContent() { return content; } String getContentRange() { return contentRange; } } /** * {@link Beta}
* The call back method that will be invoked on a server error or an I/O exception during * resumable upload inside {@link #upload}. * *

* This method changes the current request to query the current status of the upload to find how * many bytes were successfully uploaded before the server error occurred. *

*/ @Beta void serverErrorCallback() throws IOException { Preconditions.checkNotNull(currentRequest, "The current request should not be null"); // Query the current status of the upload by issuing an empty PUT request on the upload URI. currentRequest.setContent(new EmptyContent()); currentRequest.getHeaders().setContentRange("bytes */" + mediaContentLengthStr); } /** * Returns the next byte index identifying data that the server has not yet received, obtained * from the HTTP Range header (E.g a header of "Range: 0-55" would cause 56 to be returned). * null or malformed headers cause 0 to be returned. * * @param rangeHeader in the HTTP response * @return the byte index beginning where the server has yet to receive data */ private long getNextByteIndex(String rangeHeader) { if (rangeHeader == null) { return 0L; } return Long.parseLong(rangeHeader.substring(rangeHeader.indexOf('-') + 1)) + 1; } /** Returns HTTP content metadata for the media request or {@code null} for none. */ public HttpContent getMetadata() { return metadata; } /** Sets HTTP content metadata for the media request or {@code null} for none. */ public MediaHttpUploader setMetadata(HttpContent metadata) { this.metadata = metadata; return this; } /** Returns the HTTP content of the media to be uploaded. */ public HttpContent getMediaContent() { return mediaContent; } /** Returns the transport to use for requests. */ public HttpTransport getTransport() { return transport; } /** * Sets whether direct media upload is enabled or disabled. * *

* If value is set to {@code true} then a direct upload will be done where the whole media content * is uploaded in a single request. If value is set to {@code false} then the upload uses the * resumable media upload protocol to upload in data chunks. *

* *

* Direct upload is recommended if the content size falls below a certain minimum limit. This is * because there's minimum block write size for some Google APIs, so if the resumable request * fails in the space of that first block, the client will have to restart from the beginning * anyway. *

* *

* Defaults to {@code false}. *

* * @since 1.9 */ public MediaHttpUploader setDirectUploadEnabled(boolean directUploadEnabled) { this.directUploadEnabled = directUploadEnabled; return this; } /** * Returns whether direct media upload is enabled or disabled. If value is set to {@code true} * then a direct upload will be done where the whole media content is uploaded in a single * request. If value is set to {@code false} then the upload uses the resumable media upload * protocol to upload in data chunks. Defaults to {@code false}. * * @since 1.9 */ public boolean isDirectUploadEnabled() { return directUploadEnabled; } /** * Sets the progress listener to send progress notifications to or {@code null} for none. */ public MediaHttpUploader setProgressListener(MediaHttpUploaderProgressListener progressListener) { this.progressListener = progressListener; return this; } /** * Returns the progress listener to send progress notifications to or {@code null} for none. */ public MediaHttpUploaderProgressListener getProgressListener() { return progressListener; } /** * Sets the maximum size of individual chunks that will get uploaded by single HTTP requests. The * default value is {@link #DEFAULT_CHUNK_SIZE}. * *

* The minimum allowable value is {@link #MINIMUM_CHUNK_SIZE} and the specified chunk size must be * a multiple of {@link #MINIMUM_CHUNK_SIZE}. *

*/ public MediaHttpUploader setChunkSize(int chunkSize) { Preconditions.checkArgument(chunkSize > 0 && chunkSize % MINIMUM_CHUNK_SIZE == 0, "chunkSize" + " must be a positive multiple of " + MINIMUM_CHUNK_SIZE + "."); this.chunkSize = chunkSize; return this; } /** * Returns the maximum size of individual chunks that will get uploaded by single HTTP requests. * The default value is {@link #DEFAULT_CHUNK_SIZE}. */ public int getChunkSize() { return chunkSize; } /** * Returns whether to disable GZip compression of HTTP content. * * @since 1.13 */ public boolean getDisableGZipContent() { return disableGZipContent; } /** * Sets whether to disable GZip compression of HTTP content. * *

* By default it is {@code false}. *

* *

* If {@link #setDisableGZipContent(boolean)} is set to false (the default value) then content is * gzipped for direct media upload and resumable media uploads when content length is not known. * Due to a current limitation, content is not gzipped for resumable media uploads when content * length is known; this limitation will be removed in the future. *

* * @since 1.13 */ public MediaHttpUploader setDisableGZipContent(boolean disableGZipContent) { this.disableGZipContent = disableGZipContent; return this; } /** * Returns the sleeper. * * @since 1.15 */ public Sleeper getSleeper() { return sleeper; } /** * Sets the sleeper. The default value is {@link Sleeper#DEFAULT}. * * @since 1.15 */ public MediaHttpUploader setSleeper(Sleeper sleeper) { this.sleeper = sleeper; return this; } /** * Returns the HTTP method used for the initiation request. * *

* The default value is {@link HttpMethods#POST}. *

* * @since 1.12 */ public String getInitiationRequestMethod() { return initiationRequestMethod; } /** * Sets the HTTP method used for the initiation request. * *

* Can only be {@link HttpMethods#POST} (for media upload) or {@link HttpMethods#PUT} (for media * update). The default value is {@link HttpMethods#POST}. *

* * @since 1.12 */ public MediaHttpUploader setInitiationRequestMethod(String initiationRequestMethod) { Preconditions.checkArgument(initiationRequestMethod.equals(HttpMethods.POST) || initiationRequestMethod.equals(HttpMethods.PUT) || initiationRequestMethod.equals(HttpMethods.PATCH)); this.initiationRequestMethod = initiationRequestMethod; return this; } /** Sets the HTTP headers used for the initiation request. */ public MediaHttpUploader setInitiationHeaders(HttpHeaders initiationHeaders) { this.initiationHeaders = initiationHeaders; return this; } /** Returns the HTTP headers used for the initiation request. */ public HttpHeaders getInitiationHeaders() { return initiationHeaders; } /** * Gets the total number of bytes the server received so far or {@code 0} for direct uploads when * the content length is not known. * * @return the number of bytes the server received so far */ public long getNumBytesUploaded() { return totalBytesServerReceived; } /** * Sets the upload state and notifies the progress listener. * * @param uploadState value to set to */ private void updateStateAndNotifyListener(UploadState uploadState) throws IOException { this.uploadState = uploadState; if (progressListener != null) { progressListener.progressChanged(this); } } /** * Gets the current upload state of the uploader. * * @return the upload state */ public UploadState getUploadState() { return uploadState; } /** * Gets the upload progress denoting the percentage of bytes that have been uploaded, represented * between 0.0 (0%) and 1.0 (100%). * *

* Do not use if the specified {@link AbstractInputStreamContent} has no content length specified. * Instead, consider using {@link #getNumBytesUploaded} to denote progress. *

* * @throws IllegalArgumentException if the specified {@link AbstractInputStreamContent} has no * content length * @return the upload progress */ public double getProgress() throws IOException { Preconditions.checkArgument(isMediaLengthKnown(), "Cannot call getProgress() if " + "the specified AbstractInputStreamContent has no content length. Use " + " getNumBytesUploaded() to denote progress instead."); return getMediaContentLength() == 0 ? 0 : (double) totalBytesServerReceived / getMediaContentLength(); } } MediaHttpUploaderProgressListener.java000066400000000000000000000045571350651464300426600ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2011 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.api.client.googleapis.media; import java.io.IOException; /** * An interface for receiving progress notifications for uploads. * *

* Sample usage (if media content length is provided, else consider using * {@link MediaHttpUploader#getNumBytesUploaded} instead of {@link MediaHttpUploader#getProgress}: *

* *
  public static class MyUploadProgressListener implements MediaHttpUploaderProgressListener {

    public void progressChanged(MediaHttpUploader uploader) throws IOException {
      switch (uploader.getUploadState()) {
        case INITIATION_STARTED:
          System.out.println("Initiation Started");
          break;
        case INITIATION_COMPLETE:
          System.out.println("Initiation Completed");
          break;
        case MEDIA_IN_PROGRESS:
          System.out.println("Upload in progress");
          System.out.println("Upload percentage: " + uploader.getProgress());
          break;
        case MEDIA_COMPLETE:
          System.out.println("Upload Completed!");
          break;
      }
    }
  }
 * 
* * @since 1.9 * @author rmistry@google.com (Ravi Mistry) */ public interface MediaHttpUploaderProgressListener { /** * Called to notify that progress has been changed. * *

* This method is called once before and after the initiation request. For media uploads it is * called multiple times depending on how many chunks are uploaded. Once the upload completes it * is called one final time. *

* *

* The upload state can be queried by calling {@link MediaHttpUploader#getUploadState} and the * progress by calling {@link MediaHttpUploader#getProgress}. *

* * @param uploader Media HTTP uploader */ public void progressChanged(MediaHttpUploader uploader) throws IOException; } MediaUploadErrorHandler.java000066400000000000000000000071001350651464300405310ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2013 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.api.client.googleapis.media; import com.google.api.client.http.HttpIOExceptionHandler; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * MediaUpload error handler handles an {@link IOException} and an abnormal HTTP response by calling * to {@link MediaHttpUploader#serverErrorCallback()}. * * @author Eyal Peled */ @Beta class MediaUploadErrorHandler implements HttpUnsuccessfulResponseHandler, HttpIOExceptionHandler { static final Logger LOGGER = Logger.getLogger(MediaUploadErrorHandler.class.getName()); /** The uploader to callback on if there is a server error. */ private final MediaHttpUploader uploader; /** The original {@link HttpIOExceptionHandler} of the HTTP request. */ private final HttpIOExceptionHandler originalIOExceptionHandler; /** The original {@link HttpUnsuccessfulResponseHandler} of the HTTP request. */ private final HttpUnsuccessfulResponseHandler originalUnsuccessfulHandler; /** * Constructs a new instance from {@link MediaHttpUploader} and {@link HttpRequest}. */ public MediaUploadErrorHandler(MediaHttpUploader uploader, HttpRequest request) { this.uploader = Preconditions.checkNotNull(uploader); originalIOExceptionHandler = request.getIOExceptionHandler(); originalUnsuccessfulHandler = request.getUnsuccessfulResponseHandler(); request.setIOExceptionHandler(this); request.setUnsuccessfulResponseHandler(this); } public boolean handleIOException(HttpRequest request, boolean supportsRetry) throws IOException { boolean handled = originalIOExceptionHandler != null && originalIOExceptionHandler.handleIOException(request, supportsRetry); // TODO(peleyal): figure out what is best practice - call serverErrorCallback only if I/O // exception was handled, or call it regardless if (handled) { try { uploader.serverErrorCallback(); } catch (IOException e) { LOGGER.log(Level.WARNING, "exception thrown while calling server callback", e); } } return handled; } public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) throws IOException { boolean handled = originalUnsuccessfulHandler != null && originalUnsuccessfulHandler.handleResponse(request, response, supportsRetry); // TODO(peleyal): figure out what is best practice - call serverErrorCallback only if the // abnormal response was handled, or call it regardless if (handled && supportsRetry && response.getStatusCode() / 100 == 5) { try { uploader.serverErrorCallback(); } catch (IOException e) { LOGGER.log(Level.WARNING, "exception thrown while calling server callback", e); } } return handled; } } package-info.java000066400000000000000000000013071350651464300363640ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/media/* * Copyright 2010 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. */ /** * Media for Google API's. * * @since 1.9 * @author Ravi Mistry */ package com.google.api.client.googleapis.media; notifications/000077500000000000000000000000001350651464300347665ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisAbstractNotification.java000066400000000000000000000204161350651464300417460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; import com.google.api.client.util.Objects; import com.google.api.client.util.Preconditions; /** * {@link Beta}
* Notification metadata sent to this client about a watched resource. * *

* Implementation is not thread-safe. *

* * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public abstract class AbstractNotification { /** Message number (a monotonically increasing value starting with 1). */ private long messageNumber; /** {@link ResourceStates Resource state}. */ private String resourceState; /** Opaque ID for the watched resource that is stable across API versions. */ private String resourceId; /** * Opaque ID (in the form of a canonicalized URI) for the watched resource that is sensitive to * the API version. */ private String resourceUri; /** Notification channel UUID provided by the client in the watch request. */ private String channelId; /** Notification channel expiration time or {@code null} for none. */ private String channelExpiration; /** * Notification channel token (an opaque string) provided by the client in the watch request or * {@code null} for none. */ private String channelToken; /** Type of change performed on the resource or {@code null} for none. */ private String changed; /** * @param messageNumber message number (a monotonically increasing value starting with 1) * @param resourceState {@link ResourceStates resource state} * @param resourceId opaque ID for the watched resource that is stable across API versions * @param resourceUri opaque ID (in the form of a canonicalized URI) for the watched resource that * is sensitive to the API version * @param channelId notification channel UUID provided by the client in the watch request */ protected AbstractNotification(long messageNumber, String resourceState, String resourceId, String resourceUri, String channelId) { setMessageNumber(messageNumber); setResourceState(resourceState); setResourceId(resourceId); setResourceUri(resourceUri); setChannelId(channelId); } /** Copy constructor based on a source notification object. */ protected AbstractNotification(AbstractNotification source) { this(source.getMessageNumber(), source.getResourceState(), source.getResourceId(), source .getResourceUri(), source.getChannelId()); setChannelExpiration(source.getChannelExpiration()); setChannelToken(source.getChannelToken()); setChanged(source.getChanged()); } @Override public String toString() { return toStringHelper().toString(); } /** Returns the helper for {@link #toString()}. */ protected Objects.ToStringHelper toStringHelper() { return Objects.toStringHelper(this).add("messageNumber", messageNumber) .add("resourceState", resourceState).add("resourceId", resourceId) .add("resourceUri", resourceUri).add("channelId", channelId) .add("channelExpiration", channelExpiration).add("channelToken", channelToken) .add("changed", changed); } /** Returns the message number (a monotonically increasing value starting with 1). */ public final long getMessageNumber() { return messageNumber; } /** * Sets the message number (a monotonically increasing value starting with 1). * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setMessageNumber(long messageNumber) { Preconditions.checkArgument(messageNumber >= 1); this.messageNumber = messageNumber; return this; } /** Returns the {@link ResourceStates resource state}. */ public final String getResourceState() { return resourceState; } /** * Sets the {@link ResourceStates resource state}. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setResourceState(String resourceState) { this.resourceState = Preconditions.checkNotNull(resourceState); return this; } /** Returns the opaque ID for the watched resource that is stable across API versions. */ public final String getResourceId() { return resourceId; } /** * Sets the opaque ID for the watched resource that is stable across API versions. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setResourceId(String resourceId) { this.resourceId = Preconditions.checkNotNull(resourceId); return this; } /** * Returns the opaque ID (in the form of a canonicalized URI) for the watched resource that is * sensitive to the API version. */ public final String getResourceUri() { return resourceUri; } /** * Sets the opaque ID (in the form of a canonicalized URI) for the watched resource that is * sensitive to the API version. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setResourceUri(String resourceUri) { this.resourceUri = Preconditions.checkNotNull(resourceUri); return this; } /** Returns the notification channel UUID provided by the client in the watch request. */ public final String getChannelId() { return channelId; } /** * Sets the notification channel UUID provided by the client in the watch request. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setChannelId(String channelId) { this.channelId = Preconditions.checkNotNull(channelId); return this; } /** Returns the notification channel expiration time or {@code null} for none. */ public final String getChannelExpiration() { return channelExpiration; } /** * Sets the notification channel expiration time or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setChannelExpiration(String channelExpiration) { this.channelExpiration = channelExpiration; return this; } /** * Returns the notification channel token (an opaque string) provided by the client in the watch * request or {@code null} for none. */ public final String getChannelToken() { return channelToken; } /** * Sets the notification channel token (an opaque string) provided by the client in the watch * request or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setChannelToken(String channelToken) { this.channelToken = channelToken; return this; } /** * Returns the type of change performed on the resource or {@code null} for none. */ public final String getChanged() { return changed; } /** * Sets the type of change performed on the resource or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractNotification setChanged(String changed) { this.changed = changed; return this; } } NotificationUtils.java000066400000000000000000000020011350651464300412710ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import java.util.UUID; /** * Utilities for notifications and notification channels. * * @author Yaniv Inbar * @since 1.16 */ public final class NotificationUtils { /** Returns a new random UUID string to be used as a notification channel ID. */ public static String randomUuidString() { return UUID.randomUUID().toString(); } private NotificationUtils() { } } ResourceStates.java000066400000000000000000000023211350651464300406020ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; /** * {@link Beta}
* Standard resource states used by notifications. * * @author Yaniv Inbar * @since 1.16 */ @Beta public final class ResourceStates { /** Notification that the subscription is alive (comes with no payload). */ public static final String SYNC = "SYNC"; /** Resource exists, for example on a create or update. */ public static final String EXISTS = "EXISTS"; /** Resource does not exist, for example on a delete. */ public static final String NOT_EXISTS = "NOT_EXISTS"; private ResourceStates() { } } StoredChannel.java000066400000000000000000000167401350651464300403720ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; import com.google.api.client.util.Objects; import com.google.api.client.util.Preconditions; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.DataStoreFactory; import java.io.IOException; import java.io.Serializable; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * {@link Beta}
* Notification channel information to be stored in a data store. * *

* Implementation is thread safe. *

* * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public final class StoredChannel implements Serializable { /** Default data store ID. */ public static final String DEFAULT_DATA_STORE_ID = StoredChannel.class.getSimpleName(); private static final long serialVersionUID = 1L; /** Lock on access to the store. */ private final Lock lock = new ReentrantLock(); /** Notification callback called when a notification is received for this subscription. */ private final UnparsedNotificationCallback notificationCallback; /** * Arbitrary string provided by the client associated with this subscription that is delivered to * the target address with each notification or {@code null} for none. */ private String clientToken; /** * Milliseconds in Unix time at which the subscription will expire or {@code null} for an infinite * TTL. */ private Long expiration; /** Subscription UUID. */ private final String id; /** * Opaque ID for the subscribed resource that is stable across API versions or {@code null} for * none. */ private String topicId; /** * Constructor with a random UUID using {@link NotificationUtils#randomUuidString()}. * * @param notificationCallback notification handler called when a notification is received for * this subscription */ public StoredChannel(UnparsedNotificationCallback notificationCallback) { this(notificationCallback, NotificationUtils.randomUuidString()); } /** * Constructor with a custom UUID. * * @param notificationCallback notification handler called when a notification is received for * this subscription * @param id subscription UUID */ public StoredChannel(UnparsedNotificationCallback notificationCallback, String id) { this.notificationCallback = Preconditions.checkNotNull(notificationCallback); this.id = Preconditions.checkNotNull(id); } /** * Stores this notification channel in the notification channel data store, which is derived from * {@link #getDefaultDataStore(DataStoreFactory)} on the given data store factory. * *

* It is important that this method be called before the watch HTTP request is made in case the * notification is received before the watch HTTP response is received. *

* * @param dataStoreFactory data store factory */ public StoredChannel store(DataStoreFactory dataStoreFactory) throws IOException { return store(getDefaultDataStore(dataStoreFactory)); } /** * Stores this notification channel in the given notification channel data store. * *

* It is important that this method be called before the watch HTTP request is made in case the * notification is received before the watch HTTP response is received. *

* * @param dataStore notification channel data store */ public StoredChannel store(DataStore dataStore) throws IOException { lock.lock(); try { dataStore.set(getId(), this); return this; } finally { lock.unlock(); } } /** * Returns the notification callback called when a notification is received for this subscription. */ public UnparsedNotificationCallback getNotificationCallback() { lock.lock(); try { return notificationCallback; } finally { lock.unlock(); } } /** * Returns the arbitrary string provided by the client associated with this subscription that is * delivered to the target address with each notification or {@code null} for none. */ public String getClientToken() { lock.lock(); try { return clientToken; } finally { lock.unlock(); } } /** * Sets the the arbitrary string provided by the client associated with this subscription that is * delivered to the target address with each notification or {@code null} for none. */ public StoredChannel setClientToken(String clientToken) { lock.lock(); try { this.clientToken = clientToken; } finally { lock.unlock(); } return this; } /** * Returns the milliseconds in Unix time at which the subscription will expire or {@code null} for * an infinite TTL. */ public Long getExpiration() { lock.lock(); try { return expiration; } finally { lock.unlock(); } } /** * Sets the milliseconds in Unix time at which the subscription will expire or {@code null} for an * infinite TTL. */ public StoredChannel setExpiration(Long expiration) { lock.lock(); try { this.expiration = expiration; } finally { lock.unlock(); } return this; } /** Returns the subscription UUID. */ public String getId() { lock.lock(); try { return id; } finally { lock.unlock(); } } /** * Returns the opaque ID for the subscribed resource that is stable across API versions or * {@code null} for none. */ public String getTopicId() { lock.lock(); try { return topicId; } finally { lock.unlock(); } } /** * Sets the opaque ID for the subscribed resource that is stable across API versions or * {@code null} for none. */ public StoredChannel setTopicId(String topicId) { lock.lock(); try { this.topicId = topicId; } finally { lock.unlock(); } return this; } @Override public String toString() { return Objects.toStringHelper(StoredChannel.class) .add("notificationCallback", getNotificationCallback()).add("clientToken", getClientToken()) .add("expiration", getExpiration()).add("id", getId()).add("topicId", getTopicId()) .toString(); } @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof StoredChannel)) { return false; } StoredChannel o = (StoredChannel) other; return getId().equals(o.getId()); } @Override public int hashCode() { return getId().hashCode(); } /** * Returns the stored channel data store using the ID {@link #DEFAULT_DATA_STORE_ID}. * * @param dataStoreFactory data store factory * @return stored channel data store */ public static DataStore getDefaultDataStore(DataStoreFactory dataStoreFactory) throws IOException { return dataStoreFactory.getDataStore(DEFAULT_DATA_STORE_ID); } } TypedNotification.java000066400000000000000000000100741350651464300412670ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; /** * {@link Beta}
* Notification metadata and parsed content sent to this client about a watched resource. * *

* Implementation is not thread-safe. *

* * @param Java type of the notification content * * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public class TypedNotification extends AbstractNotification { /** Parsed notification content or {@code null} for none. */ private T content; /** * @param messageNumber message number (a monotonically increasing value starting with 1) * @param resourceState {@link ResourceStates resource state} * @param resourceId opaque ID for the watched resource that is stable across API versions * @param resourceUri opaque ID (in the form of a canonicalized URI) for the watched resource that * is sensitive to the API version * @param channelId notification channel UUID provided by the client in the watch request */ public TypedNotification(long messageNumber, String resourceState, String resourceId, String resourceUri, String channelId) { super(messageNumber, resourceState, resourceId, resourceUri, channelId); } /** * @param sourceNotification source notification metadata to copy */ public TypedNotification(UnparsedNotification sourceNotification) { super(sourceNotification); } /** * Returns the parsed notification content or {@code null} for none. */ public final T getContent() { return content; } /** * Sets the parsed notification content or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public TypedNotification setContent(T content) { this.content = content; return this; } @Override @SuppressWarnings("unchecked") public TypedNotification setMessageNumber(long messageNumber) { return (TypedNotification) super.setMessageNumber(messageNumber); } @Override @SuppressWarnings("unchecked") public TypedNotification setResourceState(String resourceState) { return (TypedNotification) super.setResourceState(resourceState); } @Override @SuppressWarnings("unchecked") public TypedNotification setResourceId(String resourceId) { return (TypedNotification) super.setResourceId(resourceId); } @Override @SuppressWarnings("unchecked") public TypedNotification setResourceUri(String resourceUri) { return (TypedNotification) super.setResourceUri(resourceUri); } @Override @SuppressWarnings("unchecked") public TypedNotification setChannelId(String channelId) { return (TypedNotification) super.setChannelId(channelId); } @Override @SuppressWarnings("unchecked") public TypedNotification setChannelExpiration(String channelExpiration) { return (TypedNotification) super.setChannelExpiration(channelExpiration); } @Override @SuppressWarnings("unchecked") public TypedNotification setChannelToken(String channelToken) { return (TypedNotification) super.setChannelToken(channelToken); } @Override @SuppressWarnings("unchecked") public TypedNotification setChanged(String changed) { return (TypedNotification) super.setChanged(changed); } @Override public String toString() { return super.toStringHelper().add("content", content).toString(); } } TypedNotificationCallback.java000066400000000000000000000074221350651464300427070ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.http.HttpMediaType; import com.google.api.client.util.Beta; import com.google.api.client.util.ObjectParser; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.nio.charset.Charset; /** * {@link Beta}
* Callback to receive notifications for watched resource in which the . Callback which is used to * receive typed {@link AbstractNotification}s after subscribing to a topic. * *

* Must NOT be implemented in form of an anonymous class as this will break serialization. *

* *

* Implementation should be thread-safe. *

* * Example usage: * *
  static class MyNotificationCallback
      extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {

    private static final long serialVersionUID = 1L;

    {@literal @}Override
    protected void onNotification(
        StoredChannel subscription, Notification notification, ListResponse content) {
      switch (notification.getResourceState()) {
        case ResourceStates.SYNC:
          break;
        case ResourceStates.EXISTS:
          break;
        case ResourceStates.NOT_EXISTS:
          break;
      }
    }

    {@literal @}Override
    protected ObjectParser getObjectParser(Notification notification) throws IOException {
      return new JsonObjectParser(new JacksonFactory());
    }

    {@literal @}Override
    protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
      return ListResponse.class;
    }
  }
 * 
* * @param Java type of the notification content * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public abstract class TypedNotificationCallback implements UnparsedNotificationCallback { private static final long serialVersionUID = 1L; /** * Handles a received typed notification. * * @param storedChannel stored notification channel * @param notification typed notification */ protected abstract void onNotification( StoredChannel storedChannel, TypedNotification notification) throws IOException; /** Returns an {@link ObjectParser} which can be used to parse this notification. */ protected abstract ObjectParser getObjectParser() throws IOException; /** * Returns the data class to parse the notification content into or {@code Void.class} if no * notification content is expected. */ protected abstract Class getDataClass() throws IOException; public final void onNotification(StoredChannel storedChannel, UnparsedNotification notification) throws IOException { TypedNotification typedNotification = new TypedNotification(notification); // TODO(yanivi): how to properly detect if there is no content? String contentType = notification.getContentType(); if (contentType != null) { Charset charset = new HttpMediaType(contentType).getCharsetParameter(); Class dataClass = Preconditions.checkNotNull(getDataClass()); typedNotification.setContent( getObjectParser().parseAndClose(notification.getContentStream(), charset, dataClass)); } onNotification(storedChannel, typedNotification); } } UnparsedNotification.java000066400000000000000000000106711350651464300417660ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; import java.io.InputStream; /** * {@link Beta}
* Notification metadata and unparsed content stream sent to this client about a watched resource. * *

* Implementation is not thread-safe. *

* * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public class UnparsedNotification extends AbstractNotification { /** Notification content media type for the content stream or {@code null} for none or unknown. */ private String contentType; /** Notification content input stream or {@code null} for none. */ private InputStream contentStream; /** * @param messageNumber message number (a monotonically increasing value starting with 1) * @param resourceState {@link ResourceStates resource state} * @param resourceId opaque ID for the watched resource that is stable across API versions * @param resourceUri opaque ID (in the form of a canonicalized URI) for the watched resource that * is sensitive to the API version * @param channelId notification channel UUID provided by the client in the watch request */ public UnparsedNotification(long messageNumber, String resourceState, String resourceId, String resourceUri, String channelId) { super(messageNumber, resourceState, resourceId, resourceUri, channelId); } /** * Returns the notification content media type for the content stream or {@code null} for none or * unknown. */ public final String getContentType() { return contentType; } /** * Sets the notification content media type for the content stream or {@code null} for none or * unknown. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public UnparsedNotification setContentType(String contentType) { this.contentType = contentType; return this; } /** * Returns the notification content input stream or {@code null} for none. */ public final InputStream getContentStream() { return contentStream; } /** * Sets the notification content content input stream or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public UnparsedNotification setContentStream(InputStream contentStream) { this.contentStream = contentStream; return this; } @Override public UnparsedNotification setMessageNumber(long messageNumber) { return (UnparsedNotification) super.setMessageNumber(messageNumber); } @Override public UnparsedNotification setResourceState(String resourceState) { return (UnparsedNotification) super.setResourceState(resourceState); } @Override public UnparsedNotification setResourceId(String resourceId) { return (UnparsedNotification) super.setResourceId(resourceId); } @Override public UnparsedNotification setResourceUri(String resourceUri) { return (UnparsedNotification) super.setResourceUri(resourceUri); } @Override public UnparsedNotification setChannelId(String channelId) { return (UnparsedNotification) super.setChannelId(channelId); } @Override public UnparsedNotification setChannelExpiration(String channelExpiration) { return (UnparsedNotification) super.setChannelExpiration(channelExpiration); } @Override public UnparsedNotification setChannelToken(String channelToken) { return (UnparsedNotification) super.setChannelToken(channelToken); } @Override public UnparsedNotification setChanged(String changed) { return (UnparsedNotification) super.setChanged(changed); } @Override public String toString() { return super.toStringHelper().add("contentType", contentType).toString(); } } UnparsedNotificationCallback.java000066400000000000000000000041471350651464300434040ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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.api.client.googleapis.notifications; import com.google.api.client.util.Beta; import java.io.IOException; import java.io.Serializable; /** * {@link Beta}
* Callback to receive unparsed notifications for watched resource. * *

* Must NOT be implemented in form of an anonymous class since this would break serialization. *

* *

* Should be thread-safe as several notifications might be processed at the same time. *

* * Example usage: * *
  static class MyNotificationCallback implements UnparsedNotificationCallback {

    private static final long serialVersionUID = 1L;

    {@literal @}Override
    public void onNotification(StoredChannel storedChannel, UnparsedNotification notification) {
      String contentType = notification.getContentType();
      InputStream contentStream = notification.getContentStream();
      switch (notification.getResourceState()) {
        case ResourceStates.SYNC:
          break;
        case ResourceStates.EXISTS:
          break;
        case ResourceStates.NOT_EXISTS:
          break;
      }
    }
  }
 * 
* * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @Beta public interface UnparsedNotificationCallback extends Serializable { /** * Handles a received unparsed notification. * * @param storedChannel stored notification channel * @param notification unparsed notification */ void onNotification(StoredChannel storedChannel, UnparsedNotification notification) throws IOException; } json/000077500000000000000000000000001350651464300357375ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notificationsJsonNotificationCallback.java000066400000000000000000000051531350651464300435030ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/* * Copyright 2013 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.api.client.googleapis.notifications.json; import com.google.api.client.googleapis.notifications.TypedNotificationCallback; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* A {@link TypedNotificationCallback} which uses an JSON content encoding. * *

* Must NOT be implemented in form of an anonymous class as this will break serialization. *

* *

* Implementation should be thread-safe. *

* * Example usage: * *
  static class MyNotificationCallback
      extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {

    private static final long serialVersionUID = 1L;

    {@literal @}Override
    protected void onNotification(
        StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) {
      ListResponse content = notification.getContent();
      switch (notification.getResourceState()) {
        case ResourceStates.SYNC:
          break;
        case ResourceStates.EXISTS:
          break;
        case ResourceStates.NOT_EXISTS:
          break;
      }
    }

    {@literal @}Override
    protected JsonFactory getJsonFactory() throws IOException {
      return new JacksonFactory();
    }

    {@literal @}Override
    protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
      return ListResponse.class;
    }
  }
 * 
* * @param Type of the data contained within a notification * @author Yaniv Inbar * @since 1.16 */ @Beta public abstract class JsonNotificationCallback extends TypedNotificationCallback { private static final long serialVersionUID = 1L; @Override protected final JsonObjectParser getObjectParser() throws IOException { return new JsonObjectParser(getJsonFactory()); } /** Returns the JSON factory to use to parse the notification content. */ protected abstract JsonFactory getJsonFactory() throws IOException; } package-info.java000066400000000000000000000015121350651464300411250ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* JSON-based notification handling for notification channels. * * @author Yaniv Inbar * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.notifications.json; package-info.java000066400000000000000000000016071350651464300401610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Support for notification channels to listen for changes to watched Google API resources. * * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.notifications; package-info.java000066400000000000000000000012661350651464300353110ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/* * Copyright 2010 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. */ /** * Google APIs. * * @since 1.0 * @author Yaniv Inbar */ package com.google.api.client.googleapis; services/000077500000000000000000000000001350651464300337405ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisAbstractGoogleClient.java000066400000000000000000000427101350651464300406460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.util.ObjectParser; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Strings; import java.io.IOException; import java.util.logging.Logger; /** * Abstract thread-safe Google client. * * @since 1.12 * @author Yaniv Inbar */ public abstract class AbstractGoogleClient { private static final Logger logger = Logger.getLogger(AbstractGoogleClient.class.getName()); /** The request factory for connections to the server. */ private final HttpRequestFactory requestFactory; /** * Initializer to use when creating an {@link AbstractGoogleClientRequest} or {@code null} for * none. */ private final GoogleClientRequestInitializer googleClientRequestInitializer; /** * Root URL of the service, for example {@code "https://www.googleapis.com/"}. Must be URL-encoded * and must end with a "/". */ private final String rootUrl; /** * Service path, for example {@code "tasks/v1/"}. Must be URL-encoded and must end with a "/". */ private final String servicePath; /** * Batch path, for example {@code "batch/tasks"}. Must be URL-encoded. */ private final String batchPath; /** * Application name to be sent in the User-Agent header of each request or {@code null} for none. */ private final String applicationName; /** Object parser or {@code null} for none. */ private final ObjectParser objectParser; /** Whether discovery pattern checks should be suppressed on required parameters. */ private final boolean suppressPatternChecks; /** Whether discovery required parameter checks should be suppressed. */ private final boolean suppressRequiredParameterChecks; /** * @param builder builder * * @since 1.14 */ protected AbstractGoogleClient(Builder builder) { googleClientRequestInitializer = builder.googleClientRequestInitializer; rootUrl = normalizeRootUrl(builder.rootUrl); servicePath = normalizeServicePath(builder.servicePath); batchPath = builder.batchPath; if (Strings.isNullOrEmpty(builder.applicationName)) { logger.warning("Application name is not set. Call Builder#setApplicationName."); } applicationName = builder.applicationName; requestFactory = builder.httpRequestInitializer == null ? builder.transport.createRequestFactory() : builder.transport.createRequestFactory(builder.httpRequestInitializer); objectParser = builder.objectParser; suppressPatternChecks = builder.suppressPatternChecks; suppressRequiredParameterChecks = builder.suppressRequiredParameterChecks; } /** * Returns the URL-encoded root URL of the service, for example * {@code "https://www.googleapis.com/"}. * *

* Must end with a "/". *

*/ public final String getRootUrl() { return rootUrl; } /** * Returns the URL-encoded service path of the service, for example {@code "tasks/v1/"}. * *

* Must end with a "/" and not begin with a "/". It is allowed to be an empty string {@code ""} or * a forward slash {@code "/"}, if it is a forward slash then it is treated as an empty string *

*/ public final String getServicePath() { return servicePath; } /** * Returns the URL-encoded base URL of the service, for example * {@code "https://www.googleapis.com/tasks/v1/"}. * *

* Must end with a "/". It is guaranteed to be equal to {@code getRootUrl() + getServicePath()}. *

*/ public final String getBaseUrl() { return rootUrl + servicePath; } /** * Returns the application name to be sent in the User-Agent header of each request or * {@code null} for none. */ public final String getApplicationName() { return applicationName; } /** Returns the HTTP request factory. */ public final HttpRequestFactory getRequestFactory() { return requestFactory; } /** Returns the Google client request initializer or {@code null} for none. */ public final GoogleClientRequestInitializer getGoogleClientRequestInitializer() { return googleClientRequestInitializer; } /** * Returns the object parser or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public ObjectParser getObjectParser() { return objectParser; } /** * Initializes a {@link AbstractGoogleClientRequest} using a * {@link GoogleClientRequestInitializer}. * *

* Must be called before the Google client request is executed, preferably right after the request * is instantiated. Sample usage: *

* *
    public class Get extends HttpClientRequest {
      ...
    }

    public Get get(String userId) throws IOException {
      Get result = new Get(userId);
      initialize(result);
      return result;
    }
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @param httpClientRequest Google client request type */ protected void initialize(AbstractGoogleClientRequest httpClientRequest) throws IOException { if (getGoogleClientRequestInitializer() != null) { getGoogleClientRequestInitializer().initialize(httpClientRequest); } } /** * Create an {@link BatchRequest} object from this Google API client instance. * *

* Sample usage: *

* *
     client.batch()
         .queue(...)
         .queue(...)
         .execute();
   * 
* * @return newly created Batch request */ public final BatchRequest batch() { return batch(null); } /** * Create an {@link BatchRequest} object from this Google API client instance. * *

* Sample usage: *

* *
     client.batch(httpRequestInitializer)
         .queue(...)
         .queue(...)
         .execute();
   * 
* * @param httpRequestInitializer The initializer to use when creating the top-level batch HTTP * request or {@code null} for none * @return newly created Batch request */ public final BatchRequest batch(HttpRequestInitializer httpRequestInitializer) { @SuppressWarnings("deprecated") BatchRequest batch = new BatchRequest(getRequestFactory().getTransport(), httpRequestInitializer); if (Strings.isNullOrEmpty(batchPath)) { batch.setBatchUrl(new GenericUrl(getRootUrl() + "batch")); } else { batch.setBatchUrl(new GenericUrl(getRootUrl() + batchPath)); } return batch; } /** Returns whether discovery pattern checks should be suppressed on required parameters. */ public final boolean getSuppressPatternChecks() { return suppressPatternChecks; } /** * Returns whether discovery required parameter checks should be suppressed. * * @since 1.14 */ public final boolean getSuppressRequiredParameterChecks() { return suppressRequiredParameterChecks; } /** If the specified root URL does not end with a "/" then a "/" is added to the end. */ static String normalizeRootUrl(String rootUrl) { Preconditions.checkNotNull(rootUrl, "root URL cannot be null."); if (!rootUrl.endsWith("/")) { rootUrl += "/"; } return rootUrl; } /** * If the specified service path does not end with a "/" then a "/" is added to the end. If the * specified service path begins with a "/" then the "/" is removed. */ static String normalizeServicePath(String servicePath) { Preconditions.checkNotNull(servicePath, "service path cannot be null"); if (servicePath.length() == 1) { Preconditions.checkArgument( "/".equals(servicePath), "service path must equal \"/\" if it is of length 1."); servicePath = ""; } else if (servicePath.length() > 0) { if (!servicePath.endsWith("/")) { servicePath += "/"; } if (servicePath.startsWith("/")) { servicePath = servicePath.substring(1); } } return servicePath; } /** * Builder for {@link AbstractGoogleClient}. * *

* Implementation is not thread-safe. *

*/ public abstract static class Builder { /** HTTP transport. */ final HttpTransport transport; /** * Initializer to use when creating an {@link AbstractGoogleClientRequest} or {@code null} for * none. */ GoogleClientRequestInitializer googleClientRequestInitializer; /** HTTP request initializer or {@code null} for none. */ HttpRequestInitializer httpRequestInitializer; /** Object parser to use for parsing responses. */ final ObjectParser objectParser; /** The root URL of the service, for example {@code "https://www.googleapis.com/"}. */ String rootUrl; /** The service path of the service, for example {@code "tasks/v1/"}. */ String servicePath; /** The batch path of the service, for example {@code "batch/tasks"}. */ String batchPath; /** * Application name to be sent in the User-Agent header of each request or {@code null} for * none. */ String applicationName; /** Whether discovery pattern checks should be suppressed on required parameters. */ boolean suppressPatternChecks; /** Whether discovery required parameter checks should be suppressed. */ boolean suppressRequiredParameterChecks; /** * Returns an instance of a new builder. * * @param transport The transport to use for requests * @param rootUrl root URL of the service. Must end with a "/" * @param servicePath service path * @param objectParser object parser or {@code null} for none * @param httpRequestInitializer HTTP request initializer or {@code null} for none */ protected Builder(HttpTransport transport, String rootUrl, String servicePath, ObjectParser objectParser, HttpRequestInitializer httpRequestInitializer) { this.transport = Preconditions.checkNotNull(transport); this.objectParser = objectParser; setRootUrl(rootUrl); setServicePath(servicePath); this.httpRequestInitializer = httpRequestInitializer; } /** Builds a new instance of {@link AbstractGoogleClient}. */ public abstract AbstractGoogleClient build(); /** Returns the HTTP transport. */ public final HttpTransport getTransport() { return transport; } /** * Returns the object parser or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public ObjectParser getObjectParser() { return objectParser; } /** * Returns the URL-encoded root URL of the service, for example * {@code https://www.googleapis.com/}. * *

* Must be URL-encoded and must end with a "/". *

*/ public final String getRootUrl() { return rootUrl; } /** * Sets the URL-encoded root URL of the service, for example {@code https://www.googleapis.com/} * . *

* If the specified root URL does not end with a "/" then a "/" is added to the end. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setRootUrl(String rootUrl) { this.rootUrl = normalizeRootUrl(rootUrl); return this; } /** * Returns the URL-encoded service path of the service, for example {@code "tasks/v1/"}. * *

* Must be URL-encoded and must end with a "/" and not begin with a "/". It is allowed to be an * empty string {@code ""}. *

*/ public final String getServicePath() { return servicePath; } /** * Sets the URL-encoded service path of the service, for example {@code "tasks/v1/"}. * *

* It is allowed to be an empty string {@code ""} or a forward slash {@code "/"}, if it is a * forward slash then it is treated as an empty string. This is determined when the library is * generated and normally should not be changed. *

* *

* If the specified service path does not end with a "/" then a "/" is added to the end. If the * specified service path begins with a "/" then the "/" is removed. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setServicePath(String servicePath) { this.servicePath = normalizeServicePath(servicePath); return this; } /** * Sets the URL-encoded batch path of the service, for example {@code "batch/tasks"}. */ public Builder setBatchPath(String batchPath) { this.batchPath = batchPath; return this; } /** Returns the Google client request initializer or {@code null} for none. */ public final GoogleClientRequestInitializer getGoogleClientRequestInitializer() { return googleClientRequestInitializer; } /** * Sets the Google client request initializer or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { this.googleClientRequestInitializer = googleClientRequestInitializer; return this; } /** Returns the HTTP request initializer or {@code null} for none. */ public final HttpRequestInitializer getHttpRequestInitializer() { return httpRequestInitializer; } /** * Sets the HTTP request initializer or {@code null} for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { this.httpRequestInitializer = httpRequestInitializer; return this; } /** * Returns the application name to be used in the UserAgent header of each request or * {@code null} for none. */ public final String getApplicationName() { return applicationName; } /** * Sets the application name to be used in the UserAgent header of each request or {@code null} * for none. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setApplicationName(String applicationName) { this.applicationName = applicationName; return this; } /** Returns whether discovery pattern checks should be suppressed on required parameters. */ public final boolean getSuppressPatternChecks() { return suppressPatternChecks; } /** * Sets whether discovery pattern checks should be suppressed on required parameters. * *

* Default value is {@code false}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { this.suppressPatternChecks = suppressPatternChecks; return this; } /** * Returns whether discovery required parameter checks should be suppressed. * * @since 1.14 */ public final boolean getSuppressRequiredParameterChecks() { return suppressRequiredParameterChecks; } /** * Sets whether discovery required parameter checks should be suppressed. * *

* Default value is {@code false}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @since 1.14 */ public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { this.suppressRequiredParameterChecks = suppressRequiredParameterChecks; return this; } /** * Suppresses all discovery pattern and required parameter checks. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

* * @since 1.14 */ public Builder setSuppressAllChecks(boolean suppressAllChecks) { return setSuppressPatternChecks(true).setSuppressRequiredParameterChecks(true); } } } AbstractGoogleClientRequest.java000066400000000000000000000551461350651464300422260ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import static com.google.common.base.StandardSystemProperty.OS_NAME; import static com.google.common.base.StandardSystemProperty.OS_VERSION; import com.google.api.client.googleapis.GoogleUtils; import com.google.api.client.googleapis.MethodOverride; import com.google.api.client.googleapis.batch.BatchCallback; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.googleapis.media.MediaHttpDownloader; import com.google.api.client.googleapis.media.MediaHttpUploader; import com.google.api.client.http.AbstractInputStreamContent; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.GZipEncoding; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpResponseException; import com.google.api.client.http.HttpResponseInterceptor; import com.google.api.client.http.UriTemplate; import com.google.api.client.util.GenericData; import com.google.api.client.util.Preconditions; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Abstract Google client request for a {@link AbstractGoogleClient}. * *

* Implementation is not thread-safe. *

* * @param type of the response * * @since 1.12 * @author Yaniv Inbar */ public abstract class AbstractGoogleClientRequest extends GenericData { /** * User agent suffix for all requests. * * @since 1.20 */ public static final String USER_AGENT_SUFFIX = "Google-API-Java-Client"; private static final String API_VERSION_HEADER = "X-Goog-Api-Client"; /** Google client. */ private final AbstractGoogleClient abstractGoogleClient; /** HTTP method. */ private final String requestMethod; /** URI template for the path relative to the base URL. */ private final String uriTemplate; /** HTTP content or {@code null} for none. */ private final HttpContent httpContent; /** HTTP headers used for the Google client request. */ private HttpHeaders requestHeaders = new HttpHeaders(); /** HTTP headers of the last response or {@code null} before request has been executed. */ private HttpHeaders lastResponseHeaders; /** Status code of the last response or {@code -1} before request has been executed. */ private int lastStatusCode = -1; /** Status message of the last response or {@code null} before request has been executed. */ private String lastStatusMessage; /** Whether to disable GZip compression of HTTP content. */ private boolean disableGZipContent; /** Response class to parse into. */ private Class responseClass; /** Media HTTP uploader or {@code null} for none. */ private MediaHttpUploader uploader; /** Media HTTP downloader or {@code null} for none. */ private MediaHttpDownloader downloader; /** * @param abstractGoogleClient Google client * @param requestMethod HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param httpContent HTTP content or {@code null} for none * @param responseClass response class to parse into */ protected AbstractGoogleClientRequest(AbstractGoogleClient abstractGoogleClient, String requestMethod, String uriTemplate, HttpContent httpContent, Class responseClass) { this.responseClass = Preconditions.checkNotNull(responseClass); this.abstractGoogleClient = Preconditions.checkNotNull(abstractGoogleClient); this.requestMethod = Preconditions.checkNotNull(requestMethod); this.uriTemplate = Preconditions.checkNotNull(uriTemplate); this.httpContent = httpContent; // application name String applicationName = abstractGoogleClient.getApplicationName(); if (applicationName != null) { requestHeaders.setUserAgent(applicationName + " " + USER_AGENT_SUFFIX); } else { requestHeaders.setUserAgent(USER_AGENT_SUFFIX); } // Set the header for the Api Client version (Java and OS version) requestHeaders.set( API_VERSION_HEADER, ApiClientVersion.getDefault().build(abstractGoogleClient.getClass().getSimpleName()) ); } /** * Internal class to help build the X-Goog-Api-Client header. This header identifies the * API Client version and environment. * * See * */ static class ApiClientVersion { private static final ApiClientVersion DEFAULT_VERSION = new ApiClientVersion(); private final String headerTemplate; ApiClientVersion() { this(getJavaVersion(), OS_NAME.value(), OS_VERSION.value(), GoogleUtils.VERSION); } ApiClientVersion(String javaVersion, String osName, String osVersion, String clientVersion) { StringBuilder sb = new StringBuilder("java/"); sb.append(formatSemver(javaVersion)); sb.append(" http-google-%s/"); sb.append(formatSemver(clientVersion)); if (osName != null && osVersion != null) { sb.append(" "); sb.append(formatName(osName)); sb.append("/"); sb.append(formatSemver(osVersion)); } this.headerTemplate = sb.toString(); } String build(String clientName) { return String.format(headerTemplate, formatName(clientName)); } private static ApiClientVersion getDefault() { return DEFAULT_VERSION; } private static String getJavaVersion() { String version = System.getProperty("java.version"); // Java 9 doesn't report a semver here: instead it's something like 9-Debian+0-x-y if (version.startsWith("9")) { return "9.0.0"; } else { return formatSemver(version); } } private static String formatName(String name) { // Only lowercase letters, digits, and "-" are allowed return name.toLowerCase().replaceAll("[^\\w\\d\\-]", "-"); } private static String formatSemver(String version) { if (version == null) { return null; } // Take only the semver version: x.y.z-a_b_c -> x.y.z Matcher m = Pattern.compile("(\\d+\\.\\d+\\.\\d+).*").matcher(version); if (m.find()) { return m.group(1); } else { return version; } } } /** Returns whether to disable GZip compression of HTTP content. */ public final boolean getDisableGZipContent() { return disableGZipContent; } /** * Sets whether to disable GZip compression of HTTP content. * *

* By default it is {@code false}. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractGoogleClientRequest setDisableGZipContent(boolean disableGZipContent) { this.disableGZipContent = disableGZipContent; return this; } /** Returns the HTTP method. */ public final String getRequestMethod() { return requestMethod; } /** Returns the URI template for the path relative to the base URL. */ public final String getUriTemplate() { return uriTemplate; } /** Returns the HTTP content or {@code null} for none. */ public final HttpContent getHttpContent() { return httpContent; } /** * Returns the Google client. * *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractGoogleClient getAbstractGoogleClient() { return abstractGoogleClient; } /** Returns the HTTP headers used for the Google client request. */ public final HttpHeaders getRequestHeaders() { return requestHeaders; } /** * Sets the HTTP headers used for the Google client request. * *

* These headers are set on the request after {@link #buildHttpRequest} is called, this means that * {@link HttpRequestInitializer#initialize} is called first. *

* *

* Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. *

*/ public AbstractGoogleClientRequest setRequestHeaders(HttpHeaders headers) { this.requestHeaders = headers; return this; } /** * Returns the HTTP headers of the last response or {@code null} before request has been executed. */ public final HttpHeaders getLastResponseHeaders() { return lastResponseHeaders; } /** * Returns the status code of the last response or {@code -1} before request has been executed. */ public final int getLastStatusCode() { return lastStatusCode; } /** * Returns the status message of the last response or {@code null} before request has been * executed. */ public final String getLastStatusMessage() { return lastStatusMessage; } /** Returns the response class to parse into. */ public final Class getResponseClass() { return responseClass; } /** Returns the media HTTP Uploader or {@code null} for none. */ public final MediaHttpUploader getMediaHttpUploader() { return uploader; } /** * Initializes the media HTTP uploader based on the media content. * * @param mediaContent media content */ protected final void initializeMediaUpload(AbstractInputStreamContent mediaContent) { HttpRequestFactory requestFactory = abstractGoogleClient.getRequestFactory(); this.uploader = new MediaHttpUploader( mediaContent, requestFactory.getTransport(), requestFactory.getInitializer()); this.uploader.setInitiationRequestMethod(requestMethod); if (httpContent != null) { this.uploader.setMetadata(httpContent); } } /** Returns the media HTTP downloader or {@code null} for none. */ public final MediaHttpDownloader getMediaHttpDownloader() { return downloader; } /** Initializes the media HTTP downloader. */ protected final void initializeMediaDownload() { HttpRequestFactory requestFactory = abstractGoogleClient.getRequestFactory(); this.downloader = new MediaHttpDownloader(requestFactory.getTransport(), requestFactory.getInitializer()); } /** * Creates a new instance of {@link GenericUrl} suitable for use against this service. * *

* Subclasses may override by calling the super implementation. *

* * @return newly created {@link GenericUrl} */ public GenericUrl buildHttpRequestUrl() { return new GenericUrl( UriTemplate.expand(abstractGoogleClient.getBaseUrl(), uriTemplate, this, true)); } /** * Create a request suitable for use against this service. * *

* Subclasses may override by calling the super implementation. *

*/ public HttpRequest buildHttpRequest() throws IOException { return buildHttpRequest(false); } /** * Create a request suitable for use against this service, but using HEAD instead of GET. * *

* Only supported when the original request method is GET. *

* *

* Subclasses may override by calling the super implementation. *

*/ protected HttpRequest buildHttpRequestUsingHead() throws IOException { return buildHttpRequest(true); } /** Create a request suitable for use against this service. */ private HttpRequest buildHttpRequest(boolean usingHead) throws IOException { Preconditions.checkArgument(uploader == null); Preconditions.checkArgument(!usingHead || requestMethod.equals(HttpMethods.GET)); String requestMethodToUse = usingHead ? HttpMethods.HEAD : requestMethod; final HttpRequest httpRequest = getAbstractGoogleClient() .getRequestFactory().buildRequest(requestMethodToUse, buildHttpRequestUrl(), httpContent); new MethodOverride().intercept(httpRequest); httpRequest.setParser(getAbstractGoogleClient().getObjectParser()); // custom methods may use POST with no content but require a Content-Length header if (httpContent == null && (requestMethod.equals(HttpMethods.POST) || requestMethod.equals(HttpMethods.PUT) || requestMethod.equals(HttpMethods.PATCH))) { httpRequest.setContent(new EmptyContent()); } httpRequest.getHeaders().putAll(requestHeaders); if (!disableGZipContent) { httpRequest.setEncoding(new GZipEncoding()); } final HttpResponseInterceptor responseInterceptor = httpRequest.getResponseInterceptor(); httpRequest.setResponseInterceptor(new HttpResponseInterceptor() { public void interceptResponse(HttpResponse response) throws IOException { if (responseInterceptor != null) { responseInterceptor.interceptResponse(response); } if (!response.isSuccessStatusCode() && httpRequest.getThrowExceptionOnExecuteError()) { throw newExceptionOnError(response); } } }); return httpRequest; } /** * Sends the metadata request to the server and returns the raw metadata {@link HttpResponse}. * *

* Callers are responsible for disconnecting the HTTP response by calling * {@link HttpResponse#disconnect}. Example usage: *

* *
     HttpResponse response = request.executeUnparsed();
     try {
       // process response..
     } finally {
       response.disconnect();
     }
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @return the {@link HttpResponse} */ public HttpResponse executeUnparsed() throws IOException { return executeUnparsed(false); } /** * Sends the media request to the server and returns the raw media {@link HttpResponse}. * *

* Callers are responsible for disconnecting the HTTP response by calling * {@link HttpResponse#disconnect}. Example usage: *

* *
     HttpResponse response = request.executeMedia();
     try {
       // process response..
     } finally {
       response.disconnect();
     }
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @return the {@link HttpResponse} */ protected HttpResponse executeMedia() throws IOException { set("alt", "media"); return executeUnparsed(); } /** * Sends the metadata request using HEAD to the server and returns the raw metadata * {@link HttpResponse} for the response headers. * *

* Only supported when the original request method is GET. The response content is assumed to be * empty and ignored. Calls {@link HttpResponse#ignore()} so there is no need to disconnect the * response. Example usage: *

* *
     HttpResponse response = request.executeUsingHead();
     // look at response.getHeaders()
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @return the {@link HttpResponse} */ protected HttpResponse executeUsingHead() throws IOException { Preconditions.checkArgument(uploader == null); HttpResponse response = executeUnparsed(true); response.ignore(); return response; } /** * Sends the metadata request using the given request method to the server and returns the raw * metadata {@link HttpResponse}. */ private HttpResponse executeUnparsed(boolean usingHead) throws IOException { HttpResponse response; if (uploader == null) { // normal request (not upload) response = buildHttpRequest(usingHead).execute(); } else { // upload request GenericUrl httpRequestUrl = buildHttpRequestUrl(); HttpRequest httpRequest = getAbstractGoogleClient() .getRequestFactory().buildRequest(requestMethod, httpRequestUrl, httpContent); boolean throwExceptionOnExecuteError = httpRequest.getThrowExceptionOnExecuteError(); response = uploader.setInitiationHeaders(requestHeaders) .setDisableGZipContent(disableGZipContent).upload(httpRequestUrl); response.getRequest().setParser(getAbstractGoogleClient().getObjectParser()); // process any error if (throwExceptionOnExecuteError && !response.isSuccessStatusCode()) { throw newExceptionOnError(response); } } // process response lastResponseHeaders = response.getHeaders(); lastStatusCode = response.getStatusCode(); lastStatusMessage = response.getStatusMessage(); return response; } /** * Returns the exception to throw on an HTTP error response as defined by * {@link HttpResponse#isSuccessStatusCode()}. * *

* It is guaranteed that {@link HttpResponse#isSuccessStatusCode()} is {@code false}. Default * implementation is to call {@link HttpResponseException#HttpResponseException(HttpResponse)}, * but subclasses may override. *

* * @param response HTTP response * @return exception to throw */ protected IOException newExceptionOnError(HttpResponse response) { return new HttpResponseException(response); } /** * Sends the metadata request to the server and returns the parsed metadata response. * *

* Subclasses may override by calling the super implementation. *

* * @return parsed HTTP response */ public T execute() throws IOException { return executeUnparsed().parseAs(responseClass); } /** * Sends the metadata request to the server and returns the metadata content input stream of * {@link HttpResponse}. * *

* Callers are responsible for closing the input stream after it is processed. Example sample: *

* *
     InputStream is = request.executeAsInputStream();
     try {
       // Process input stream..
     } finally {
       is.close();
     }
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @return input stream of the response content */ public InputStream executeAsInputStream() throws IOException { return executeUnparsed().getContent(); } /** * Sends the media request to the server and returns the media content input stream of * {@link HttpResponse}. * *

* Callers are responsible for closing the input stream after it is processed. Example sample: *

* *
     InputStream is = request.executeMediaAsInputStream();
     try {
       // Process input stream..
     } finally {
       is.close();
     }
   * 
* *

* Subclasses may override by calling the super implementation. *

* * @return input stream of the response content */ protected InputStream executeMediaAsInputStream() throws IOException { return executeMedia().getContent(); } /** * Sends the metadata request to the server and writes the metadata content input stream of * {@link HttpResponse} into the given destination output stream. * *

* This method closes the content of the HTTP response from {@link HttpResponse#getContent()}. *

* *

* Subclasses may override by calling the super implementation. *

* * @param outputStream destination output stream */ public void executeAndDownloadTo(OutputStream outputStream) throws IOException { executeUnparsed().download(outputStream); } /** * Sends the media request to the server and writes the media content input stream of * {@link HttpResponse} into the given destination output stream. * *

* This method closes the content of the HTTP response from {@link HttpResponse#getContent()}. *

* *

* Subclasses may override by calling the super implementation. *

* * @param outputStream destination output stream */ protected void executeMediaAndDownloadTo(OutputStream outputStream) throws IOException { if (downloader == null) { executeMedia().download(outputStream); } else { downloader.download(buildHttpRequestUrl(), requestHeaders, outputStream); } } /** * Queues the request into the specified batch request container using the specified error class. * *

* Batched requests are then executed when {@link BatchRequest#execute()} is called. *

* * @param batchRequest batch request container * @param errorClass data class the unsuccessful response will be parsed into or * {@code Void.class} to ignore the content * @param callback batch callback */ public final void queue( BatchRequest batchRequest, Class errorClass, BatchCallback callback) throws IOException { Preconditions.checkArgument(uploader == null, "Batching media requests is not supported"); batchRequest.queue(buildHttpRequest(), getResponseClass(), errorClass, callback); } // @SuppressWarnings was added here because this is generic class. // see: http://stackoverflow.com/questions/4169806/java-casting-object-to-a-generic-type and // http://www.angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#Type%20Erasure // for more details @SuppressWarnings("unchecked") @Override public AbstractGoogleClientRequest set(String fieldName, Object value) { return (AbstractGoogleClientRequest) super.set(fieldName, value); } /** * Ensures that the specified required parameter is not null or * {@link AbstractGoogleClient#getSuppressRequiredParameterChecks()} is true. * * @param value the value of the required parameter * @param name the name of the required parameter * @throws IllegalArgumentException if the specified required parameter is null and * {@link AbstractGoogleClient#getSuppressRequiredParameterChecks()} is false * @since 1.14 */ protected final void checkRequiredParameter(Object value, String name) { Preconditions.checkArgument( abstractGoogleClient.getSuppressRequiredParameterChecks() || value != null, "Required parameter %s must be specified", name); } } CommonGoogleClientRequestInitializer.java000066400000000000000000000070631350651464300441120ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import java.io.IOException; /** * Google common client request initializer implementation for setting properties like key and * userIp. * *

* The simplest usage is to use it to set the key parameter: *

* *
  public static final GoogleClientRequestInitializer KEY_INITIALIZER =
      new CommonGoogleClientRequestInitializer(KEY);
 * 
* *

* There is also a constructor to set both the key and userIp parameters: *

* *
  public static final GoogleClientRequestInitializer INITIALIZER =
      new CommonGoogleClientRequestInitializer(KEY, USER_IP);
 * 
* *

* If you want to implement custom logic, extend it like this: *

* *
  public static class MyRequestInitializer extends CommonGoogleClientRequestInitializer {

    {@literal @}Override
    public void initialize(AbstractGoogleClientRequest{@literal <}?{@literal >} request)
        throws IOException {
      // custom logic
    }
  }
 * 
* *

* Finally, to set the key and userIp parameters and insert custom logic, extend it like this: *

* *
  public static class MyRequestInitializer2 extends CommonGoogleClientRequestInitializer {

    public MyRequestInitializer2() {
      super(KEY, USER_IP);
    }

    {@literal @}Override
    public void initialize(AbstractGoogleClientRequest{@literal <}?{@literal >} request)
        throws IOException {
      super.initialize(request); // must be called to set the key and userIp parameters
      // insert some additional logic
    }
  }
 * 
* *

* Subclasses should be thread-safe. *

* * @since 1.12 * @author Yaniv Inbar */ public class CommonGoogleClientRequestInitializer implements GoogleClientRequestInitializer { /** API key or {@code null} to leave it unchanged. */ private final String key; /** User IP or {@code null} to leave it unchanged. */ private final String userIp; public CommonGoogleClientRequestInitializer() { this(null); } /** * @param key API key or {@code null} to leave it unchanged */ public CommonGoogleClientRequestInitializer(String key) { this(key, null); } /** * @param key API key or {@code null} to leave it unchanged * @param userIp user IP or {@code null} to leave it unchanged */ public CommonGoogleClientRequestInitializer(String key, String userIp) { this.key = key; this.userIp = userIp; } /** * Subclasses should call super implementation in order to set the key and userIp. * * @throws IOException I/O exception */ public void initialize(AbstractGoogleClientRequest request) throws IOException { if (key != null) { request.put("key", key); } if (userIp != null) { request.put("userIp", userIp); } } /** Returns the API key or {@code null} to leave it unchanged. */ public final String getKey() { return key; } /** Returns the user IP or {@code null} to leave it unchanged. */ public final String getUserIp() { return userIp; } } GoogleClientRequestInitializer.java000066400000000000000000000023621350651464300427360ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import java.io.IOException; /** * Google client request initializer. * *

* For example, this might be used to set a key URL query parameter on all requests: *

* *
  public class KeyRequestInitializer implements GoogleClientRequestInitializer {
    public void initialize(GoogleClientRequest request) {
      request.put("key", KEY);
    }
  }
 * 
* *

* Implementations should be thread-safe. *

* * @since 1.12 * @author Yaniv Inbar */ public interface GoogleClientRequestInitializer { /** Initializes a Google client request. */ void initialize(AbstractGoogleClientRequest request) throws IOException; } json/000077500000000000000000000000001350651464300347115ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/servicesAbstractGoogleJsonClient.java000066400000000000000000000104261350651464300424500ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/* * Copyright 2012 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.api.client.googleapis.services.json; import com.google.api.client.googleapis.services.AbstractGoogleClient; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import java.util.Arrays; import java.util.Collections; /** * Thread-safe Google JSON client. * * @since 1.12 * @author Yaniv Inbar */ public abstract class AbstractGoogleJsonClient extends AbstractGoogleClient { /** * @param builder builder * * @since 1.14 */ protected AbstractGoogleJsonClient(Builder builder) { super(builder); } @Override public JsonObjectParser getObjectParser() { return (JsonObjectParser) super.getObjectParser(); } /** Returns the JSON Factory. */ public final JsonFactory getJsonFactory() { return getObjectParser().getJsonFactory(); } /** * Builder for {@link AbstractGoogleJsonClient}. * *

* Implementation is not thread-safe. *

*/ public abstract static class Builder extends AbstractGoogleClient.Builder { /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @param legacyDataWrapper whether using the legacy data wrapper in responses */ protected Builder(HttpTransport transport, JsonFactory jsonFactory, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer, boolean legacyDataWrapper) { super(transport, rootUrl, servicePath, new JsonObjectParser.Builder( jsonFactory).setWrapperKeys( legacyDataWrapper ? Arrays.asList("data", "error") : Collections.emptySet()) .build(), httpRequestInitializer); } @Override public final JsonObjectParser getObjectParser() { return (JsonObjectParser) super.getObjectParser(); } /** Returns the JSON Factory. */ public final JsonFactory getJsonFactory() { return getObjectParser().getJsonFactory(); } @Override public abstract AbstractGoogleJsonClient build(); @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } } } AbstractGoogleJsonClientRequest.java000066400000000000000000000111731350651464300440210ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/* * Copyright 2012 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.api.client.googleapis.services.json; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.googleapis.batch.json.JsonBatchCallback; import com.google.api.client.googleapis.json.GoogleJsonErrorContainer; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.UriTemplate; import com.google.api.client.http.json.JsonHttpContent; import java.io.IOException; /** * Google JSON request for a {@link AbstractGoogleJsonClient}. * *

* Implementation is not thread-safe. *

* * @param type of the response * @since 1.12 * @author Yaniv Inbar */ public abstract class AbstractGoogleJsonClientRequest extends AbstractGoogleClientRequest { /** POJO that can be serialized into JSON content or {@code null} for none. */ private final Object jsonContent; /** * @param abstractGoogleJsonClient Google JSON client * @param requestMethod HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param jsonContent POJO that can be serialized into JSON content or {@code null} for none * @param responseClass response class to parse into */ protected AbstractGoogleJsonClientRequest(AbstractGoogleJsonClient abstractGoogleJsonClient, String requestMethod, String uriTemplate, Object jsonContent, Class responseClass) { super(abstractGoogleJsonClient, requestMethod, uriTemplate, jsonContent == null ? null : new JsonHttpContent(abstractGoogleJsonClient.getJsonFactory(), jsonContent) .setWrapperKey(abstractGoogleJsonClient.getObjectParser().getWrapperKeys().isEmpty() ? null : "data"), responseClass); this.jsonContent = jsonContent; } @Override public AbstractGoogleJsonClient getAbstractGoogleClient() { return (AbstractGoogleJsonClient) super.getAbstractGoogleClient(); } @Override public AbstractGoogleJsonClientRequest setDisableGZipContent(boolean disableGZipContent) { return (AbstractGoogleJsonClientRequest) super.setDisableGZipContent(disableGZipContent); } @Override public AbstractGoogleJsonClientRequest setRequestHeaders(HttpHeaders headers) { return (AbstractGoogleJsonClientRequest) super.setRequestHeaders(headers); } /** * Queues the request into the specified batch request container. * *

* Batched requests are then executed when {@link BatchRequest#execute()} is called. *

*

* Example usage: *

* *
     request.queue(batchRequest, new JsonBatchCallback<SomeResponseType>() {

       public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) {
         log("Success");
       }

       public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
         log(e.getMessage());
       }
     });
   * 
* * * @param batchRequest batch request container * @param callback batch callback */ public final void queue(BatchRequest batchRequest, JsonBatchCallback callback) throws IOException { super.queue(batchRequest, GoogleJsonErrorContainer.class, callback); } @Override protected GoogleJsonResponseException newExceptionOnError(HttpResponse response) { return GoogleJsonResponseException.from(getAbstractGoogleClient().getJsonFactory(), response); } /** Returns POJO that can be serialized into JSON content or {@code null} for none. */ public Object getJsonContent() { return jsonContent; } @Override public AbstractGoogleJsonClientRequest set(String fieldName, Object value) { return (AbstractGoogleJsonClientRequest) super.set(fieldName, value); } } CommonGoogleJsonClientRequestInitializer.java000066400000000000000000000067221350651464300457160ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/* * Copyright 2012 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.api.client.googleapis.services.json; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.googleapis.services.CommonGoogleClientRequestInitializer; import java.io.IOException; /** * Google JSON client request initializer implementation for setting properties like key and userIp. * *

* The simplest usage is to use it to set the key parameter: *

* *
  public static final GoogleClientRequestInitializer KEY_INITIALIZER =
      new CommonGoogleJsonClientRequestInitializer(KEY);
 * 
* *

* There is also a constructor to set both the key and userIp parameters: *

* *
  public static final GoogleClientRequestInitializer INITIALIZER =
      new CommonGoogleJsonClientRequestInitializer(KEY, USER_IP);
 * 
* *

* If you want to implement custom logic, extend it like this: *

* *
  public static class MyRequestInitializer extends CommonGoogleJsonClientRequestInitializer {

    {@literal @}Override
    public void initialize(AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request)
        throws IOException {
      // custom logic
    }
  }
 * 
* *

* Finally, to set the key and userIp parameters and insert custom logic, extend it like this: *

* *
  public static class MyKeyRequestInitializer extends CommonGoogleJsonClientRequestInitializer {

    public MyKeyRequestInitializer() {
      super(KEY, USER_IP);
    }

    {@literal @}Override
    public void initializeJsonRequest(
        AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request) throws IOException {
      // custom logic
    }
  }
 * 
* *

* Subclasses should be thread-safe. *

* * @since 1.12 * @author Yaniv Inbar */ public class CommonGoogleJsonClientRequestInitializer extends CommonGoogleClientRequestInitializer { public CommonGoogleJsonClientRequestInitializer() { super(); } /** * @param key API key or {@code null} to leave it unchanged */ public CommonGoogleJsonClientRequestInitializer(String key) { super(key); } /** * @param key API key or {@code null} to leave it unchanged * @param userIp user IP or {@code null} to leave it unchanged */ public CommonGoogleJsonClientRequestInitializer(String key, String userIp) { super(key, userIp); } @Override public final void initialize(AbstractGoogleClientRequest request) throws IOException { super.initialize(request); initializeJsonRequest((AbstractGoogleJsonClientRequest) request); } /** * Initializes a Google JSON client request. * *

* Default implementation does nothing. Called from * {@link #initialize(AbstractGoogleClientRequest)}. *

* * @throws IOException I/O exception */ protected void initializeJsonRequest(AbstractGoogleJsonClientRequest request) throws IOException { } } package-info.java000066400000000000000000000014221350651464300400770ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/* * Copyright 2012 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. */ /** * Contains the basis for the generated service-specific libraries based on the JSON format. * * @since 1.12 * @author Yaniv Inbar */ package com.google.api.client.googleapis.services.json; package-info.java000066400000000000000000000013631350651464300371320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/services/* * Copyright 2010 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. */ /** * Contains the basis for the generated service-specific libraries. * * @since 1.6 * @author Ravi Mistry */ package com.google.api.client.googleapis.services; testing/000077500000000000000000000000001350651464300335725ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapisTestUtils.java000066400000000000000000000030561350651464300364010ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/* * Copyright 2014 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.api.client.googleapis.testing; import com.google.common.base.Splitter; import com.google.common.collect.Lists; import java.io.IOException; import java.net.URLDecoder; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Utility class for test code. */ public final class TestUtils { private static final String UTF_8 = "UTF-8"; public static Map parseQuery(String query) throws IOException { Map map = new HashMap(); Iterable entries = Splitter.on('&').split(query); for (String entry : entries) { List sides = Lists.newArrayList(Splitter.on('=').split(entry)); if (sides.size() != 2) { throw new IOException("Invalid Query String"); } String key = URLDecoder.decode(sides.get(0), UTF_8); String value = URLDecoder.decode(sides.get(1), UTF_8); map.put(key, value); } return map; } private TestUtils() { } } auth/000077500000000000000000000000001350651464300345335ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testingoauth2/000077500000000000000000000000001350651464300357355ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/authMockGoogleCredential.java000066400000000000000000000112141350651464300426200ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/auth/oauth2package com.google.api.client.googleapis.testing.auth.oauth2; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Beta; import com.google.api.client.util.Clock; import java.io.IOException; /** * {@link Beta}
* Mock for {@link GoogleCredential}. * * @since 1.20 */ @Beta public class MockGoogleCredential extends GoogleCredential { public static final String ACCESS_TOKEN = "access_xyz"; public static final String REFRESH_TOKEN = "refresh123"; private static final String EXPIRES_IN_SECONDS = "3600"; private static final String TOKEN_TYPE = "Bearer"; private static final String TOKEN_RESPONSE = "{" + "\"access_token\": \"%s\", " + "\"expires_in\": %s, " + "\"refresh_token\": \"%s\", " + "\"token_type\": \"%s\"" + "}"; private static final String DEFAULT_TOKEN_RESPONSE_JSON = String.format(TOKEN_RESPONSE, ACCESS_TOKEN, EXPIRES_IN_SECONDS, REFRESH_TOKEN, TOKEN_TYPE); public MockGoogleCredential(Builder builder) { super(builder); } /** * Mock for GoogleCredential.Builder. * *

Setters that are necessary for simple {@link GoogleCredential} creation are overridden in * order to change the return type. A concrete {@link JsonFactory} is set by default, since JSON * parsing is relied upon often in GoogleCredential which makes mocking parse calls problematic. *

* *

By default, a standard {@link MockHttpTransport} is supplied. For simple tests in which * 'refresh' methods are called but the request/response isn't used * {@link #newMockHttpTransportWithSampleTokenResponse()} provides a minimal implementation. For * more complex tests which check request/response behavior prefer MockTokenServerTransport.

*/ @Beta public static class Builder extends GoogleCredential.Builder { @Override public Builder setTransport(HttpTransport transport) { return (MockGoogleCredential.Builder) super.setTransport(transport); } @Override public Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication) { return (MockGoogleCredential.Builder) super.setClientAuthentication(clientAuthentication); } @Override public Builder setJsonFactory(JsonFactory jsonFactory) { return (MockGoogleCredential.Builder) super.setJsonFactory(jsonFactory); } @Override public Builder setClock(Clock clock) { return (MockGoogleCredential.Builder) super.setClock(clock); } @Override public MockGoogleCredential build() { if (getTransport() == null) { setTransport(new MockHttpTransport.Builder().build()); } if (getClientAuthentication() == null) { setClientAuthentication(new MockClientAuthentication()); } if (getJsonFactory() == null) { setJsonFactory(new JacksonFactory()); } return new MockGoogleCredential(this); } } /** * Returns a new {@link MockHttpTransport} with a sample {@link MockLowLevelHttpResponse}. The * response includes sample TokenResponse content as specified in DEFAULT_TOKEN_RESPONSE_JSON. This * is meant to produce a minimal implementation that allows methods such as * {@link GoogleCredential#executeRefreshToken()} to be called without failing abruptly. This * content is static. If you are making assertions based on the content of the request, then * MockTokenServerTransport should be used instead. * * @return mockHttpTransport */ public static MockHttpTransport newMockHttpTransportWithSampleTokenResponse() { MockLowLevelHttpResponse mockLowLevelHttpResponse = new MockLowLevelHttpResponse() .setContentType(Json.MEDIA_TYPE) .setContent(DEFAULT_TOKEN_RESPONSE_JSON); MockLowLevelHttpRequest request = new MockLowLevelHttpRequest() .setResponse(mockLowLevelHttpResponse); return new MockHttpTransport.Builder() .setLowLevelHttpRequest(request) .build(); } /** * Mock for ClientAuthentication. */ @Beta private static class MockClientAuthentication implements HttpExecuteInterceptor { @Override public void intercept(HttpRequest request) throws IOException { // pass } } } MockTokenServerTransport.java000066400000000000000000000125721350651464300436050ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/auth/oauth2/* * Copyright 2014 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.api.client.googleapis.testing.auth.oauth2; import com.google.api.client.googleapis.auth.oauth2.GoogleOAuthConstants; import com.google.api.client.googleapis.testing.TestUtils; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.GenericJson; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.json.webtoken.JsonWebSignature; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Beta; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * {@link Beta}
* A test transport that simulates Google's token server for refresh tokens and service accounts. * * @since 1.19 */ @Beta public class MockTokenServerTransport extends MockHttpTransport { static final String EXPECTED_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer"; static final JsonFactory JSON_FACTORY = new JacksonFactory(); final String tokenServerUrl; Map serviceAccounts = new HashMap(); Map clients = new HashMap(); Map refreshTokens = new HashMap(); public MockTokenServerTransport() { this(GoogleOAuthConstants.TOKEN_SERVER_URL); } public MockTokenServerTransport(String tokenServerUrl) { this.tokenServerUrl = tokenServerUrl; } public void addServiceAccount(String email, String accessToken) { serviceAccounts.put(email, accessToken); } public void addClient(String clientId, String clientSecret) { clients.put(clientId, clientSecret); } public void addRefreshToken(String refreshToken, String accessTokenToReturn) { refreshTokens.put(refreshToken, accessTokenToReturn); } @Override public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { if (url.equals(tokenServerUrl)) { MockLowLevelHttpRequest request = new MockLowLevelHttpRequest(url) { @Override public LowLevelHttpResponse execute() throws IOException { String content = this.getContentAsString(); Map query = TestUtils.parseQuery(content); String accessToken = null; String foundId = query.get("client_id"); if (foundId != null) { if (!clients.containsKey(foundId)) { throw new IOException("Client ID not found."); } String foundSecret = query.get("client_secret"); String expectedSecret = clients.get(foundId); if (foundSecret == null || !foundSecret.equals(expectedSecret)) { throw new IOException("Client secret not found."); } String foundRefresh = query.get("refresh_token"); if (!refreshTokens.containsKey(foundRefresh)) { throw new IOException("Refresh Token not found."); } accessToken = refreshTokens.get(foundRefresh); } else if (query.containsKey("grant_type")) { String grantType = query.get("grant_type"); if (!EXPECTED_GRANT_TYPE.equals(grantType)) { throw new IOException("Unexpected Grant Type."); } String assertion = query.get("assertion"); JsonWebSignature signature = JsonWebSignature.parse(JSON_FACTORY, assertion); String foundEmail = signature.getPayload().getIssuer(); if (!serviceAccounts.containsKey(foundEmail)) { throw new IOException("Service Account Email not found as issuer."); } accessToken = serviceAccounts.get(foundEmail); String foundScopes = (String) signature.getPayload().get("scope"); if (foundScopes == null || foundScopes.length() == 0) { throw new IOException("Scopes not found."); } } else { throw new IOException("Unknown token type."); } // Create the JSon response GenericJson refreshContents = new GenericJson(); refreshContents.setFactory(JSON_FACTORY); refreshContents.put("access_token", accessToken); refreshContents.put("expires_in", 3600000); refreshContents.put("token_type", "Bearer"); String refreshText = refreshContents.toPrettyString(); MockLowLevelHttpResponse response = new MockLowLevelHttpResponse() .setContentType(Json.MEDIA_TYPE) .setContent(refreshText); return response; } }; return request; } return super.buildRequest(method, url); } } package-info.java000066400000000000000000000015151350651464300411260ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/auth/oauth2/* * Copyright 2014 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.auth.oauth2} package. * * @since 1.19 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.auth.oauth2; compute/000077500000000000000000000000001350651464300352465ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testingMockMetadataServerTransport.java000066400000000000000000000075531350651464300435610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/compute/* * Copyright 2014 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.api.client.googleapis.testing.compute; import com.google.api.client.googleapis.auth.oauth2.OAuth2Utils; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.GenericJson; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Transport that simulates the GCE metadata server for access tokens. * * @since 1.19 */ @Beta public class MockMetadataServerTransport extends MockHttpTransport { private static final String METADATA_SERVER_URL = OAuth2Utils.getMetadataServerUrl(); private static final String METADATA_TOKEN_SERVER_URL = METADATA_SERVER_URL + "/computeMetadata/v1/instance/service-accounts/default/token"; static final JsonFactory JSON_FACTORY = new JacksonFactory(); String accessToken; Integer tokenRequestStatusCode; public MockMetadataServerTransport(String accessToken) { this.accessToken = accessToken; } public void setTokenRequestStatusCode(Integer tokenRequestStatusCode) { this.tokenRequestStatusCode = tokenRequestStatusCode; } @Override public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { if (url.equals(METADATA_TOKEN_SERVER_URL)) { MockLowLevelHttpRequest request = new MockLowLevelHttpRequest(url) { @Override public LowLevelHttpResponse execute() throws IOException { if (tokenRequestStatusCode != null) { MockLowLevelHttpResponse response = new MockLowLevelHttpResponse() .setStatusCode(tokenRequestStatusCode) .setContent("Token Fetch Error"); return response; } String metadataRequestHeader = getFirstHeaderValue("Metadata-Flavor"); if (!"Google".equals(metadataRequestHeader)) { throw new IOException("Metadata request header not found."); } // Create the JSon response GenericJson refreshContents = new GenericJson(); refreshContents.setFactory(JSON_FACTORY); refreshContents.put("access_token", accessToken); refreshContents.put("expires_in", 3600000); refreshContents.put("token_type", "Bearer"); String refreshText = refreshContents.toPrettyString(); MockLowLevelHttpResponse response = new MockLowLevelHttpResponse() .setContentType(Json.MEDIA_TYPE) .setContent(refreshText); return response; } }; return request; } else if (url.equals(METADATA_SERVER_URL)) { MockLowLevelHttpRequest request = new MockLowLevelHttpRequest(url) { @Override public LowLevelHttpResponse execute() { MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); response.addHeader("Metadata-Flavor", "Google"); return response; } }; return request; } return super.buildRequest(method, url); } } package-info.java000066400000000000000000000015051350651464300404360ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/compute/* * Copyright 2014 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.compute} package. * * @since 1.19 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.compute; json/000077500000000000000000000000001350651464300345435ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testingGoogleJsonResponseExceptionFactoryTesting.java000066400000000000000000000062351350651464300457460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/json/* * Copyright 2013 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.api.client.googleapis.testing.json; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.json.JsonFactory; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Factory class that builds {@link GoogleJsonResponseException} instances for * testing. * * @since 1.18 */ @Beta public final class GoogleJsonResponseExceptionFactoryTesting { /** * Convenience factory method that builds a {@link GoogleJsonResponseException} * from its arguments. The method builds a dummy {@link HttpRequest} and * {@link HttpResponse}, sets the response's status to a user-specified HTTP * error code, suppresses exceptions, and executes the request. This forces * the underlying framework to create, but not throw, a * {@link GoogleJsonResponseException}, which the method retrieves and returns * to the invoker. * * @param jsonFactory the JSON factory that will create all JSON required * by the underlying framework * @param httpCode the desired HTTP error code. Note: do nut specify any codes * that indicate successful completion, e.g. 2XX. * @param reasonPhrase the HTTP reason code that explains the error. For example, * if {@code httpCode} is {@code 404}, the reason phrase should be * {@code NOT FOUND}. * @return the generated {@link GoogleJsonResponseException}, as specified. * @throws IOException if request transport fails. */ public static GoogleJsonResponseException newMock(JsonFactory jsonFactory, int httpCode, String reasonPhrase) throws IOException { MockLowLevelHttpResponse otherServiceUnavaiableLowLevelResponse = new MockLowLevelHttpResponse() .setStatusCode(httpCode) .setReasonPhrase(reasonPhrase); MockHttpTransport otherTransport = new MockHttpTransport.Builder() .setLowLevelHttpResponse(otherServiceUnavaiableLowLevelResponse) .build(); HttpRequest otherRequest = otherTransport .createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); otherRequest.setThrowExceptionOnExecuteError(false); HttpResponse otherServiceUnavailableResponse = otherRequest.execute(); return GoogleJsonResponseException.from(jsonFactory, otherServiceUnavailableResponse); } } package-info.java000066400000000000000000000014771350651464300377430ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/json/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.json} package. * * @since 1.18 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.json; notifications/000077500000000000000000000000001350651464300364435ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testingMockUnparsedNotificationCallback.java000066400000000000000000000032501350651464300456650ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/notifications/* * Copyright 2013 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.api.client.googleapis.testing.notifications; import com.google.api.client.googleapis.notifications.StoredChannel; import com.google.api.client.googleapis.notifications.UnparsedNotification; import com.google.api.client.googleapis.notifications.UnparsedNotificationCallback; import com.google.api.client.util.Beta; import java.io.IOException; /** * {@link Beta}
* Mock for the {@link UnparsedNotificationCallback} class. * * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @SuppressWarnings("rawtypes") @Beta public class MockUnparsedNotificationCallback implements UnparsedNotificationCallback { private static final long serialVersionUID = 0L; /** Whether this handler was called. */ private boolean wasCalled; /** Returns whether this handler was called. */ public boolean wasCalled() { return wasCalled; } public MockUnparsedNotificationCallback() { } @SuppressWarnings("unused") public void onNotification(StoredChannel storedChannel, UnparsedNotification notification) throws IOException { wasCalled = true; } } package-info.java000066400000000000000000000016151350651464300416350ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/notifications/* * Copyright 2013 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.notifications} package. * * @author Yaniv Inbar * @author Matthias Linder (mlinder) * @since 1.16 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.notifications; package-info.java000066400000000000000000000014651350651464300367670ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/* * Copyright 2014 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis} package. * * @since 1.19 */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing; services/000077500000000000000000000000001350651464300354155ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testingMockGoogleClient.java000066400000000000000000000101051350651464300414420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/* * 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.api.client.googleapis.testing.services; import com.google.api.client.googleapis.services.AbstractGoogleClient; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.util.Beta; import com.google.api.client.util.ObjectParser; /** * {@link Beta}
* Thread-safe mock Google client. * * @since 1.12 * @author Yaniv Inbar */ @Beta public class MockGoogleClient extends AbstractGoogleClient { /** * @param transport The transport to use for requests * @param rootUrl root URL of the service. Must end with a "/" * @param servicePath service path * @param objectParser object parser or {@code null} for none * @param httpRequestInitializer HTTP request initializer or {@code null} for none * * @since 1.14 */ public MockGoogleClient(HttpTransport transport, String rootUrl, String servicePath, ObjectParser objectParser, HttpRequestInitializer httpRequestInitializer) { this(new Builder(transport, rootUrl, servicePath, objectParser, httpRequestInitializer)); } /** * @param builder builder * * @since 1.14 */ protected MockGoogleClient(Builder builder) { super(builder); } /** * Builder for {@link MockGoogleClient}. * *

* Implementation is not thread-safe. *

*/ @Beta public static class Builder extends AbstractGoogleClient.Builder { /** * @param transport The transport to use for requests * @param rootUrl root URL of the service. Must end with a "/" * @param servicePath service path * @param objectParser object parser or {@code null} for none * @param httpRequestInitializer HTTP request initializer or {@code null} for none */ public Builder(HttpTransport transport, String rootUrl, String servicePath, ObjectParser objectParser, HttpRequestInitializer httpRequestInitializer) { super(transport, rootUrl, servicePath, objectParser, httpRequestInitializer); } @Override public MockGoogleClient build() { return new MockGoogleClient(this); } @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } } } MockGoogleClientRequest.java000066400000000000000000000046011350651464300430170ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/* * 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.api.client.googleapis.testing.services; import com.google.api.client.googleapis.services.AbstractGoogleClient; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.UriTemplate; import com.google.api.client.util.Beta; /** * {@link Beta}
* Thread-safe mock Google request. * * @param type of the response * @since 1.12 * @author Yaniv Inbar */ @Beta public class MockGoogleClientRequest extends AbstractGoogleClientRequest { /** * @param client Google client * @param method HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param content HTTP content or {@code null} for none * @param responseClass response class to parse into */ public MockGoogleClientRequest(AbstractGoogleClient client, String method, String uriTemplate, HttpContent content, Class responseClass) { super(client, method, uriTemplate, content, responseClass); } @Override public MockGoogleClientRequest setDisableGZipContent(boolean disableGZipContent) { return (MockGoogleClientRequest) super.setDisableGZipContent(disableGZipContent); } @Override public MockGoogleClientRequest setRequestHeaders(HttpHeaders headers) { return (MockGoogleClientRequest) super.setRequestHeaders(headers); } @Override public MockGoogleClientRequest set(String fieldName, Object value) { return (MockGoogleClientRequest) super.set(fieldName, value); } } json/000077500000000000000000000000001350651464300363665ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/servicesMockGoogleJsonClient.java000066400000000000000000000104171350651464300432530ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/json/* * 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.api.client.googleapis.testing.services.json; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.util.Beta; /** * {@link Beta}
* Thread-safe mock Google JSON client. * * @since 1.12 * @author Yaniv Inbar */ @Beta public class MockGoogleJsonClient extends AbstractGoogleJsonClient { /** * @param builder builder * * @since 1.14 */ protected MockGoogleJsonClient(Builder builder) { super(builder); } /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @param legacyDataWrapper whether using the legacy data wrapper in responses */ public MockGoogleJsonClient(HttpTransport transport, JsonFactory jsonFactory, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer, boolean legacyDataWrapper) { this(new Builder( transport, jsonFactory, rootUrl, servicePath, httpRequestInitializer, legacyDataWrapper)); } /** * {@link Beta}
* Builder for {@link MockGoogleJsonClient}. * *

* Implementation is not thread-safe. *

*/ @Beta public static class Builder extends AbstractGoogleJsonClient.Builder { /** * @param transport HTTP transport * @param jsonFactory JSON factory * @param rootUrl root URL of the service * @param servicePath service path * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @param legacyDataWrapper whether using the legacy data wrapper in responses */ public Builder(HttpTransport transport, JsonFactory jsonFactory, String rootUrl, String servicePath, HttpRequestInitializer httpRequestInitializer, boolean legacyDataWrapper) { super( transport, jsonFactory, rootUrl, servicePath, httpRequestInitializer, legacyDataWrapper); } @Override public MockGoogleJsonClient build() { return new MockGoogleJsonClient(this); } @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } } } MockGoogleJsonClientRequest.java000066400000000000000000000045331350651464300446260ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/json/* * 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.api.client.googleapis.testing.services.json; import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient; import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.UriTemplate; import com.google.api.client.util.Beta; /** * {@link Beta}
* Thread-safe mock Google JSON request. * * @param type of the response * @since 1.12 * @author Yaniv Inbar */ @Beta public class MockGoogleJsonClientRequest extends AbstractGoogleJsonClientRequest { /** * @param client Google client * @param method HTTP Method * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/" * the base path from the base URL will be stripped out. The URI template can also be a * full URL. URI template expansion is done using * {@link UriTemplate#expand(String, String, Object, boolean)} * @param content A POJO that can be serialized into JSON or {@code null} for none */ public MockGoogleJsonClientRequest(AbstractGoogleJsonClient client, String method, String uriTemplate, Object content, Class responseClass) { super(client, method, uriTemplate, content, responseClass); } @Override public MockGoogleJsonClient getAbstractGoogleClient() { return (MockGoogleJsonClient) super.getAbstractGoogleClient(); } @Override public MockGoogleJsonClientRequest setDisableGZipContent(boolean disableGZipContent) { return (MockGoogleJsonClientRequest) super.setDisableGZipContent(disableGZipContent); } @Override public MockGoogleJsonClientRequest setRequestHeaders(HttpHeaders headers) { return (MockGoogleJsonClientRequest) super.setRequestHeaders(headers); } } package-info.java000066400000000000000000000015071350651464300415600ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/json/* * 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.services.json} package. * * @since 1.12 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.services.json; package-info.java000066400000000000000000000014751350651464300406130ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/* * 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. */ /** * {@link com.google.api.client.util.Beta}
* Test utilities for the {@code com.google.api.client.googleapis.services} package. * * @since 1.12 * @author Yaniv Inbar */ @com.google.api.client.util.Beta package com.google.api.client.googleapis.testing.services; google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/util/000077500000000000000000000000001350651464300331515ustar00rootroot00000000000000Utils.java000066400000000000000000000037051350651464300350420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/util/* * Copyright 2013 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.api.client.googleapis.util; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.Beta; /** * {@link Beta}
* Utility class for the Google API Client Library. * * @since 1.19 */ @Beta public final class Utils { /** * Returns a cached default implementation of the JsonFactory interface. */ public static JsonFactory getDefaultJsonFactory() { return JsonFactoryInstanceHolder.INSTANCE; } private static class JsonFactoryInstanceHolder { // The jackson2.JacksonFactory was introduced as a product dependency in 1.19 to enable // other APIs to not require one of these for input. This was the most commonly used // implementation in public samples. This is a compile-time dependency to help detect the // dependency as early as possible. static final JsonFactory INSTANCE = new JacksonFactory(); } /** * Returns a cached default implementation of the HttpTransport interface. */ public static HttpTransport getDefaultTransport() { return TransportInstanceHolder.INSTANCE; } private static class TransportInstanceHolder { static final HttpTransport INSTANCE = new NetHttpTransport(); } private Utils() { } } package-info.java000066400000000000000000000013041350651464300362570ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/java/com/google/api/client/googleapis/util/* * Copyright 2014 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. */ /** * Utilities for the Google API Client Library. * * @since 1.19 */ package com.google.api.client.googleapis.util; google-api-java-client-1.27.1/google-api-client/src/main/resources/000077500000000000000000000000001350651464300250535ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/000077500000000000000000000000001350651464300256315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/google/000077500000000000000000000000001350651464300271055ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/google/api/000077500000000000000000000000001350651464300276565ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/google/api/client/000077500000000000000000000000001350651464300311345ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/google/api/client/googleapis/000077500000000000000000000000001350651464300332655ustar00rootroot00000000000000google.jks000066400000000000000000002141241350651464300351770ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/main/resources/com/google/api/client/googleapisþíþíF29<VÞ%X.509¨0‚¤0‚Œ 0  *†H†÷ 0c1 0 UUS10U America Online Inc.1604U-America Online Root Certification Authority 10 020528060000Z 371119204300Z0c1 0 UUS10U America Online Inc.1604U-America Online Root Certification Authority 10‚"0  *†H†÷ ‚0‚ ‚¨/è¤iGÃé*˜ÿ¢pšÆP²~¥ßhM|¶—h}-¦‹—éd†É£ï †¿`eœKTˆÂHÅJ9¿ãYUå´tÈ´9\¥â•à®Y‹¢3hX¦Ô·ØŸ×Üq«~š¿›Ž3"ý.ç6ïb9ÅÝ˺%#Þ Æ=<΂æf>ÚQ;:£ Ü‡Õœür© }xä·1Ue»Ôa°!`í2rÅ’%øJxGß~07>PÛÓkš†S°ï¬xø„™þ!L€¶ ‚öfpyÓO£ÏñÏF°K>݈b¸Œ© (;zÇ—áåôŸÀÀ®$ È¡ÙÖ{&‚i2=§£c0a0Uÿ0ÿ0U­Ù£öyönt©3=×LÏ3Þ0U#0€­Ù£öyönt©3=×LÏ3Þ0Uÿ†0  *†H†÷ ‚|ŠÑ7‚ะ£íV•Èbaœ¢ÍÂb&aÍ×Ì´e4Њ­¨©fïtóm_™¯ö‹ûëR²˜¢o*ÅT½%½_®È†êF,Á³½ÁéIp—Œ à.:GËä0•[ôE£À°N«½À#nc?€JÅíÜâoÇÁbñãrÖÈtg úˆ«¡Èoð¯Ò™ÍQ“~í.8ǽÎFP=rãy%›ˆ+ Ý¥¸2Ÿà)ß!t†‚Û/‚0ÆÇ5†³ù–_FÛ EýóPÃoÆÃH­F¦á'G ›¶Âwcòà}¾üàß×ǧl°ù®º<ýt´èX €¼Ó¨€:™íuÌF{28<VÞ%X.509p0‚l0‚T 0  *†H†÷ 0G1 0 UUS10U  GeoTrust Inc.1 0UGeoTrust Universal CA 20 040304050000Z 290304050000Z0G1 0 UUS10U  GeoTrust Inc.1 0UGeoTrust Universal CA 20‚"0  *†H†÷ ‚0‚ ‚³TRÁÉ>òÙܱSY)ç±ÃE(å×ÑíÅÅK¡ªt{W¯J&üØõ^§nÛt O5[2 ãÛëzw5êªZàÖè¡W”ð£tV”D0\N+…&t‚z v oMÎA- _·BÍ{Xa4Ü*ù.æ"DL‚æ[ÎÐJ|Ós'ðª˜.¯Në‡$wj]¶è[EºÜáoVŽ&¥IÃ.×A‡"àO†Ê`µê¡cÀ—y½<m+±¬K±î¹N–ÜÜvÿ;¾Ï_Àü;è¾FÿÚ@ÂR÷þã:÷jw5ÐÚë^j1Ǻ<(ÖkTƪ[×¢,Ì¢ö›Y½7k†µm‚ºØêÉV¼©6Xý>óí &©“8øOÁ]"Зêá­ÆUà+(ƒ:úô{!Q¾R8ÎÍfy¨ôVâЃ GQ[PjÏÛH]>÷Ëöe÷lñ•ø;2V‚9z[½/‰¿¡´èÿŒßñ`NXLë£?+ƒšsÙ”m„'f¬ðp@ B’­O“ a Q$Ø’Õ ”a²‡²íÿš5ÿ…TÊíDC¬<kHJ @ˆ’ ÿòÈJ¤ª©Ì™–œ/Xà}á¾»Ü_r\14Ãì_-à=d"æÑì¸.ÝY®Ù¡7¿T5Üs2OŒ3²ÉFñØ\ÈUPÉh½¨º6 £c0a0Uÿ0ÿ0UvóUáú¤6ûðŸ\bqí<ôG8+0U#0€vóUáú¤6ûðŸ\bqí<ôG8+0Uÿ†0  *†H†÷ ‚fÁÆ#óÙà.n_èÏ®°°%M+ø;X›@$7ZË«Iÿ³uy3¡/mp4‘þg~ì›å^‚©U/ÜÔQþ¬>,5ÆcüÜë £ªÐ|ÌÑÐ/Q.ÄZÞèá>ÆÌ¤)ç.„ª0xvTs(˜Y8à bÓB}!Ÿ®=:ŒÕúw +_6áü*µ0$Ïàc {Xþ™ºB±‘ô|hâÈè¯,êÉ~®»*= Ü4•¶t¨jÇ´ôÄä[í Ò¤—L*í/l‰=ñ'pªjR!Ÿ@¨gPòóZßß#öÜxNæ˜OU:SãïòôŸÇ|ØX¯)"—¸à½‘.°vìWÏï)Dóé…z`cä]3‰Ù1ªÚÖó5rχ+/c#„]„Œ?W ˆü™‘(&i™Ô—D¾ŽÕH±¤()ñ´áåžÝø¦o&× <:¦l7÷­D‡,(ÇØt‚³ÐoJW»5)' ‹è!§‡d6]ÌØ¬Ç²'@’U8(QnÝgSlq\&„MuZ¶~`V©M­û›—ó ÙÒ—TwÚ=·àï¬ù…‡é¢Ü¯~ƒýVA.Õ)‚}™ô1öq©Ï,'¥¹ª²HN*RQ•­•Ààà+1×”TÓB3 4EvÝOÊ7ì…züÕÇœðò©.©’æ=X=©hçÒ 5”Ý€NS—×µ D dLS hÞÕªrM“m‚Ûœ½Ï´ó\]Tzi –ÖÛÁu¨´Ï9ÈÎ<¼$|æbÊá½}§½We äþ%í¶iÜ(F½Зµá˜;À7dÖ=”î áõ(® V¿q‹#)AކÅKR{Øq«Š¦;ƒZ×XQÆLAÙØAgr¢(ß`ƒ©žÈ{üSsrYõ“zvÎ÷å\Ù U4¢ª[µjTçÊWì—mô^/E‹XÔ#’än(cY0ßPœc‰ŸÛ”‚p7Ã$žšGÖZÊN¨i‰r‘lÛ~ž­ÇsÝ,Oeý“@.Òðí<ž.(>i&3Å{£c0a0Uÿ0ÿ0UÚ».ª° ¸ˆ&Qt\mÓÀØzÖ0U#0€Ú».ª° ¸ˆ&Qt\mÓÀØzÖ0Uÿ†0  *†H†÷ ‚1xæÇµß¸”@ÉqĨ5ìFÂ…ó(X†° ü޲9DU«d„\i©Ðš8<úå5åDã€y”h¤»ÄŸ=á4Í0F‹T+•¥ï÷?™„ý5æÏ1ÆÜj¿§×#á˜^ÃZv©¦¯w/·`½DFjï—ÿs•ÁŽè“ûý1·ìWE›0ñˆ9ÁO<§ÕÇü«m€"p¥ à])ûË ‘Ñ|ÖÃ~PÕX¾A8ë¹u<Ù›ÉJƒYÀÚSý3»6›…Ýî-¬v“¹ÙH¨ûõ8†ñÛ Æ½„£#AÞÖwo…Ô…Pà®QŠº>vâ¹Ê'ò_ŸïnY Ø+¤Ò|k»_HLç³GŽLE+ îHßçÝ Ž¨Ú@’&Sas]ë½çÄM)7aë¬9-g.Öõƒ…¡ÌvÄ}ä·KfïE`i¶ R–’„^¦£µ¤>+ÙÌØGªòDÚOùèðË?óƒÞÐÁTã·è 7M‹ Y0¡,Ƚß®ÉJÅó'ff†¬h‘ÿÙæS‹\ie &È4Ã]Q{שœ¡6ÝÕ‰”¼Ùä- ^ l—|£=|“ÿ?¡§Ïµ]ëÛÛÄv߈¹½E•®üFjL¯HãήÒ~ëælœOjzd¬»>ÕçËv.ŧHÁ\ËÈ?úæ2áo¤æŽØù)HŠÎsþ,58<VÞ%X.509ˆ0‚„0‚  /€þ#Œ"Hg(‘‡¬³0 *†HÎ=0Ê1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 2007 VeriSign, Inc. - For authorized use only1E0CU…ˆñ‰ È(#™è+ Æó`FØÁ²ÕŒ1ÙÜ y$¿52üciÛ±*kî!XòéxËoËüRÈ‘Äÿ=sÞ±>§Â}fÁõ~R$âÕg‘Ђ×xKO+B9½d-@ °Ó8HFˆ¡ »:3*b˜ûYo;rªî¦†ùaêg 7–‹æiGÂ'Y³¦`Â!@Vú Ç}:ãìWdz֮‰€÷ç,ö–+ y,ÙÀä†{KŒ r‚ŠûÍl:<°„‡Kz)²OÛÔ óf7½ØöW»^$z¸<‹¹ú’„žØtª^ôþE"!£c0a0Uÿ0ÿ0Uq86ò1SG+nºeF©X  0U#0€q86ò1SG+nºeF©X  0Uÿ†0  *†H†÷ ‚÷µ+«]ü{²²^¬›~SxY>Bþu£­¬N׋^Ä-ÈRvÇ,ü2˜ÑKÆ’“351/üØDÝàé‹ád‘b 9Œ¬tYÙzYR—¹{oEÓ–Ù1}6œ;nÏ, FEë ôHDÆ@ÌÞpµ)­º‹;4euq!, °–•¸Öêòeû)ºOê‘“ti¶òÿáÐ Ñv…ËŠ%½—^,o™&ç¶)ÿ"ìÉÇVÍI¹³l{Sâ¨Éª#ÂÎç»ÌÀG¢äÄ)/[EW‰Qî<ëRÿ5Ÿ5jGJV˜ÑZ…Œõ"¿«Îƒóâ")®}ƒ@¨ºl57<VÞ%X.509½0‚¹0‚¡ @Äd!³!»äÅ0  *†H†÷  0½1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 2008 VeriSign, Inc. - For authorized use only1806U/VeriSign Universal Root Certification Authority0 080402000000Z 371201235959Z0½1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 2008 VeriSign, Inc. - For authorized use only1806U/VeriSign Universal Root Certification Authority0‚"0  *†H†÷ ‚0‚ ‚Ça7^±4Ûb×›ÿXZŒ##Ö`Ž‘×˜ƒzæX8ŒÅöåd…´¢qûí½¹ÚÍM´È-s¥Çiq•9<²DœèúMJÄ!ß)a2"a‚ŇnŒ|_ QDÑpOWêããÌyîXسE“À,çš+{7zA3xá3âó‡,¾öõ÷Bâ忇b‰_KßÅÝäuD2A:qniË uFÑÊÒ+•ÐÏû¹@kdŒWMüy„í^Tö4Ÿó%JÚñzfk˜`f¤ÙïÒ.‚ñðï êDÉjân3Ó¬ŸUÇöj”¹_Üà3ñ„`ù['´üò»Vj€%£²0¯0Uÿ0ÿ0Uÿ0m+ a0_¡] [0Y0W0U image/gif0!00+åÓ†¬ŽkÃÏ€jÔH,{.0%#http://logo.verisign.com/vslogo.gif0U¶wúiHGŸSÕÂê2vÑ—0  *†H†÷  ‚Jøø°æ,g{ä”wcÌnLù} Üȹ5¹pOcú$úlƒŒG;cóšùv2•‘±w¼¬š¾±ä1!Æ•VZ±ÂÔ±¦Y¬ñc˸LYJï(Z®ûP8 lÌñ=Ãõcã³ã!É$9éýfFôÐMs£}Fù=í¨_bÔñ?øàtW+´Ä(Ú”—¥p묾ðÕÛÝåŒðÕ2°ƒæW⿾¡ª¿=µÔ8ê×°\:Oj?ÀflcªéÙ¤ôÑ•}Í•4ÙÒps{œ~½˜aØE‡˜Åë†0Æ5¿ðÿÃUˆƒKï’qò¸˜“·ìÍ‚añ8æO—˜*Z25<VÞ%X.509X0‚T0‚< 4V0  *†H†÷ 0B1 0 UUS10U  GeoTrust Inc.10UGeoTrust Global CA0 020521040000Z 220521040000Z0B1 0 UUS10U  GeoTrust Inc.10UGeoTrust Global CA0‚"0  *†H†÷ ‚0‚ ‚ÚÌc0ýô#V~[ßœ&dÌß΃qÊNæÔÕ{©ÍUÞÈìÒ^8Så\OŒ-þP#6üfæËޤ9·•9‘ þ8.ÑšöM>o¯,`9âú6S9Ô^&+Û=¨½2ë(Rqå«3=á8»6„bœyê0ô_À+èqkäù£S0Q0Uÿ0ÿ0UÀz˜h‰û«d }ª}e¸ÊÌN0U#0€Àz˜h‰û«d }ª}e¸ÊÌN0  *†H†÷ ‚5ã)jå/]TŽ)P”Ÿ™äx*b”¢'gžÐÏ^GéÁ²¤ÏÝAN›KîJoUR³$¡7 ëdv*.,óý;u¿úqØÇ=7Òµ•b¹¦Þ‰=6{8wH—¬¦ .¦É ²™EÇÎQ""à¥ê¶H dê^Ot÷>ÇŠR Û´½m›åƱTh©ãi¶š¥¸¹? }®Jµ¸œä¶«æ”¥Áǃ­Ûõ'‡lÕÿÝ ]í‡R·+®9¦jtéÚÄç¼M4©\M3_’ /ˆf]w—Çv©Õåñ 5Õ¬Û$qp,˜V Ù´ÑãQ+^uèÕÐÜO4íÂf€¡Ëæ356<VÞ%X.509²0‚®0‚5 <²ôH âþë$;^`>Ãk0 *†HÎ=0˜1 0 UUS10U  GeoTrust Inc.1907U 0(c) 2007 GeoTrust Inc. - For authorized use only1604U-GeoTrust Primary Certification Authority - G20 071105000000Z 380118235959Z0˜1 0 UUS10U  GeoTrust Inc.1907U 0(c) 2007 GeoTrust Inc. - For authorized use only1604U-GeoTrust Primary Certification Authority - G20v0*†HÎ=+"b±èýCå¬ë‡7bïÒƒ6R}EW J{T;:n_ÀP¦Ï%/}ÊH¸ÇPc*!|š6Ø þÑ&ÅX10(%ó]]£¸¶¥´’íl,ŸëÝC‰¢¨Ð˺В ¶ž–ªŠ24<VÞ%X.509•0‚‘0‚y EkPT0  *†H†÷ 0°1 0 UUS10U  Entrust, Inc.1907U 0www.entrust.net/CPS is incorporated by reference10U (c) 2006 Entrust, Inc.1-0+U$Entrust Root Certification Authority0 061127202342Z 261127205342Z0°1 0 UUS10U  Entrust, Inc.1907U 0www.entrust.net/CPS is incorporated by reference10U (c) 2006 Entrust, Inc.1-0+U$Entrust Root Certification Authority0‚"0  *†H†÷ ‚0‚ ‚¶•¶CBúÆm*oHß”L9WîÃyAh6íìþš¡8(ü÷Ff.M±NÆÑÀ•ˆ°Éÿ1‹3Û·ƒ{> „^í²V(§øà¹@q7ÅËG—*hÀ"•bÛGÙõÐ+ÿ‚KÉ­>ÞLÛ€P? Š„ì0 =Íûý*Yš#•,EžnCym \˜þH§Å#G\^ýnç´öhEцƒ[¢Š±ã)€þ%qˆ­¾¼¬R–KªQä1èNMŸÛ¬³jÕ¼9TqÊzzÝ}€Ù»Y&Âþæ“â÷€äeû47)€pM¯8†.žW¯ž®ëË(!_¶Øç¢"ùÓÚØË£°0­0Uÿ0Uÿ0ÿ0+U$0"€20061127202342Z20261127205342Z0U#0€häg¤¦S€Ç†f¤ñ÷KCû„½m0Uhäg¤¦S€Ç†f¤ñ÷KCû„½m0 *†H†ö}A0V7.1:4.00  *†H†÷ ‚“Ô0°× *Ðùcè‘  ©_Ê{rNÔ±ÛЖûTZ, ÷²¼…¨m;R³*ÛçÔ„ŒcöË&‘Plô_â“tÀž0:Pã´`Åð"DqG¬ÈÉ雚`ÿp~_MI³R{ÉTÚ¿•¯kšØžéñäCâD:¿¯½ƒBsR‹ª»§)Ïõd MѼª¬Ÿ*ÐÿÚ}ê±í0%Á„Ú4Ò[xƒVìœ6Ã&âögI’«Œûëÿzî…J§P€ð§\J”._™¼|®ó¦'š4£h1q83bäóqfy±©e£¥‹Õ`-?B̪k2À#Ë,AÝäßüaœâs²"•C_ĶWl X"È6L:|¥Ñφ¯ˆ§Dtqs BYøkBßo_ºk‚¢[çJ½rÛKtè;}´&›à´Z¬G=U¸×°&R(1@fØÙ$½ö*Øì!I\›özéU5~–k““'Ë’»ê¬@ÀŸÂø€Ï]ôZÜÎt†¦>l Sʽ’Îræ \8iÇÖ¼lÎ[ö÷hœÜ%Hˆ¡é©ø˜œàóÕ1(alg–9™ËÂE$9£B0@0Uÿ0ÿ0Uÿ0U­lª”`œíäÿú> t+c÷¶Y¿0  *†H†÷  ‚@Ø•e¬ ’‰Æ9ôå©fS]xÞú$‘»çDQ߯4 ïjDQê+ŠzÃë? ,R +C¹%?p©3%mE(;'ϪÃ)Bß;LÀ34[Aˆ¿k+e¯(ï²õêfÎ{Vî·ÈËgÁÉœ¸ÄÃIñ`PÍFÅówy÷¶à8ÛÇ/(  ?w&tÙ%Ú1ÚÜ)A‘"Ôpkºq¦ªX®ô»él¶ï‡Ì›»ÿ9æVaÓ §Ä\L`{w&z¿ØR,b÷pcÙ9¼oÂyÜv)¯ÎÅ,d^ˆ6n1Ô@b46?5®¬c 23<VÞ%X.509"0‚0‚ 0  *†H†÷ 0g1 0 USE10U  AddTrust AB10U AddTrust TTP Network1#0!UAddTrust Qualified CA Root0 000530104450Z 200530104450Z0g1 0 USE10U  AddTrust AB10U AddTrust TTP Network1#0!UAddTrust Qualified CA Root0‚"0  *†H†÷ ‚0‚ ‚äšþÜ Z‡¤ŸG¾_¯„4ÛbiJ"Øï­š)™áªDEš^>mRüç =h/ðKp|8­¼%ñÖΫ¢À1Ö/ŸàÿYü„“Ù‡|LTëŸÑ-ø::Þ%Ù÷Ó@í¤Ä;á‘ÁV5ðÜe6 n«¤Ç5ÑÂ36[u&mBñkCoKq”ú4ínÊ€˜/l¹eØé£Ô0Ñ0U9•‹b‹\ÉÔ€ºX—?C̘§0 U0Uÿ0ÿ0‘U#‰0†€9•‹b‹\ÉÔ€ºX—?C̘§¡k¤i0g1 0 USE10U  AddTrust AB10U AddTrust TTP Network1#0!UAddTrust Qualified CA Root‚0  *†H†÷ ‚«uêø‹ea•ºiï†Ê ÇªOd?ö¨-,U·0êBjÀ%Q-§¿ ³íïl‚cHªâH>ªò²…b¦´§Ù½7œhµ-V}°·? ±ÖéOÜÞEq02. ù¿R¡î€>\.U@ÁõpE°Ü]úörZwÒcÍÏX‰Bc?y9ÐD°‚nAèÝàÁˆZÑq“$0tå¨Þ<'7ƒ®žwÏð0±ÿK™èÆ¡54<VÞ%X.509Œ0‚ˆ0‚  5ü&\Ù„OÉ=&=W›®×V0 *†HÎ=0„1 0 UUS10U  thawte, Inc.1806U /(c) 2007 thawte, Inc. - For authorized use only1$0"Uthawte Primary Root CA - G20 071105000000Z 380118235959Z0„1 0 UUS10U  thawte, Inc.1806U /(c) 2007 thawte, Inc. - For authorized use only1$0"Uthawte Primary Root CA - G20v0*†HÎ=+"b¢Õœ‚{•ñRx‡þŠ¿æß£O ÆQº R-"¤B9ÄþêÉÁ¾ÔMÿŸzžâ±|𭧆 s‡Ñçšãz¥ªnûº³pÀgˆ¢5Ô£š±ý­Âï1ú¨¹óûÆ‘Ñû)•£B0@0Uÿ0ÿ0Uÿ0UšØ0çk…Ί øá»0 *†HÎ=i0f1ÝøàWG[§æ ýõ€Š—5 ‰ÙÏ1Ä”üÜSÒÜx3#SRãZ1]Ê®½)D '[¨çhœ÷X?.rW£¡.22<VÞ%X.5090‚0‚ý 0  *†H†÷ 0d1 0 USE10U  AddTrust AB10U AddTrust TTP Network1 0UAddTrust Public CA Root0 000530104150Z 200530104150Z0d1 0 USE10U  AddTrust AB10U AddTrust TTP Network1 0UAddTrust Public CA Root0‚"0  *†H†÷ ‚0‚ ‚é0ƒˆÁ Ø<›~t»ÚiÓF¥øŽÂ Q¥/fT@UêÛJVîŸ#nô9Ë¡¹oò~ù]‡&ažøâì¦ø!Å$Ì ?Û&rzÇ—ù×,0}zbÆKÀý}bwÓD'ö?KD³·8Ù9`ÕQ’s´iãóNîÑÜ Ïw4FP°øòþ8y÷9þQ’— [_4†­ˆ—ëfÍ^ÑÿÜ}ò„Úºw­Ü€ǧ‡ÖUŸ—jèÈdºç)?³x„ R[ïxЃöÕHÐ0Ï€ù`þyäˆòÝë”Eëe”i@ºÀÕ´¸º}¨ë1–”NX!ŽŸÐ`ý£Ñ0Î0U>7Ø’°wŸ\´«sªçö4`/ú0 U0Uÿ0ÿ0ŽU#†0ƒ€>7Ø’°wŸ\´«sªçö4`/ú¡h¤f0d1 0 USE10U  AddTrust AB10U AddTrust TTP Network1 0UAddTrust Public CA Root‚0  *†H†÷ ‚÷Jø$Ú#V“vÝ6(¹®¸Ãñdº x•)'W¼|*ô¹QUÚ‡Þ1øªy. »¯² å“ùKùƒèDÕ²A%¿ˆuoÿüJTÐ_ðúï6s}6EÆ!m´¸NÏœ\¥=ZŽã´ÉÁÅgƒ]3óìjÐSâѺ6`”€»acl[~ß@”« Â!(pˆÿÖ&ll`%NU~}ï¿”HÞ·Ýp_ˆ¥›òÂîêÑ@Amb8VÅGQ ü{ b®vU¿_w¾>IS=˜%v$Z´Û‰êyå¶³;?ºL(A¬jŽÁÐö}æB†ã¥ÕG£B0@0Uÿ0ÿ0Uÿ0UÄyÊŽ¡NÜkÛ1[”>?0-0  *†H†÷  ‚-ÅÏV€{zx½Ÿ®,™çïÚß”^ i§çnhŒ½r¾G©—¸JñdÓ9ß%4ÔÁÍNðÄ$³4–Ʀª0ßhas×ùŽ…‰ï^•(J*'Ž.|†ÄžÚ weD ’ýý³6ú Œ‰j)V÷rôÝœw5fW«SØŽÁ@Å×ZrÇ·iÄz±ƒh}A¡”Á%\üðþƒ‡| Ï.\J@ >ìaæ$ÛÊà-²>VÜõA…H› ËI?}ì·ýËg‰«í»£*‚\1]FŠ-†›tÙEûÔ@±zªh-†²™"áÁ+Çœøó_¨‚ë-21<VÞ%X.509:0‚60‚ 0  *†H†÷ 0o1 0 USE10U  AddTrust AB1&0$U AddTrust External TTP Network1"0 UAddTrust External CA Root0 000530104838Z 200530104838Z0o1 0 USE10U  AddTrust AB1&0$U AddTrust External TTP Network1"0 UAddTrust External CA Root0‚"0  *†H†÷ ‚0‚ ‚·÷3æò-9àN[í¼l͵ú#¶ÎÞ›3—¤)L}“Ÿ½J¼“íãÏåmPZÖ—)”Z€°IzÛ.•ý¸Ê¿78->‘A­pVÇðO?è2žtÊÈTéÆ_xš@<¬aª^ž‡¡jPÜךN¯³¦q”œq³P` Ç8†¨é¨i&«L°O#«:O„ØßΟáio»×B×kDäÇ­îmA_rZq7³ye¤Y ”7÷/ Â’rÚÐ8rÛ¨EÄ]*}·´ÖÄî¬ÍD·É+ÝC%úa¹ijX#·§3VuYõÍ)×F· +e¶ÓBo²¸{ûïé]SÕ4Z'£Ü0Ù0U­½˜z4´&÷úÄ&Tï½à$ËT0 U0Uÿ0ÿ0™U#‘0Ž€­½˜z4´&÷úÄ&Tï½à$ËT¡s¤q0o1 0 USE10U  AddTrust AB1&0$U AddTrust External TTP Network1"0 UAddTrust External CA Root‚0  *†H†÷ ‚°›à…%ÂÖ#â–’A˜œÙ„yÙ[#6e°Øw»¬AlG`ƒQ°ù2=çüö&Ç€¥¿Zü‡Ïxy‰!šâL †5¼òÞQÄÒ–·Ü~Nîpý9ë Q-޽àÁßFuç$­ìôB´…“pgº5JÓ+zÌQB¡zcÑæ»¡Å+Â6¾ æ½c~y{§ @«jÝŠÃööŒBQÔEõŸ§b!h C<™ç|½$Ø©‘sˆ?V18´qšÍÈžŽ.ጘƒË1ñDLÆsIv`Çø½€k.éÌLZšy .Õžc&U’”Ø‚Z{мÇN†52<VÞ%X.509¥0‚¡0‚‰  …ª-H0  *†H†÷ 0;10U Cybertrust, Inc10UCybertrust Global Root0 061215080000Z 211215080000Z0;10U Cybertrust, Inc10UCybertrust Global Root0‚"0  *†H†÷ ‚0‚ ‚øÈ¼½PfÿðÓyì#ò·ÇŽ…ñs¦ªÛœ¢etZw>Q}VöÜ#¶Ôí_X±7MÕInõj‡ÖÒŒÒ'Æâÿ6Ÿ˜e NÆ*d›ÕÏô;ãÔ(¾èø«NH”mŽ•1\í¢-½Õ:m²»`ÀFKõI®~FŠÐt¡ Îîüç¸kfóD¿f%+Ý0–?Mök¸·{ ¥8ëÞGÛÕ]9üˆ§ó×*tñèZ¢;ŸPº¦ŒE5ÂPe•Üc‚ïÝ¿wMœbÉcsÐ)I©H𳪷lŧ09@]®Äâ]&SðÎ#a¨”ºb@ì8pwq§0]%'¥£¥0¢0Uÿ0Uÿ0ÿ0U¶{ z̬ L†V2^Ï«n…-pW0?U80604 2 0†.http://www2.public-trust.com/crl/ct/ctroot.crl0U#0€¶{ z̬ L†V2^Ï«n…-pW0  *†H†÷ ‚Vï # TN•—Éø‰ÚEÁÔ£%ô«·£…XiÂ0­ØŠ-ãÉÍZøs#Z§|óý";ÑÄÛ6LsŽå°"äÅó.¥Ù#ã¸NJ §n$Ÿ"`g{‹r Å1\éyŸ€G=­¡ =Gÿi Dçc%§²É¸v„í#ö}«E~Óß³¿éŠ¶Í¨¢g+RÕ·eð9Lc ‘y“RT݃»ŸÑ§SsÃËÿ0ì|¸ØD“_q "·n>êN aû7ì^ü E«×çUРê`›¦öãŒ[)Â`-—L©“aÄ_HÖX½V1NÈ!೑eÛ´¦ˆ8ÎU20<VÞ%X.5090‚0‚ 0  *†H†÷ 0e1 0 USE10U  AddTrust AB10U AddTrust TTP Network1!0UAddTrust Class 1 CA Root0 000530103831Z 200530103831Z0e1 0 USE10U  AddTrust AB10U AddTrust TTP Network1!0UAddTrust Class 1 CA Root0‚"0  *†H†÷ ‚0‚ ‚––Ô!I`âkèA ÞÄàÜ#ÍÁ5ÇûÖN g^õ[k¥;[):燲4ż¥|‚Ë)®áˆ½ÖžÓþ-VÁÎã&.û0Þ§´c´ÿ±œ®<¯w¶Vŵ«¢éi:=3y2?p‚’™am0q?¦HWø%ÜKf\¥t˜®ÈùÀ"ç¬sߥ.ûRܱe ú5fiÞß,ñn¼0Û,$Ûë55h˰—!=t!#e4+»xY£Öáv9š¤IŽŒt¯n¤š£Ù›Ò8\›¢Ìu#„¾ëâM3qŽðÂøÇ¢­—,øÏ%Æö¸$1±c]’cð%ÉS.¿M£Ò0Ï0U•±´ð”¶½ÇÚÑ !¾Á¯Iý{0 U0Uÿ0ÿ0U#‡0„€•±´ð”¶½ÇÚÑ !¾Á¯Iý{¡i¤g0e1 0 USE10U  AddTrust AB10U AddTrust TTP Network1!0UAddTrust Class 1 CA Root‚0  *†H†÷ ‚,mdÍ Ý¹ú–c42HG™®—íýr¦sGZôëÝéõÖûEÌ)‰D]¿F9=èî¼MT†lã'Cá‰V+©orNI3ãr|*#š¼>ÿ(*í£ÿ#ºCW gMKb-øÿl`ØK}µ1/ÙÐ|]øÞkƒx7W/è3gßÇk*•v®W£ðôR´©SÏàOÓzS‹ý»V6òþ²¶åv»Õ"e§?þÑf­ ¼k™†ï?}ó2Ê{Æã«dF•ø&iÙUƒ{,–ÿY,D£Æåé©Ü¡c€Z!^!ÏSTðºo‰Û¨ª•Ï‹ãqÌ DÀz¶@ýÄä5áм+ŽÖqÙ51<VÞ%X.509á0‚Ý0‚Å ¢ì·`€x¶0  *†H†÷ 0y1 0 UDE10U TC TrustCenter GmbH1$0"U TC TrustCenter Universal CA1&0$UTC TrustCenter Universal CA I0 060322155428Z 251231225959Z0y1 0 UDE10U TC TrustCenter GmbH1$0"U TC TrustCenter Universal CA1&0$UTC TrustCenter Universal CA I0‚"0  *†H†÷ ‚0‚ ‚¤w#–D¯ô1§ô&‡œó8Ù^ÞÏAè1­Æt‘$–x  ›š•JJõb|¨Ê¬ûZv9Þ_ñù³¿óXUÒª·ã"Ñø”Ú"Ó|&]Ìwyç,x9¨&s¢]%i…OUšïƹDáW=ßT"åoeª3„:óÎz¾U—®3âPpÃI‡¼QÞטZï:ƒ3’u‹’|h{pjµ›¶w[HYäïZ­óÁžÔ×ENÊV4!¼>[ow HC)°Ý?–n敪 À ¶ý>6'œã\ÏNÜ»‘}ìæ—“Ì"I×—†¶ d`Z/ ű`ýE5Ïð²¿ÙïZ¾³b!´×«5|S>¦'ñ¡-Ú#ÌÝì<-ž'4]Â6y¼ÉJb-íkÙ}AC|¶ªÊía±7‚ Š0ØìÉÖGrxKFŽ_¯ìÇ/«×¶ñn솲Âè ’sÜ¢ô:¿a#‰œH@np³Óº7DXzjˆð74ðé¬ÔesöiŒd”:y…)°+ ‚?œÇý+ž,¶žã¿Ù6º%R=ì" ढ=ðè9ÏÀ{í]oÅРט50<VÞ%X.509®0‚ª0‚’ JGå ]Ö?Q¿0  *†H†÷ 0v1 0 UDE10U TC TrustCenter GmbH1"0 U TC TrustCenter Class 3 CA1%0#UTC TrustCenter Class 3 CA II0 060112144157Z 251231225959Z0v1 0 UDE10U TC TrustCenter GmbH1"0 U TC TrustCenter Class 3 CA1%0#UTC TrustCenter Class 3 CA II0‚"0  *†H†÷ ‚0‚ ‚´à»Q»9\‹ÅLy#†1cCU'?ÆEǤ=ì  ÂVÞ70"/oññ«­ÖÈ«a£/Cݲ-üÖi{~ŠäÌÀ9B`ÉÌ5hîÚ_V_ÍM[XIëOdú,<‰XØ/.â°hé";u‰ÖDeò—&(m¬è½Y+$öÖ„fˆ$x`ñø«þ²kû"û5æÑ­ö.äú5jå¹]Û;ûÓÿØ jºEy`}¯@Šs³“–Ót4:7)Þ\ìõî.1 ܾñO#RÙ[âdÙœªµE½ÑÐ1Á«TŸ©ÒÃb`ñ»9J’J= ¹Å þ7£‚40‚00Uÿ0ÿ0Uÿ0UÔ¢üŸ³ÃØÓW\¤Ð$§ÀòÔ0íUå0â0ß Ü Ù†5http://www.trustcenter.de/crl/v2/tc_class_3_ca_II.crl†Ÿldap://www.trustcenter.de/CN=TC%20TrustCenter%20Class%203%20CA%20II,O=TC%20TrustCenter%20GmbH,OU=rootcerts,DC=trustcenter,DC=de?certificateRevocationList?base?0  *†H†÷ ‚6`äp÷ CÙ#Bòø£²¹MŠ´óšU1|Ä;gš´ßMŠ“J‹ʉáÏ:¬ñœ2´ŽYv¢A…%7 Ðõ|NÕê–ânrÁ»*þlnø‘˜FüÉW[êÈ;?°Q˜<Ú,YÚ‹Dèátý§hÝTºƒFìÈFµø¯—À; Îr–=3Vp¼–ËØÕ} šƒŸÜ9ñÅr£ý;BR)Ûè÷›^ŒÖ†Nú¼¾Å!¥‡žx.6Û q£r4ølã ò^V¥ÓݘúÔæôð¶ cKê)½ª‚fûª§7­æ’ÃÁ3»ˆ¡çâ´½1lQ=oû–V€â6ÑÜä9<VÞ%X.509ë0‚ç0‚P0  *†H†÷ 0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 1 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0 990625222348Z 190625222348Z0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 1 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0Ÿ0  *†H†÷ 0‰ØY‚z‰¸–º¦/hoX.§TnôêH¼1”ðóN¼²¸5’v°Ð¥¥×"øÿ#›Îõ¿i&þNéÑ,@Yhn¦øX°Ó?ñܨà:ÝÈSE æpÃú@¦âVMü ‚ÑsUtvr ÀÝ?q0  *†H†÷ Ph=Iô,”ß•`–{þOq­dÈÝwÒïYUè?èŽ*!òÒµ§Rþœ±¶â[w@êrÖ#Ë(2ÃyìY‰ÉÆjqÉý·t¥%EiÅH«áEŠ%kîå»õ÷¦QÃðt·©> ¥ÿ¶IÚ"Ìíq‚+™Ï:·õ-rÈ8<VÞ%X.509¾0‚º0‚¢  †&æ 0  *†H†÷ 0L1 0U GlobalSign Root CA - R210U  GlobalSign10U GlobalSign0 061215080000Z 211215080000Z0L1 0U GlobalSign Root CA - R210U  GlobalSign10U GlobalSign0‚"0  *†H†÷ ‚0‚ ‚¦Ï$¾.o(™EBÄ«>!T› Ó„pú³Ë¿‡_ƆӲ0\Öý­ñ{Üåø`– ’õÐSÞû{~sˆ¬Rˆ{J¦ÊI¦^¨§ŒZ¼z‚뾌鳬–%—J™*/´w¿Šµ|–¸Å¹:,¼Ö¹ëY}âІ_^Ijµ9^ˆ4ì¼x ˜„l¨ÍK´ } yMð¸-Ë!ÊÕl[}á )„¡ùÓ”IË$b‘ ¼Ý ÕÙÌùê' +s‘ƬÈËèà ô/‹Mû°6öz…àmòaˆ\Ÿà“ Q—ŠZί«Õ÷ª ª`½ÜÙ_ßr©`^ÉJú?¤ê!Ž‚Ê›£œ0™0Uÿ0Uÿ0ÿ0U›âWgÀjÞY´š-ß܆.06U/0-0+ ) '†%http://crl.globalsign.net/root-r2.crl0U#0€›âWgÀjÞY´š-ß܆.0  *†H†÷ ‚™S‡h—†‘ìàJ¸D «¬'OÖÁ¸Cx³ šüê,¡[AõßådC-éÕ9«Ò¢ß·‹ÐÀ€EÀ-Œèø-¤tVIŵOÞnDx9‡¨~»óy‘»ôoÁðŒ5Œ]ûÃm¹ïDmyF1~ þ©‚Áÿï«n ÄPÉ_M›Œ åÉ AjsSú¥P´n%ûLôýRÙŽi±èÞˆØûI÷ªÞ•Ï xÂ`Û%@Œjü~B8@d÷žá“.19<VÞ%X.509$0‚ 0‚‰ 7pϵ0  *†H†÷ 0N1 0 UUS10U Equifax Secure1&0$U Equifax Secure eBusiness CA-20 990623121445Z 190623121445Z0N1 0 UUS10U Equifax Secure1&0$U Equifax Secure eBusiness CA-20Ÿ0  *†H†÷ 0‰ä99“R(6ø²£)Å펲½þëç´tÂÿçÙ¿È?òÖÑ$²ÞÑs ŠÔ±,˜ PF²ƒ¦Ebh»… p2ª@ͦ–_Äq7?ó·A$9.aX  å¥ßÅ«ê7qÌÈ7:¹—R§¬Åj$”Nœ{ÏÀjÖß!½£‚ 0‚0pUi0g0e c a¤_0]1 0 UUS10U Equifax Secure1&0$U Equifax Secure eBusiness CA-21 0 UCRL10U020190623121445Z0 U0U#0€Pž ê¯^¹ H¦PjËýØ z§‚v0UPž ê¯^¹ H¦PjËýØ z§‚v0 U0ÿ0 *†H†ö}A 0 V3.0cÀ0  *†H†÷  †‚­èNõމ'â5X=)´6P•¿nÁžëIJ…¨»·Bà9ßûž²ÑÁ>SŸD°~Kôoä|çâ±ä¸šïýÎÞ 24ÙÞ(í3kÄÔ×=X«} -ËpõŠ”¡'¤ÖpÅm”µÉ} ÒÆIÙf›¦Óô ÜÅ&Wá‘0êÍ7<VÞ%X.509y0‚u0‚]  KZÔ0  *†H†÷ 0W1 0 UBE10U GlobalSign nv-sa10U Root CA10UGlobalSign Root CA0 980901120000Z 280128120000Z0W1 0 UBE10U GlobalSign nv-sa10U Root CA10UGlobalSign Root CA0‚"0  *†H†÷ ‚0‚ ‚Úæ™Î£ãOŠ~ûñ‹ƒ%kêHñ*°¹•½ðcÑâgfÏÝÏH+š¯)€e«éÇ-Ë«Lp¡= 0ÍOøÝÔŒPïPîÄ.÷üéRò‘}àmÕ50Ž^CsòAéÕj㲉:V98o<ˆi[*MŧT¸l‰Ì›ù<Êåý‰õ<’x–ÖÜtn“DaÑÇF²u†èŠÕmlÕx•¢éÈ 8ëò$OsT“…:¼4µ‹Œ¹w‹±Û ‘« SnÎ{7t¹pG‘"Qcy®±®A&È+ÑFªHÖd*׃4ÿ,*ÁlCJ…çÓ|ö!hïêòRŸ“Ï£B0@0Uÿ0Uÿ0ÿ0U`{fE —ʉP/}Í4¨ÿüýK0  *†H†÷ ‚Ösç|Ovп캢¾4Å(2µ|ülœ,+½ žS¿k^ªH¶å£³Ê=aMÓF ³>àãcUòºï­9áC¹8£æ/Š&;ï PVùÆ ý8ÍÄ pQ”—˜ßÃ_”ÕÉAœÄ]ud ÿU0ì†ÿ ï,¹cFöªüß¼iý.Hdšà•ð¦ï)±µ ¥þi,i$x³§qbîÊÈ—¬]ŠÂøG†n*ÄV1•Ðg‰…+ùl¦]F ª‚ä™QÝp·ÛV=aäjá\Ööþ=ÞAÌ®cR¿SSô+éÇý¶÷‚_…ÒA۳Ť€o ÉÞ ˆ ÖfUâüHÉ)&ià18<VÞ%X.509†0‚‚0‚ë 0  *†H†÷ 0S1 0 UUS10U Equifax Secure Inc.1&0$UEquifax Secure eBusiness CA-10 990621040000Z 200621040000Z0S1 0 UUS10U Equifax Secure Inc.1&0$UEquifax Secure eBusiness CA-10Ÿ0  *†H†÷ 0‰Î/¼·wÞ“©_Z O4 ˜ô"ÙYÔÄhFð´5Å… ƯE¥!QEAëX62oâPbdùýQœª$Ùôƒ*‡ !Ó84lnZ ÙBî!•ùRLUZÅ8OFúmø.5Ö|ëâð°u€È©¬¾ˆï:n«_*8b°{þ¦£f0d0 `†H†øB0Uÿ0ÿ0U#0€Jx2RÛY6^ßÁ6@jG|L¡0UJx2RÛY6^ßÁ6@jG|L¡0  *†H†÷ u[¨›æéVLÍù©LÀ šóÌeiæ%vÌY·ÖTÃÍ™¬Ý´…Õà=üb §„KXeñâù•!?õÔ~XG‡T>X¡µµø*ïqç¼Ãö±IFâ× kåVzš'˜|FbçÉüny€8H‚üþ*–+µb¦¦=½’YÍZ*‚²7y49<VÞ%X.509®0‚ª0‚’ .j×R!,\;0  *†H†÷ 0v1 0 UDE10U TC TrustCenter GmbH1"0 U TC TrustCenter Class 2 CA1%0#UTC TrustCenter Class 2 CA II0 060112143843Z 251231225959Z0v1 0 UDE10U TC TrustCenter GmbH1"0 U TC TrustCenter Class 2 CA1%0#UTC TrustCenter Class 2 CA II0‚"0  *†H†÷ ‚0‚ ‚«€‡›ŽðÃ|‡×è$‚³<ÝCbîøÃEÚèá _Ñ*²ê“hß´ÈÖCéÄuYüáø1p#ˆž'¹{ý:ÒÉ©é/¾RÁIÍöýäf WŠ¢B ¸Õi\2²— ÊJÜF>U‰SãZË6ÆV÷ŒÏôL»0p•¥ö9Œýs}‰^2"©"EK°f.0ÌŸeýüË©ñà;¯£†Ñ‰êÄEyP]®é!t’M‹Y‚”ãéJñçI°ãõbËÕr½¹ÒŸ Í¨úÈÙ ßÚüG³ÈTßIJñ!©þNîHÔ»ï}äâË[¶nÿãÍZçt‚º€%8Ëäiž¯Aª„õ£‚40‚00Uÿ0ÿ0Uÿ0Uã«TL€¡ÛVC·‘JËó‚z\«0íUå0â0ß Ü Ù†5http://www.trustcenter.de/crl/v2/tc_class_2_ca_II.crl†Ÿldap://www.trustcenter.de/CN=TC%20TrustCenter%20Class%202%20CA%20II,O=TC%20TrustCenter%20GmbH,OU=rootcerts,DC=trustcenter,DC=de?certificateRevocationList?base?0  *†H†÷ ‚Œ×ß~ƒõÛêkK¨’Ù÷9õ,¾uzhSêJí^ü#² Ó ÿöö.kAqyÍâmý®Yk…¸N"šíf9nK”æUü ‹wÁSf‰Ù(Ö‹óEJc·ý{ a]¸m¾ÃÜ[yÒí†å¢M¾^t|jí8XZë2ˆ-²ó9w€¯^¶au)Û#MˆÊP(Ë…ÒÓ¢YnÓ“Tz¢F•†œ©˜å1r âgÙ@à$3{o,¹\«e,¬vê5™õ—¹$ìÇv!(e®WèˆuJV Ò:¤æ’ˆ,óòáÁÆaÛAÅÇ›÷QEÂakÜd'ŒZ·Út(Í—ä½6<VÞ%X.5090‚0‚k}ÙþϨ·ygû§‰4Æ0  *†H†÷ 0Á1 0 UUS10U VeriSign, Inc.1<0:U 3Class 3 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0 980518000000Z 280801235959Z0Á1 0 UUS10U VeriSign, Inc.1<0:U 3Class 3 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0Ÿ0  *†H†÷ 0‰Ì^Ñ]\iЫӹjL™Y˜0Ž… FmG?Ô… „ám³ø¤í ñ;ù§ù%×ÁÏ„cò|cÏ¢GòÆ[3Žd@hÁ€¹dEwÇØnõ•)>`nvœg…ÅÈÃa£f0d0 `†H†øB0Uÿ0ÿ0U#0€¾¨ trPkD·É#Øû¨ÿ³Wkhl0U¾¨ trPkD·É#Øû¨ÿ³Wkhl0  *†H†÷ 0âQªÇê_Ú¹Ðe0Ö>Ú In‘“'1ïÄ÷-EøìÇ¿¢A #´’ùg½¯ÍàqüZÏdÄà–˜Ð£@âŠï'ñeŠD-euRÀ† !_lkl® ¯ò¢4Äu¤sñÜï­ù³v´’¿Ü•¾ËÈ;Z„`V”©U48<VÞ%X.5090‚‰0‚ G¯ªbpPTLž›c™*0 *†HÎ=0…1 0 UGB10UGreater Manchester10USalford10U COMODO CA Limited1+0)U"COMODO ECC Certification Authority0 080306000000Z 380118235959Z0…1 0 UGB10UGreater Manchester10USalford10U COMODO CA Limited1+0)U"COMODO ECC Certification Authority0v0*†HÎ=+"bG{/uÉ‚…ûuä‘Ô«b™õ>R ÎA—á $<î=Ò — àuäúûwŠ*õ`K6‹#­ qôJô(P´þˆn?l// Y[¥[ 3™âÃ=‰ùj,ï²Óé£B0@0Uuq§H¼êAGß”ÄHw™Óy0Uÿ0Uÿ0ÿ0 *†HÎ=h0e1ï[z¬·x r·ˆßÿµF ú æ}Ƈ½¨s½&Ê` ΙŸÏ\0á¾1ê0ô“_ÿíi¼ù96ruÏwRMóÉ,¹=åÉ#S?$˜!\™)½Æ:ìçn†:k—tc3½h1ðxv¿üžŽ]*†§MÜ'9£E0C0UåY0‚GX̬úT6†{:µMð0Uÿ0ÿ0Uÿ0  *†H†÷ ‚… ]ŽäoQhB Ý»O'%„½÷dý-×0ã¤ëÚ))¶y?vö#¸ ùX¤Ôap½ajŠÕ ½Å¼0|Öé %†@OìÌ£~8Æ7OíÝh1ŽLÒ³tî¾u^Hpÿ\„Ày…¸ý¾e£À´øR79Õ©1z¿ *ô™÷£E‚ã<^õžµÈž|.ȤžNKmýpmkc½dæ·ÎðòŸ.»·òPˆs’Ââãš2«ŽÝéî~5«¯>0”zÐ3=§eõüŽžbÏGD,]»µ2ÒGÒ8.ÐþÜ2jµî<ÕüçÃ$Bêc9©47<VÞ%X.509ê0‚æ0‚ΠWË3oÂ\æGã1hà0  *†H†÷ 0b1 0 UUS1!0U Network Solutions L.L.C.100.U'Network Solutions Certificate Authority0 061201000000Z 291231235959Z0b1 0 UUS1!0U Network Solutions L.L.C.100.U'Network Solutions Certificate Authority0‚"0  *†H†÷ ‚0‚ ‚ä¼~’0mÆØŽ+ ¼FÎà'–ÞÞùúÓ<3s³/¼qŒåŸ¶"`>_]Î ÿ‚ šQP&‰ÝÕa]Ü- ¢C]Ð4’ êsÏ8,& zr÷úP2øÂ“Ói¢#ÎA±ÌäÕ6ÑŠ:øŒcâYií Ókè¸åOjå˜ciH¾.ÿ3¶é—Yiøg®“a–DÓr°?¼j}ìHëªq+SiAS4µ°¹Å İEõA]n‰E{=;&ŒtÂåÒÑ}²ÔûX2"š€ÉÜý é^—Î;‡'p8©Žn³'v˜Qàã!«Õ…"<)µšÅ€¨ô»k0/F¢± "àÓ£—0”0U!0Éû×N˜Ú‡ª*Ч.±@1§L0Uÿ0Uÿ0ÿ0RUK0I0G E C†Ahttp://crl.netsolssl.com/NetworkSolutionsCertificateAuthority.crl0  *†H†÷ ‚»®Kç·Wëª-·sG…jÁä¥äç<éôYewµz[Z%6àz—.8ÀW`ƒ˜ƒŸ¹vznPຈ,üḚ™•Q츈ÿ‡P‚Âãà2€¿  GÈÃ1ï™g2€O!y i\Þ^4®µ&êPße,Éòcá©þ|qk3$j÷hÀjË.^aË®(Ó~´f‘&_<.$_ËXë(쯖óÜ{oÀ§ˆòSw³`^®®(Ú5,o4EÓ&áÞì[O'k|½D‚³‰yq=z¢Nõͤleh¡Iv\CÉØ¼6gl¥”µÔ̹½j5V!ÞØÃëûˤ`L°U  {W²4<VÞ%X.509$0‚ 0‚‰ 5ÞôÏ0  *†H†÷ 0N1 0 UUS10U Equifax1-0+U $Equifax Secure Certificate Authority0 980822164151Z 180822164151Z0N1 0 UUS10U Equifax1-0+U $Equifax Secure Certificate Authority0Ÿ0  *†H†÷ 0‰Á]±Xgbî š-m‘h˜ þÚo„b!ÃÑ|Οà¸ðN4ì⊕d¬ñkS_³Ëg€¿BŽþÝ ìáOüûð ÝCº[+á€p™W“ñ—j·Âh#ÌMY0¬Q;¯+ÖîcE{ÅÙ_PÒãP:ˆç¿ýàǹ£‚ 0‚0pUi0g0e c a¤_0]1 0 UUS10U Equifax1-0+U $Equifax Secure Certificate Authority1 0 UCRL10U020180822164151Z0 U0U#0€Hæhù+Ò²•×GØ# O3˜ŸÔ0UHæhù+Ò²•×GØ# O3˜ŸÔ0 U0ÿ0 *†H†ö}A 0 V3.0cÀ0  *†H†÷ XÎ)êü÷޵ιµ…ѹãà•Ì%1 ¦’n¶’cžP•ÑšoäÞc…n˜î¨ÿZÈÓU²fqWÞÀ!ë=*§#I†B{üî¢RµggÓ@Û;&X²(w=®waÖú*f'  ú§s\êpñ”!eD_úüï)h©¢‡yïyïO¬w815<VÞ%X.509`0‚\0‚D 8c¹f0  *†H†÷ 0´10U  Entrust.net1@0>U 7www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)1%0#U (c) 1999 Entrust.net Limited1301U*Entrust.net Certification Authority (2048)0 991224175051Z 191224182051Z0´10U  Entrust.net1@0>U 7www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)1%0#U (c) 1999 Entrust.net Limited1301U*Entrust.net Certification Authority (2048)0‚"0  *†H†÷ ‚0‚ ‚­MK©†²ê£ d*+KÑ¿ JMŽí€v¥g·x@ÀsBÈhÀÛS+Ý^¸v˜5“‹|:[·Ïå$±©}¸ÌkKñ Ü«¥@$t”¡)³ˆ õ‡wUÍäÃ~×jd«…†•[—2Po=Ⱥf ãü½¸IÁv‰IýÀ¨½‰£g/ÆŸ¼q`¸-é,Évf{”â¯xÖeS]<Öœ²Ï)ù/¤P²ÔHÎ2UŠý²dLä˜uÛß¹U`…0)ù{H¤i†ã5?†]zz½ïŽ"T&“¼Ih‘¿øGÓ•BÁMßo&ÏÃ!bfCpÖÕÀá£t0r0 `†H†øB0U#0€UäÑ€¾Ø‰¹£1ù¡$ ¹p0UUäÑ€¾Ø‰¹£1ù¡$ ¹p0 *†H†ö}A0V5.0:4.00  *†H†÷ ‚YG¬!„ŠÉœ‰Sº€…Ʊœ¶|Æ’]dãÓa|cã+1pvÒ£( ô»šcsímå*Ûí©+Æ6Ð+ë‹¥Úž\VõT)Èí²*ôÿç’‡°:µÃ7£Çô¹Õ¤9›S:#‘ñ¨‚¢jˆhÁy"¼ª¦Ö®ß°_¸‡ÐÝ|{ÿ¯ÏæÛ­^Û…Ð+ 3ÛÑæI@+vû>霉ΰ…x!OkOú6gÍòÿÐâÞÙ¿*¯¸‡†!<Ê·”hÏ<é˜×8ÿìÀÙPð.KX®FoÐ.Ã`ÚrUr½LEžaº¿„’ÑÒi|Å46<VÞ%X.509!0‚0‚ N-Š‚eà î>5Få=0  *†H†÷ 01 0 UGB10UGreater Manchester10USalford10U COMODO CA Limited1'0%UCOMODO Certification Authority0 061201000000Z 291231235959Z01 0 UGB10UGreater Manchester10USalford10U COMODO CA Limited1'0%UCOMODO Certification Authority0‚"0  *†H†÷ ‚0‚ ‚Ð@‹‹rã‘÷QÁT˜Ó©¿ÁæŠ];‡û»ˆÎ ã/?–ð¢)P™®Û;¡W°tQqÍíB‘MAþ©ÈØj†wD»Yf—P^´Ô,pDÏÚ7•Bi<0Äq³Rð!M¡Øº9|ž£$òƒ˜ª|C›[·®4‘þÔb&Fš?ëÁùñWë¬z ‹Ûr0jfÕàF£pÜhÙÿH‰wÞµéûgmAé¼9½2Ùbñ±¨=n7œâ/âÓ¢&‹Æ¸UCˆá#>¥Ò$9jG«Ô¡³©%þ ?§ºÓQÁ ¤Ú¬8ïUP$eF“4O-­ÆÔ!ÒŽÊaqsG劽MÎNœ¥H¬»&÷£Ž0‹0U X勯L7¤@©0©!¾G6ZVÿ0Uÿ0Uÿ0ÿ0IUB0@0> < :†8http://crl.comodoca.com/COMODOCertificationAuthority.crl0  *†H†÷ ‚>˜ž›öé×9·x®rIÓ‡äC‚ë?ɪõ¨µïU|!ReùÕ álô>Œ“s‘.ÄNqoÀ8a¨ À/ /A‹‘ÜHE¼ñÆÞºvk3È-1FLíçψ”ÿ3ÀVè$†&¸Ø88ß*kÝÌÇ?GL¢Â– ÖÛþ?%·”™»’2qð†^íP'¦ ¦#ù»Ë¦B14<VÞ%X.509Ü0‚Ø0‚A 7JÒC0  *†H†÷ 0Ã1 0 UUS10U  Entrust.net1;09U 2www.entrust.net/CPS incorp. by ref. (limits liab.)1%0#U (c) 1999 Entrust.net Limited1:08U1Entrust.net Secure Server Certification Authority0 990525160940Z 190525163940Z0Ã1 0 UUS10U  Entrust.net1;09U 2www.entrust.net/CPS incorp. by ref. (limits liab.)1%0#U (c) 1999 Entrust.net Limited1:08U1Entrust.net Secure Server Certification Authority00  *†H†÷ ‹0‡Í(ƒ4T‰ó¯7‘1ÿ¯1`ɨè²híŸç“6ñ d»Gõ?#GMÅ'& Tr ˆ-ÙšŸ¼³qÓ€?Gf{Œ5(Ò¹ ß$ÚœÖPyzZÓ7÷ÂJØ)’&dÑä˜l:Šõ4›eøíãÿý¸IXÜ Þ‚9k±a¹T¶æC£‚×0‚Ó0 `†H†øB0‚U‚0‚ 0ޠ۠ؤÕ0Ò1 0 UUS10U  Entrust.net1;09U 2www.entrust.net/CPS incorp. by ref. (limits liab.)1%0#U (c) 1999 Entrust.net Limited1:08U1Entrust.net Secure Server Certification Authority1 0 UCRL10) ' %†#http://www.entrust.net/CRL/net1.crl0+U$0"€19990525160940Z20190525160940Z0 U0U#0€ðbU=³ÿ kûP„—óíbÐ0UðbU=³ÿ kûP„—óíbÐ0 U0ÿ0 *†H†ö}A 0 V4.00  *†H†÷ Ü0údt§ ¥|!4¨ûGÿ%| ûä˜µïŒøÅ ÷’¾ñÃÕÕ•j»,Î&6eÈ1Æçî?ãWu„zïFOôÓ˜»¨‡2ºrö<â=Ÿ×ÙÃ`CŒX"–/b£,º­ï«2x‡ Tsµ\ùR>m-E ÷ “êíù²45<VÞ%X.509×0‚Ó0‚» ÚÑž&}è»J!XÍÌk;J0  *†H†÷ 0Ê1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 2006 VeriSign, Inc. - For authorized use only1E0CUmn< nØæ‘@¹øÁíßÛAªà– ÉÍd8ɔ) oŽÛ Ý%Û¤‹DÒAziJXO`Ê~‚j ª%9µÛç„e*•н†Þ^ƒ-ÌÞý¨‚*m( Äåç&áôoµ•üçB2ÛÎQ^(¶ž…Ó[ï¥}E@rŽ·kû35Hq¸'‹Äe_ †vœDzö•\ö]23¤T¶?h\òBJ…8Tƒ_Ñè,ò¬Ö¨ícj2<VÞ%X.5090‚0‚| 0  *†H†÷ 0Ä1 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting cc1(0&U Certification Services Division10UThawte Server CA1&0$ *†H†÷  server-certs@thawte.com0 960801000000Z 201231235959Z0Ä1 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting cc1(0&U Certification Services Division10UThawte Server CA1&0$ *†H†÷  server-certs@thawte.com0Ÿ0  *†H†÷ 0‰Ó¤PnÈÿVkæÏ]¶ê huG¢ªÂÚ„%ü¨ôGQÚ…µ t”†uÉéaõm0néRÀbÛM™žâj D8Íþ¾ãd pÅþ±k)¶/IÈ;Ô'%—/çmÀ(B™×LCÞÃõ!mTŸ]ÃXáÀäÙ[°¸Ü´{ß6:µf"Ö‡ £00Uÿ0ÿ0  *†H†÷ úLi\û•ÌFî…ƒM!0ŽÊÙ¨oIæÚQã`pl„a¡ÈH>YC}O•=¡‹· b˜zuŠÝˆNNž@Û¨Ì2t¹o Æã³D ÙŠoš)›™(;Ñã@(šZ<Õµç ‹Ê¤«éQÙâL,Y©Ú¹²uöBòïÇòù‰¼£ÿŠ#.pG13<VÞ%X.5090‚0‚ì §‹nujÏÄ|Ì/”^×0  *†H†÷ 0Ê1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 1999 VeriSign, Inc. - For authorized use only1E0CU“sú0Ãf­ÿ“-—ï0  *†H†÷ ‚ú%kO[ä¤N'U«"Y<ʵ ÔJÛ«Ý¡_SÅ W9ÂÎG+¾:ÈV¿ÂÙ':±<Àw1»:Ó{mš0Œ€Ë““*ƒ«Q‚gkóˆaG_“Õ[ àñÔ¡25…²:Û°‚«ÑË ¼OŒ[ÅK;*‚¦~6…Ü~ ªÃ5`‘Î44<VÞ%X.509$0‚ 0‚ 4NÕW ÕíìIô/Î7Û+m0  *†H†÷ 0©1 0 UUS10U  thawte, Inc.1(0&U Certification Services Division1806U /(c) 2006 thawte, Inc. - For authorized use only10Uthawte Primary Root CA0 061117000000Z 360716235959Z0©1 0 UUS10U  thawte, Inc.1(0&U Certification Services Division1806U /(c) 2006 thawte, Inc. - For authorized use only10Uthawte Primary Root CA0‚"0  *†H†÷ ‚0‚ ‚¬ ðû€YԜǤϡYs E ,nhñl[HhIY7ü 3ÂwÌ-•4æëM §Ҹɗ6·‰Ô$_ÀÌD””boëZÝ(š\„z ½tf/j8 âÕTD럺oîéýN )õ>„ ñœ«ø~‰¤è¡Øqe £Q{î¼Ò"` ¹[ߺüQ[ ¯˜²é.éèb‡Þ+È×NÁLdÝχXºJOÊhJÆÕ/‘Ì|qrÅÀgë2ýÉ’\”Ú…À›¿S}+ ôŒ‘—jRËÞ 6¤wØ{‡PDÕ>n)iû9I& ¥€{@-ëè'…Éþaý~æ|—Õ£B0@0Uÿ0ÿ0Uÿ0U{[EϯÎËzý1’j¶óFëWHP0  *†H†÷ ‚yÀK³‘¶üðégÔ nE¾Uè“ÒÎ?íÚ%°WË:v LìPvèdr ¤©ñ¸‹ÖÖ‡„»2åAÀwÙ³`ëÕÑnDD©¦ìUbw¸\ŽHI|œ;W¬­s7Ž/x\hGÙ``æü=" Ä÷éÄØrùÈs|ß/©>ýj'¶¡ëZº˜ÕãMd Èaºõ9‡º¸½{"öþ¬@yå¬o=yv‹Ä7³!„å6ëc ™¹éþ3»AÈÁùDc žÎBÓÖ?,vÓcœYݦá .A÷.•Gϼý3óö a~~‘+GÂ'0î§]7\9+äð{VŒh1<VÞ%X.509^0‚Z0‚Ã¥0  *†H†÷ 0u1 0 UUS10U GTE Corporation1'0%U GTE CyberTrust Solutions, Inc.1#0!UGTE CyberTrust Global Root0 980813002900Z 180813235900Z0u1 0 UUS10U GTE Corporation1'0%U GTE CyberTrust Solutions, Inc.1#0!UGTE CyberTrust Global Root0Ÿ0  *†H†÷ 0‰• ¶ðPœèzLjÍÝ.°”Ð=ö”ÀŠ”Çȗȸdz~lb¹ÕîHq)ïW0  *†H†÷ 0Ê1 0 UUS10U VeriSign, Inc.10U VeriSign Trust Network1:08U 1(c) 1999 VeriSign, Inc. - For authorized use only1E0CU f/•“¿ªG/¨F—ðâþ +Qævæ·F·â ¦Ì¨ÃLYU‰æèS\êðb §É_ ðÞÂvί÷jòúA¦¢3ÉåzcÓžb7Õ…ežæS$t^S[Ç,çƒI;®Šh¹W—0  *†H†÷ ‚–Á«’÷?/ɲþäZŸdÞÛ!O†™4v6WÝÐ/Å­7bs>Ôç_ÎÛ5ú+Û®` __n» =êZ `oµÀµ#". Ë©tËG»Á×¥kÌ/ÒBýIݧ‰ÏSºÚZ(¿‚ßøºP†‚ýŽ0)F°=5Ú8bJ­æ¶QlÞ¯bëÐ$þzh¸ûf™E\®ç®i+Z7É^*ôÆâ¡\T›¦TÏðñÁǘ0;6Û£nêý­²ÂÚïGŠÀñ³1­OáOœ¯ ÷x Øô5V€Ú·mdáþÅEº­k¹ zNOK„îKñ}Ý43<VÞ%X.509€0‚|0‚d ¬µjýi¶:cl¯ÚúÄ¡0  *†H†÷ 0X1 0 UUS10U  GeoTrust Inc.110/U(GeoTrust Primary Certification Authority0 061127000000Z 360716235959Z0X1 0 UUS10U  GeoTrust Inc.110/U(GeoTrust Primary Certification Authority0‚"0  *†H†÷ ‚0‚ ‚¾¸{ÿÔ|}g­ƒd{ÈBS-ßö„ aÖYjœD¯ïvý•~Îa0»zƒ_½fÊîo¡0œ½¡…ž”:óVˆ1ÏØîj–ÙíŒûumçê¸Ušôà^±ˆÀd…\MˆÇ·ºàué­=ljHà»(Èá0“d^RÀYp"5WˆŠñ• ƒ×¼1s4íïFqàk¨5rk—›fàËy_ØhGæ`â6—ßÎ5’ß¾gÇmwY;Ö”¼B4Á9ù±'>~ÖŠuŲ¯–Ӣޛ䘾}áé­¶oü×Úà4° wçã˜ïXúœ„·6¯Â߬Òôpq5£B0@0Uÿ0ÿ0Uÿ0U,ÕPA—‹ð6a[JûkÙ™É3’0  *†H†÷ ‚Zp,Ý·4Oõ†Q©&¾K¸ªñq ÜaÇ ê4zw5è'l¿‘$F>JNÎ+Õ Rüg¢E1OÎóú§ySjÙÚc:ø€×Ó™á¥á¾ÔUq˜5:¾“ê®­B²oàü!M5c3‰IÖ›NÊÇçN ÷ÚÇï™b™w¶•"^Š «ô¸x˜Ê8™ÉržxÍK¬¯ s-üÂAº‘ÚZ1·ù´q€H™rsZYSÁcR3í§ÉÒ9púà±Bf)ª›Qí0T"_Ù«Áä”ðøõ+÷êÊxFÖ¸‘ý¦ +>€ðB •^mÍÌK¤E«è³ÞZå |è"ZéY11<VÞ%X.509ë0‚ç0‚P0  *†H†÷ 0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 3 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0 990626002233Z 190626002233Z0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 3 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0Ÿ0  *†H†÷ 0‰ã˜Q–èÕ±jWÃru“«Ïž¦üóRÖ-MŸ5D¨.MIŠ8)õw7ç·«]ß6q™ÜÂ’ñç`’—ìØHÜ¿Á Æ$¤(L0Zvm±\óÝÞžq¡ˆÇ[›Amʰ¸Žî­3+ÏG\uq ˜$˜)§IY¥Ýø·CbaóÓâÐU?0  *†H†÷ V»X„g,ßÛ{I3õÓgô´ ³ÉÅ,â’jqx'òpƒBÓ>Ï©TôñØ’ŒÑËK«ÉŸE®<Š©°q3]ÈÅW߯¨5³‰‡éè%’¸…z®Ö¼7X*gÉ‘Ï*>íÆ9ßÀ>œÌM‚AµŒÞà=` E~k¢£Œî42<VÞ%X.509É0‚Å0‚­ ¬\&j @› yò®F%w0  *†H†÷ 0l1 0 UUS10U  DigiCert Inc10U www.digicert.com1+0)U"DigiCert High Assurance EV Root CA0 061110000000Z 311110000000Z0l1 0 UUS10U  DigiCert Inc10U www.digicert.com1+0)U"DigiCert High Assurance EV Root CA0‚"0  *†H†÷ ‚0‚ ‚ÆÌåsæûÔ»å--2¦ßå?ÉÍ%I¶q*ÃÕ”4g¢ °_i¦@±Ä·²Ð˜¤©AY:ÓÜ”Ö<Ût8¤JÌM%‚÷J¥S8îóImq‘~c¶«¦_䄸ObQ¾øÅìÛ8’ãå‘ Ä(AUûËZ‰~qè5¿Mr =¾:8P[w1³Ç$Eš§¬mZ·ºëQ ˜AA"Nea‡AP¦y\‰ÞJWÕ.æ]S,~˜Í¤hsÐ4\¡qÓZ|UÛ^dá7‡0Vå´)€ñy9ˆ¢|'f·ˆ·xòÊ ¨8« d¿f]•„Á¡%‡]P ÌA»n Q8¸KË£c0a0Uÿ†0Uÿ0ÿ0U±>Ãiø¿GÔ˜&ïcd+Ã0U#0€±>Ãiø¿GÔ˜&ïcd+Ã0  *†H†÷ ‚—ÜלŸ<ˆfW!Û!Gø*gª¿2v@WÁŠózÙeŽ5úžüEµžÙL1K¸‘èC,޳xÎÛãSyqÖå!”ÚU‡š$döŠfÌÞœ7ͨ4±i›#Èžx"+pCãUG1aïXÅ…/N0ö 1#Èçâe3Ë¿ =øÊ^‹1‹`‰- \R·Äù ˜Ñ_Ÿ¾|6c8½D¤ä&+ Ä—i éŒâÀW¸Èv‘UòHiؼ*[DÔ 1Ûôºp&]`ž¼K /´ËChÉ'ÁÒ\÷ê!¹hœ<œ¿žü€\›cÍìGª%'g 7ó‚}Tשøé.£wèJ10<VÞ%X.509ë0‚ç0‚P0  *†H†÷ 0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 2 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0 990626001954Z 190626001954Z0»1$0"UValiCert Validation Network10U ValiCert, Inc.1503U ,ValiCert Class 2 Policy Validation Authority1!0Uhttp://www.valicert.com/1 0 *†H†÷  info@valicert.com0Ÿ0  *†H†÷ 0‰Î:qÊå«ÈY’U׫ØtùîÙöUGYeGUÜë˜6<\S]Ó0Ï8ì½A‰í%B $k ^³|ÝR-LæÔÖ}ZY©eÔI-$MPoµÁ…T;þqäÓ\Bù€à‘ [96gó?U|?´_ds4ã´¿‡døÚÿ7'Á³C»ï{n.i÷0  *†H†÷ ;PooP”™Ib88Kø¥È>§‚ö+ÇèÅÎè:‚ËŽM½¨X¡yµ»é¯AÙ4î! 2I(ôÄŽVÕR3ýPÕ~™läÉLüËl«f³J!Œåµ 2>²Ìl¡Üš˜L[óιž¥rJ·?<æhø¾ítL¼[ÕbCÝ41<VÞ%X.509³0‚¯0‚— ;àVBF±¡ujÉY‘ÇJ0  *†H†÷ 0a1 0 UUS10U  DigiCert Inc10U www.digicert.com1 0UDigiCert Global Root CA0 061110000000Z 311110000000Z0a1 0 UUS10U  DigiCert Inc10U www.digicert.com1 0UDigiCert Global Root CA0‚"0  *†H†÷ ‚0‚ ‚â;árÞ¨¤Ó£WªP¢ wÉ¢¥îΖ[ Ì“§N0·S÷CÄiWâ"݇@ Î΃¿ßÍ;qFâÖfdzv'{ž•}î·H£ÚÖ¯z 9eJ]¼ø«¾î(×tzx™Y…hn\#2K¿NÀèZmãp¿w¿üö…Ù¨DX2©uÕÑ¢¾Gâ'jôš3øI`‹Ô_´:„¿¡ªJL}>ÏO_lv^ K7‘žÜ"æmÎŽjËþͳdÇ[)ž2¿òîúÓ BÔ«·A2Ú ÔïøÕ»X?µèI(¢pÚ1Ý÷²òL N¨íJ=^µ£Ã¯'£c0a0Uÿ†0Uÿ0ÿ0UÞP5VÑL»fð£âײ=ÑU0U#0€ÞP5VÑL»fð£âײ=ÑU0  *†H†÷ ‚Ëœ7ªH úÝDœOR°ôß®õyy£$üK+„À-¹ÕÇþôÁX˸mœztç˜)«µãp ¡ÍLˆ™“Œ‘p⫾“©ÿcÕä`Ó£¿[ ñÕŽãSôŽcú?§Û´fßbfÖÑnAò-µêwJŸXâ+YÀ@#í-(‚E>yT’&˜à€H¨7ïðÖy`Þ¬èÍn¬D8/IÚáE>*¹6SÏ:P÷.èÄWIla!Õ­x<,:€k§ë¯騉Á¹8lâ‘lŠÿd¹w%W0À$£áÜéßG|µ´$0ì-½ ¿E¿P¹©ó똭ȈƘ4_ <ÆéÕ••mÞ40<VÞ%X.509»0‚·0‚Ÿ  çàåØFþå`üð090  *†H†÷ 0e1 0 UUS10U  DigiCert Inc10U www.digicert.com1$0"UDigiCert Assured ID Root CA0 061110000000Z 311110000000Z0e1 0 UUS10U  DigiCert Inc10U www.digicert.com1$0"UDigiCert Assured ID Root CA0‚"0  *†H†÷ ‚0‚ ‚­ÎäC€\±‡ó·`ùq¥®Ü&”ˆªôÎõ 9(X` ø€Ú©•2a<µ±(„ŠŠÜŸ ƒz¬ŠçyS\1„*ö˜26vÌÞÝ<¨¢ïjû!òRaߟ ×â±ÙþdÒ[_ùX5¼GÍ¡6ùkÔ°8>ÁÃŒ3ÙØ/þ(³§ƒÖÃnDÀa5–þYœ‹vm×ñ¢K +ÿ rÚž`ÐŽ5ÆxU‡ ¡Ïåm ÈI|1˜3l"é‡Ð2Z¢º‚í9™:r¡æú¤ÙÕ1u®…}"®?F†ö(yȱÚäWÄ~°´’¦V³½²—íª§ð·Å¨?•Ðÿ¡–ë_wO£c0a0Uÿ†0Uÿ0ÿ0UE뢯ô’Ë‚1-Q‹§§!ómÈ0U#0€E뢯ô’Ë‚1-Q‹§§!ómÈ0  *†H†÷ ‚¢¼ßâíðãrszd”¿÷rfØ2äBub®‡ëòÕÙÞV³ŸÌÎ(¹ —`\LXäÓ=ƒIEX—5i¨GêVÆy«Øg„ß <”æ¸&, ½=³(‰÷_ÿ"â—„éeï‡àßÁgI³]ë² *ë&íx¾}?+ó·&5m_‰¶I[Ÿ›«=%Á̶Âño†Æúdhë-”ëB·úŒÝbñ¾Pg·l½óñk 67|©[mzñF`ƒ×'¾KΗ¾Ãg*h߀ç 3f¿ nócú%ml¥·a±Ò£&¡q­âÃùÙQ·+Î.æP²§ú E/¢ðò70<VÞ%X.509g0‚c0‚K ;0  *†H†÷  0S1 0 UIL10U  StartCom Ltd.1,0*U#StartCom Certification Authority G20 100101010001Z 391231235901Z0S1 0 UIL10U  StartCom Ltd.1,0*U#StartCom Certification Authority G20‚"0  *†H†÷ ‚0‚ ‚¶‰6[· 6½‚»á •z¯£UÉ%™JÅÐVA‡M!`¤‡;Íý²>´gjíáKÀ‘…pEàBžÞ)#Ô  y¸Û½ó©/ÑÆàËžŠ ¸½öVbñÅr¶2%Ù²ó½eÅ ,nÕ’o‹A‚o@ &z(õ'÷”±7=·Ç‘÷âìý”‰áÌnÓ6Ö y®×4‚eÿ|B»¶Ý ¦4¯K`þCI‹ŒC¸VòÙ!Cê§H•uuê+¥C•ê„&nU›«ÜÒ9Ò1`â¬ÌVE$õT«î†Ý–2…øLOè•v¶Ý6#g¼ÿâÊ;æ¦ì;ì&4Hö€+#ëŠ:v*{Vr*³ªã`¥Ÿ›âoX[¥l‹X<úN:\÷á–+>Då]ÌMŸ áܪ»ánìá¶LMyr]5 ×ÁGÚ–$àÐr¨Z_f-Ü/*®&þ ÌÐ> œÈ .ù[–zGœézóPt•sž0 ó—‚^æ9Yå5Bÿœ÷¾ªPÏâQH׸o¯øN~3˜’b:ucÏ{úÞ‚;©»9âĽ,ȬïM%ŽØ³/©Ú)}¯t:²'ÀÁ>u£©¯z"]Ÿϧ ëㆠÓýæ–•×#È7ÝÄ|ª6¬˜±àNè±;õÖoñ0×£B0@0Uÿ0ÿ0Uÿ0UKÅ´@k­³¥enF6‰‡ ¶0  *†H†÷  ‚sW?,Õ•2~7Û–’ë^~SçAì¶GïµÞít\ÅñŽIàün™ÍŸŠÚÍ: Ø:Z ?_4Ð/Òf½œ7È ŽZ”EF*æ¾zÚ¡©¤i’°}6ÔD‡×Qñ)cÖuÍä'‰øÂ2HýÛ™Ð_Tt̬g4bÙ 7‡Ñ£HŽÒö×ýÛeëý¨ÔõÖO¤[uèÅÒ`²Û ~%‹{ºR’ž>èÅw¡<àJskaφÜCÿÿ!þ#]$JõÓmbW‚Ún¤3%yK.T‹Ì,=0éÑÿè2F¾µ3vw¨]–ÁÁÕ¾®%ÀÉ ˆ¡ÉóoM‚T §Òä9T.¸»½šN;4ÜœˆSï¢1[XO‘bÈššÍ]8©Ö¾øµŸiòPb¬û7ôî¸ug`ûƒPùDµuœ@²þýy]nXX_0ü®¯3ÁNlº§¦¡2Û8à±r +‘ìjc&í‰ÔxÌtøkþŒjv9)®e#•"—Î[î ⻼D“öØ8E!íä­«¶¤B.-Ä :gi„šáYŠ(…Õ]t±Ñ X›¥°c¦í{GýEU0¤îšÔæâ‡ï˜É2‚)"¼ 1^-ÀŽék².ØÑ‘ÇÆôLý0ÃÁÚ8[ã©ê桺yïsضSW-öÐá×H39<VÞ%X.509Í0‚É0‚± 0  *†H†÷ 0}1 0 UIL10U  StartCom Ltd.1+0)U "Secure Digital Certificate Signing1)0'U StartCom Certification Authority0 060917194636Z 360917194636Z0}1 0 UIL10U  StartCom Ltd.1+0)U "Secure Digital Certificate Signing1)0'U StartCom Certification Authority0‚"0  *†H†÷ ‚0‚ ‚ÁˆÛ ¼lF|xŸ•{µ3òrbÖÁ6 "$^ÎéwòC ¢d¤ÌŽ6ø8æ#ðnm±<Ýr£…¡Ó=´3+Ó/¯þê°AYg¶Ä} žt…ÖyL€7zß9RY÷ôFC¤Ò……ÒÃqóub4º,Šîí4ÐÇ–ÍR=º3ÖÝMÞ ;JKŸÂ&/úµr5wÊ<]æÊá&‹6v\Ût%þíµ ˆÝxÊ-—0-ryúFÖ*¨¹¦«ƒIåòïÝäŽ cS…b©:̵f¦Âktä+áv>´mØöDásb;ľ SV%lQ ÷ª«Ê¿vým›óÛ¿=f¼ Vª¯˜H•:Kß§XPÙ8u©[êC ÿ™ëèlMp[)eœÝª]̯1ì ëÒèêœ{æn÷'f H×nBã?Þ!>{á pûcª¨lT´\%zɢɋ¦»,~^MXnî Æ2ÿüôúÍn‘è6I¾Hi‹Â–M²iÁ Öúy"H¿º{iøpÇúz7ØØ ÒvOWÿ·ã‘ÒÝïÂ`·g:ÝþªœðÔ‹r"ÎÆŸ—¶ø¯Š ¨Ùûƶµ\R<‰¶*s ³`òz/Û£nÿ&0—õ‹Ý‰W¶­=³¯+Å·vð¥Ö+š†*röã3Œ] Kß»ŒtRK£‚R0‚N0 U0ÿ0 U®0UN ï¤@[¥i‡0Ê4hCÐA®ò0dU]0[0, * (†&http://cert.startcom.org/sfsca-crl.crl0+ ) '†%http://crl.startcom.org/sfsca-crl.crl0‚]U ‚T0‚P0‚L +µ70‚;0/+#http://cert.startcom.org/policy.pdf05+)http://cert.startcom.org/intermediate.pdf0Ð+0Ã0' Start Commercial (StartCom) Ltd.0—Limited Liability, read the section *Legal Limitations* of the StartCom Certification Authority Policy available at http://cert.startcom.org/policy.pdf0 `†H†øB08 `†H†øB +)StartCom Free SSL Certification Authority0  *†H†÷ ‚l™ôf 4õÐ…^} ìÚN8^ߦ%K‘2Áè;ñ=ÝD [IŠ)Ëf·±š÷%˜ <ŽáÝ6‡+K»hÓ9f= &Çò9‘Q«‚{~ÕÎZäâWpi—ù^X¦ ߌšE8 ^WöbÇzæ¼µòžô©)ƒø²ãn(‡DÃÞ8©<¬CMdEÎÝ(©\òs{ø諱ó.\dns1:¸¼³ä}Qš;‰ôM“f{<íÓššóePõ ÐuŸ/¯ðê‚C˜øiœ‰yÄCŽFrãd6¯÷%8‰w~Ãkj¹ÃËDK¬x‹çÇ,KDÈ4R'Í ]Ÿ…Á‰Õxò•S2Ý€„fuÙµh(ûa.¾„¨8À™†¥gd­./©p…Ç–|‰eõŽCT«Ý¥€9”`À4É–p,£õH{½~k·ô";®øü*Êú‚R ï¯KU“ëÁµð"‹¬4N&"¡‡,uJ·å}׸ dÀ6ÒÉ/†Œ# Á‚;sI£jW‡”åÖxÅ™CcãMàw-áe™riG æV$û¿y©X.¹Ä ~•ºm>²êJ9ØÐ+õ¿ìu¿—Å ÜU7âû7„Cb ÊçVKeêþlÁ$“$¡4ëÿš"®›}?ñeQ ¦0j³ôˆ€ ürŠèƒ^38<VÞ%X.5090‚0‚÷ 0  *†H†÷ 0h1 0 UUS1%0#U Starfield Technologies, Inc.1200U )Starfield Class 2 Certification Authority0 040629173916Z 340629173916Z0h1 0 UUS1%0#U Starfield Technologies, Inc.1200U )Starfield Class 2 Certification Authority0‚ 0  *†H†÷ ‚ 0‚‚·2Èþéq¦…­ dßÎMïȇ?¡«û<¦ŸðáÚÔØn+Sû$¤>„ðžè_ìå'Dõ(¦?{Þà*ðȯS/žÊ“f9§MúZ¶s%fëwçYÆJ™%Të&ÇóÕ0p¯°F*ÿ­ë)íןª‡£Ôù‰¥4_ÛC‘‚6Ùf<±¸¹‚ýœ:>È;ïefz›=ÿqQ<0._¾=ws²]lÃ#Vš+…&’§³ä? ¯y‚¸6=êœÓ5³¼iÊõÌèýd€3n^J]™É‡´ÀÕn5#^ß›_=ïÖ÷vÂê>»x BgkØøÖÚo‹òD «£Å0Â0U¿_·ÑÎ݆ô[U¬Üשˆç0’U#Š0‡€¿_·ÑÎ݆ô[U¬Üשˆç¡l¤j0h1 0 UUS1%0#U Starfield Technologies, Inc.1200U )Starfield Class 2 Certification Authority‚0 U0ÿ0  *†H†÷ ‚?ˆÑÉU¡¬ióóYÚ›‡OW©¡y *Û÷/²ÌÇ^j؃‡¡—ïI5>wAXb¿ŽX¸ g?ì³Ý!fÉTúrÌ=L@دwžƒz»¢Çõ4ŽÙ@ôü,*M§b].%Ó hù¸ô½‹í(YÝM‹ƒÈ²eÇ-z¥ª¼S†mÝW¤Êø A hðôût¾V]zyõù…ã-•¾õqCÌš ‡)éU"X#êãC)[GÝŒAje¨å!ªA´•!•¹}Ñ4«Ö­¼Üâ=9ͽ>up¡YÉ"´œÕ^*×¥¶Ô mø·@Fšyb¿—ìà/”69<VÞ%X.509‹0‚‡0‚o -0  *†H†÷  0}1 0 UIL10U  StartCom Ltd.1+0)U "Secure Digital Certificate Signing1)0'U StartCom Certification Authority0 060917194637Z 360917194636Z0}1 0 UIL10U  StartCom Ltd.1+0)U "Secure Digital Certificate Signing1)0'U StartCom Certification Authority0‚"0  *†H†÷ ‚0‚ ‚ÁˆÛ ¼lF|xŸ•{µ3òrbÖÁ6 "$^ÎéwòC ¢d¤ÌŽ6ø8æ#ðnm±<Ýr£…¡Ó=´3+Ó/¯þê°AYg¶Ä} žt…ÖyL€7zß9RY÷ôFC¤Ò……ÒÃqóub4º,Šîí4ÐÇ–ÍR=º3ÖÝMÞ ;JKŸÂ&/úµr5wÊ<]æÊá&‹6v\Ût%þíµ ˆÝxÊ-—0-ryúFÖ*¨¹¦«ƒIåòïÝäŽ cS…b©:̵f¦Âktä+áv>´mØöDásb;ľ SV%lQ ÷ª«Ê¿vým›óÛ¿=f¼ Vª¯˜H•:Kß§XPÙ8u©[êC ÿ™ëèlMp[)eœÝª]̯1ì ëÒèêœ{æn÷'f H×nBã?Þ!>{á pûcª¨lT´\%zɢɋ¦»,~^MXnî Æ2ÿüôúÍn‘è6I¾Hi‹Â–M²iÁ Öúy"H¿º{iøpÇúz7ØØ ÒvOWÿ·ã‘ÒÝïÂ`·g:ÝþªœðÔ‹r"ÎÆŸ—¶ø¯Š ¨Ùûƶµ\R<‰¶*s ³`òz/Û£nÿ&0—õ‹Ý‰W¶­=³¯+Å·vð¥Ö+š†*röã3Œ] Kß»ŒtRK£‚0‚ 0Uÿ0ÿ0Uÿ0UN ï¤@[¥i‡0Ê4hCÐA®ò0U#0€N ï¤@[¥i‡0Ê4hCÐA®ò0‚ZU ‚Q0‚M0‚I +µ70‚80.+"http://www.startssl.com/policy.pdf04+(http://www.startssl.com/intermediate.pdf0Ï+0Â0' Start Commercial (StartCom) Ltd.0–Limited Liability, read the section *Legal Limitations* of the StartCom Certification Authority Policy available at http://www.startssl.com/policy.pdf0 `†H†øB08 `†H†øB +)StartCom Free SSL Certification Authority0  *†H†÷  ‚ŽçÜ”y|ñ…ŸIokÊ]ûŒþÅÁbÑ}BмS·”f0?±ç §P U%vz ë@æ>؈«'ƒ©u¦7sÇýKÒM­@ÈF¾;Qüö1ÜÍ…"Nq·òq^°ƺ“‹x’J…øxƒþ/­,÷䤻-Ðç :¸>Îöxö®G$Ê£56ÎÇÆ‡˜Úìûé²Î'›ˆÃ¡ö Yh¯ÉÛMödc\¥o’²“”Lj“¶~b‹«NŸüãuO*2ß[ àõ{“ «¡Ï‡á¥Eè<¥ ŰѷSó`º…ij!|ua {l;A)\á¬ZÑÍŒ›ë`ì÷å°Úùy¥E?ICWÒÝ$Õ,£ý‘'µåëšL{!»:­0ÀØÁk,Y\]‘±p"WëŠkHJÕ)ìÆ@À/ˆLhwô$O½úá² !KÝØ)}ª¸ÞTì!U€lõ0È£岿*1Ã…-Œ˜±†ZO‰Y-¹Ç÷ÈŠÀJæBOb£m)¤…«ÛåÈ­*=L][„&qÄ…^q$Ê¥lØaÓàTÛκ©2µ"ösA ]¸]™ÖGÚo :b(g‚ÙñЀY›Ë1Ø›ŒwNµhŠòlö$-lpÅsÑÞÐq¶Ó{öã¸Ô nkžu„9æ%¥òHÀ¤Ú?37<VÞ%X.5090‚0‚è 0  *†H†÷ 0c1 0 UUS1!0U The Go Daddy Group, Inc.110/U (Go Daddy Class 2 Certification Authority0 040629170620Z 340629170620Z0c1 0 UUS1!0U The Go Daddy Group, Inc.110/U (Go Daddy Class 2 Certification Authority0‚ 0  *†H†÷ ‚ 0‚‚Þ×êWI¡[ë×_H†ê¾Ýÿäïgôeh³Wq ^w»í›Iép€=VcoÚòÌÐ?T"TزÔÀu=KÇwÃ>x«µ k/j+±Åˆ~Ä»°ÁØE'oª7X÷‡&ר-ö©·r6N¦?e˜’Û*n]¢þˆà ÞåáëË:Õâ¢-ØŽ¯_= ¶\¥e8E™£``tÅA¥rbbÅo_B¾Qe¨®#jüx©M€Ãú«Zü¡@¤Êþ²Èï^s îw½šöy˜¼±g¢ Ý XÆD{ >b(_ºASXÏ~8tÅøÿµi„tê—¯£À0½0UÒİґÔLq³aË=¡þݨjÔã0U#…0‚€ÒİґÔLq³aË=¡þݨjÔã¡g¤e0c1 0 UUS1!0U The Go Daddy Group, Inc.110/U (Go Daddy Class 2 Certification Authority‚0 U0ÿ0  *†H†÷ ‚2Kó²Ê>‘üÆ¡ŒŽw 3\÷¦= ù‡€niä–0ÿ4‘cr8îÌ£”(¤1özÄT×öå1X¢ÌÎbÛ”Esµ¿EÉ$µÕ‚­#yi¸¶MÎÏLÊ3#航‹AnÉ å‰žÍ;Úp÷~™& T%«ns…æ›! l‚¨øÂ úl–ï‡ Äa‹­îƒ+•øŽ’„r9ë êƒíƒÍ—n¼ëN&¶s+äÓöLþ&qâatJÿW‡uH.ÏQi a•ÕÑ@²LîĬC¦¥ž Õ•bš ψ‚Å2 ä+ŸEæ Ÿ(œ±¹*ZW­7¯Û½Ÿ68<VÞ%X.5090‚þ0‚… t—%ŠÇ?zT0 *†HÎ=0E1 0 UUS10U AffirmTrust1 0U AffirmTrust Premium ECC0 100129142024Z 401231142024Z0E1 0 UUS10U AffirmTrust1 0U AffirmTrust Premium ECC0v0*†HÎ=+"b 0^Сy5·:<’zÊÍbóœ&\=åTú£ÖÌêô_莫/.Hæ¬Cx¬Ð7ý²Í,æGâæc¸=./xÄOÛô¤hLUrk•NB•xÌ7<‘â›e+)£B0@0Uš¯)zÀ55&Q0Ãjþ@Õ®Ö<0Uÿ0ÿ0Uÿ0 *†HÎ=g0d0 ó‡ˆPZ¯ÈÀB¿G_õlj†àÄ'tä8S×4ãÆ/³Ê <7×ç¸Fñý¡âq0BY‡CÔQßºÓ 2ZΈ~W=œ_Bkõ-µð‚“ùYo®dúXå‹ãc¾µÍoŒy36<VÞ%X.50940‚00‚ P”lìêÕœMÕ—ïu ­0  *†H†÷ 0‚1 0 UUS10U www.xrampsecurity.com1$0"U XRamp Security Services Inc1-0+U$XRamp Global Certification Authority0 041101171404Z 350101053719Z0‚1 0 UUS10U www.xrampsecurity.com1$0"U XRamp Security Services Inc1-0+U$XRamp Global Certification Authority0‚"0  *†H†÷ ‚0‚ ‚˜$½´ºßÇŒ¥'¶8 ió¶N¨,.!\Dß!]~#tþ^~´J·¦­®àâ›[Ùgtk]€)†Ùœ ˜mv(Xäe°J˜yŸàÃ1~€+µŒÀ@;†ÐË¢†6`¤Õ0‚mÙnÐ3—_OaZðäù‘«ç;¼èÏôk-4|âHaŽóaDÌo J©”°MÚç©4zr8¨AÌ<”}ëȦŒ·†ËÊ3;Ù=7‹ûz>†,çs× W¬d›ëôЬdôZ%"4,²öhmÓŠÚĦâ#…Õz ½jàéìì»Bgª%íEƒ!üÁÉ|Õb>úòÅ-ÓýÔe£Ÿ0œ0 +‚7CA0 U†0Uÿ0ÿ0UÆO¢=c„ œÎbä¬\µé¶06U/0-0+ ) '†%http://crl.xrampsecurity.com/XGCA.crl0 +‚70  *†H†÷ ‚‘9gûJù `[¡ÚM—bù$S'ׂdN.ÃI+šÜü¨xg5ñð½·Hãö ß?ÒɶªU¤HºÛÞY.[;}G×7ê_Mv6»סF £,m©ž~?)ΓßýÉ’s‰‰džç+ä‘,Ò¹Î}Îo1™Óæ¾Òð y\#«MÒÚ!M™yáÏ'Ÿ›ˆ °ŠdA1¸l$¤›\qº»~Ûj€!¼éÛ¦·@ô²‹©±äïšÐ=i™î¨(£á<³ð²œÏ|@æÝçC}¢Ø:µ©ò4™ÄÔáý „;îÄLôì'|BÂt|‚Š É´%¼67<VÞ%X.509J0‚F0‚. mŒF±¦ î0  *†H†÷  0A1 0 UUS10U AffirmTrust10U AffirmTrust Premium0 100129141036Z 401231141036Z0A1 0 UUS10U AffirmTrust10U AffirmTrust Premium0‚"0  *†H†÷ ‚0‚ ‚Äß©_þAÝÝõŸŠãö¬áQ§Ñ"Ä §8Hl³ùÿ}«†WãºÖ…xwºCêHöؾ#m¿Ñ6lX\ñî¤TõÒvæáŒ½<³ÓHKâÈø’¨vFœBe>¤ÁZF-¸—ó·Õ²U!ïºÜL—û•'3¿èCGFÒ™`;š~Òæí8êìå ÉšBlÅ”~aÄŠß‚ YÄY2w³¼`iV9ý´{,Öd6Ù½Hí„~¥"*¸Bô‚·ÔSxN-ýoD×;t–Bàâ.kêÅîr¬»¿þꪨøÜö²yжg£B0@0UÀg¦ "Ù&õE«¦eR'ØE¬c0Uÿ0ÿ0Uÿ0  *†H†÷  ‚³WMbN:ä¬ê¸¯2#ȳIZQœv(yªWFÕõRö·DèD¿„Ò €ÍÅýUa‡Aܵ$ž<ÄØÈûpž/x–ƒ 6Þ|iˆ¥u6˜¦Æß¬ÎãXÖ·>Þºóë4@Ø¢õx?/Õ¥üÙ¢Ô^­þAðå²rúD‚3Bè-X÷VŒb?ºB°œ \~.e&\SO²x~¡ ™-¸ޢİý`Ð0¤ŽÈb©Äí5Þz—í8^’/“p¥©œo§}~ÆH±^gëQ%éæ%kR)‘œÒ9sWÞ™´[ᨸJ ÐÁAÊûŒ5!}‚8ò©T‘5“”mj:Ų뉆“è›É:§z¸¡ðxFúü7/劄óßþÙ¡h /$â •Õ•Êá$–ë|ö“»ísé-Ñu9×ç$ÛØN_CžÐ9¿UpH™W1´œîJ˜–0`î#þ`#Gb…¥Ì4€o³¬ãŸð{H­ÕÙg¶©r“ê-fµ²¸ä=<²ïLŒêë¿«5šU†¼¦µ¨^´ƒlki@ÓŸÜñÃik¹ám ôñªPv z}z¡U–B™1 Ý`0~æŽFÑÚÇä–ŒÄ$µÏ²@ø£žA†¼Ðk–È*€4ý¿ï£ÝXÅ…=>þž)ම hC35<VÞ%X.509x0‚t0‚\ D¾ ‹P$´Ó6*þe ý0  *†H†÷ 0—1 0 UUS1 0 UUT10USalt Lake City10U The USERTRUST Network1!0U http://www.usertrust.com10UUTN-USERFirst-Hardware0 990709181042Z 190709181922Z0—1 0 UUS1 0 UUT10USalt Lake City10U The USERTRUST Network1!0U http://www.usertrust.com10UUTN-USERFirst-Hardware0‚"0  *†H†÷ ‚0‚ ‚±÷Ã8?´¨Ï9‚QgÐmŸÒÿXóçŸ+ì ‰T™¹8™÷à!yH»at–¬a½ ˆÈß=î|L ^k‘ÖîÇí(«M‡‰sÐn¤Ð‹ávDc¬äÍIœÅ’ô«2¡H[£¹0¶0 UÆ0Uÿ0ÿ0U¡r_&(˜C•]7Õ…–KÒÃE0DU=0;09 7 5†3http://crl.usertrust.com/UTN-USERFirst-Hardware.crl01U%*0(++++0  *†H†÷ ‚GÞtÆ™—¯ü­(^uŽë-gîN{+× ÿöÞËU¢ áLTe“`kŸœ­^ƒ,ëZ®Àä-ôc¸ÀlòÏI»M“o¦ "²IbNÿÈȲˆ]çä•åE4³‹i½Ï´…uQž}:8:HÆû§; ‚@衉ËPßʼ{v—;îÊÄnuï3øÓo[–ãàtwt{Š¢n-ÝvÖ90‚ð«œRò*ǯI^~Çhå‚Èj'ù'ˆ*ÕXP•ð;W»}9b+šÉ”’*£" ÿ‰&}_#+GשjžQ *QžùÔ;^p2œ»øf¨66<VÞ%X.509P0‚L0‚4 |O9Ô™-0  *†H†÷ 0D1 0 UUS10U AffirmTrust10U AffirmTrust Networking0 100129140824Z 301231140824Z0D1 0 UUS10U AffirmTrust10U AffirmTrust Networking0‚"0  *†H†÷ ‚0‚ ‚´„Ì3.k”lkaR ë£Ïy”L唀™ËUdDegdâã\7Iö/›„„-ò`0NÌ„…â,Ïžþ6«3w5DØ5–=6èzØÕG¡ji‹Ùü»:®yZÕôÖq»š#kš·ˆt‡ _¹ž-ú«S+Ü»v>“LŒ¢#Ôj­"º™.me˾$fU$K@D±×áÂ…ÀÞ?=í¸üññ#SÜ¿e—oÙù@q}½•Ôξ ^'#Þý¦Ð&)ë¼®¼GŠj®qʱ*¸_B ìF0Ñr ÊéVmõïßx¾aº²¥®L¼¨¬i—½ïë´Œ¿5øÔÃÑ(\:Ÿp3 wÄ¢¯£«0¨0 UÆ0Uÿ0ÿ0US2ѳÏúàñ ]…N’ÒžE´O0=U60402 0 .†,http://crl.usertrust.com/UTN-DATACorpSGC.crl0*U%#0!+ +‚7  `†H†øB0  *†H†÷ ‚'5—Š‹(½Æ30)üâ÷Õ˜Ô@»`Ê¿«, 6PúAÜ®–: #>‰YÉ£í7­ü|¾QIZÞ: TE™±‡ÍŒhàiéÄN˜²;Œ³  ˜P›“©p È,£ßäàq:ñ´#r ªßߘ>P 1&½(éZ0&uù{`óÍP&m'šßÕ EG)k,ævÙ©)}2ÝÉ6<½®5ñž»?GNŽ×~bsR&8Iý0tšÄå"/ØÀí‘zLr]ÚÝ‹EkçÝi—¨ÅVL öŸz‘7ö—‚àÝqiÿv?`M<Ï÷™ùÆWôÉU9xº,yɦˆ+ô65<VÞ%X.509P0‚L0‚4 ww'&©±|0  *†H†÷  0D1 0 UUS10U AffirmTrust10U AffirmTrust Commercial0 100129140606Z 301231140606Z0D1 0 UUS10U AffirmTrust10U AffirmTrust Commercial0‚"0  *†H†÷ ‚0‚ ‚öOg+¡õ"˲ãsEDI,»I%ÖÎ÷«,OÆA2”Wú§[↧ªµ-¹_ ŠÂ¯…5y2-»b7ò±[J=ÊÍq_éB¾”èÈÞù"HdÆå«Æ+m­ðúÕ ÏšåðP¤‹;G¥#[zzø3?¸ï™—ã ÁÖ(‰Ï”û¹Eíã@Ôtð 1â+&j›LW®¬ >ºEzó½›i®}N cÄ5v:É7ýÇGîèñvsò—¤µÈzyÙBª+\þÎ&O£f5¯DºT02eæ<“^PNzã:ÔnÌûùÒ7®$*«W"( Iu·(Úu¿ŽãÜy1£B0@0U“ÆS‹^ʯ?Ÿ噕¼$ö”0Uÿ0ÿ0Uÿ0  *†H†÷  ‚X¬ôÍÀ ÿ ýÔº_)½{h™XIÒ´7M'}F]CƆ.>s²&}O“©¶Ä*š«!—±ÞŒÓ«‰Øk$Ôñ®Ø¤\ÔQŽí±“c½¼øa€šž±ÎBpâ©}%}'¡þoì³$ÚãKU;5´;Ù×]0ý‰òÂ+ígÄŽÉC²\k‰¼büNòµ3ª²oÓ ¢Pãö;è.DÂÛf8©3VHñm3 Œ?`7ÓÊm~4~ Ÿrv‹ŸrýR5AE–/²šsI!±IGEG´ïj4ÉMšÌY·ÖžZNeµ”®ß)°ñ¿ž:dµµ#!™ •;—|ï33<VÞ%X.509G0‚C0‚+ 0  *†H†÷ 01 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1%0#U Trusted Certificate Services0 040101000000Z 281231235959Z01 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1%0#U Trusted Certificate Services0‚"0  *†H†÷ ‚0‚ ‚ßqo6XSZò6TW€Ät í*æ5š%¬œå–~rR BÛYÝdzи{Ý9¼UHÄí:ê1ºòqtg¸Ï3̨1¯£ã׿3-Lj<ì‹Ã’ÒSw$tœnpü½ [vº_òÿ×7KJ`x÷ðúÊp´êYª£ÎH/©Ã² ~r ¦ 8ÏÉb·? “¥‡Aò·p@wؾ|ã¨ÀzŽécjÑšÆÒô‹:VÔí¸Ìnõûâ,X½Ok+÷`$X$Î&ï4‘:Õãвð×[·>’¬kŠùä°;‘I\²ëSêøŸG†î¿•ÀÀŸÒ[^ôÇ5)ÒU\äíë£É0Æ0UÅ{X½íÚ%iÒ÷Y¨³2À{'[ô0Uÿ0Uÿ0ÿ0ƒU|0z0< : 8†6http://crl.comodoca.com/TrustedCertificateServices.crl0: 8 6†4http://crl.comodo.net/TrustedCertificateServices.crl0  *†H†÷ ‚È“;‰´¯¸„LÒðÛpºW†4¹/°¨‰`¡ŠÂw PJ›‹Ø‹ôAâЃŠJ°£hp10§S›éJ Xig®ö¥,A¿<käYÌmñ–oßô¤ŸE>ÈØú6FDP?‚—‘(ÛŒ*äeƒWŒ?”6þ]°Àw¸ôÕ?8Ì”:UЬ˜õº_à†x/(À~ÓÌB õ®P Ñ>Æ¡qì?  Œf:‰´ŽÔرM%Gî/ˆÈµáEÀ¾qÞzýŽ{}M–¥sð-Ê7't'L˶—éÙ®mZ9@ÝGujZ!³£ÏN÷.W·˜p^ÈÄx°b64<VÞ%X.509ó0‚ï0‚× 0  *†H†÷  0˜1 0 UUS10UArizona10U Scottsdale1%0#U Starfield Technologies, Inc.1;09U2Starfield Services Root Certificate Authority - G20 090901000000Z 371231235959Z0˜1 0 UUS10UArizona10U Scottsdale1%0#U Starfield Technologies, Inc.1;09U2Starfield Services Root Certificate Authority - G20‚"0  *†H†÷ ‚0‚ ‚Õ :Ä*ùNâõ¾—_ŽˆS±?ËÏŸ m):È}<÷kv8cÙ6`¨›^\€²/Yö‡ù%C†çiRšáqãØ- NoöÈIÙ¶óV®+¶tëÏû&㺖.j;X”‰GVÿ% “pSƒÚ„tÃgžh:ߎ@ZJNÏC‘;çVÖpËRî{}®:ç¼1ùEöÂ`ÏY+€Ì4Gß¹ÞemÏ,‘¦¦çÞ…I|fN£:m©µî4.º ¸3ßGë±k%Ù›ÎÑEF2–p‡ÞIC…¶ls»dêaA¬ÉÔT߇/Ç"²&ÌŸYThŸü¾*/ÄUu@`…U9‹£B0@0Uÿ0ÿ0Uÿ0Uœ_ߪ×0+8ˆ¢¸mJœò‘ƒ0  *†H†÷  ‚K6¦„wiÝ;Ÿg#oaÉý„Ü_Ø6ÍØA-Ÿ`ÝÇhÙÑn†áˆ#ÏÞCÏâ4³)Õ¿ø^ÈÕÁ½î’o2tò‘‚/½‚Bz­*· }M¼zUÂê½÷j•.ltŸÏ´òÅ£…Ðr>­s« ›u mE·Ž”¬–7µ ÐGãèƒÝýïAwÌ'©b…3ò7ïqÏwÞȈ@Ï}FÿÇáÎÿ#ÛÆúUN©çGF>ôý½{)&»©ab7(¶-*ö†dÉp§Ò­·)pyê<Úc%Ÿýh·0ìpûuŠ·m`g²È¹éبo‹g M&WqÚ üÁJP±(º32<VÞ%X.509C0‚?0‚' 0  *†H†÷ 0~1 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1$0"U Secure Certificate Services0 040101000000Z 281231235959Z0~1 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1$0"U Secure Certificate Services0‚"0  *†H†÷ ‚0‚ ‚Àq3‚ŠÐpës‡‚@ÕäËÉBùÞ4¹¡ºô%…óÌrmò{—k³ñw$‘_%öt=ä€Âø< ó¿@ê÷ÈRÑroïÈ«A¸n.*•i ÍÒ”{-”ªu׳˜Ë¬¼dS@¼¬¬6Ë\­»Ýà”ìÑ\п凌É۬ûCßz]·¸ò@+'žPÎ^e‚ˆŒ^ÓN zê‘¶6ª+Bûê£9åÛ&8­‹ îcÇ$ßxÚæêÁG F ÝüÞˇ_×0ch¡®Ü2¡º¾þD«h¶¥ý½Õ§§šäD3鈎üíQë“qN­çDŽ«-˨þIHðÀÝÇhØ’þ=£Ç0Ä0U<Ø“ˆÂÀ‚ Ì™“ éžp cO0Uÿ0Uÿ0ÿ0Uz0x0; 9 7†5http://crl.comodoca.com/SecureCertificateServices.crl09 7 5†3http://crl.comodo.net/SecureCertificateServices.crl0  *†H†÷ ‚‡m#~[}Áa2ÏçóŠ”Yfàž(¨^Ó·ô4æª9²—Å‚o2¤éŒç¯ýïÂè¹Kª£ôæÚe!ûº€ë&(…þ9ŒÞ[´Tù£gžAú RÌH¨É?!ÎHkü…èÂ{¯·Ìø_:ý5Æ ï—ÜL«ákË1ÑlûH€«Üœ7¸!K q=ìƒ3nÑn2ì˜Ç‹Y¦4«W-“÷ªËÒâ·.;ÍkP h>µ&Wî¶à¶Ý¹)€y}£ð¤(¤Ä…ô'Ôk¿å\äevT´ã7f$ÓaÈRå‹7š¹©ù¿ê™’a–ÿÍ¡_ ¼q¼¬ GEÁì|ìý)63<VÞ%X.509á0‚Ý0‚Å 0  *†H†÷  01 0 UUS10UArizona10U Scottsdale1%0#U Starfield Technologies, Inc.1200U)Starfield Root Certificate Authority - G20 090901000000Z 371231235959Z01 0 UUS10UArizona10U Scottsdale1%0#U Starfield Technologies, Inc.1200U)Starfield Root Certificate Authority - G20‚"0  *†H†÷ ‚0‚ ‚½íÁüöü±o[ŸHÙy⢷aVÃG¶×Ê=5.‰C÷¡i›ÞŠý œ´Iw2)Vý¹ìŒÝ"úrÜ'a—îöZ„ìn¹‰,Ü„[Õtûk_ʼn¥R‰FUô¸uæäT®KøUrWøqYë(tÅH¾l´ô¤°ód7y’ÀìF^ámSLb¯Í c»:ûüy˜atÏ&‚@có²rj ™ÊÔuÌ7û‹‰ÁYñb_³_e0ø§·MvZv^4Àè–V™Š³ð¤Í½Ü21|‘Ïà_økªI\Ñ™”Ñ¢ãc[ vµVbáKt–Ô&ÔYИæÞüÃìñ£B0@0Uÿ0ÿ0Uÿ0U| 2§Ù0Ä}h£b¨¡Î«['0  *†H†÷  ‚Yú%Oo”™;š‚…9Ôv”^á(“mb]  ¨Ô°u8ñ4j䟊†&Qæ,ÑÆ-n• J’츊g{1âg.Œ•&.CJ1öµ »·â7"º£{Rûk»;ÄÓyQNÍôgÈ8u–súh±ËÎÅìúœ~Ï~±ñ-¶ü¿Ê¤¿Ð—J¼ê(½Tx !qÓÑ}Ù°©a=Ð "üÇ{Ë dE ;@÷}|2õ˜ÊXŽ}*îYsdù6t^%¡õf.9©*ûP‹Ž…iô31<VÞ%X.50960‚20‚ 0  *†H†÷ 0{1 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1!0U AAA Certificate Services0 040101000000Z 281231235959Z0{1 0 UGB10U Greater Manchester10U Salford10U Comodo CA Limited1!0U AAA Certificate Services0‚"0  *†H†÷ ‚0‚ ‚¾@ônáêv‡MED޾FȃÁ*þŽäúó«]PŠ1 šÐÅp"ÍI-Tc̶nhF SêËL$À¼rNêñ®ôTš Ãz²3`âÚ‰Uó"XóÞÜÏ¢Œ”OŸhò˜F„'Çv¿ãÌ5,‹^de‚ÀH°¨‘ùaŸv P¨‘ÇfµëxbVðŠê1£ ™ý8öö'2Xoõk¸û+¯·ªÌÖc_sŒÚ™¨8¨Ëx6Q¬éžôx:ÏÙB☠«/ŸÞIñ-߬tM˜µGÅå)ÑùÇbœ¾ƒÇ&{>Š%ÇÀÝæ5h ØÞÒÄœ ^è/É£À0½0U  #>–ñìâ¯)ï‚¥Ð0¤´0Uÿ0Uÿ0ÿ0{Ut0r08 6 4†2http://crl.comodoca.com/AAACertificateServices.crl06 4 2†0http://crl.comodo.net/AAACertificateServices.crl0  *†H†÷ ‚Vüð›èÿ¤úÖ{ÆD€ÎOÄÅöX̦¶¼Ihvèæî]ì`ÖPO&Nãæ°¥î¿¼tTA¿ýü¸ÇOZô‰``·Jóöñ¿Ĺt†¶-}kÌÒóFÝ/ÆàjÃÃ4,}–ÝZ§ ™Á‹« /ó\:Ïl7U ‡ÞS@lXïü¶«enöÜ<àZÆžÙñYH0!elìé!s웡à7­ úºΧ,©,Ôå&«"—`ø^tÔ¢šS½ò©hà¢nÂ×l±£ž¿ëhçVò®òã+8: µk…×¾-í?·²câõb,‚ÔjAPñ9ƒŸ•é6–˜n62<VÞ%X.509É0‚Å0‚­ 0  *†H†÷  0ƒ1 0 UUS10UArizona10U Scottsdale10U GoDaddy.com, Inc.110/U(Go Daddy Root Certificate Authority - G20 090901000000Z 371231235959Z0ƒ1 0 UUS10UArizona10U Scottsdale10U GoDaddy.com, Inc.110/U(Go Daddy Root Certificate Authority - G20‚"0  *†H†÷ ‚0‚ ‚¿qbñúY4÷É£÷€IXé"ƒ¦Å C;„ñæ…IŸ'êö„N ´Ûp˜Ç2±>NîôúO/Y0"ç«Vkâ€üóu€9Q{åù5¶tN©‚ä¶?©ƒú¢¾ŠjÞ Ã¶Êêè”;F|2 óf"Èim6Œ·Ó²`´8úŒÎÓÝFÞ >ë]|È|û°+S¤’biQ%aDŒ,©C–#߬:š)Å©é]¶žž0 9Îñˆ€ûK]Ì2ì…bC%4V'‘´;p*?n±èœˆ}ŸÔùÛSm`¿,çX«¸_FüÎÄ< ëI1\iF³àG£B0@0Uÿ0ÿ0Uÿ0U:š…g(¶ïö½An Á”ÚÞ0  *†H†÷  ‚™Û]yÕù—Ygañ~;1u-¡ ŽOe‡´÷¦œ¼Øé/ÐÛZîÏtŒs´8BÚ{øu¸ý¥±×®ö×ÞËS~ŠFÑ—ú·.+«°'€ùèŸZé7Ÿ«äßl³…=Ù$Oy‘5Ö_뀃«š-µôØÇs@ír% ©Ÿìž«h™WÆ: ¤½Dý7Á›ä2£í8èØdó,~üêŸÍÿhÛ"8-zÑTñiã_3Êz={ ãÊ_9åâuºÅv3Î,ð/L­÷±çÎO¨Ä›JTÅ}Õâþ~¸¬^öÔ²C Mö§k´™„eÊzˆââD¾\÷êõ30<VÞ%X.509¨0‚¤0‚Œ 0  *†H†÷ 0c1 0 UUS10U America Online Inc.1604U-America Online Root Certification Authority 20 020528060000Z 370929140800Z0c1 0 UUS10U America Online Inc.1604U-America Online Root Certification Authority 20‚"0  *†H†÷ ‚0‚ ‚ÌAEé=MöŒ±AÉà^Ë ·¿GsÓðUMÝÆ ú±fjÍx´ÜÛNó×§|q¼uc ]ã Hì%Ä ôÿ;ÿ›áÆÕ´m"ã±Û!d¯†¼W"*ÖGWD‚VS½† üt¤Z®ñºµ›XZ€´7x 3|2G\Ä¥ƒHôWVn6'Oì›(ÂÔ´×| > +ßÊׯŽêXN¨¤¥lE˜£AÑ-ÒÇmñ­y·?½‚'-Xµx¹/Û k~Y8»”$åÑßÓ‚MFð€9R2ㄲzCò^Þ_?Ýã² ¡*#n.‡\¦uuÇ—a¾Þ†ÜÔHÛ½*¿JUÚè}Pû´€¸”¿=êÚº|àXg¹Xàˆ†FglGX2Ð5|y*¢Z#5­/ÌäJ[§È'òƒÞ^»^wçè¥nc ]aÐŒÒlZ!Ê(£Î*é•ÇHÏ–o’%ÈÆÆÁÁ ¬&ÄÒuÒá*gÀ=[¥šëÏ{¨Eå šeÞ/(½Îo”fƒH)ØêeŒ¯“ÙdŸUW&¿oË71™£`»­‰42b¸C!r ¡\mFÅú)Ï0Þ‰Üq[ݶ7>ßPõ¸%&å¼µþ<³·ø¾CÁ‡”ž#lЏŠ' TGð©³À€Œ 'ëãŽwpÊ+ô}vàxg£c0a0Uÿ0ÿ0UMEÁh8»s©i¡ çíõ"¡#מ0U#0€MEÁh8»s©i¡ çíõ"¡#מ0Uÿ†0  *†H†÷ ‚gk¹_E;*K3³ækYN"̹·¤%ɧÄðT– dó±XO^Qü²—{'eÂåÊç %{bãúŸ´‡·EF¯ƒ¥—HŒ¥½ñ+›v,z5`l€—Ì©’Ræ+æií©ø6-,w¿aHÑc ¹[Rí°CB"¦±w®ÞiÅÍÇ¡±¥û¾pÝÁ’K¾)Z?5¾å}QøUà%u#‡\ܺ°¬³iÛƒÉ÷Þ ¼Ü‘ž¨Ð×7s¥5¸ü~ÅD@Ãëø"€\GÎãŸDÿýš2Ì}dQëW&v:ã"<¦6Ýï§üó&ÀY1…LœØÏߤÌÌ)“ÿ”mv\—òí¥ MÝèÉhfÓ3[¼•å2¨³Ælƒ­wî‹~~±©«Óáñ¶À±êˆÀçÓé(’”{h{—* g-…8äaÔÚ%6ÇX-¡§Q¯0 Iõ¦i‡-DFvŽ*åš;×¢üœ8ÌÆ;Òµ:oý®%½õrYd±t*8_LßÏqZ6Ô¿/™œèÙº±•æK!¡[ÕÁO®imSÛ“µ\ÝdZÊ(>cý¸7ßgŠf©j‘ÿÊ/]ƒ¼‡“lÜ$Q%fú³Ùº)¾šH8‚™ô¿;J1ù¿Ž!3ÊOT_ûÎûqý^ K‘¸ÄT¼°E&‘¢Žþ©61<VÞ%X.509å0‚á0‚É c%3älô0  *†H†÷ 0{1 0 UDE10U TC TrustCenter GmbH1$0"U TC TrustCenter Universal CA1(0&UTC TrustCenter Universal CA III0 090909081527Z 291231235959Z0{1 0 UDE10U TC TrustCenter GmbH1$0"U TC TrustCenter Universal CA1(0&UTC TrustCenter Universal CA III0‚"0  *†H†÷ ‚0‚ ‚ÂÚœb°¹q° ÈW²®ƒ™³4K›¢Åçç/ M-¤ú…Ú›%…-@( mêཱHƒ")DŸNƒî5QstÕ¼ò0f”SÀ@6/ „eÎnÂX“è, :éÁŽûòkÊ<âœNŽäù}Ó'ŸÕgx‡- G³ÇèÉH|¯/Ì ÙAïŸþšá²®ùSµåéFŸ`ãßÓû–~³µrøK­yÍi‰@'õ*Á­Cì¤SÈa¶÷Òy*gvHm[%Ñ&Å·Wi#[aŠ­ð-Ù¯\ñ&i©Õ @õ3€Cœ£v*E´¯¿>‡?vÅÍ*Þ ÅXËùõË Rd¸ÒvbwƒñXŸÿ£c0a0U#0€Vçá[%C€àöŒáq¼Žå€/ÄHâ0Uÿ0ÿ0Uÿ0UVçá[%C€àöŒáq¼Žå€/ÄHâ0  *†H†÷ ‚ƒÇ¯êM <9±h¾{m‰.é³ çW…šóvBPÇo3­ÅI`+lIXÔâ¾·¿«I¼”È«¾(lhàÈ—F  hg`ˆ9 QØhΧööì쬲fnVg`zt^Àm—6®µ ]fsÀ%2EØJÄ·±M á¥ëôuʺœÐ½³Ó2$Lî~âvKISØòéT3üåq=\–Kñ:ò»l´ú–Uˆ ÁÌ‘)° -ÿË8¤@á¾ya€ÿ†LN{Ÿ†‰î'ÄÛ⼎ ÃÃÇ-c;Óèä¢*‚”Tðï'%¸ (GwG½¨%ñ”´f60<VÞ%X.509c0‚_0‚G  !XS¢0  *†H†÷  0L1 0U GlobalSign Root CA - R310U  GlobalSign10U GlobalSign0 090318100000Z 290318100000Z0L1 0U GlobalSign Root CA - R310U  GlobalSign10U GlobalSign0‚"0  *†H†÷ ‚0‚ ‚Ì%vyx"õÀƒ¶„Ê(žývÅ­ˆrüFCDzŠ_$Ë.Ká`‚FáR« GplÝdÑëõ,£‚= +®—×¶†y»;€wŒáIÒjb/^ú–h߉'•8Ÿ×>ÉË&Y sÞ°Èé&ƒÆï[‹Ò`ÊI¦(öi;öËÈ(‘åŠaW7¬tÜtà:îr/.œûл¿õ=á3è‚+®S¦:sŒÝA :À´§¡é²O.2`éW˹’hhå8&`u²Ÿwÿ‘ï® Iü­@HÑ1a^¸—ï­w·dšz¿_Áï›bû làTi©Ún郓qvÆi…‚£B0@0Uÿ0Uÿ0ÿ0UðK¨.E$®MPúcš‹Þâݼ0  *†H†÷  ‚K@ÛÀPªþÈ ï÷–TEI»– A¬³††(3Êkæt¹º-®¤ ÓõññŠ¿sgJƒÇD{xà¯nlo)Ž39EÃŽä¹Wlªü–ìSÆ-ä$l¹”cûÜShgV>ƒ¸Ï5!ÃÉhþÎÚÂSªÌŠéð]FŒ•ÝzX(/ÞÍ7AíDm×S(—~óg׊–´ÓÞL'¤Lssvô™Âzã-­ ,ÿ<«U‘~6ëÃWI¾á.-|`‹ÃAQ#Î÷2k”¨™ç,3:;%Ò†@Î;,†xÉa/ºîÛUoß„î M½(ØrÎÓbPeë’—ƒ1Ù³µÊGX?_¹Ñ“£yom@®è¹‹google-api-java-client-1.27.1/google-api-client/src/test/000077500000000000000000000000001350651464300230745ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/000077500000000000000000000000001350651464300240155ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/000077500000000000000000000000001350651464300245735ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/000077500000000000000000000000001350651464300260475ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/000077500000000000000000000000001350651464300266205ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/000077500000000000000000000000001350651464300300765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/000077500000000000000000000000001350651464300322275ustar00rootroot00000000000000GoogleUtilsTest.java000066400000000000000000000025051350651464300361120ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/* * Copyright 2013 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.api.client.googleapis; import java.security.KeyStore; import java.util.Enumeration; import junit.framework.TestCase; /** * Tests {@link GoogleUtils}. * * @author Yaniv Inbar */ public class GoogleUtilsTest extends TestCase { public void testGetCertificateTrustStore() throws Exception { KeyStore trustStore = GoogleUtils.getCertificateTrustStore(); Enumeration aliases = trustStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); assertTrue(trustStore.isCertificateEntry(alias)); } // intentionally check the count of certificates, so it can help us detect if a new certificate // has been added or removed assertEquals(70, trustStore.size()); } } MethodOverrideTest.java000066400000000000000000000107651350651464300366040ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/* * Copyright 2010 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.api.client.googleapis; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.UrlEncodedContent; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import junit.framework.TestCase; /** * Tests {@link MethodOverride}. * * @author Yaniv Inbar */ public class MethodOverrideTest extends TestCase { private static final ImmutableList OVERRIDDEN_METHODS = ImmutableList.of( "FOO", HttpMethods.DELETE, HttpMethods.HEAD, HttpMethods.OPTIONS, HttpMethods.PATCH, HttpMethods.PUT, HttpMethods.TRACE); private static final ImmutableList SUPPORTED_METHODS = ImmutableList.builder() .addAll(OVERRIDDEN_METHODS) .add(HttpMethods.GET, HttpMethods.POST) .build(); public MethodOverrideTest(String name) { super(name); } public void testIntercept() throws Exception { subtestIntercept(ImmutableSet.of(), new MockHttpTransport(), new MethodOverride()); subtestIntercept(OVERRIDDEN_METHODS, new MockHttpTransport(), new MethodOverride.Builder().setOverrideAllMethods(true).build()); subtestIntercept(OVERRIDDEN_METHODS, new MockHttpTransport.Builder() .setSupportedMethods(ImmutableSet.of(HttpMethods.GET, HttpMethods.POST)).build(), new MethodOverride()); } private void subtestIntercept(Collection methodsThatShouldOverride, HttpTransport transport, MethodOverride interceptor) throws Exception { for (String requestMethod : SUPPORTED_METHODS) { subtestIntercept( methodsThatShouldOverride.contains(requestMethod), transport, interceptor, requestMethod); } } private void subtestIntercept(boolean shouldOverride, HttpTransport transport, MethodOverride interceptor, String requestMethod) throws Exception { HttpRequest request = transport.createRequestFactory() .buildRequest(requestMethod, HttpTesting.SIMPLE_GENERIC_URL, null); interceptor.intercept(request); assertEquals(requestMethod, shouldOverride ? HttpMethods.POST : requestMethod, request.getRequestMethod()); assertEquals(requestMethod, shouldOverride ? requestMethod : null, request.getHeaders().get(MethodOverride.HEADER)); } public void testInterceptMaxLength() throws IOException { HttpTransport transport = new MockHttpTransport(); GenericUrl url = new GenericUrl(HttpTesting.SIMPLE_URL); url.set("a", "foo"); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); new MethodOverride().intercept(request); assertEquals(HttpMethods.GET, request.getRequestMethod()); assertNull(request.getHeaders().get(MethodOverride.HEADER)); assertNull(request.getContent()); char[] arr = new char[MethodOverride.MAX_URL_LENGTH]; Arrays.fill(arr, 'x'); url.set("a", new String(arr)); request.setUrl(url); new MethodOverride().intercept(request); assertEquals(HttpMethods.POST, request.getRequestMethod()); assertEquals(HttpMethods.GET, request.getHeaders().get(MethodOverride.HEADER)); assertEquals(HttpTesting.SIMPLE_GENERIC_URL, request.getUrl()); char[] arr2 = new char[arr.length + 2]; Arrays.fill(arr2, 'x'); arr2[0] = 'a'; arr2[1] = '='; UrlEncodedContent content = (UrlEncodedContent) request.getContent(); ByteArrayOutputStream out = new ByteArrayOutputStream(); content.writeTo(out); assertEquals(new String(arr2), out.toString()); } } google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/000077500000000000000000000000001350651464300331705ustar00rootroot00000000000000oauth2/000077500000000000000000000000001350651464300343135ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/authCloudShellCredentialTest.java000066400000000000000000000063301350651464300420510ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2015, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.google.api.client.googleapis.auth.oauth2; import static org.junit.Assert.assertEquals; import com.google.api.client.json.gson.GsonFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** * Unit tests for CloudShellCredential */ @RunWith(JUnit4.class) public class CloudShellCredentialTest { @Test public void refreshAccessToken() throws IOException{ final ServerSocket authSocket = new ServerSocket(0); Runnable serverTask = new Runnable() { @Override public void run() { try { Socket clientSocket = authSocket.accept(); BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String lines = input.readLine(); lines += '\n' + input.readLine(); assertEquals(CloudShellCredential.GET_AUTH_TOKEN_REQUEST, lines); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); out.println("32\n[\"email\", \"project-id\", \"token\", 1234]"); } catch (Exception reThrown) { throw new RuntimeException(reThrown); } } }; Thread serverThread = new Thread(serverTask); serverThread.start(); GoogleCredential creds = new CloudShellCredential( authSocket.getLocalPort(), GsonFactory.getDefaultInstance()); assertEquals("token", creds.executeRefreshToken().getAccessToken()); } } DefaultCredentialProviderTest.java000066400000000000000000000622511350651464300431160ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2014 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.testing.auth.oauth2.MockTokenServerTransport; import com.google.api.client.googleapis.testing.compute.MockMetadataServerTransport; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import junit.framework.TestCase; /** * Tests {@link DefaultCredentialProvider}. * */ public class DefaultCredentialProviderTest extends TestCase { private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final Collection SCOPES = Collections.unmodifiableCollection(Arrays.asList("scope1", "scope2")); private static final String SA_KEY_ID = "key_id"; private static final String SA_KEY_TEXT = "-----BEGIN PRIVATE KEY-----\n" + "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALX0PQoe1igW12i" + "kv1bN/r9lN749y2ijmbc/mFHPyS3hNTyOCjDvBbXYbDhQJzWVUikh4mvGBA07qTj79Xc3yBDfKP2IeyYQIFe0t0" + "zkd7R9Zdn98Y2rIQC47aAbDfubtkU1U72t4zL11kHvoa0/RuFZjncvlr42X7be7lYh4p3NAgMBAAECgYASk5wDw" + "4Az2ZkmeuN6Fk/y9H+Lcb2pskJIXjrL533vrDWGOC48LrsThMQPv8cxBky8HFSEklPpkfTF95tpD43iVwJRB/Gr" + "CtGTw65IfJ4/tI09h6zGc4yqvIo1cHX/LQ+SxKLGyir/dQM925rGt/VojxY5ryJR7GLbCzxPnJm/oQJBANwOCO6" + "D2hy1LQYJhXh7O+RLtA/tSnT1xyMQsGT+uUCMiKS2bSKx2wxo9k7h3OegNJIu1q6nZ6AbxDK8H3+d0dUCQQDTrP" + "SXagBxzp8PecbaCHjzNRSQE2in81qYnrAFNB4o3DpHyMMY6s5ALLeHKscEWnqP8Ur6X4PvzZecCWU9BKAZAkAut" + "LPknAuxSCsUOvUfS1i87ex77Ot+w6POp34pEX+UWb+u5iFn2cQacDTHLV1LtE80L8jVLSbrbrlH43H0DjU5AkEA" + "gidhycxS86dxpEljnOMCw8CKoUBd5I880IUahEiUltk7OLJYS/Ts1wbn3kPOVX3wyJs8WBDtBkFrDHW2ezth2QJ" + "ADj3e1YhMVdjJW5jqwlD/VNddGjgzyunmiZg0uOXsHXbytYmsA545S8KRQFaJKFXYYFo2kOjqOiC1T2cAzMDjCQ" + "==\n-----END PRIVATE KEY-----\n"; private static final String ACCESS_TOKEN = "1/MkSJoj1xsli0AccessToken_NKPY2"; private static final String GAE_SIGNAL_CLASS = "com.google.appengine.api.utils.SystemProperty"; private static final Lock lock = new ReentrantLock(); private static File tempDirectory = null; public void testDefaultCredentialAppEngineDeployed() throws IOException { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addType(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS, MockAppEngineCredential.class); testProvider.addType(GAE_SIGNAL_CLASS, MockAppEngineSystemProperty.class); Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(defaultCredential); assertTrue(defaultCredential instanceof MockAppEngineCredential); assertSame(transport, defaultCredential.getTransport()); assertSame(JSON_FACTORY, defaultCredential.getJsonFactory()); } public void testDefaultCredentialAppEngineComponentOffAppEngineGivesNotFoundError() { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addType(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS, MockAppEngineCredential.class); testProvider.addType(GAE_SIGNAL_CLASS, MockOffAppEngineSystemProperty.class); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("No credential expected when not on App Engine."); } catch (IOException e) { String message = e.getMessage(); assertTrue(message.contains(DefaultCredentialProvider.HELP_PERMALINK)); } } public void testDefaultCredentialAppEngineWithoutDependencyThrowsHelpfulLoadError() { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addType(GAE_SIGNAL_CLASS, MockAppEngineSystemProperty.class); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("Credential expected to fail to load if credential class not present."); } catch (IOException e) { String message = e.getMessage(); assertFalse(message.contains(DefaultCredentialProvider.HELP_PERMALINK)); assertTrue(message.contains(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS)); } } public void testDefaultCredentialCaches() throws IOException { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addType(DefaultCredentialProvider.APP_ENGINE_CREDENTIAL_CLASS, MockAppEngineCredential.class); testProvider.addType(GAE_SIGNAL_CLASS, MockAppEngineSystemProperty.class); Credential firstCall = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(firstCall); Credential secondCall = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertSame(firstCall, secondCall); } public void testGetDefaultCredentials_cloudshell() throws IOException { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.setEnv(DefaultCredentialProvider.CLOUD_SHELL_ENV_VAR, "4"); GoogleCredential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertTrue(defaultCredential instanceof CloudShellCredential); assertEquals(((CloudShellCredential) defaultCredential).getAuthPort(), 4); } public void testGetDefaultCredentials_cloudshell_withComputCredentialsPresent() throws IOException { MockMetadataServerTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.setEnv(DefaultCredentialProvider.CLOUD_SHELL_ENV_VAR, "4"); GoogleCredential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertTrue(defaultCredential instanceof CloudShellCredential); assertEquals(((CloudShellCredential) defaultCredential).getAuthPort(), 4); } public void testDefaultCredentialCompute() throws IOException { HttpTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(defaultCredential); assertTrue(defaultCredential.refreshToken()); assertEquals(ACCESS_TOKEN, defaultCredential.getAccessToken()); } public void testDefaultCredentialComputeErrorNotFound() throws IOException { MockMetadataServerTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN); transport.setTokenRequestStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(defaultCredential); try { defaultCredential.refreshToken(); fail("Expected error refreshing token."); } catch (IOException expected) { String message = expected.getMessage(); assertTrue(message.contains(Integer.toString(HttpStatusCodes.STATUS_CODE_NOT_FOUND))); assertTrue(message.contains("scope")); } } public void testDefaultCredentialComputeErrorUnexpected() throws IOException { MockMetadataServerTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN); transport.setTokenRequestStatusCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); Credential defaultCredential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(defaultCredential); try { defaultCredential.refreshToken(); fail("Expected error refreshing token."); } catch (IOException expected) { String message = expected.getMessage(); assertTrue(message.contains(Integer.toString(HttpStatusCodes.STATUS_CODE_SERVER_ERROR))); assertTrue(message.contains("Unexpected")); } } public void testDefaultCredentialComputeCachesFailureAfterFixedNumberOfRetries() { MockRequestUrlRecordingTransport transport = new MockRequestUrlRecordingTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); // First attempt to get credentials we retry. try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("No credential expected for default test provider."); } catch (IOException expected) { } assertEquals(3, transport.getRequestCount()); // Second attempt we get back the cached result. try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("No credential expected for default test provider."); } catch (IOException expected) { } assertEquals(3, transport.getRequestCount()); } public void testDefaultCredentialNoGceCheck() throws IOException { MockRequestUrlRecordingTransport transport = new MockRequestUrlRecordingTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.setEnv("NO_GCE_CHECK", "True"); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("No credential expected for default test provider."); } catch (IOException expected) { } assertEquals(0, transport.getRequestCount()); } public void testDefaultCredentialWithCustomMetadataServerAddress() throws IOException { MockRequestUrlRecordingTransport transport = new MockRequestUrlRecordingTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.setEnv("GCE_METADATA_HOST", "test.metadata.server.address"); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("No credential expected for default test provider."); } catch (IOException expected) { } assertTrue(transport.urlWasRequested("http://test.metadata.server.address")); } public void testDefaultCredentialNonExistentFileThrows() throws Exception { File nonExistentFile = new java.io.File(getTempDirectory(), "DefaultCredentialBadFile.json"); assertFalse(nonExistentFile.exists()); HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.setEnv(DefaultCredentialProvider.CREDENTIAL_ENV_VAR, nonExistentFile.getAbsolutePath()); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail("Non existent user credential should throw exception."); } catch (IOException e) { String message = e.getMessage(); assertTrue(message.contains(DefaultCredentialProvider.CREDENTIAL_ENV_VAR)); assertTrue(message.contains(nonExistentFile.getAbsolutePath())); } } public void testDefaultCredentialNotFoundError() { HttpTransport transport = new MockHttpTransport(); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); try { testProvider.getDefaultCredential(transport, JSON_FACTORY); fail(); } catch (IOException e) { String message = e.getMessage(); assertTrue(message.contains(DefaultCredentialProvider.HELP_PERMALINK)); } } public void testDefaultCredentialServiceAccount() throws IOException { File serviceAccountFile = new java.io.File(getTempDirectory(), "DefaultCredentialServiceAccount.json"); if (serviceAccountFile.exists()) { serviceAccountFile.delete(); } final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; final String serviceAccountEmail = "36680232662-vrd7ji19qe3nelgchdcsanun6bnr@developer.gserviceaccount.com"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, ACCESS_TOKEN); TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); try { // Write out service account file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); PrintWriter writer = new PrintWriter(serviceAccountFile); String json = serviceAccountContents.toPrettyString(); writer.println(json); writer.close(); // Point the default credential to the file testProvider.setEnv(DefaultCredentialProvider.CREDENTIAL_ENV_VAR, serviceAccountFile.getAbsolutePath()); GoogleCredential credential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(credential); credential = credential.createScoped(SCOPES); assertTrue(credential.refreshToken()); assertEquals(ACCESS_TOKEN, credential.getAccessToken()); } finally { if (serviceAccountFile.exists()) { serviceAccountFile.delete(); } } } public void testDefaultCredentialUser() throws IOException { File userCredentialFile = new java.io.File(getTempDirectory(), "DefaultCredentialUser.json"); if (userCredentialFile.exists()) { userCredentialFile.delete(); } TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); // Point the default credential to the file testProvider.setEnv(DefaultCredentialProvider.CREDENTIAL_ENV_VAR, userCredentialFile.getAbsolutePath()); testDefaultCredentialUser(userCredentialFile, testProvider); } public void testDefaultCredentialWellKnownFileNonWindows() throws IOException { // Simulate where the SDK puts the well-known file on non-Windows platforms File homeDir = getTempDirectory(); File configDir = new File(homeDir, ".config"); if (!configDir.exists()) { configDir.mkdir(); } File cloudConfigDir = new File(configDir, DefaultCredentialProvider.CLOUDSDK_CONFIG_DIRECTORY); if (!cloudConfigDir.exists()) { cloudConfigDir.mkdir(); } File wellKnownFile = new File( cloudConfigDir, DefaultCredentialProvider.WELL_KNOWN_CREDENTIALS_FILE); if (wellKnownFile.exists()) { wellKnownFile.delete(); } TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addFile(wellKnownFile.getAbsolutePath()); testProvider.setProperty("os.name", "linux"); testProvider.setProperty("user.home", homeDir.getAbsolutePath()); testDefaultCredentialUser(wellKnownFile, testProvider); } public void testDefaultCredentialWellKnownFileWindows() throws IOException { // Simulate where the SDK puts the well-known file on Windows File appDataDir = getTempDirectory(); File cloudConfigDir = new File(appDataDir, DefaultCredentialProvider.CLOUDSDK_CONFIG_DIRECTORY); if (!cloudConfigDir.exists()) { cloudConfigDir.mkdir(); } File wellKnownFile = new File( cloudConfigDir, DefaultCredentialProvider.WELL_KNOWN_CREDENTIALS_FILE); if (wellKnownFile.exists()) { wellKnownFile.delete(); } TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); testProvider.addFile(wellKnownFile.getAbsolutePath()); testProvider.setProperty("os.name", "windows"); testProvider.setEnv("APPDATA", appDataDir.getAbsolutePath()); testDefaultCredentialUser(wellKnownFile, testProvider); } public void testDefaultCredentialEnvironmentVariableWinsOverWellKnownFile() throws IOException { final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxH8cruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshTokenEnv = "2/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; final String accessTokenEnv = "2/MkSJoj1xsli0AccessToken_NKPY2"; final String refreshTokenWkf = "3/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; final String accessTokenWkf = "3/MkSJoj1xsli0AccessToken_NKPY2"; TestDefaultCredentialProvider testProvider = new TestDefaultCredentialProvider(); // Set up an environment variable file File environmentVariableFile = new java.io.File(getTempDirectory(), "EnvVarUser.json"); if (environmentVariableFile.exists()) { environmentVariableFile.delete(); } testProvider.setEnv(DefaultCredentialProvider.CREDENTIAL_ENV_VAR, environmentVariableFile.getAbsolutePath()); // Also set up a well-known-location file File homeDir = getTempDirectory(); File configDir = new File(homeDir, ".config"); if (!configDir.exists()) { configDir.mkdir(); } File cloudConfigDir = new File(configDir, DefaultCredentialProvider.CLOUDSDK_CONFIG_DIRECTORY); if (!cloudConfigDir.exists()) { cloudConfigDir.mkdir(); } File wellKnownFile = new File( cloudConfigDir, DefaultCredentialProvider.WELL_KNOWN_CREDENTIALS_FILE); if (wellKnownFile.exists()) { wellKnownFile.delete(); } testProvider.addFile(wellKnownFile.getAbsolutePath()); testProvider.setProperty("os.name", "linux"); testProvider.setProperty("user.home", homeDir.getAbsolutePath()); // Define a transport that can simulate refreshing tokens MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshTokenEnv, accessTokenEnv); transport.addRefreshToken(refreshTokenWkf, accessTokenWkf); String jsonEnv = GoogleCredentialTest.createUserJson(clientId, clientSecret, refreshTokenEnv); String jsonWkf = GoogleCredentialTest.createUserJson(clientId, clientSecret, refreshTokenWkf); try { // Write out user files PrintWriter writer = new PrintWriter(environmentVariableFile); writer.println(jsonEnv); writer.close(); writer = new PrintWriter(wellKnownFile); writer.println(jsonWkf); writer.close(); Credential credential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(credential); assertEquals(refreshTokenEnv, credential.getRefreshToken()); assertTrue(credential.refreshToken()); assertEquals(accessTokenEnv, credential.getAccessToken()); } finally { if (wellKnownFile.exists()) { wellKnownFile.delete(); } if (environmentVariableFile.exists()) { environmentVariableFile.delete(); } } } private void testDefaultCredentialUser(File userFile, TestDefaultCredentialProvider testProvider) throws IOException { final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxH8cruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; // Define a transport that can simulate refreshing tokens MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, ACCESS_TOKEN); String json = GoogleCredentialTest.createUserJson(clientId, clientSecret, refreshToken); try { // Write out user file PrintWriter writer = new PrintWriter(userFile); writer.println(json); writer.close(); Credential credential = testProvider.getDefaultCredential(transport, JSON_FACTORY); assertNotNull(credential); assertEquals(refreshToken, credential.getRefreshToken()); assertTrue(credential.refreshToken()); assertEquals(ACCESS_TOKEN, credential.getAccessToken()); } finally { if (userFile.exists()) { userFile.delete(); } } } private static File getTempDirectory() { lock.lock(); try { if (tempDirectory == null) { String userHome = System.getProperty("user.home"); File temp = new java.io.File(userHome, ".temptest"); if (!temp.exists()) { temp.mkdir(); } else if (!temp.isDirectory()) { fail("Temp directory is a file!"); } tempDirectory = temp; } } finally { lock.unlock(); } return tempDirectory; } public static class MockAppEngineCredential extends GoogleCredential { public MockAppEngineCredential(HttpTransport transport, JsonFactory jsonFactory) { super(new GoogleCredential.Builder().setTransport(transport).setJsonFactory(jsonFactory)); } } /* * App Engine is detected by calling SystemProperty.environment.value() via Reflection. * The following mock types simulate the shape and behavior of that call sequence. */ private static class MockAppEngineSystemProperty { @SuppressWarnings("unused") public static final MockEnvironment environment = new MockEnvironment(MockEnvironmentEnum.Production); } private static class MockOffAppEngineSystemProperty { @SuppressWarnings("unused") public static final MockEnvironment environment = new MockEnvironment(null); } private enum MockEnvironmentEnum { Production, Development; } public static class MockEnvironment { private MockEnvironmentEnum innerValue; MockEnvironment(MockEnvironmentEnum value) { this.innerValue = value; } public MockEnvironmentEnum value() { return innerValue; } } /* * End of types simulating SystemProperty.environment.value() */ private static class MockRequestUrlRecordingTransport extends MockHttpTransport { List requestUrls = new ArrayList(); MockRequestUrlRecordingTransport() { } int getRequestCount() { return requestUrls.size(); } boolean urlWasRequested(String url) { return requestUrls.contains(url); } @Override public LowLevelHttpRequest buildRequest(String method, String url) { MockLowLevelHttpRequest request = new MockLowLevelHttpRequest(url) { @Override public LowLevelHttpResponse execute() throws IOException { requestUrls.add(getUrl()); throw new IOException("MockRequestCountingTransport request failed."); } }; return request; } } private static class TestDefaultCredentialProvider extends DefaultCredentialProvider { private Map> types = new HashMap>(); private Map variables = new HashMap(); private Map properties = new HashMap(); private Set files = new HashSet(); private int forNameCallCount = 0; TestDefaultCredentialProvider() { } void addFile(String file) { files.add(file); } void addType(String className, Class type) { types.put(className, type); } @Override String getEnv(String name) { return variables.get(name); } @Override boolean getEnvEquals(String name, String value) { return variables.containsKey(name) && variables.get(name).equals(value); } void setEnv(String name, String value) { variables.put(name, value); } @Override String getProperty(String property, String def) { String value = properties.get(property); return value == null ? def : value; } void setProperty(String property, String value) { properties.put(property, value); } @Override boolean fileExists(File file) { return files.contains(file.getAbsolutePath()); } @Override Class forName(String className) throws ClassNotFoundException { forNameCallCount++; Class lookup = types.get(className); if (lookup != null) { return lookup; } throw new ClassNotFoundException("TestDefaultCredentialProvider: Class not found."); } int getForNameCallCount() { return forNameCallCount; } } } GoogleAuthorizationCodeFlowTest.java000066400000000000000000000027471350651464300434500ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.common.collect.ImmutableList; import junit.framework.TestCase; /** * Tests {@link GoogleAuthorizationCodeFlow}. * * @author Yaniv Inbar */ public class GoogleAuthorizationCodeFlowTest extends TestCase { private static final String CLIENT_ID = "812741506391.apps.googleusercontent.com"; private static final String CLIENT_SECRET = "{client_secret}"; public void testBuilder() { GoogleAuthorizationCodeFlow.Builder builder = new GoogleAuthorizationCodeFlow.Builder( new MockHttpTransport(), new JacksonFactory(), CLIENT_ID, CLIENT_SECRET, ImmutableList.of("https://www.googleapis.com/auth/userinfo.email")); assertNull(builder.getApprovalPrompt()); assertNull(builder.getAccessType()); } } GoogleAuthorizationCodeRequestUrlTest.java000066400000000000000000000030701350651464300446420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import java.util.Arrays; import junit.framework.TestCase; /** * Tests {@link GoogleAuthorizationCodeRequestUrl}. * * @author Yaniv Inbar */ public class GoogleAuthorizationCodeRequestUrlTest extends TestCase { private static final String EXPECTED = "https://accounts.google.com/o/oauth2/auth?client_id=812741506391.apps.googleusercontent.com&" + "redirect_uri=https://oauth2-login-demo.appspot.com/code&response_type=code" + "&scope=https://www.googleapis.com/auth/userinfo.email%20" + "https://www.googleapis.com/auth/userinfo.profile&state=/profile"; public void testBuild() { assertEquals(EXPECTED, new GoogleAuthorizationCodeRequestUrl( "812741506391.apps.googleusercontent.com", "https://oauth2-login-demo.appspot.com/code", Arrays.asList("https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build()); } } GoogleAuthorizationCodeTokenRequestTest.java000066400000000000000000000041421350651464300451610ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.oauth2.ClientParametersAuthentication; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import junit.framework.TestCase; /** * Tests {@link GoogleAuthorizationCodeTokenRequest}. * * @author Yaniv Inbar */ public class GoogleAuthorizationCodeTokenRequestTest extends TestCase { private static final String CLIENT_ID = "812741506391.apps.googleusercontent.com"; private static final String CLIENT_SECRET = "{client_secret}"; private static final String CODE = "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7"; private static final String REDIRECT_URI = "https://oauth2-login-demo.appspot.com/code"; public void test() { GoogleAuthorizationCodeTokenRequest request = new GoogleAuthorizationCodeTokenRequest(new MockHttpTransport(), new JacksonFactory(), CLIENT_ID, CLIENT_SECRET, CODE, REDIRECT_URI); ClientParametersAuthentication clientAuthentication = (ClientParametersAuthentication) request.getClientAuthentication(); assertEquals(CLIENT_ID, clientAuthentication.getClientId()); assertEquals(CLIENT_SECRET, clientAuthentication.getClientSecret()); assertEquals(CODE, request.getCode()); assertEquals(REDIRECT_URI, request.getRedirectUri()); assertEquals("authorization_code", request.getGrantType()); assertNull(request.getScopes()); assertNotNull(request.getTokenServerUrl()); } } GoogleBrowserClientRequestUrlTest.java000066400000000000000000000031141350651464300437700ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2011 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.api.client.googleapis.auth.oauth2; import java.util.Arrays; import junit.framework.TestCase; /** * Tests {@link GoogleBrowserClientRequestUrl}. * * @author Yaniv Inbar */ public class GoogleBrowserClientRequestUrlTest extends TestCase { private static final String EXPECTED = "https://accounts.google.com/o/oauth2/auth?client_id=812741506391.apps.googleusercontent.com&" + "redirect_uri=https://oauth2-login-demo.appspot.com/oauthcallback&response_type=token" + "&scope=https://www.googleapis.com/auth/userinfo.email%20" + "https://www.googleapis.com/auth/userinfo.profile&state=/profile"; public void testBuild() { assertEquals(EXPECTED, new GoogleBrowserClientRequestUrl( "812741506391.apps.googleusercontent.com", "https://oauth2-login-demo.appspot.com/oauthcallback", Arrays.asList( "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build()); } } GoogleClientSecretsTest.java000066400000000000000000000031651350651464300417270ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.Details; import com.google.api.client.json.gson.GsonFactory; import java.io.StringReader; import junit.framework.TestCase; /** * Tests {@link GoogleClientSecrets}. * * @author Yaniv Inbar */ public class GoogleClientSecretsTest extends TestCase { private static final String CLIENT_ID = "812741506391.apps.googleusercontent.com"; private static final String CLIENT_SECRET = "{client_secret}"; private final static String CLIENT_SECRETS = "{\"installed\": {\"client_id\": \"" + CLIENT_ID + "\",\"client_secret\": \"" + CLIENT_SECRET + "\"}}"; public void testLoad() throws Exception { GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(new GsonFactory(), new StringReader(CLIENT_SECRETS)); Details installed = clientSecrets.getInstalled(); assertNotNull(installed); assertEquals(CLIENT_ID, installed.getClientId()); assertEquals(CLIENT_SECRET, installed.getClientSecret()); } } GoogleCredentialTest.java000066400000000000000000000616771350651464300412460ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2013 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.api.client.googleapis.auth.oauth2; import com.google.api.client.googleapis.testing.auth.oauth2.MockTokenServerTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.util.SecurityTestUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import junit.framework.TestCase; /** * Tests {@link GoogleCredential}. * * @author Yaniv Inbar */ public class GoogleCredentialTest extends TestCase { private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final Collection SCOPES = Collections.unmodifiableCollection(Arrays.asList("scope1", "scope2")); private static final Collection EMPTY_SCOPES = Collections.emptyList(); private static final String SA_KEY_TEXT = "-----BEGIN PRIVATE KEY-----\n" + "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALX0PQoe1igW12i" + "kv1bN/r9lN749y2ijmbc/mFHPyS3hNTyOCjDvBbXYbDhQJzWVUikh4mvGBA07qTj79Xc3yBDfKP2IeyYQIFe0t0" + "zkd7R9Zdn98Y2rIQC47aAbDfubtkU1U72t4zL11kHvoa0/RuFZjncvlr42X7be7lYh4p3NAgMBAAECgYASk5wDw" + "4Az2ZkmeuN6Fk/y9H+Lcb2pskJIXjrL533vrDWGOC48LrsThMQPv8cxBky8HFSEklPpkfTF95tpD43iVwJRB/Gr" + "CtGTw65IfJ4/tI09h6zGc4yqvIo1cHX/LQ+SxKLGyir/dQM925rGt/VojxY5ryJR7GLbCzxPnJm/oQJBANwOCO6" + "D2hy1LQYJhXh7O+RLtA/tSnT1xyMQsGT+uUCMiKS2bSKx2wxo9k7h3OegNJIu1q6nZ6AbxDK8H3+d0dUCQQDTrP" + "SXagBxzp8PecbaCHjzNRSQE2in81qYnrAFNB4o3DpHyMMY6s5ALLeHKscEWnqP8Ur6X4PvzZecCWU9BKAZAkAut" + "LPknAuxSCsUOvUfS1i87ex77Ot+w6POp34pEX+UWb+u5iFn2cQacDTHLV1LtE80L8jVLSbrbrlH43H0DjU5AkEA" + "gidhycxS86dxpEljnOMCw8CKoUBd5I880IUahEiUltk7OLJYS/Ts1wbn3kPOVX3wyJs8WBDtBkFrDHW2ezth2QJ" + "ADj3e1YhMVdjJW5jqwlD/VNddGjgzyunmiZg0uOXsHXbytYmsA545S8KRQFaJKFXYYFo2kOjqOiC1T2cAzMDjCQ" + "==\n-----END PRIVATE KEY-----\n"; private static final String SA_KEY_ID = "key_id"; public void testRefreshToken_ServiceAccounts() throws Exception { final String serviceAccountEmail = "36680232662-vrd7ji19q3ne0ah2csanun6bnr@developer.gserviceaccount.com"; final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setServiceAccountId(serviceAccountEmail) .setServiceAccountScopes(SCOPES) .setServiceAccountPrivateKey(SecurityTestUtils.newRsaPrivateKey()) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); assertTrue(credential.refreshToken()); assertEquals(accessToken, credential.getAccessToken()); } public void testRefreshToken_User() throws Exception { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PuGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setClientSecrets(clientId, clientSecret) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); credential.setRefreshToken(refreshToken); assertTrue(credential.refreshToken()); assertEquals(accessToken, credential.getAccessToken()); } public void testCreateScoped() throws Exception { final String serviceAccountEmail = "36680232662-vrd7ji19q3ne0ah2csanun6bnr@developer.gserviceaccount.com"; final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setServiceAccountId(serviceAccountEmail) .setServiceAccountScopes(EMPTY_SCOPES) .setServiceAccountPrivateKey(SecurityTestUtils.newRsaPrivateKey()) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); assertTrue(credential.createScopedRequired()); try { credential.refreshToken(); fail("Should not be able to refresh token without scopes."); } catch (Exception expected) { } GoogleCredential scopedCredential = credential.createScoped(SCOPES); assertFalse(scopedCredential.createScopedRequired()); assertNotSame(credential, scopedCredential); assertTrue(scopedCredential.refreshToken()); assertEquals(accessToken, scopedCredential.getAccessToken()); assertSame(credential.getTransport(), scopedCredential.getTransport()); assertSame(credential.getJsonFactory(), scopedCredential.getJsonFactory()); assertSame(credential.getServiceAccountId(), scopedCredential.getServiceAccountId()); assertSame(credential.getServiceAccountUser(), scopedCredential.getServiceAccountUser()); assertSame(credential.getServiceAccountPrivateKey(), scopedCredential.getServiceAccountPrivateKey()); } public void testCreateScopesNotSet() throws Exception { final String serviceAccountEmail = "36680232662-vrd7ji19q3ne0ah2csanun6bnr@developer.gserviceaccount.com"; final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setServiceAccountId(serviceAccountEmail) .setServiceAccountPrivateKey(SecurityTestUtils.newRsaPrivateKey()) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); // Note that setServiceAccountScopes() is not called, so it is uninitialized (i.e. null) on the // builder. assertTrue(credential.getServiceAccountScopes().isEmpty()); } public void testGetApplicationDefaultNullTransportThrows() throws IOException { try { GoogleCredential.getApplicationDefault(null, JSON_FACTORY); fail(); } catch (NullPointerException expected) { } } public void testGetApplicationDefaultNullJsonFactoryThrows() throws IOException { HttpTransport transport = new MockHttpTransport(); try { GoogleCredential.getApplicationDefault(transport, null); fail(); } catch (NullPointerException expected) { } } public void testFromStreamNullTransportThrows() throws IOException { InputStream stream = new ByteArrayInputStream("foo".getBytes()); try { GoogleCredential.fromStream(stream, null, JSON_FACTORY); fail(); } catch (NullPointerException expected) { } } public void testFromStreamNullJsonFactoryThrows() throws IOException { HttpTransport transport = new MockHttpTransport(); InputStream stream = new ByteArrayInputStream("foo".getBytes()); try { GoogleCredential.fromStream(stream, transport, null); fail(); } catch (NullPointerException expected) { } } public void testFromStreamNullStreamThrows() throws IOException { HttpTransport transport = new MockHttpTransport(); try { GoogleCredential.fromStream(null, transport, JSON_FACTORY); fail(); } catch (NullPointerException expected) { } } public void testFromStreamServiceAccount() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; final String serviceAccountEmail = "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); GoogleCredential defaultCredential = GoogleCredential .fromStream(serviceAccountStream, transport, JSON_FACTORY); assertNotNull(defaultCredential); defaultCredential = defaultCredential.createScoped(SCOPES); assertTrue(defaultCredential.refreshToken()); assertEquals(accessToken, defaultCredential.getAccessToken()); } public void testFromStreamServiceAccountAlternateTokenUri() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; final String serviceAccountEmail = "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com"; final String tokenServerUrl = "http://another.auth.com/token"; MockTokenServerTransport transport = new MockTokenServerTransport(tokenServerUrl); transport.addServiceAccount(serviceAccountEmail, accessToken); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); serviceAccountContents.put("token_uri", tokenServerUrl); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); GoogleCredential defaultCredential = GoogleCredential .fromStream(serviceAccountStream, transport, JSON_FACTORY); assertNotNull(defaultCredential); assertEquals(tokenServerUrl, defaultCredential.getTokenServerEncodedUrl()); defaultCredential = defaultCredential.createScoped(SCOPES); assertEquals(tokenServerUrl, defaultCredential.getTokenServerEncodedUrl()); assertTrue(defaultCredential.refreshToken()); assertEquals(accessToken, defaultCredential.getAccessToken()); } public void testFromStreamServiceAccountMissingClientIdThrows() throws IOException { final String serviceAccountEmail = "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com"; MockHttpTransport transport = new MockTokenServerTransport(); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(serviceAccountStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("client_id")); } } public void testFromStreamServiceAccountMissingClientEmailThrows() throws IOException { final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; MockHttpTransport transport = new MockTokenServerTransport(); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(serviceAccountStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("client_email")); } } public void testFromStreamServiceAccountMissingPrivateKeyThrows() throws IOException { final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; final String serviceAccountEmail = "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com"; MockHttpTransport transport = new MockTokenServerTransport(); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key_id", SA_KEY_ID); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(serviceAccountStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("private_key")); } } public void testFromStreamServiceAccountMissingPrivateKeyIdThrows() throws IOException { final String serviceAccountId = "36680232662-vrd7ji19qe3nelgchd0ah2csanun6bnr.apps.googleusercontent.com"; final String serviceAccountEmail = "36680232662-vrd7ji19qgchd0ah2csanun6bnr@developer.gserviceaccount.com"; MockHttpTransport transport = new MockTokenServerTransport(); // Write out user file GenericJson serviceAccountContents = new GenericJson(); serviceAccountContents.setFactory(JSON_FACTORY); serviceAccountContents.put("client_id", serviceAccountId); serviceAccountContents.put("client_email", serviceAccountEmail); serviceAccountContents.put("private_key", SA_KEY_TEXT); serviceAccountContents.put("type", GoogleCredential.SERVICE_ACCOUNT_FILE_TYPE); String json = serviceAccountContents.toPrettyString(); InputStream serviceAccountStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(serviceAccountStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("private_key_id")); } } public void testFromStreamUser() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PSc5yhCqfA9nDFp1dfvH8cruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); // Create user stream. String json = createUserJson(clientId, clientSecret, refreshToken); InputStream userStream = new ByteArrayInputStream(json.getBytes()); GoogleCredential defaultCredential = GoogleCredential .fromStream(userStream, transport, JSON_FACTORY); assertNotNull(defaultCredential); assertEquals(refreshToken, defaultCredential.getRefreshToken()); assertTrue(defaultCredential.refreshToken()); assertEquals(accessToken, defaultCredential.getAccessToken()); } public void testFromStreamUsertMissingClientIdThrows() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PSruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); // Write out user file String json = createUserJson(null, clientSecret, refreshToken); InputStream userStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(userStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("client_id")); } } public void testFromStreamUsertMissingClientSecretThrows() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PSruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); // Write out user file String json = createUserJson(clientId, null, refreshToken); InputStream userStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(userStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("client_secret")); } } public void testFromStreamUsertMissingRefreshTokenThrows() throws IOException { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PSruGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); // Write out user file String json = createUserJson(clientId, clientSecret, null); InputStream userStream = new ByteArrayInputStream(json.getBytes()); try { GoogleCredential.fromStream(userStream, transport, JSON_FACTORY); fail(); } catch (IOException expected) { assertTrue(expected.getMessage().contains("refresh_token")); } } public void testCreateDelegated() throws Exception { final String serviceAccountEmail = "36680232662-vrd7ji19q3ne0ah2csanun6bnr@developer.gserviceaccount.com"; final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String delegateUser = "user@domain.com"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setServiceAccountId(serviceAccountEmail) .setServiceAccountScopes(SCOPES) .setServiceAccountPrivateKey(SecurityTestUtils.newRsaPrivateKey()) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); assertNotSame(delegateUser, credential.getServiceAccountUser()); GoogleCredential delegatedCredential = credential.createDelegated(delegateUser); assertNotSame(credential, delegatedCredential); assertTrue(delegatedCredential.refreshToken()); assertEquals(accessToken, delegatedCredential.getAccessToken()); assertNotSame(credential.getServiceAccountUser(), delegatedCredential.getServiceAccountUser()); assertSame(credential.getTransport(), delegatedCredential.getTransport()); assertSame(credential.getJsonFactory(), delegatedCredential.getJsonFactory()); assertSame(credential.getServiceAccountId(), delegatedCredential.getServiceAccountId()); assertSame(credential.getServiceAccountPrivateKey(), delegatedCredential.getServiceAccountPrivateKey()); } public void testBuilderUserAccount() throws Exception { final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String clientSecret = "jakuaL9YyieakhECKL2SwZcu"; final String clientId = "ya29.1.AADtN_UtlxN3PuGAxrN2XQnZTVRvDyVWnYq4I6dws"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addClient(clientId, clientSecret); transport.addRefreshToken(refreshToken, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setClientSecrets(clientId, clientSecret) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); credential.setRefreshToken(refreshToken); assertTrue(credential.refreshToken()); assertEquals(accessToken, credential.getAccessToken()); GoogleCredential newCredential = credential.toBuilder().build(); assertNotSame(credential, newCredential); assertSame(credential.getClientAuthentication(), newCredential.getClientAuthentication()); assertEquals(credential.getTransport(), newCredential.getTransport()); assertEquals(credential.getJsonFactory(), newCredential.getJsonFactory()); } public void testBuilderServiceAccount() throws Exception { final String serviceAccountEmail = "36680232662-vrd7ji19q3ne0ah2csanun6bnr@developer.gserviceaccount.com"; final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2"; final String refreshToken = "1/Tl6awhpFjkMkSJoj1xsli0H2eL5YsMgU_NKPY2TyGWY"; final String delegateUser = "user@domain.com"; MockTokenServerTransport transport = new MockTokenServerTransport(); transport.addServiceAccount(serviceAccountEmail, accessToken); GoogleCredential credential = new GoogleCredential.Builder() .setServiceAccountId(serviceAccountEmail) .setServiceAccountScopes(SCOPES) .setServiceAccountPrivateKey(SecurityTestUtils.newRsaPrivateKey()) .setServiceAccountUser(delegateUser) .setTransport(transport) .setJsonFactory(JSON_FACTORY) .build(); assertTrue(credential.refreshToken()); GoogleCredential newCredential = credential.toBuilder().build(); assertNotSame(credential, newCredential); assertEquals(credential.getServiceAccountId(), newCredential.getServiceAccountId()); assertEquals(credential.getServiceAccountProjectId(), newCredential.getServiceAccountProjectId()); org.junit.Assert.assertArrayEquals( credential.getServiceAccountScopes().toArray(), newCredential.getServiceAccountScopes().toArray()); assertEquals(credential.getServiceAccountPrivateKey(), newCredential.getServiceAccountPrivateKey()); assertEquals(credential.getServiceAccountPrivateKeyId(), newCredential.getServiceAccountPrivateKeyId()); assertEquals(credential.getServiceAccountUser(), newCredential.getServiceAccountUser()); assertTrue(newCredential.refreshToken()); assertEquals(credential.getAccessToken(), newCredential.getAccessToken()); assertEquals(credential.getTransport(), newCredential.getTransport()); assertEquals(credential.getJsonFactory(), newCredential.getJsonFactory()); } static String createUserJson(String clientId, String clientSecret, String refreshToken) throws IOException { GenericJson userCredentialContents = new GenericJson(); userCredentialContents.setFactory(JSON_FACTORY); if (clientId != null) { userCredentialContents.put("client_id", clientId); } if (clientSecret != null) { userCredentialContents.put("client_secret", clientSecret); } if (refreshToken != null) { userCredentialContents.put("refresh_token", refreshToken); } userCredentialContents.put("type", GoogleCredential.USER_FILE_TYPE); String json = userCredentialContents.toPrettyString(); return json; } } GoogleIdTokenTest.java000066400000000000000000000063301350651464300405120ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2013 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.api.client.googleapis.auth.oauth2; import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload; import junit.framework.TestCase; /** Tests for {@link GoogleIdToken}.*/ public class GoogleIdTokenTest extends TestCase { private static final String USER_ID = "1234567890"; private static final String ANOTHER_USER_ID = "2345678901"; private static final String CLIENT_ID = "myClientId"; private static final String ANOTHER_CLIENT_ID = "anotherClientId"; private static final String EMAIL_VERIFIED_KEY = "email_verified"; private static Payload newPayload(String userId, String clientId) { Payload payload = new Payload(); payload.setIssuer("accounts.google.com"); payload.setAudience(clientId); payload.setAuthorizedParty(clientId); payload.setSubject(userId); payload.setExpirationTimeSeconds(100L); payload.setIssuedAtTimeSeconds(0L); return payload; } @SuppressWarnings("deprecation") public void testDeprecatedMethods() { Payload payload = newPayload(USER_ID, CLIENT_ID); assertEquals(USER_ID, payload.getUserId()); assertEquals(CLIENT_ID, payload.getIssuee()); payload.setUserId(ANOTHER_USER_ID); payload.setIssuee(ANOTHER_CLIENT_ID); assertEquals(ANOTHER_USER_ID, payload.getUserId()); assertEquals(ANOTHER_CLIENT_ID, payload.getIssuee()); assertEquals(ANOTHER_USER_ID, payload.getSubject()); assertEquals(ANOTHER_CLIENT_ID, payload.getAuthorizedParty()); } public void testEmailVerified() { Payload payload = newPayload(USER_ID, CLIENT_ID); assertNull(payload.getEmailVerified()); payload.setEmailVerified(true); assertTrue(payload.getEmailVerified()); payload.setEmailVerified(false); assertFalse(payload.getEmailVerified()); payload.setEmailVerified(null); assertNull(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, "true"); assertTrue(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, true); assertTrue(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, "false"); assertFalse(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, false); assertFalse(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, "RandomString"); assertFalse(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, ""); assertFalse(payload.getEmailVerified()); payload.set(EMAIL_VERIFIED_KEY, null); assertNull(payload.getEmailVerified()); // Wrong type. payload.set(EMAIL_VERIFIED_KEY, new Integer(5)); try { payload.getEmailVerified(); fail(); } catch (ClassCastException e) { // Expected. } } } GoogleIdTokenVerifierTest.java000066400000000000000000000066661350651464300422220ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2012 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.api.client.googleapis.auth.oauth2; import com.google.api.client.auth.openidconnect.IdTokenVerifier; import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.json.webtoken.JsonWebSignature.Header; import com.google.api.client.testing.http.FixedClock; import com.google.api.client.util.Clock; import com.google.api.client.util.Lists; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; /** * Tests {@link GoogleIdTokenVerifier}. * * @author Yaniv Inbar */ public class GoogleIdTokenVerifierTest extends TestCase { private static final String ISSUER = "issuer.example.com"; private static final String CLIENT_ID = "myclientid"; private static final List TRUSTED_CLIENT_IDS = Arrays.asList(CLIENT_ID); private static Payload newPayload(String clientId) { Payload payload = new Payload(); payload.setIssuer("accounts.google.com"); payload.setAudience(clientId); payload.setAuthorizedParty(clientId); payload.setExpirationTimeSeconds(100L); payload.setIssuedAtTimeSeconds(0L); return payload; } public void testBuilder() throws Exception { GoogleIdTokenVerifier.Builder builder = new GoogleIdTokenVerifier.Builder( new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).setIssuer( ISSUER).setAudience(TRUSTED_CLIENT_IDS); assertEquals(Clock.SYSTEM, builder.getClock()); assertEquals(ISSUER, builder.getIssuer()); assertTrue(TRUSTED_CLIENT_IDS.equals(builder.getAudience())); Clock clock = new FixedClock(4); builder.setClock(clock); assertEquals(clock, builder.getClock()); IdTokenVerifier verifier = builder.build(); assertEquals(clock, verifier.getClock()); assertEquals(ISSUER, verifier.getIssuer()); assertEquals(TRUSTED_CLIENT_IDS, Lists.newArrayList(verifier.getAudience())); } public void testVerify() throws Exception { GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder( new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).build(); Header header = new Header(); header.setAlgorithm("RS25"); Payload payload = newPayload(CLIENT_ID); Payload payload2 = newPayload(CLIENT_ID + "2"); GoogleIdToken idToken = new GoogleIdToken(header, payload, new byte[0], new byte[0]); GoogleIdToken idToken2 = new GoogleIdToken(header, payload2, new byte[0], new byte[0]); assertFalse(verifier.verify(idToken)); assertFalse(verifier.verify(idToken2)); verifier = new GoogleIdTokenVerifier( new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()); assertFalse(verifier.verify(idToken)); assertFalse(verifier.verify(idToken2)); // TODO(yanivi): add a unit test that returns true } } GooglePublicKeysManagerTest.java000066400000000000000000000136731350651464300425320ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/auth/oauth2/* * Copyright 2013 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.api.client.googleapis.auth.oauth2; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.FixedClock; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import junit.framework.TestCase; /** * Tests {@link GooglePublicKeysManager}. * * @author Yaniv Inbar */ public class GooglePublicKeysManagerTest extends TestCase { private static final String TEST_CERTIFICATES = "{\r\n \"69d93af12d09b07b1f55680ac7e7fb2513b823e7\": \"-----BEGIN CERTIFICATE-----" + "\\nMIICITCCAYqgAwIBAgIIA9YgrgKJ4cowDQYJKoZIhvcNAQEFBQAwNjE0MDIGA1UE" + "\\nAxMrZmVkZXJhdGVkLXNpZ25vbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTAe" + "\\nFw0xMjA2MTIyMjQzMzRaFw0xMjA2MTQxMTQzMzRaMDYxNDAyBgNVBAMTK2ZlZGVy" + "\\nYXRlZC1zaWdub24uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wgZ8wDQYJKoZI" + "\\nhvcNAQEBBQADgY0AMIGJAoGBAJ6TDzmLxYD67aoTrzA3b8ouMXMeFxQOmsHn0SIA" + "\\nGjJypTQd0hXr3jGKqP53a4qtzm7YxyPyPOsvG8IMsB0RtB8gxh82KDQUqJ+mww8n" + "\\ney7WxW1qSmzyYog1z80MDYojODZ3j7wv1r8ajeJQSxQjBMehMEQkfjPuzERuzkCk" + "\\niBzzAgMBAAGjODA2MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMBYGA1Ud" + "\\nJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA4GBAIx9j1gXCEm2Vr9r" + "\\nck6VK3ayG29+5ehNvzfYob+l731yU0yylEDEfN9OqqdW0dAqaauca+Ol8mGDIszx" + "\\nxudWD0NzNyvm39jwypvYz9qMYwbwVnQdfbpY5O0qbcb30eIDKZRHXzpZUj0zWHPM" + "\\nfwdrgc6XqQ48rjOsn22sWKQcB4/u\\n-----END CERTIFICATE-----\\n\",\r\n " + "\"67aec7b8e284bb03f489a5828d0eba52cc84cc23\": \"-----BEGIN CERTIFICATE-----" + "\\nMIICITCCAYqgAwIBAgIIcAqoF0CS2WgwDQYJKoZIhvcNAQEFBQAwNjE0MDIGA1UE" + "\\nAxMrZmVkZXJhdGVkLXNpZ25vbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTAe" + "\\nFw0xMjA2MTMyMjI4MzRaFw0xMjA2MTUxMTI4MzRaMDYxNDAyBgNVBAMTK2ZlZGVy" + "\\nYXRlZC1zaWdub24uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wgZ8wDQYJKoZI" + "\\nhvcNAQEBBQADgY0AMIGJAoGBAMVlf20FzpqZHR7lzNWbbXq5Ol+j+/2gwTtYlgNz" + "\\ns6njxEP4oTmViZQsuQABmvYzg7BHOOW2IRE0U2osrfAw97Gg8L/84D0Sdf9sAjr2" + "\\nb3F6reVPUYJNDvpvKr6351+N+VRskOVnpqp/rS8k69jHlUYiGTpeQ5MA5n1BUCoF" + "\\nJb/vAgMBAAGjODA2MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMBYGA1Ud" + "\\nJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA4GBAHoD+K9ffsDR+XWn" + "\\nBODExaCtMTie0l2yRds1wsgc7645PeSYsLB8p4NABI/z28VMD2e7CFzoO2kzNj5I" + "\\nKLO2FYliXRw35P3ZJxvxs8aSP0S/U2vlhfDM/W0a4KMF9ATfoWqTaoHG1rWmYOuj" + "\\nncTIM79cE3iBrhFqq8HpetXj77Qf\\n-----END CERTIFICATE-----\\n\"\r\n}"; private static final int MAX_AGE = 12345; private static final int AGE = 42; public void testBuilder() throws Exception { HttpTransport transport = new MockHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); GooglePublicKeysManager.Builder builder = new GooglePublicKeysManager.Builder(transport, jsonFactory); GooglePublicKeysManager certs = builder.build(); assertEquals(transport, certs.getTransport()); assertEquals(jsonFactory, certs.getJsonFactory()); } static class PublicCertsMockHttpTransport extends MockHttpTransport { boolean useAgeHeader; @Override public LowLevelHttpRequest buildRequest(String name, String url) { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { MockLowLevelHttpResponse r = new MockLowLevelHttpResponse(); r.setStatusCode(200); r.addHeader("Cache-Control", "max-age=" + MAX_AGE); if (useAgeHeader) { r.addHeader("Age", String.valueOf(AGE)); } r.setContentType(Json.MEDIA_TYPE); r.setContent(TEST_CERTIFICATES); return r; } }; } } public void testRefresh() throws Exception { GooglePublicKeysManager certs = new GooglePublicKeysManager.Builder( new PublicCertsMockHttpTransport(), new JacksonFactory()).build(); certs.refresh(); assertEquals(2, certs.getPublicKeys().size()); } public void testLoadCerts_cache() throws Exception { PublicCertsMockHttpTransport transport = new PublicCertsMockHttpTransport(); transport.useAgeHeader = true; GooglePublicKeysManager certs = new GooglePublicKeysManager.Builder( transport, new JacksonFactory()).setClock(new FixedClock(100)).build(); certs.refresh(); assertEquals(2, certs.getPublicKeys().size()); assertEquals(100 + (MAX_AGE - AGE) * 1000, certs.getExpirationTimeMilliseconds()); } public void testGetCacheTimeInSec() throws Exception { GooglePublicKeysManager certs = new GooglePublicKeysManager.Builder(new MockHttpTransport(), new JacksonFactory()).build(); assertEquals(12000, certs.getCacheTimeInSec( new HttpHeaders().setAge(345L).setCacheControl("max-age=" + MAX_AGE))); assertEquals(0, certs.getCacheTimeInSec(new HttpHeaders())); assertEquals(0, certs.getCacheTimeInSec(new HttpHeaders().setAge(345L))); assertEquals( 0, certs.getCacheTimeInSec(new HttpHeaders().setAge(345L).setCacheControl("max-age=300"))); } } batch/000077500000000000000000000000001350651464300332315ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapisBatchRequestTest.java000066400000000000000000001047641350651464300373420ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/batch// Copyright 2012 Google Inc. All Rights Reserved. package com.google.api.client.googleapis.batch; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.api.client.googleapis.batch.BatchRequest.RequestInfo; import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonError.ErrorInfo; import com.google.api.client.googleapis.json.GoogleJsonErrorContainer; import com.google.api.client.googleapis.testing.services.MockGoogleClient; import com.google.api.client.googleapis.testing.services.MockGoogleClientRequest; import com.google.api.client.http.ByteArrayContent; import com.google.api.client.http.ExponentialBackOffPolicy; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpHeaders; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpUnsuccessfulResponseHandler; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.protobuf.ProtoObjectParser; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Charsets; import com.google.api.client.util.Key; import com.google.api.client.util.ObjectParser; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; /** * Tests {@link BatchRequest}. * * @author rmistry@google.com (Ravi Mistry) */ @SuppressWarnings("deprecation") public class BatchRequestTest extends TestCase { private static final String ROOT_URL = "http://www.test.com/"; private static final String SERVICE_PATH = "test/"; private static final String TEST_BATCH_URL = "http://www.testgoogleapis.com/batch"; private static final String URI_TEMPLATE1 = "uri/template/1"; private static final String URI_TEMPLATE2 = "uri/template/2"; private static final String METHOD1 = HttpMethods.GET; private static final String METHOD2 = HttpMethods.POST; private static final String ERROR_MSG = "Error message"; private static final String ERROR_REASON = "notFound"; private static final int ERROR_CODE = 503; private static final String ERROR_DOMAIN = "global"; private static final String RESPONSE_BOUNDARY = "ABC=DE=F"; private static final String TEST_ID = "Humpty Dumpty"; private static final String TEST_KIND = "Big\nEgg\n"; // Newlines help test boundary detection private static final String TEST_NAME = "James Bond"; private static final String TEST_NUM = "007"; private TestCallback1 callback1; private TestCallback2 callback2; private TestCallback3 callback3; private MockTransport transport; private MockCredential credential; @Override protected void setUp() { callback1 = new TestCallback1(); callback2 = new TestCallback2(); callback3 = new TestCallback3(); } public static class MockDataClass1 extends GenericJson { @Key String id; @Key String kind; } public static class MockDataClass2 extends GenericJson { @Key String name; @Key String number; } private static class TestCallback1 implements BatchCallback { int successCalls; TestCallback1() { } @Override public void onSuccess(MockDataClass1 dataClass, HttpHeaders responseHeaders) { successCalls++; assertEquals(TEST_ID, dataClass.id); assertEquals(TEST_KIND, dataClass.kind); } @Override public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { fail("Should not be invoked in this test"); } } private static class TestCallback2 implements BatchCallback { int successCalls; int failureCalls; TestCallback2() { } @Override public void onSuccess(MockDataClass2 dataClass, HttpHeaders responseHeaders) { successCalls++; assertEquals(TEST_NAME, dataClass.name); assertEquals(TEST_NUM, dataClass.number); } @Override public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { failureCalls++; GoogleJsonError error = e.getError(); ErrorInfo errorInfo = error.getErrors().get(0); assertEquals(ERROR_DOMAIN, errorInfo.getDomain()); assertEquals(ERROR_REASON, errorInfo.getReason()); assertEquals(ERROR_MSG, errorInfo.getMessage()); assertEquals(ERROR_CODE, error.getCode()); assertEquals(ERROR_MSG, error.getMessage()); } } private static class TestCallback3 implements BatchCallback { int successCalls; int failureCalls; TestCallback3() { } @Override public void onSuccess(Void dataClass, HttpHeaders responseHeaders) { successCalls++; assertNull(dataClass); } @Override public void onFailure(Void e, HttpHeaders responseHeaders) { failureCalls++; assertNull(e); } } /** * Base class for callback adapters to handle error conversion. * * @param The input type * @param The output type */ private abstract static class TestCallbackBaseAdapter implements BatchCallback { protected final BatchCallback callback; protected TestCallbackBaseAdapter( BatchCallback callback) { this.callback = callback; } @Override public void onFailure(ErrorOutput.ErrorBody e, HttpHeaders responseHeaders) throws IOException { GoogleJsonErrorContainer errorContainer = new GoogleJsonErrorContainer(); if (e.hasError()) { ErrorOutput.ErrorProto errorProto = e.getError(); GoogleJsonError error = new GoogleJsonError(); if (errorProto.hasCode()) { error.setCode(errorProto.getCode()); } if (errorProto.hasMessage()) { error.setMessage(errorProto.getMessage()); } List errorInfos = new ArrayList(errorProto.getErrorsCount()); for (ErrorOutput.IndividualError individualError : errorProto.getErrorsList()) { ErrorInfo errorInfo = new ErrorInfo(); if (individualError.hasDomain()) { errorInfo.setDomain(individualError.getDomain()); } if (individualError.hasMessage()) { errorInfo.setMessage(individualError.getMessage()); } if (individualError.hasReason()) { errorInfo.setReason(individualError.getReason()); } errorInfos.add(errorInfo); } error.setErrors(errorInfos); errorContainer.setError(error); } callback.onFailure(errorContainer, responseHeaders); } } private static class TestCallback1Adapter extends TestCallbackBaseAdapter { public TestCallback1Adapter(TestCallback1 callback) { super(callback); } @Override public void onSuccess(MockData.Class1 message, HttpHeaders responseHeaders) throws IOException { MockDataClass1 dataClass = new MockDataClass1(); dataClass.id = message.hasId() ? message.getId() : null; dataClass.kind = message.hasKind() ? message.getKind() : null; callback.onSuccess(dataClass, responseHeaders); } } private static class TestCallback2Adapter extends TestCallbackBaseAdapter { public TestCallback2Adapter(TestCallback2 callback) { super(callback); } @Override public void onSuccess(MockData.Class2 message, HttpHeaders responseHeaders) throws IOException { MockDataClass2 dataClass = new MockDataClass2(); dataClass.name = message.hasName() ? message.getName() : null; dataClass.number = message.hasNumber() ? message.getNumber() : null; callback.onSuccess(dataClass, responseHeaders); } } private static class MockUnsuccessfulResponseHandler implements HttpUnsuccessfulResponseHandler { MockTransport transport; boolean returnSuccessAuthenticatedContent; MockUnsuccessfulResponseHandler( MockTransport transport, boolean returnSuccessAuthenticatedContent) { this.transport = transport; this.returnSuccessAuthenticatedContent = returnSuccessAuthenticatedContent; } @Override public boolean handleResponse( HttpRequest request, HttpResponse response, boolean supportsRetry) { if (transport.returnErrorAuthenticatedContent) { // If transport has already been set to return error content do not handle response. return false; } if (returnSuccessAuthenticatedContent) { transport.returnSuccessAuthenticatedContent = true; } else { transport.returnErrorAuthenticatedContent = true; } return true; } } @Deprecated private static class MockExponentialBackOffPolicy extends ExponentialBackOffPolicy { public MockExponentialBackOffPolicy() { } @Override public long getNextBackOffMillis() { return 0; } } private static class MockTransport extends MockHttpTransport { final boolean testServerError; final boolean testAuthenticationError; boolean returnSuccessAuthenticatedContent; boolean returnErrorAuthenticatedContent; final boolean testExponentialBackOff; final boolean testRedirect; final boolean testBinary; final boolean testMissingLength; int actualCalls; int callsBeforeSuccess; MockTransport(boolean testServerError, boolean testAuthenticationError, boolean testExponentialBackOff, boolean testRedirect, boolean testBinary, boolean testMissingLength) { this.testServerError = testServerError; this.testAuthenticationError = testAuthenticationError; this.testExponentialBackOff = testExponentialBackOff; this.testRedirect = testRedirect; this.testBinary = testBinary; this.testMissingLength = testMissingLength; } @Override public LowLevelHttpRequest buildRequest(String name, String url) { actualCalls++; return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() throws IOException { MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); response.setStatusCode(200); response.addHeader("Content-Type", "multipart/mixed; boundary=" + RESPONSE_BOUNDARY); String contentType = testBinary ? "application/x-protobuf" : "application/json; charset=UTF-8"; byte[] content1 = testBinary ? MockData.Class1.newBuilder() .setId(TEST_ID) .setKind(TEST_KIND) .build().toByteArray() : utf8Encode("{\n \"id\": \"" + TEST_ID + "\",\n \"kind\": \"" + TEST_KIND.replace("\n", "\\n") + "\"\n}"); byte[] content2 = testBinary ? MockData.Class2.newBuilder() .setName(TEST_NAME) .setNumber(TEST_NUM) .build().toByteArray() : utf8Encode("{\"name\": \"" + TEST_NAME + "\", \"number\": \"" + TEST_NUM + "\"}"); byte[] errorContent = testBinary ? ErrorOutput.ErrorBody.newBuilder() .setError(ErrorOutput.ErrorProto.newBuilder() .setCode(ERROR_CODE) .setMessage(ERROR_MSG) .addErrors(ErrorOutput.IndividualError.newBuilder() .setDomain(ERROR_DOMAIN) .setReason(ERROR_REASON) .setMessage(ERROR_MSG)) ).build().toByteArray() : utf8Encode("{\"error\": { \"errors\": [{\"domain\": \"" + ERROR_DOMAIN + "\"," + "\"reason\": \"" + ERROR_REASON + "\", \"message\": \"" + ERROR_MSG + "\"}]," + "\"code\": " + ERROR_CODE + ", \"message\": \"" + ERROR_MSG + "\"}}"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Writer responseContent = new OutputStreamWriter(outputStream, "ISO-8859-1"); if (returnSuccessAuthenticatedContent || (testExponentialBackOff && actualCalls > 1) || (testRedirect && actualCalls > 1)) { if (returnSuccessAuthenticatedContent || actualCalls == callsBeforeSuccess) { responseContent.append("--" + RESPONSE_BOUNDARY + "\n") .append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n") .append("Content-ID: response-1\n\n").append("HTTP/1.1 200 OK\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + content2.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(content2); responseContent.append("\n--" + RESPONSE_BOUNDARY + "--\n\n"); } else { responseContent.append("--" + RESPONSE_BOUNDARY + "\n") .append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n") .append("Content-ID: response-1\n\n") .append("HTTP/1.1 " + ERROR_CODE + " Not Found\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + errorContent.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(errorContent); responseContent.append("\n--" + RESPONSE_BOUNDARY + "--\n\n"); } } else if (returnErrorAuthenticatedContent) { responseContent.append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n").append("Content-ID: response-1\n\n"); responseContent.append("HTTP/1.1 " + ERROR_CODE + " Not Found\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + errorContent.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(errorContent); responseContent.append("\n--" + RESPONSE_BOUNDARY + "--\n\n"); } else { responseContent.append("--" + RESPONSE_BOUNDARY + "\n") .append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n").append("Content-ID: response-1\n\n") .append("HTTP/1.1 200 OK\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + content1.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(content1); responseContent .append("\n--" + RESPONSE_BOUNDARY + "\n") .append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n") .append("Content-ID: response-2\n\n"); if (testServerError) { responseContent.append("HTTP/1.1 " + ERROR_CODE + " Not Found\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + errorContent.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(errorContent); responseContent.append("\n--" + RESPONSE_BOUNDARY + "--\n\n"); } else if (testAuthenticationError) { responseContent.append("HTTP/1.1 401 Unauthorized\n") .append("Content-Type: application/json; charset=UTF-8\n\n") .append("--" + RESPONSE_BOUNDARY + "--\n\n"); } else if (testRedirect && actualCalls == 1) { responseContent.append("HTTP/1.1 301 MovedPermanently\n") .append("Content-Type: " + contentType + "\n") .append("Location: http://redirect/location\n\n") .append("--" + RESPONSE_BOUNDARY + "--\n\n"); } else { responseContent.append("HTTP/1.1 200 OK\n") .append("Content-Type: " + contentType + "\n"); if (!testMissingLength) { responseContent.append("Content-Length: " + content2.length + "\n"); } responseContent.append("\n"); responseContent.flush(); outputStream.write(content2); responseContent.append("\n--" + RESPONSE_BOUNDARY + "--\n\n"); } } responseContent.flush(); response.setContent(outputStream.toByteArray()); return response; } // Short-hand to encode a String as a UTF-8 byte array private byte[] utf8Encode(String string) { return Charsets.UTF_8.encode(string).array(); } }; } } private static class MockCredential implements HttpRequestInitializer, HttpExecuteInterceptor { boolean initializerCalled = false; boolean interceptorCalled = false; MockCredential() { } @Override public void initialize(HttpRequest request) { request.setInterceptor(this); initializerCalled = true; } @Override public void intercept(HttpRequest request) { interceptorCalled = true; } } private BatchRequest getBatchPopulatedWithRequests(boolean testServerError, boolean testAuthenticationError, boolean returnSuccessAuthenticatedContent, boolean testExponentialBackOff, boolean testRedirect, boolean testBinary, boolean testMissingLength) throws Exception { transport = new MockTransport(testServerError, testAuthenticationError, testExponentialBackOff, testRedirect, testBinary, testMissingLength); MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, null, null).setApplicationName("Test Application") .build(); MockGoogleClientRequest jsonHttpRequest1 = new MockGoogleClientRequest(client, METHOD1, URI_TEMPLATE1, null, String.class); MockGoogleClientRequest jsonHttpRequest2 = new MockGoogleClientRequest(client, METHOD2, URI_TEMPLATE2, null, String.class); credential = new MockCredential(); ObjectParser parser = testBinary ? new ProtoObjectParser() : new JsonObjectParser(new JacksonFactory()); BatchRequest batchRequest = new BatchRequest(transport, credential).setBatchUrl(new GenericUrl(TEST_BATCH_URL)); HttpRequest request1 = jsonHttpRequest1.buildHttpRequest(); request1.setParser(parser); HttpRequest request2 = jsonHttpRequest2.buildHttpRequest(); request2.setParser(parser); if (testAuthenticationError) { request2.setUnsuccessfulResponseHandler( new MockUnsuccessfulResponseHandler(transport, returnSuccessAuthenticatedContent)); } if (testExponentialBackOff) { request2.setBackOffPolicy(new MockExponentialBackOffPolicy()); } if (testBinary) { batchRequest.queue(request1, MockData.Class1.class, ErrorOutput.ErrorBody.class, new TestCallback1Adapter(callback1)); batchRequest.queue(request2, MockData.Class2.class, ErrorOutput.ErrorBody.class, new TestCallback2Adapter(callback2)); } else { batchRequest.queue(request1, MockDataClass1.class, GoogleJsonErrorContainer.class, callback1); batchRequest.queue(request2, MockDataClass2.class, GoogleJsonErrorContainer.class, callback2); } return batchRequest; } public void testQueueDatastructures() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, false, false, false, false, false, false); List> requestInfos = batchRequest.requestInfos; // Assert that the expected objects are queued. assertEquals(2, requestInfos.size()); assertEquals(MockDataClass1.class, requestInfos.get(0).dataClass); assertEquals(callback1, requestInfos.get(0).callback); assertEquals(MockDataClass2.class, requestInfos.get(1).dataClass); assertEquals(callback2, requestInfos.get(1).callback); // Assert that the requests in the queue are as expected. assertEquals( ROOT_URL + SERVICE_PATH + URI_TEMPLATE1, requestInfos.get(0).request.getUrl().build()); assertEquals( ROOT_URL + SERVICE_PATH + URI_TEMPLATE2, requestInfos.get(1).request.getUrl().build()); assertEquals(METHOD1, requestInfos.get(0).request.getRequestMethod()); assertEquals(METHOD2, requestInfos.get(1).request.getRequestMethod()); } public void testExecute() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, false, false, false, false, false, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback2.successCalls); assertEquals(0, callback2.failureCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testExecuteWithError() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(true, false, false, false, false, false, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(0, callback2.successCalls); assertEquals(1, callback2.failureCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); // Assert transport called expected number of times. assertEquals(1, transport.actualCalls); } public void testExecuteWithVoidCallback() throws Exception { subTestExecuteWithVoidCallback(false); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback3.successCalls); assertEquals(0, callback3.failureCalls); } public void testExecuteWithVoidCallbackError() throws Exception { subTestExecuteWithVoidCallback(true); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(0, callback3.successCalls); assertEquals(1, callback3.failureCalls); } public void subTestExecuteWithVoidCallback(boolean testServerError) throws Exception { MockTransport transport = new MockTransport(testServerError, false, false, false, false, false); MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, null, null).setApplicationName("Test Application") .build(); MockGoogleClientRequest jsonHttpRequest1 = new MockGoogleClientRequest(client, METHOD1, URI_TEMPLATE1, null, String.class); MockGoogleClientRequest jsonHttpRequest2 = new MockGoogleClientRequest(client, METHOD2, URI_TEMPLATE2, null, String.class); ObjectParser parser = new JsonObjectParser(new JacksonFactory()); BatchRequest batchRequest = new BatchRequest(transport, null).setBatchUrl(new GenericUrl(TEST_BATCH_URL)); HttpRequest request1 = jsonHttpRequest1.buildHttpRequest(); request1.setParser(parser); HttpRequest request2 = jsonHttpRequest2.buildHttpRequest(); request2.setParser(parser); batchRequest.queue(request1, MockDataClass1.class, GoogleJsonErrorContainer.class, callback1); batchRequest.queue(request2, Void.class, Void.class, callback3); batchRequest.execute(); // Assert transport called expected number of times. assertEquals(1, transport.actualCalls); } public void testExecuteWithAuthenticationErrorThenSuccessCallback() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, true, true, false, false, false, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback2.successCalls); assertEquals(0, callback2.failureCalls); // Assert transport called expected number of times. assertEquals(2, transport.actualCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testExecuteWithAuthenticationErrorThenErrorCallback() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, true, false, false, false, false, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(0, callback2.successCalls); assertEquals(1, callback2.failureCalls); // Assert transport called expected number of times. assertEquals(2, transport.actualCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testExecuteWithExponentialBackoffThenSuccessCallback() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(true, false, false, true, false, false, false); transport.callsBeforeSuccess = 2; batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback2.successCalls); // Assert transport called expected number of times. assertEquals(2, transport.actualCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testExecuteWithExponentialBackoffThenErrorCallback() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(true, false, false, true, false, false, false); transport.callsBeforeSuccess = 20; batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(0, callback2.successCalls); assertEquals(1, callback2.failureCalls); // Assert transport called expected number of times. assertEquals(11, transport.actualCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testInterceptor() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(true, false, false, true, false, false, false); batchRequest.execute(); // Assert the top-level request initializer is called. assertTrue(credential.initializerCalled); assertTrue(credential.interceptorCalled); } public void testRedirect() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, false, false, false, true, false, false); transport.callsBeforeSuccess = 2; batchRequest.execute(); // Assert transport called expected number of times. assertEquals(2, transport.actualCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testExecute_checkWriteTo() throws Exception { String request1Method = HttpMethods.POST; String request1Url = "http://test/dummy/url1"; String request1ContentType = "application/json"; String request1Content = "{\"data\":{\"foo\":{\"v1\":{}}}}"; String request2Method = HttpMethods.GET; String request2Url = "http://test/dummy/url2"; final StringBuilder expectedOutput = new StringBuilder(); expectedOutput.append("--__END_OF_PART__\r\n"); expectedOutput.append("Content-Length: 118\r\n"); expectedOutput.append("Content-Type: application/http\r\n"); expectedOutput.append("content-id: 1\r\n"); expectedOutput.append("content-transfer-encoding: binary\r\n"); expectedOutput.append("\r\n"); expectedOutput.append("POST http://test/dummy/url1 HTTP/1.1\r\n"); expectedOutput.append("Content-Length: 26\r\n"); expectedOutput.append("Content-Type: " + request1ContentType + "\r\n"); expectedOutput.append("\r\n"); expectedOutput.append(request1Content + "\r\n"); expectedOutput.append("--__END_OF_PART__\r\n"); expectedOutput.append("Content-Length: 39\r\n"); expectedOutput.append("Content-Type: application/http\r\n"); expectedOutput.append("content-id: 2\r\n"); expectedOutput.append("content-transfer-encoding: binary\r\n"); expectedOutput.append("\r\n"); expectedOutput.append("GET http://test/dummy/url2 HTTP/1.1\r\n"); expectedOutput.append("\r\n"); expectedOutput.append("\r\n"); expectedOutput.append("--__END_OF_PART__--\r\n"); MockHttpTransport transport = new MockHttpTransport(); HttpRequest request1 = transport .createRequestFactory() .buildRequest( request1Method, new GenericUrl(request1Url), new ByteArrayContent(request1ContentType, request1Content.getBytes(UTF_8))); HttpRequest request2 = transport.createRequestFactory() .buildRequest(request2Method, new GenericUrl(request2Url), null); subtestExecute_checkWriteTo(expectedOutput.toString(), request1, request2); } private void subtestExecute_checkWriteTo(final String expectedOutput, HttpRequest... requests) throws IOException { MockHttpTransport transport = new MockHttpTransport() { @Override public LowLevelHttpRequest buildRequest(String method, String url) { return new MockLowLevelHttpRequest(url) { @Override public LowLevelHttpResponse execute() throws IOException { assertEquals("multipart/mixed; boundary=__END_OF_PART__", getContentType()); ByteArrayOutputStream out = new ByteArrayOutputStream(); getStreamingContent().writeTo(out); assertEquals(expectedOutput, out.toString("UTF-8")); MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); response.setStatusCode(200); response.addHeader("Content-Type", "multipart/mixed; boundary=" + RESPONSE_BOUNDARY); String content2 = "{\"name\": \"" + TEST_NAME + "\", \"number\": \"" + TEST_NUM + "\"}"; StringBuilder responseContent = new StringBuilder(); responseContent.append("--" + RESPONSE_BOUNDARY + "\n") .append("Content-Type: application/http\n") .append("Content-Transfer-Encoding: binary\n").append("Content-ID: response-1\n\n") .append("HTTP/1.1 200 OK\n") .append("Content-Type: application/json; charset=UTF-8\n") .append("Content-Length: " + content2.length() + "\n\n").append(content2 + "\n\n") .append("--" + RESPONSE_BOUNDARY + "--\n\n"); response.setContent(responseContent.toString()); return response; } }; } }; BatchRequest batchRequest = new BatchRequest(transport, null); BatchCallback callback = new BatchCallback() { @Override public void onSuccess(Void t, HttpHeaders responseHeaders) { } @Override public void onFailure(Void e, HttpHeaders responseHeaders) { } }; for (HttpRequest request : requests) { batchRequest.queue(request, Void.class, Void.class, callback); } batchRequest.execute(); } public void testExecute_checkWriteToNoHeaders() throws Exception { MockHttpTransport transport = new MockHttpTransport(); HttpRequest request1 = transport.createRequestFactory() .buildPostRequest(HttpTesting.SIMPLE_GENERIC_URL, new HttpContent() { @Override public long getLength() { return -1; } @Override public String getType() { return null; } @Override public void writeTo(OutputStream out) { } @Override public boolean retrySupported() { return true; } }); subtestExecute_checkWriteTo(new StringBuilder().append("--__END_OF_PART__\r\n") .append("Content-Length: 36\r\n").append("Content-Type: application/http\r\n") .append("content-id: 1\r\n").append("content-transfer-encoding: binary\r\n").append("\r\n") .append("POST http://google.com/ HTTP/1.1\r\n").append("\r\n").append("\r\n") .append("--__END_OF_PART__--\r\n").toString(), request1); } public void testProtoExecute() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, false, false, false, false, true, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback2.successCalls); assertEquals(0, callback2.failureCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } public void testProtoExecuteWithError() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(true, false, false, false, false, true, false); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(0, callback2.successCalls); assertEquals(1, callback2.failureCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); // Assert transport called expected number of times. assertEquals(1, transport.actualCalls); } public void testProtoExecuteWithoutLength() throws Exception { BatchRequest batchRequest = getBatchPopulatedWithRequests(false, false, false, false, false, true, true); batchRequest.execute(); // Assert callbacks have been invoked. assertEquals(1, callback1.successCalls); assertEquals(1, callback2.successCalls); assertEquals(0, callback2.failureCalls); // Assert requestInfos is empty after execute. assertTrue(batchRequest.requestInfos.isEmpty()); } } compute/000077500000000000000000000000001350651464300336245ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapisComputeCredentialTest.java000066400000000000000000000026301350651464300407370ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/compute/* * Copyright 2013 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.api.client.googleapis.compute; import com.google.api.client.googleapis.testing.compute.MockMetadataServerTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import junit.framework.TestCase; /** * Tests {@link ComputeCredential}. * * @author Yaniv Inbar */ public class ComputeCredentialTest extends TestCase { static final String ACCESS_TOKEN = "ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_QtAS08i85nHq39HE3C2LTrCARA"; public void testExecuteRefreshToken() throws Exception { HttpTransport transport = new MockMetadataServerTransport(ACCESS_TOKEN); ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory()); assertTrue(credential.refreshToken()); assertEquals(ACCESS_TOKEN, credential.getAccessToken()); } } google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/json/000077500000000000000000000000001350651464300332005ustar00rootroot00000000000000GoogleJsonErrorContainerTest.java000066400000000000000000000030031350651464300415430ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/json/* * Copyright 2012 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.api.client.googleapis.json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonParser; import com.google.api.client.json.jackson2.JacksonFactory; import junit.framework.TestCase; /** * Tests {@link GoogleJsonErrorContainer}. * * @author rmistry@google.com (Ravi Mistry) */ public class GoogleJsonErrorContainerTest extends TestCase { static final JsonFactory FACTORY = new JacksonFactory(); static final String ERROR = "{" + "\"error\":{" + "\"code\":403," + "\"errors\":[{" + "\"domain\":\"usageLimits\"," + "\"message\":\"Access Not Configured\"," + "\"reason\":\"accessNotConfigured\"" + "}]," + "\"message\":\"Access Not Configured\"}}"; public void test_json() throws Exception { JsonParser parser = FACTORY.createJsonParser(ERROR); GoogleJsonErrorContainer e = parser.parse(GoogleJsonErrorContainer.class); assertEquals(ERROR, FACTORY.toString(e)); } } GoogleJsonErrorTest.java000066400000000000000000000060611350651464300377070ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/json/* * Copyright 2011 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.api.client.googleapis.json; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonParser; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import junit.framework.TestCase; /** * Tests {@link GoogleJsonError}. * * @author Yaniv Inbar */ public class GoogleJsonErrorTest extends TestCase { static final JsonFactory FACTORY = new JacksonFactory(); static final String ERROR = "{" + "\"code\":403," + "\"errors\":[{" + "\"domain\":\"usageLimits\"," + "\"message\":\"Access Not Configured\"," + "\"reason\":\"accessNotConfigured\"" + "}]," + "\"message\":\"Access Not Configured\"}"; static final String ERROR_RESPONSE = "{\"error\":" + ERROR + "}"; public void test_json() throws Exception { JsonParser parser = FACTORY.createJsonParser(ERROR); parser.nextToken(); GoogleJsonError e = parser.parse(GoogleJsonError.class); assertEquals(ERROR, FACTORY.toString(e)); } static class ErrorTransport extends MockHttpTransport { final MockLowLevelHttpResponse response; ErrorTransport() { this(ERROR_RESPONSE, Json.MEDIA_TYPE); } ErrorTransport(String content, String contentType) { response = new MockLowLevelHttpResponse().setContent(content) .setContentType(contentType).setStatusCode(HttpStatusCodes.STATUS_CODE_FORBIDDEN); } @Override public LowLevelHttpRequest buildRequest(String name, String url) { return new MockLowLevelHttpRequest(url).setResponse(response); } } public void testParse() throws Exception { HttpTransport transport = new ErrorTransport(); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonError errorResponse = GoogleJsonError.parse(FACTORY, response); assertEquals(ERROR, FACTORY.toString(errorResponse)); } } GoogleJsonResponseExceptionTest.java000066400000000000000000000162341350651464300422760ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/json/* * Copyright 2011 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.api.client.googleapis.json; import com.google.api.client.googleapis.json.GoogleJsonErrorTest.ErrorTransport; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.Json; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.util.StringUtils; import junit.framework.TestCase; /** * Tests {@link GoogleJsonResponseException}. * * @author Yaniv Inbar */ public class GoogleJsonResponseExceptionTest extends TestCase { public void testFrom_noDetails() throws Exception { HttpTransport transport = new MockHttpTransport(); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("200", ge.getMessage()); } public void testFrom_withDetails() throws Exception { HttpTransport transport = new ErrorTransport(); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertEquals(GoogleJsonErrorTest.ERROR, GoogleJsonErrorTest.FACTORY.toString(ge.getDetails())); assertTrue( ge.getMessage(), ge.getMessage().startsWith("403" + StringUtils.LINE_SEPARATOR + "{")); } public void testFrom_detailsMissingContent() throws Exception { HttpTransport transport = new ErrorTransport(null, Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); } public void testFrom_detailsArbitraryJsonContent() throws Exception { HttpTransport transport = new ErrorTransport("{\"foo\":\"bar\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); } public void testFrom_detailsArbitraryXmlContent() throws Exception { HttpTransport transport = new ErrorTransport("", "application/atom+xml; charset=utf-8"); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertTrue( ge.getMessage(), ge.getMessage().startsWith("403" + StringUtils.LINE_SEPARATOR + "<")); } public void testFrom_errorNoContentButWithJsonContentType() throws Exception { HttpTransport transport = new ErrorTransport("", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); } public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception { HttpTransport transport = new ErrorTransport(null, Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); } public void testFrom_detailsErrorObject() throws Exception { HttpTransport transport = new ErrorTransport("{\"error\": {\"message\": \"invalid_token\"}, \"error_description\": \"Invalid value\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNotNull(ge.getDetails()); assertEquals("invalid_token", ge.getDetails().getMessage()); assertTrue(ge.getMessage().contains("403")); } public void testFrom_detailsErrorString() throws Exception { HttpTransport transport = new ErrorTransport("{\"error\": \"invalid_token\", \"error_description\": \"Invalid value\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertTrue(ge.getMessage().contains("403")); assertTrue(ge.getMessage().contains("invalid_token")); } public void testFrom_detailsNoErrorField() throws Exception { HttpTransport transport = new ErrorTransport("{\"error_description\": \"Invalid value\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); } } media/000077500000000000000000000000001350651464300332275ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapisMediaHttpDownloaderTest.java000066400000000000000000000407121350651464300406340ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/media/* * Copyright 2012 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.api.client.googleapis.media; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpResponseException; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import junit.framework.TestCase; /** * Tests {@link MediaHttpDownloader}. * * @author rmistry@google.com (Ravi Mistry) */ public class MediaHttpDownloaderTest extends TestCase { private static final String TEST_REQUEST_URL = "http://www.test.com/request/url?alt=media"; private static final int TEST_CHUNK_SIZE = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; private static class MediaTransport extends MockHttpTransport { int lowLevelExecCalls; int contentLength; int bytesDownloaded; int lastBytePos = -1; boolean testServerError; boolean testClientError; boolean directDownloadEnabled; protected MediaTransport(int contentLength) { this.contentLength = contentLength; } @Override public LowLevelHttpRequest buildRequest(String name, String url) { assertEquals(TEST_REQUEST_URL, url); return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { lowLevelExecCalls++; MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); if (directDownloadEnabled) { if (bytesDownloaded != 0) { if (lastBytePos == -1) { assertEquals("bytes=" + bytesDownloaded + "-", getFirstHeaderValue("Range")); } else { assertEquals( "bytes=" + bytesDownloaded + "-" + lastBytePos, getFirstHeaderValue("Range")); } } if (testServerError && lowLevelExecCalls == 1) { // send a server error in the 1st request response.setStatusCode(500); return response; } response.setStatusCode(200); response.addHeader("Content-Length", String.valueOf(contentLength)); response.setContent( new ByteArrayInputStream(new byte[contentLength - bytesDownloaded])); return response; } // Assert that the required headers are set. long currentRequestLastBytePos = bytesDownloaded + TEST_CHUNK_SIZE - 1; if (lastBytePos != -1) { currentRequestLastBytePos = Math.min(lastBytePos, currentRequestLastBytePos); } assertEquals("bytes=" + bytesDownloaded + "-" + currentRequestLastBytePos, getFirstHeaderValue("Range")); if (testServerError && lowLevelExecCalls == 2) { // Send a server error in the 2nd request. response.setStatusCode(500); return response; } if (testClientError) { // Return a 404. response.setStatusCode(404); return response; } response.setStatusCode(206); int upper = Math.min(bytesDownloaded + TEST_CHUNK_SIZE, contentLength) - 1; response.addHeader( "Content-Range", "bytes " + bytesDownloaded + "-" + upper + "/" + contentLength); int bytesDownloadedCur = upper - bytesDownloaded + 1; response.setContent(new ByteArrayInputStream(new byte[bytesDownloadedCur])); bytesDownloaded += bytesDownloadedCur; return response; } }; } } private static class ProgressListenerWithTwoDownloadCalls implements MediaHttpDownloaderProgressListener { int progressListenerCalls; public ProgressListenerWithTwoDownloadCalls() { } public void progressChanged(MediaHttpDownloader downloader) { progressListenerCalls++; switch (downloader.getDownloadState()) { case MEDIA_IN_PROGRESS: // Assert that the 1st call is media in progress and check the progress percent. assertTrue(progressListenerCalls == 1); assertEquals(0.5, downloader.getProgress()); break; case MEDIA_COMPLETE: // Assert that the 2nd call is media complete. assertEquals(2, progressListenerCalls); assertEquals(1.0, downloader.getProgress()); break; default: // TODO(b/18683919): go/enum-switch-lsc } } } public void testDownloadOneCallHalfChunkSize() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE / 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(contentLength, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDownloadOneCallMaxChunkSize() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(TEST_CHUNK_SIZE, outputStream.size()); } finally { outputStream.close(); } // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testSetBytesDownloaded() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.bytesDownloaded = contentLength - 10000; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setBytesDownloaded(contentLength - 10000); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(10000, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDownloadMultipleCallsMaxChunkSize() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 3; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(contentLength, outputStream.size()); // There should be 3 download calls made. assertEquals(3, fakeTransport.lowLevelExecCalls); } public void testDownloadProgressListener() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setProgressListener(new ProgressListenerWithTwoDownloadCalls()); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); } public void testDownloadServerErrorWithBackOffEnabled() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; MediaHttpDownloader downloader = new MediaHttpDownloader( fakeTransport, new MediaHttpUploaderTest.ZeroBackOffRequestInitializer()); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); // There should be 3 calls made: 1 download request with server error and 2 successful download // requests. assertEquals(3, fakeTransport.lowLevelExecCalls); } public void testDownloadServerErrorWithBackOffDisabled() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); try { downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); fail("Expected " + HttpResponseException.class); } catch (HttpResponseException e) { // Expected } // There should be 2 calls made: 1 successful download request and 1 download request with // server error. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testDownloadClientError() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testClientError = true; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); try { downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); fail("Expected " + HttpResponseException.class); } catch (HttpResponseException e) { // Expected } // There should be only 1 call made: 1 download request that returned a 404. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaDownload() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directDownloadEnabled = true; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setDirectDownloadEnabled(true); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(TEST_CHUNK_SIZE, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testSetBytesDownloadedWithIllegalArguments() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); try { downloader.setBytesDownloaded(-1); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { // Expected. } // Anything >= 0 should be accepted. downloader.setBytesDownloaded(0); downloader.setBytesDownloaded(1); } public void testSetContentRangeWithIllegalArguments() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); try { downloader.setContentRange(-1, 0); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { // Expected. } try { downloader.setContentRange(1, 0); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { // Expected. } try { downloader.setContentRange(200, 199); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { // Expected. } // The following should be accepted downloader.setContentRange(0, 0); downloader.setContentRange(0, 1); downloader.setContentRange(1, 1); downloader.setContentRange(199, 200); downloader.setContentRange(200, 200); } public void testSetBytesDownloadedWithDirectDownload() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directDownloadEnabled = true; fakeTransport.bytesDownloaded = contentLength - 10000; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setDirectDownloadEnabled(true); downloader.setBytesDownloaded(contentLength - 10000); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(10000, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testSetContentRangeWithResumableDownload() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.bytesDownloaded = contentLength - 10000; fakeTransport.lastBytePos = contentLength; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setContentRange(contentLength - 10000, contentLength); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(10000, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testSetContentRangeWithDirectDownload() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directDownloadEnabled = true; fakeTransport.bytesDownloaded = contentLength - 10000; fakeTransport.lastBytePos = contentLength; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); downloader.setDirectDownloadEnabled(true); downloader.setContentRange(contentLength - 10000, contentLength); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); assertEquals(10000, outputStream.size()); // There should be 1 download call made. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectDownloadServerErrorWithBackOffEnabled() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directDownloadEnabled = true; fakeTransport.testServerError = true; MediaHttpDownloader downloader = new MediaHttpDownloader( fakeTransport, new MediaHttpUploaderTest.ZeroBackOffRequestInitializer()); downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); // should be 2 calls made: 1 download request w/server error and 1 successful download request assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testDirectDownloadServerErrorWithBackOffDisabled() throws Exception { int contentLength = MediaHttpDownloader.MAXIMUM_CHUNK_SIZE * 2; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directDownloadEnabled = true; fakeTransport.testServerError = true; MediaHttpDownloader downloader = new MediaHttpDownloader(fakeTransport, null); try { downloader.download(new GenericUrl(TEST_REQUEST_URL), outputStream); fail("Expected " + HttpResponseException.class); } catch (HttpResponseException e) { // Expected } // should be 1 call made: 1 download request with server error assertEquals(1, fakeTransport.lowLevelExecCalls); } } MediaHttpUploaderTest.java000066400000000000000000001507131350651464300403140ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/media/* * Copyright 2011 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.api.client.googleapis.media; import com.google.api.client.http.AbstractHttpContent; import com.google.api.client.http.ByteArrayContent; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpBackOffIOExceptionHandler; import com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.testing.util.TestableByteArrayInputStream; import com.google.api.client.util.BackOff; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.util.Arrays; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import junit.framework.TestCase; /** * Tests {@link MediaHttpUploader}. * * @author rmistry@google.com (Ravi Mistry) */ public class MediaHttpUploaderTest extends TestCase { private static final String TEST_RESUMABLE_REQUEST_URL = "http://www.test.com/request/url?uploadType=resumable"; private static final String TEST_DIRECT_REQUEST_URL = "http://www.test.com/request/url?uploadType=media"; private static final String TEST_MULTIPART_REQUEST_URL = "http://www.test.com/request/url?uploadType=multipart"; private static final String TEST_UPLOAD_URL = "http://www.test.com/media/upload/location"; private static final String TEST_CONTENT_TYPE = "image/jpeg"; private static Logger LOGGER = Logger.getLogger(HttpTransport.class.getName()); private Level oldLevel; @Override public void setUp() { // suppress logging warnings to the console oldLevel = LOGGER.getLevel(); LOGGER.setLevel(Level.SEVERE); } @Override public void tearDown() { // back to the standard logging level for console LOGGER.setLevel(oldLevel); } private static class MockHttpContent extends AbstractHttpContent { public MockHttpContent() { super("mock/type"); } public void writeTo(OutputStream out) { } } static class MediaTransport extends MockHttpTransport { int lowLevelExecCalls; int bytesUploaded; final int contentLength; boolean testServerError; boolean testClientError; boolean testAuthenticationError; boolean directUploadEnabled; boolean directUploadWithMetadata; boolean contentLengthNotSpecified; boolean assertTestHeaders; boolean testIOException; boolean testMethodOverride; boolean force308OnRangeQueryResponse; int maxByteIndexUploadedOnError = MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1; /** * Bytes received by this server or {@code null} for none. To enable test content use the * following constructor {@link #MediaTransport(int, boolean)}. */ byte[] bytesReceived; MediaTransport(int contentLength) { this.contentLength = contentLength; } MediaTransport(int contentLength, boolean testContent) { this(contentLength); if (testContent) { bytesReceived = new byte[contentLength]; } } @Override public boolean supportsMethod(String method) throws IOException { return method.equals(HttpMethods.POST) || method.equals(HttpMethods.PUT) || method.equals(HttpMethods.GET); } @Override public LowLevelHttpRequest buildRequest(final String name, String url) { if (name.equals("POST")) { if (directUploadEnabled) { if (directUploadWithMetadata) { assertEquals(TEST_MULTIPART_REQUEST_URL, url); } else { assertEquals(TEST_DIRECT_REQUEST_URL, url); } } else { assertEquals(TEST_RESUMABLE_REQUEST_URL, url); } return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { lowLevelExecCalls++; if (!directUploadEnabled) { // Assert that the required headers are set. if (!contentLengthNotSpecified) { assertEquals(Integer.toString(contentLength), getFirstHeaderValue("x-upload-content-length")); } assertEquals(TEST_CONTENT_TYPE, getFirstHeaderValue("x-upload-content-type")); } if (assertTestHeaders) { assertEquals("test-header-value", getFirstHeaderValue("test-header-name")); } if (testMethodOverride) { assertEquals("PATCH", getFirstHeaderValue("X-HTTP-Method-Override")); } // This is the initiation call. MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); assertFalse(directUploadEnabled && testIOException); if (directUploadEnabled && testServerError && lowLevelExecCalls == 1) { // send a server error in the 1st request of a direct upload response.setStatusCode(500); } else if (testAuthenticationError) { // Return 404. response.setStatusCode(404); } else { // Return 200 with the upload URI. response.setStatusCode(200); if (!directUploadEnabled) { response.addHeader("Location", TEST_UPLOAD_URL); } } return response; } }; } assertEquals(TEST_UPLOAD_URL, url); assertEquals("PUT", name); return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() throws IOException { lowLevelExecCalls++; MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); String contentRangeHeader = getFirstHeaderValue("Content-Range"); if (testServerError || testIOException) { // TODO(peleyal): add test with two different failures in a row switch (lowLevelExecCalls) { case 3: // This request is where we simulate the error. Read into the bytesReceived array // up to maxByteIndexUploadedOnError to simulate the successfully-written bytes. int bytesToRead = maxByteIndexUploadedOnError + 1 - bytesUploaded; copyBytesToBytesReceivedArray(bytesToRead); bytesUploaded += bytesToRead; // Send a server error or throw IOException in response to the 3rd request. if (testIOException) { throw new IOException(); } response.setStatusCode(500); return response; case 4: // This request follows the error. Client should be asking server for its range. // Assert that the client sent the correct range query request header. if (!contentLengthNotSpecified || (2 * MediaHttpUploader.DEFAULT_CHUNK_SIZE >= contentLength)) { // Client should send */length if it knows the content length. assertEquals("bytes */" + contentLength, contentRangeHeader); } else { // Client should send */* if it does not know the content length. assertEquals("bytes */*", contentRangeHeader); } // Return 308 if there are more bytes to upload or 308 is forced, else return 200. int statusCode = 200; if (contentLength != (maxByteIndexUploadedOnError + 1) || force308OnRangeQueryResponse) { statusCode = 308; } response.setStatusCode(statusCode); // Set the Range header with the bytes uploaded so far. response.addHeader("Range", "bytes=0-" + maxByteIndexUploadedOnError); return response; case 5: // If the file finished uploading, but we forced a 308 on request 4, validate // response and return 200. if (force308OnRangeQueryResponse && (contentLength == (maxByteIndexUploadedOnError + 1))) { assertEquals("bytes */" + contentLength, contentRangeHeader); response.setStatusCode(200); response.addHeader("Range", "bytes=0-" + contentLength); return response; } break; default: break; } } else if (testClientError) { // Return a 411. response.setStatusCode(411); return response; } String bytesRange; if (bytesUploaded + MediaHttpUploader.DEFAULT_CHUNK_SIZE > contentLength) { bytesRange = bytesUploaded + "-" + (contentLength - 1); } else { bytesRange = bytesUploaded + "-" + (bytesUploaded + MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1); } String expectedContentRange; if (contentLength == 0) { expectedContentRange = "bytes */0"; } else if (contentLengthNotSpecified && ((bytesUploaded + MediaHttpUploader.DEFAULT_CHUNK_SIZE) < contentLength)) { expectedContentRange = "bytes " + bytesRange + "/*"; } else { expectedContentRange = "bytes " + bytesRange + "/" + contentLength; } assertEquals(expectedContentRange, contentRangeHeader); copyBytesToBytesReceivedArray(-1); bytesUploaded += MediaHttpUploader.DEFAULT_CHUNK_SIZE; if (bytesUploaded >= contentLength) { // Return 200 since the upload is complete. response.setStatusCode(200); } else { // Return 308 and the range since the upload is incomplete. response.setStatusCode(308); response.addHeader("Range", "bytes=" + bytesRange); } return response; } void copyBytesToBytesReceivedArray(int length) throws IOException { if (bytesReceived == null || length == 0) { return; } ByteArrayOutputStream stream = new ByteArrayOutputStream(); this.getStreamingContent().writeTo(stream); byte[] currentRequest = stream.toByteArray(); System.arraycopy(currentRequest, 0, bytesReceived, bytesUploaded, length == -1 ? currentRequest.length : length); } }; } } private static class ResumableProgressListenerWithTwoUploadCalls implements MediaHttpUploaderProgressListener { int progressListenerCalls; boolean contentLengthNotSpecified; public ResumableProgressListenerWithTwoUploadCalls() { } public void progressChanged(MediaHttpUploader uploader) throws IOException { progressListenerCalls++; switch (uploader.getUploadState()) { case INITIATION_STARTED: // Assert that the first call is initiation started. assertEquals(1, progressListenerCalls); break; case INITIATION_COMPLETE: // Assert that the 2nd call is initiation complete. assertEquals(2, progressListenerCalls); break; case MEDIA_IN_PROGRESS: // Assert that the 3rd call is media in progress and check the progress percent. assertTrue(progressListenerCalls == 3); if (contentLengthNotSpecified) { try { uploader.getProgress(); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } else { assertEquals(0.5, uploader.getProgress(), 0.0); } break; case MEDIA_COMPLETE: // Assert that the 4th call is media complete. assertEquals(4, progressListenerCalls); if (contentLengthNotSpecified) { try { uploader.getProgress(); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } else { assertEquals(1.0, uploader.getProgress(), 0.0); } break; default: // TODO(b/18683919): go/enum-switch-lsc } } } private static class DirectProgressListener implements MediaHttpUploaderProgressListener { int progressListenerCalls; boolean contentLengthNotSpecified; public DirectProgressListener() { } public void progressChanged(MediaHttpUploader uploader) throws IOException { progressListenerCalls++; switch (uploader.getUploadState()) { case MEDIA_IN_PROGRESS: // Assert that the first call is media in progress. assertEquals(1, progressListenerCalls); if (contentLengthNotSpecified) { try { uploader.getProgress(); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } else { assertEquals(0.0, uploader.getProgress(), 0.0); } break; case MEDIA_COMPLETE: // Assert that the 2nd call is media complete. assertEquals(2, progressListenerCalls); if (contentLengthNotSpecified) { try { uploader.getProgress(); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } else { assertEquals(1.0, uploader.getProgress(), 0.0); } break; default: // TODO(b/18683919): go/enum-switch-lsc } } } private static class GZipCheckerInitializer implements HttpRequestInitializer { private boolean gzipDisabled; public GZipCheckerInitializer(boolean gzipDisabled) { this.gzipDisabled = gzipDisabled; } public void initialize(HttpRequest request) { request.setInterceptor(new GZipCheckerInterceptor(gzipDisabled)); } } private static class GZipCheckerInterceptor implements HttpExecuteInterceptor { private boolean gzipDisabled; public GZipCheckerInterceptor(boolean gzipDisabled) { this.gzipDisabled = gzipDisabled; } public void intercept(HttpRequest request) { assertEquals(!gzipDisabled && !(request.getContent() instanceof EmptyContent), request.getEncoding() != null); } } // TODO(peleyal): ZeroBackOffRequestInitializer can go into http testing package? static class ZeroBackOffRequestInitializer implements HttpRequestInitializer { public void initialize(HttpRequest request) { request.setIOExceptionHandler(new HttpBackOffIOExceptionHandler(BackOff.ZERO_BACKOFF)); request.setUnsuccessfulResponseHandler( new HttpBackOffUnsuccessfulResponseHandler(BackOff.ZERO_BACKOFF)); } } public void testUploadOneCall() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithPatch() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testMethodOverride = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setInitiationRequestMethod(HttpMethods.PATCH); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithGZipDisabled() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); fakeTransport.contentLengthNotSpecified = true; // Disable GZip content. MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new GZipCheckerInitializer(true)); uploader.setDisableGZipContent(true); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithGZipEnabled() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); fakeTransport.contentLengthNotSpecified = true; // Enable GZip content. MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new GZipCheckerInitializer(false)); uploader.setDisableGZipContent(false); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithDefaultGzip() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); fakeTransport.contentLengthNotSpecified = true; // GZip content must be disabled by default. MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new GZipCheckerInitializer(false)); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadOneCall_WithContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new GZipCheckerInitializer(true)); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 6 calls made. 1 initiation request and 5 upload requests. assertEquals(6, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls_WithPatch() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testMethodOverride = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setInitiationRequestMethod(HttpMethods.PATCH); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 6 calls made. 1 initiation request and 5 upload requests. assertEquals(6, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls_WithSpecifiedHeader() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.assertTestHeaders = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.getInitiationHeaders().set("test-header-name", "test-header-value"); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 6 calls made. 1 initiation request and 5 upload requests. assertEquals(6, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 6 calls made. 1 initiation request and 5 upload requests. assertEquals(6, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls_WithNoContentSizeProvidedChunkedInput() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]) { @Override public synchronized int read(byte[] b, int off, int len) { return super.read(b, off, Math.min(len, MediaHttpUploader.DEFAULT_CHUNK_SIZE / 10)); } }; InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 6 calls made. 1 initiation request and 5 upload requests. assertEquals(6, fakeTransport.lowLevelExecCalls); } public void testUploadMultipleCalls_WithNoContentSizeProvided_WithExtraByte() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 5 + 1; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 7 calls made. 1 initiation request and 6 upload requests. assertEquals(7, fakeTransport.lowLevelExecCalls); } public void testUploadProgressListener() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setProgressListener(new ResumableProgressListenerWithTwoUploadCalls()); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); } public void testUploadProgressListener_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); ResumableProgressListenerWithTwoUploadCalls listener = new ResumableProgressListenerWithTwoUploadCalls(); listener.contentLengthNotSpecified = true; uploader.setProgressListener(listener); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); } public void testUploadServerError_WithoutUnsuccessfulHandler() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(500, response.getStatusCode()); // There should be 3 calls made. 1 initiation request, 1 successful upload request and 1 upload // request with server error assertEquals(3, fakeTransport.lowLevelExecCalls); } public void testUpload_ResumableIOException_WithIOExceptionHandler() throws Exception { subtestUpload_ResumableWithError(ErrorType.IO_EXCEPTION); } public void testUpload_ResumableServerError_WithoutUnsuccessfulHandler() throws Exception { subtestUpload_ResumableWithError(ErrorType.SERVER_UNAVAILABLE); } private void subtestUpload_ResumableWithError(ErrorType error) throws Exception { // no bytes were uploaded on the 2nd chunk. Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], DEFAULT-[2*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1, 3, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1, 3, false); // no bytes were uploaded on the 2nd chunk. Client sends the following 4 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], DEFAULT-[2*DEFAULT-1], 2*DEFAULT-[3*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1, 4, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1, 4, false); // all bytes were uploaded in the 2nd chunk, and the server sends a 200 on the client's resume. // Client sends the following 2 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 2, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 2, false); // all bytes were uploaded in the 2nd chunk, and we force the server to send a 308 on the // client's Range query of '*/' instead of sending a 200 as in previous. // Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], empty (as */[2*DEFAULT]) subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 3, true /* force 308 */); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 3, true /* force 308 */); // all bytes were uploaded in the 2nd chunk. Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], 2*DEFAULT-[3*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 3, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 - 1, 3, false); // part of the bytes were uploaded in the 2nd chunk. Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], DEFAULT*4/3-[2*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 4 / 3, 3, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 4 / 3, 3, false); // part of the bytes were uploaded in the 2nd chunk. Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], DEFAULT+5/[2*DEFAULT+2] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 + 3, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE + 4, 3, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2 + 3, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE + 4, 3, false); // only 1 byte were uploaded in the 2nd chunk. Client sends the following 3 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], [DEFAULT+1]-[2*DEFAULT-1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE, 3, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE, 3, false); // only 1 byte were uploaded in the 2nd chunk. Client sends the following 5 media chunks: // 0-[DEFAULT-1], DEFAULT-[2*DEFAULT-1], [DEFAULT+1]-[2*DEFAULT], [2*DEFAULT+1]-[3*DEFAULT], // [3*DEFAULT+1]-[3*DEFAULT+1] subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3 + 2, false, MediaHttpUploader.DEFAULT_CHUNK_SIZE, 5, false); subtestUpload_ResumableWithError(error, MediaHttpUploader.DEFAULT_CHUNK_SIZE * 3 + 2, true, MediaHttpUploader.DEFAULT_CHUNK_SIZE, 5, false); } /** * Error type represents an error (I/O exception or server unavailable error) which will be raise * when uploading media to the server. */ enum ErrorType { IO_EXCEPTION, SERVER_UNAVAILABLE } public void subtestUpload_ResumableWithError(ErrorType error, int contentLength, boolean contentLengthKnown, int maxByteIndexUploadedOnError, int chunks, boolean force308OnRangeQueryResponse) throws Exception { MediaTransport fakeTransport = new MediaTransport(contentLength, true); if (error == ErrorType.IO_EXCEPTION) { fakeTransport.testIOException = true; } else if (error == ErrorType.SERVER_UNAVAILABLE) { fakeTransport.testServerError = true; } fakeTransport.contentLengthNotSpecified = !contentLengthKnown; fakeTransport.maxByteIndexUploadedOnError = maxByteIndexUploadedOnError; fakeTransport.force308OnRangeQueryResponse = force308OnRangeQueryResponse; byte[] testedData = new byte[contentLength]; new Random().nextBytes(testedData); InputStream is = new ByteArrayInputStream(testedData); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); if (contentLengthKnown) { mediaContent.setLength(contentLength); } MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new ZeroBackOffRequestInitializer()); // disable GZip - so we would be able to test byte received by server. uploader.setDisableGZipContent(true); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be the following number of calls made: // 1 initiation request + 1 call to query the range + chunks int calls = 2 + chunks; assertEquals(calls, fakeTransport.lowLevelExecCalls); assertTrue(Arrays.equals(testedData, fakeTransport.bytesReceived)); } public void testUploadIOException_WithoutIOExceptionHandler() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testIOException = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); try { uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); fail("expected " + IOException.class); } catch (IOException e) { // There should be 3 calls made. 1 initiation request, 1 successful upload request, // and 1 upload request with server error assertEquals(3, fakeTransport.lowLevelExecCalls); } } public void testUploadServerErrorWithBackOffDisabled_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(500, response.getStatusCode()); // There should be 3 calls made. 1 initiation request, 1 successful upload request and 1 upload // request with server error assertEquals(3, fakeTransport.lowLevelExecCalls); } public void testUploadAuthenticationError() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testAuthenticationError = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(404, response.getStatusCode()); // There should be only 1 initiation request made with a 404. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testUploadClientErrorInUploadCalls() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testClientError = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(411, response.getStatusCode()); // There should be 2 calls made. 1 initiation request and 1 upload request that returned a 411. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testUploadClientErrorInUploadCalls_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testClientError = true; fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); HttpResponse response = uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertEquals(411, response.getStatusCode()); // There should be 2 calls made. 1 initiation request and 1 upload request that returned a 411. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUpload() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setProgressListener(new DirectProgressListener()); // Enable direct media upload. uploader.setDirectUploadEnabled(true); HttpResponse response = uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUpload_WithSpecifiedHeader() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; fakeTransport.assertTestHeaders = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.getInitiationHeaders().set("test-header-name", "test-header-value"); uploader.setProgressListener(new DirectProgressListener()); // Enable direct media upload. uploader.setDirectUploadEnabled(true); HttpResponse response = uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUpload_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); DirectProgressListener listener = new DirectProgressListener(); listener.contentLengthNotSpecified = true; uploader.setProgressListener(listener); // Enable direct media upload. uploader.setDirectUploadEnabled(true); HttpResponse response = uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUploadWithMetadata() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; fakeTransport.directUploadWithMetadata = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setProgressListener(new DirectProgressListener()); // Enable direct media upload. uploader.setDirectUploadEnabled(true); // Set Metadata uploader.setMetadata(new MockHttpContent()); HttpResponse response = uploader.upload(new GenericUrl(TEST_MULTIPART_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUploadWithMetadata_WithNoContentSizeProvided() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; fakeTransport.contentLengthNotSpecified = true; fakeTransport.directUploadWithMetadata = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); DirectProgressListener listener = new DirectProgressListener(); listener.contentLengthNotSpecified = true; uploader.setProgressListener(listener); // Enable direct media upload. uploader.setDirectUploadEnabled(true); // Set Metadata uploader.setMetadata(new MockHttpContent()); HttpResponse response = uploader.upload(new GenericUrl(TEST_MULTIPART_REQUEST_URL)); assertEquals(200, response.getStatusCode()); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testSetChunkSize() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); // None of the below should throw Exceptions. uploader.setChunkSize(MediaHttpUploader.DEFAULT_CHUNK_SIZE); uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE); uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE * 2); uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE * 3); uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE * 100); // Assert that specifying invalid chunk sizes throws an Exception. try { uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE - 1); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } try { uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE + 1); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } try { uploader.setChunkSize((int) (MediaHttpUploader.MINIMUM_CHUNK_SIZE * 2.5)); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } public void testDirectUploadServerErrorWithBackOffEnabled() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; fakeTransport.directUploadEnabled = true; ByteArrayContent mediaContent = new ByteArrayContent(TEST_CONTENT_TYPE, new byte[contentLength]); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new ZeroBackOffRequestInitializer()); uploader.setDirectUploadEnabled(true); uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); // should be 2 calls made: 1 upload request with server error, 1 successful upload request assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testDirectUploadServerErrorWithBackOffDisabled() throws Exception { int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE * 2; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.testServerError = true; fakeTransport.directUploadEnabled = true; ByteArrayContent mediaContent = new ByteArrayContent(TEST_CONTENT_TYPE, new byte[contentLength]); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setDirectUploadEnabled(true); uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); // should be 1 call made: 1 upload request with server error assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testDirectMediaUploadWithZeroContent() throws Exception { int contentLength = 0; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.directUploadEnabled = true; ByteArrayContent mediaContent = new ByteArrayContent(TEST_CONTENT_TYPE, new byte[contentLength]); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.setDirectUploadEnabled(true); uploader.upload(new GenericUrl(TEST_DIRECT_REQUEST_URL)); // There should be only 1 call made for direct media upload. assertEquals(1, fakeTransport.lowLevelExecCalls); } public void testResumableMediaUploadWithZeroContent() throws Exception { int contentLength = 0; MediaTransport fakeTransport = new MediaTransport(contentLength); ByteArrayContent mediaContent = new ByteArrayContent(TEST_CONTENT_TYPE, new byte[contentLength]); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testResumableMediaUploadWithZeroContentOfUnknownLength() throws Exception { int contentLength = 0; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; InputStream is = new ByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); // There should be 2 calls made. 1 initiation request and 1 upload request. assertEquals(2, fakeTransport.lowLevelExecCalls); } public void testResumableMediaUploadWithContentClose() throws Exception { int contentLength = 0; MediaTransport fakeTransport = new MediaTransport(contentLength); TestableByteArrayInputStream inputStream = new TestableByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, inputStream).setLength(contentLength); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertTrue(inputStream.isClosed()); } public void testResumableMediaUploadWithoutContentClose() throws Exception { int contentLength = 0; MediaTransport fakeTransport = new MediaTransport(contentLength); TestableByteArrayInputStream inputStream = new TestableByteArrayInputStream(new byte[contentLength]); InputStreamContent mediaContent = new InputStreamContent( TEST_CONTENT_TYPE, inputStream).setLength(contentLength).setCloseInputStream(false); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, null); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); assertFalse(inputStream.isClosed()); } class SlowWriter implements Runnable { final private OutputStream outputStream; final private int contentLength; SlowWriter(OutputStream outputStream, int contentLength) { this.outputStream = outputStream; this.contentLength = contentLength; } @Override public void run() { try { for (int i = 0; i < contentLength; i++) { outputStream.write(i); Thread.sleep(1000); } outputStream.close(); } catch (IOException e) { // ignore } catch (InterruptedException e) { // ignore } } } class TimeoutRequestInitializer implements HttpRequestInitializer { class TimingInterceptor implements HttpExecuteInterceptor { private long initTime; TimingInterceptor() { initTime = System.currentTimeMillis(); } @Override public void intercept(HttpRequest request) { assertTrue( "Request initialization to execute should be fast", System.currentTimeMillis() - initTime < 100L ); } } @Override public void initialize(HttpRequest request) { request.setInterceptor(new TimingInterceptor()); } } public void testResumableSlowUpload() throws Exception { int contentLength = 3; MediaTransport fakeTransport = new MediaTransport(contentLength); fakeTransport.contentLengthNotSpecified = true; PipedOutputStream outputStream = new PipedOutputStream(); InputStream inputStream = new PipedInputStream(outputStream); Thread thread = new Thread(new SlowWriter(outputStream, contentLength)); thread.start(); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, inputStream); MediaHttpUploader uploader = new MediaHttpUploader(mediaContent, fakeTransport, new TimeoutRequestInitializer()); uploader.setDirectUploadEnabled(false); uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL)); } } services/000077500000000000000000000000001350651464300337735ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapisAbstractGoogleClientRequestTest.java000066400000000000000000000276271350651464300431240ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest.ApiClientVersion; import com.google.api.client.googleapis.testing.services.MockGoogleClient; import com.google.api.client.googleapis.testing.services.MockGoogleClientRequest; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.HttpMethods; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponseException; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.StringUtils; import java.io.IOException; import java.util.Arrays; import junit.framework.TestCase; /** * Tests {@link AbstractGoogleClientRequest}. * * @author Yaniv Inbar */ public class AbstractGoogleClientRequestTest extends TestCase { private static final String ROOT_URL = "https://www.googleapis.com/test/"; private static final String SERVICE_PATH = "path/v1/"; private static final String URI_TEMPLATE = "tests/{testId}"; private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final JsonObjectParser JSON_OBJECT_PARSER = new JsonObjectParser(JSON_FACTORY); private static final String ERROR_CONTENT = "{\"error\":{\"code\":401,\"errors\":[{\"domain\":\"global\"," + "\"location\":\"Authorization\",\"locationType\":\"header\"," + "\"message\":\"me\",\"reason\":\"authError\"}],\"message\":\"me\"}}"; private String originalOsName; private String originalOsVersion; @Override protected void setUp() throws Exception { super.setUp(); // save the original system properties so we can mock them out this.originalOsName = System.getProperty("os.name"); this.originalOsVersion = System.getProperty("os.version"); } @Override protected void tearDown() throws Exception { // restore the original system properties System.setProperty("os.name", originalOsName); System.setProperty("os.version", originalOsVersion); super.tearDown(); } public void testExecuteUnparsed_error() throws Exception { HttpTransport transport = new MockHttpTransport() { @Override public LowLevelHttpRequest buildRequest(final String method, final String url) { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { assertEquals("GET", method); assertEquals("https://www.googleapis.com/test/path/v1/tests/foo", url); MockLowLevelHttpResponse result = new MockLowLevelHttpResponse(); result.setStatusCode(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED); result.setContentType(Json.MEDIA_TYPE); result.setContent(ERROR_CONTENT); return result; } }; } }; MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); MockGoogleClientRequest request = new MockGoogleClientRequest( client, HttpMethods.GET, URI_TEMPLATE, null, String.class); try { request.put("testId", "foo"); request.executeUnparsed(); fail("expected " + HttpResponseException.class); } catch (HttpResponseException e) { // expected assertEquals("401" + StringUtils.LINE_SEPARATOR + ERROR_CONTENT, e.getMessage()); } } public void testExecuteUsingHead() throws Exception { HttpTransport transport = new MockHttpTransport() { @Override public LowLevelHttpRequest buildRequest(final String method, final String url) { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { assertEquals("HEAD", method); assertEquals("https://www.googleapis.com/test/path/v1/tests/foo", url); return new MockLowLevelHttpResponse(); } }; } }; MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); MockGoogleClientRequest request = new MockGoogleClientRequest( client, HttpMethods.GET, URI_TEMPLATE, null, String.class); request.put("testId", "foo"); request.executeUsingHead(); } public void testBuildHttpRequest_emptyContent() throws Exception { for (String method : Arrays.asList("GET", "HEAD", "DELETE", "FOO")) { subtestBuildHttpRequest_emptyContent(method, false); } for (String method : Arrays.asList("POST", "PUT", "PATCH")) { subtestBuildHttpRequest_emptyContent(method, true); } } private void subtestBuildHttpRequest_emptyContent(String method, boolean expectEmptyContent) throws Exception { HttpTransport transport = new MockHttpTransport(); MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); MockGoogleClientRequest request = new MockGoogleClientRequest(client, method, URI_TEMPLATE, null, String.class); HttpRequest httpRequest = request.buildHttpRequest(); if (expectEmptyContent) { assertTrue(httpRequest.getContent() instanceof EmptyContent); } else { assertNull(httpRequest.getContent()); } } public void testCheckRequiredParameter() throws Exception { HttpTransport transport = new MockHttpTransport(); MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); MockGoogleClientRequest request = new MockGoogleClientRequest( client, HttpMethods.GET, URI_TEMPLATE, null, String.class); // Should not throw an Exception. request.checkRequiredParameter("Not Null", "notNull()"); try { request.checkRequiredParameter(null, "content.getTest().getAnotherTest()"); fail("Expected " + IllegalArgumentException.class); } catch (IllegalArgumentException iae) { // Expected. } } public void testExecute_void() throws Exception { HttpTransport transport = new MockHttpTransport() { @Override public LowLevelHttpRequest buildRequest(final String method, final String url) { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { return new MockLowLevelHttpResponse().setContent("{\"a\":\"ignored\"}") .setContentType(Json.MEDIA_TYPE); } }; } }; MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); MockGoogleClientRequest request = new MockGoogleClientRequest(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class); Void v = request.execute(); assertNull(v); } public void testUserAgentSuffix() throws Exception { AssertUserAgentTransport transport = new AssertUserAgentTransport(); // Specify an Application Name. String applicationName = "Test Application"; transport.expectedUserAgent = applicationName + " " + AbstractGoogleClientRequest.USER_AGENT_SUFFIX + " " + HttpRequest.USER_AGENT_SUFFIX; MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).setApplicationName( applicationName).build(); MockGoogleClientRequest request = new MockGoogleClientRequest(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class); request.executeUnparsed(); } public void testUserAgent() throws Exception { AssertUserAgentTransport transport = new AssertUserAgentTransport(); transport.expectedUserAgent = AbstractGoogleClientRequest.USER_AGENT_SUFFIX + " " + HttpRequest.USER_AGENT_SUFFIX; // Don't specify an Application Name. MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).build(); MockGoogleClientRequest request = new MockGoogleClientRequest(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class); request.executeUnparsed(); } public void testSetsApiClientHeader() throws Exception { HttpTransport transport = new AssertHeaderTransport("X-Goog-Api-Client", "java/\\d+\\.\\d+\\.\\d+.*"); MockGoogleClient client = new MockGoogleClient.Builder( transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null).build(); MockGoogleClientRequest request = new MockGoogleClientRequest(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class); request.executeUnparsed(); } public void testSetsApiClientHeaderWithOsVersion() throws Exception { System.setProperty("os.name", "My OS"); System.setProperty("os.version", "1.2.3"); String version = new ApiClientVersion().build("My Client"); assertTrue("Api version should contain the os version", version.matches(".* my-os/1.2.3")); } public void testSetsApiClientHeaderWithoutOsVersion() throws Exception { System.setProperty("os.name", "My OS"); System.clearProperty("os.version"); assertNull(System.getProperty("os.version")); String version = new ApiClientVersion().build("My Client"); assertFalse("Api version should not contain the os version", version.matches(".*my-os.*")); } private class AssertHeaderTransport extends MockHttpTransport { String expectedHeader; String expectedHeaderValue; AssertHeaderTransport(String header, String value) { expectedHeader = header; expectedHeaderValue = value; } @Override public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() throws IOException { String firstHeader = getFirstHeaderValue(expectedHeader); assertTrue( String.format( "Expected header value to match %s, instead got %s.", expectedHeaderValue, firstHeader ), firstHeader.matches(expectedHeaderValue) ); return new MockLowLevelHttpResponse(); } }; } } private class AssertUserAgentTransport extends MockHttpTransport { String expectedUserAgent; @Override public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() throws IOException { assertEquals(expectedUserAgent, getFirstHeaderValue("User-Agent")); return new MockLowLevelHttpResponse(); } }; } } } AbstractGoogleClientTest.java000066400000000000000000000267611350651464300415510ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import com.google.api.client.googleapis.media.MediaHttpUploader; import com.google.api.client.googleapis.testing.services.MockGoogleClient; import com.google.api.client.googleapis.testing.services.MockGoogleClientRequest; import com.google.api.client.http.EmptyContent; import com.google.api.client.http.HttpExecuteInterceptor; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.InputStreamContent; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonObjectParser; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Key; import java.io.ByteArrayInputStream; import java.io.InputStream; import junit.framework.TestCase; /** * Tests {@link AbstractGoogleClient}. * * @author Yaniv Inbar */ public class AbstractGoogleClientTest extends TestCase { private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final JsonObjectParser JSON_OBJECT_PARSER = new JsonObjectParser(JSON_FACTORY); private static final HttpTransport TRANSPORT = new MockHttpTransport(); static private class TestRemoteRequestInitializer implements GoogleClientRequestInitializer { boolean isCalled; TestRemoteRequestInitializer() { } public void initialize(AbstractGoogleClientRequest request) { isCalled = true; } } public void testGoogleClientBuilder() { String rootUrl = "http://www.testgoogleapis.com/test/"; String servicePath = "path/v1/"; GoogleClientRequestInitializer jsonHttpRequestInitializer = new TestRemoteRequestInitializer(); String applicationName = "Test Application"; AbstractGoogleClient.Builder setApplicationName = new MockGoogleClient.Builder( TRANSPORT, rootUrl, servicePath, JSON_OBJECT_PARSER, null).setApplicationName( applicationName).setGoogleClientRequestInitializer(jsonHttpRequestInitializer) .setSuppressAllChecks(true); AbstractGoogleClient client = setApplicationName.build(); assertEquals(rootUrl + servicePath, client.getBaseUrl()); assertEquals(rootUrl, client.getRootUrl()); assertEquals(servicePath, client.getServicePath()); assertEquals(applicationName, client.getApplicationName()); assertEquals(jsonHttpRequestInitializer, client.getGoogleClientRequestInitializer()); assertTrue(client.getSuppressPatternChecks()); assertTrue(client.getSuppressRequiredParameterChecks()); } public void testGoogleClientSuppressionDefaults() { String rootUrl = "http://www.testgoogleapis.com/test/"; String servicePath = "path/v1/"; // Assert suppression defaults. AbstractGoogleClient.Builder googleClientBuilder = new MockGoogleClient.Builder( TRANSPORT, rootUrl, servicePath, JSON_OBJECT_PARSER, null); assertFalse(googleClientBuilder.getSuppressPatternChecks()); assertFalse(googleClientBuilder.getSuppressRequiredParameterChecks()); AbstractGoogleClient googleClient = googleClientBuilder.build(); assertFalse(googleClient.getSuppressPatternChecks()); assertFalse(googleClient.getSuppressRequiredParameterChecks()); } public void testBaseServerAndBasePathBuilder() { AbstractGoogleClient client = new MockGoogleClient.Builder( TRANSPORT, "http://www.testgoogleapis.com/test/", "path/v1/", JSON_OBJECT_PARSER, null).setApplicationName("Test Application") .setRootUrl("http://www.googleapis.com/test/").setServicePath("path/v2/").build(); assertEquals("http://www.googleapis.com/test/path/v2/", client.getBaseUrl()); } public void testInitialize() throws Exception { TestRemoteRequestInitializer remoteRequestInitializer = new TestRemoteRequestInitializer(); AbstractGoogleClient client = new MockGoogleClient.Builder( TRANSPORT, "http://www.test.com/", "", JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").setGoogleClientRequestInitializer(remoteRequestInitializer).build(); client.initialize(null); assertTrue(remoteRequestInitializer.isCalled); } private static final String TEST_RESUMABLE_REQUEST_URL = "http://www.test.com/request/url?uploadType=resumable"; private static final String TEST_UPLOAD_URL = "http://www.test.com/media/upload/location"; private static final String TEST_CONTENT_TYPE = "image/jpeg"; private static class MediaTransport extends MockHttpTransport { int bytesUploaded; int contentLength = MediaHttpUploader.DEFAULT_CHUNK_SIZE; boolean contentLengthNotSpecified; protected MediaTransport() { } @Override public LowLevelHttpRequest buildRequest(String name, String url) { if (name.equals("POST")) { assertEquals(TEST_RESUMABLE_REQUEST_URL, url); return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { // Assert that the required headers are set. if (!contentLengthNotSpecified) { assertEquals( Integer.toString(contentLength), getFirstHeaderValue("x-upload-content-length")); } assertEquals(TEST_CONTENT_TYPE, getFirstHeaderValue("x-upload-content-type")); // This is the initiation call. Return 200 with the upload URI. MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); response.setStatusCode(200); response.addHeader("Location", TEST_UPLOAD_URL); return response; } }; } assertEquals(TEST_UPLOAD_URL, url); return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); String bytesRange = bytesUploaded + "-" + (bytesUploaded + MediaHttpUploader.DEFAULT_CHUNK_SIZE - 1); String expectedContentRange = "bytes " + bytesRange + "/" + contentLength; assertEquals(expectedContentRange, getFirstHeaderValue("Content-Range")); bytesUploaded += MediaHttpUploader.DEFAULT_CHUNK_SIZE; if (bytesUploaded == contentLength) { // Return 200 since the upload is complete. response.setStatusCode(200); response.setContent("{\"foo\":\"somevalue\"}"); response.setContentType(Json.MEDIA_TYPE); } else { // Return 308 and the range since the upload is incomplete. response.setStatusCode(308); response.addHeader("Range", bytesRange); } return response; } }; } } public static class A { @Key String foo; } public void testMediaUpload() throws Exception { MediaTransport transport = new MediaTransport(); AbstractGoogleClient client = new MockGoogleClient.Builder( transport, TEST_RESUMABLE_REQUEST_URL, "", JSON_OBJECT_PARSER, null).setApplicationName( "Test Application").build(); InputStream is = new ByteArrayInputStream(new byte[MediaHttpUploader.DEFAULT_CHUNK_SIZE]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); mediaContent.setLength(MediaHttpUploader.DEFAULT_CHUNK_SIZE); MockGoogleClientRequest rq = new MockGoogleClientRequest(client, "POST", "", null, A.class); rq.initializeMediaUpload(mediaContent); A result = rq.execute(); assertEquals("somevalue", result.foo); } private static class GZipCheckerInitializer implements HttpRequestInitializer { private boolean gzipDisabled; public GZipCheckerInitializer(boolean gzipDisabled) { this.gzipDisabled = gzipDisabled; } public void initialize(HttpRequest request) { request.setInterceptor(new GZipCheckerInterceptor(gzipDisabled)); } } private static class GZipCheckerInterceptor implements HttpExecuteInterceptor { private boolean gzipDisabled; public GZipCheckerInterceptor(boolean gzipDisabled) { this.gzipDisabled = gzipDisabled; } public void intercept(HttpRequest request) { assertEquals(!gzipDisabled && !(request.getContent() instanceof EmptyContent), request.getEncoding() != null); } } public void testMediaUpload_disableGZip() throws Exception { MediaTransport transport = new MediaTransport(); transport.contentLengthNotSpecified = true; AbstractGoogleClient client = new MockGoogleClient.Builder( transport, TEST_RESUMABLE_REQUEST_URL, "", JSON_OBJECT_PARSER, new GZipCheckerInitializer(true)).setApplicationName("Test Application").build(); InputStream is = new ByteArrayInputStream(new byte[MediaHttpUploader.DEFAULT_CHUNK_SIZE]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MockGoogleClientRequest rq = new MockGoogleClientRequest(client, "POST", "", null, A.class); rq.initializeMediaUpload(mediaContent); rq.setDisableGZipContent(true); A result = rq.execute(); assertEquals("somevalue", result.foo); } public void testMediaUpload_enableGZip() throws Exception { MediaTransport transport = new MediaTransport(); transport.contentLengthNotSpecified = true; AbstractGoogleClient client = new MockGoogleClient.Builder( transport, TEST_RESUMABLE_REQUEST_URL, "", JSON_OBJECT_PARSER, new GZipCheckerInitializer(false)).setApplicationName("Test Application").build(); InputStream is = new ByteArrayInputStream(new byte[MediaHttpUploader.DEFAULT_CHUNK_SIZE]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MockGoogleClientRequest rq = new MockGoogleClientRequest(client, "POST", "", null, A.class); rq.initializeMediaUpload(mediaContent); rq.setDisableGZipContent(false); A result = rq.execute(); assertEquals("somevalue", result.foo); } public void testMediaUpload_defaultGZip() throws Exception { MediaTransport transport = new MediaTransport(); transport.contentLengthNotSpecified = true; AbstractGoogleClient client = new MockGoogleClient.Builder( transport, TEST_RESUMABLE_REQUEST_URL, "", JSON_OBJECT_PARSER, new GZipCheckerInitializer(false)).setApplicationName("Test Application").build(); InputStream is = new ByteArrayInputStream(new byte[MediaHttpUploader.DEFAULT_CHUNK_SIZE]); InputStreamContent mediaContent = new InputStreamContent(TEST_CONTENT_TYPE, is); MockGoogleClientRequest rq = new MockGoogleClientRequest(client, "POST", "", null, A.class); rq.initializeMediaUpload(mediaContent); A result = rq.execute(); assertEquals("somevalue", result.foo); } } CommonGoogleClientRequestInitializerTest.java000066400000000000000000000035741350651464300450100ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/services/* * 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.api.client.googleapis.services; import com.google.api.client.googleapis.testing.services.MockGoogleClient; import com.google.api.client.http.HttpContent; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.util.Key; import junit.framework.TestCase; /** * Tests {@link CommonGoogleClientRequestInitializer}. * * @author Yaniv Inbar */ public class CommonGoogleClientRequestInitializerTest extends TestCase { public static class MyRequest extends AbstractGoogleClientRequest { @Key String key; protected MyRequest(MockGoogleClient client, String method, String uriTemplate, HttpContent content, Class responseClass) { super(client, method, uriTemplate, content, responseClass); } } public void testInitialize() throws Exception { CommonGoogleClientRequestInitializer key = new CommonGoogleClientRequestInitializer("foo"); MockGoogleClient client = new MockGoogleClient.Builder(new MockHttpTransport(), HttpTesting.SIMPLE_URL, "test/", null, null).setApplicationName("Test Application").build(); MyRequest request = new MyRequest(client, "GET", "", null, String.class); assertNull(request.key); key.initialize(request); assertEquals("foo", request.key); } } json/000077500000000000000000000000001350651464300347445ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/servicesAbstractGoogleJsonClientTest.java000066400000000000000000000063411350651464300433440ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/services/json/* * 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.api.client.googleapis.services.json; import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.googleapis.testing.services.json.MockGoogleJsonClient; import com.google.api.client.googleapis.testing.services.json.MockGoogleJsonClientRequest; import com.google.api.client.http.HttpStatusCodes; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.Json; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import junit.framework.TestCase; /** * Tests {@link AbstractGoogleJsonClient}. * * @author Yaniv Inbar */ public class AbstractGoogleJsonClientTest extends TestCase { public void testExecuteUnparsed_error() throws Exception { HttpTransport transport = new MockHttpTransport() { @Override public LowLevelHttpRequest buildRequest(String name, String url) { return new MockLowLevelHttpRequest() { @Override public LowLevelHttpResponse execute() { MockLowLevelHttpResponse result = new MockLowLevelHttpResponse(); result.setStatusCode(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED); result.setContentType(Json.MEDIA_TYPE); result.setContent("{\"error\":{\"code\":401,\"errors\":[{\"domain\":\"global\"," + "\"location\":\"Authorization\",\"locationType\":\"header\"," + "\"message\":\"me\",\"reason\":\"authError\"}],\"message\":\"me\"}}"); return result; } }; } }; JsonFactory jsonFactory = new JacksonFactory(); MockGoogleJsonClient client = new MockGoogleJsonClient.Builder( transport, jsonFactory, HttpTesting.SIMPLE_URL, "", null, false).setApplicationName( "Test Application").build(); MockGoogleJsonClientRequest request = new MockGoogleJsonClientRequest(client, "GET", "foo", null, String.class); try { request.executeUnparsed(); fail("expected " + GoogleJsonResponseException.class); } catch (GoogleJsonResponseException e) { // expected GoogleJsonError details = e.getDetails(); assertEquals("me", details.getMessage()); assertEquals("me", details.getErrors().get(0).getMessage()); } } } CommonGoogleJsonClientRequestInitializerTest.java000066400000000000000000000040151350651464300466020ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/services/json/* * 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.api.client.googleapis.services.json; import com.google.api.client.googleapis.testing.services.json.MockGoogleJsonClient; import com.google.api.client.http.HttpContent; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.util.Key; import junit.framework.TestCase; /** * Tests {@link CommonGoogleJsonClientRequestInitializer}. * * @author Yaniv Inbar */ public class CommonGoogleJsonClientRequestInitializerTest extends TestCase { public static class MyRequest extends AbstractGoogleJsonClientRequest { @Key String key; protected MyRequest(MockGoogleJsonClient client, String method, String uriTemplate, HttpContent content, Class responseClass) { super(client, method, uriTemplate, content, responseClass); } } public void testInitialize() throws Exception { CommonGoogleJsonClientRequestInitializer key = new CommonGoogleJsonClientRequestInitializer("foo"); MockGoogleJsonClient client = new MockGoogleJsonClient.Builder( new MockHttpTransport(), new JacksonFactory(), HttpTesting.SIMPLE_URL, "test/", null, false).setApplicationName("Test Application").build(); MyRequest request = new MyRequest(client, "GET", "", null, String.class); assertNull(request.key); key.initialize(request); assertEquals("foo", request.key); } } testing/000077500000000000000000000000001350651464300336255ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapisjson/000077500000000000000000000000001350651464300345765ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/testingGoogleJsonResponseExceptionFactoryTestingTest.java000066400000000000000000000031351350651464300466350ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/testing/json/* * Copyright 2013 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.api.client.googleapis.testing.json; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import java.io.IOException; import junit.framework.TestCase; /** * Tests {@link GoogleJsonResponseExceptionFactoryTesting} * * @author Eric Mintz */ public class GoogleJsonResponseExceptionFactoryTestingTest extends TestCase { private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final int HTTP_CODE_NOT_FOUND = 404; private static final String REASON_PHRASE_NOT_FOUND = "NOT FOUND"; public void testCreateException() throws IOException { GoogleJsonResponseException exception = GoogleJsonResponseExceptionFactoryTesting.newMock( JSON_FACTORY, HTTP_CODE_NOT_FOUND, REASON_PHRASE_NOT_FOUND); assertEquals(HTTP_CODE_NOT_FOUND, exception.getStatusCode()); assertEquals(REASON_PHRASE_NOT_FOUND, exception.getStatusMessage()); } } google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/util/000077500000000000000000000000001350651464300332045ustar00rootroot00000000000000UtilsTest.java000066400000000000000000000042311350651464300357300ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/java/com/google/api/client/googleapis/util/* * Copyright 2013 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.api.client.googleapis.util; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import java.io.IOException; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; /** * Tests {@link Utils}. * * @author Yaniv Inbar */ public class UtilsTest extends TestCase { public void testGetDefaultJsonFactory() { JsonFactory jsonFactory = Utils.getDefaultJsonFactory(); assertNotNull(jsonFactory); assertTrue(jsonFactory instanceof JacksonFactory); JsonFactory secondCall = Utils.getDefaultJsonFactory(); assertSame(jsonFactory, secondCall); } public void testGetDefaultTransport() { HttpTransport transport = Utils.getDefaultTransport(); assertNotNull(transport); assertTrue(transport instanceof NetHttpTransport); HttpTransport secondCall = Utils.getDefaultTransport(); assertSame(transport, secondCall); } public static Map parseQuery(String query) throws IOException { Map map = new HashMap(); String[] entries = query.split("&"); for (String entry : entries) { String[] sides = entry.split("="); if (sides.length != 2) { throw new IOException("Invalid Query String"); } String key = URLDecoder.decode(sides[0], "UTF-8"); String value = URLDecoder.decode(sides[1], "UTF-8"); map.put(key, value); } return map; } } google-api-java-client-1.27.1/google-api-client/src/test/proto/000077500000000000000000000000001350651464300242375ustar00rootroot00000000000000google-api-java-client-1.27.1/google-api-client/src/test/proto/error_output.proto000066400000000000000000000041251350651464300300770ustar00rootroot00000000000000// Mock ProtoBuf message on the body of HTTP responses that represent errors. syntax = "proto2"; package api.client.googleapis.batch; option optimize_for = LITE_RUNTIME; option java_package = "com.google.api.client.googleapis.batch"; // These messages are the protobuf version of the // com.google.api.client.googleapis.json.GoogleJsonError output // structure, and have a 1:1 mapping with it. Said structure is: // { // error: { // code: , // message: , // errors: [ // { // ..., // }, // { // ..., // }, // ], // } // } // Top-level object present in the HTTP body. message ErrorBody { optional ErrorProto error = 1; } message ErrorProto { // HTTP code of the response. Further specified by the first element of the // "errors" field. Always present. optional int32 code = 1; // Same value as the "message" field of the first element of the "errors" // field. Always present. optional string message = 2; // Non-empty list of errors found while processing the request. Not all of // them must be the same type of error, in which case only the first is // expected to be handled. repeated IndividualError errors = 3; } message IndividualError { // Description of this error for human consumption. Always present. optional string message = 1; // Namespace under which the "reason" field is to be interpreted. Always // present. optional string domain = 2; // Alphanumeric error code, in lowerCamel case, that identifies the error // with a granularity finer than the HTTP status code. Always present. optional string reason = 3; // For client errors, these two fields point at where in the HTTP request // lies the problem. E.g. location_type = HEADER, location = "Authorization". optional LocationType location_type = 5; optional string location = 6; } enum LocationType { // Either a query parameter or a URL path parameter. PARAMETER = 0; // An HTTP request header. HEADER = 1; // Some place in the body of the HTTP request. ENTITY = 2; // API-specific location type. OTHER = 3; } google-api-java-client-1.27.1/google-api-client/src/test/proto/mock_data.proto000066400000000000000000000004641350651464300272520ustar00rootroot00000000000000syntax = "proto2"; package api.client.googleapis.batch; option optimize_for = LITE_RUNTIME; option java_package = "com.google.api.client.googleapis.batch"; message Class1 { optional string id = 1; optional string kind = 2; } message Class2 { optional string name = 1; optional string number = 2; } google-api-java-client-1.27.1/pom.xml000066400000000000000000000533351350651464300173550ustar00rootroot00000000000000 4.0.0 org.sonatype.oss oss-parent 7 com.google.api-client google-api-client-parent 1.27.1 pom Parent for the Google API Client Library for Java https://github.com/google/google-api-java-client GitHub https://github.com/google/google-api-java-client/issues 2010 3.3.9 scm:git:https://github.com/googleapis/google-api-java-client.git scm:git:ssh:git@github.com:googleapis/google-api-java-client.git https://github.com/googleapis/google-api-java-client Google http://www.google.com/ The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo google-api-client google-api-client-servlet google-api-client-android google-api-client-appengine google-api-client-assembly google-api-client-bom google-api-client-gson google-api-client-jackson2 google-api-client-java6 google-api-client-protobuf google-api-client-xml never false central Central Repository https://repo.maven.apache.org/maven2 protoc-plugin https://dl.bintray.com/sergei-ivanov/maven/ junit junit 4.8.2 com.google.appengine appengine-api-1.0-sdk ${project.appengine.version} com.google.appengine appengine-tools-sdk ${project.appengine.version} com.google.appengine appengine-testing ${project.appengine.version} com.google.appengine appengine-api-labs ${project.appengine.version} com.google.appengine appengine-api-stubs ${project.appengine.version} xpp3 xpp3 ${project.xpp3.version} org.apache.httpcomponents httpclient ${project.httpclient.version} com.google.guava guava ${project.guava.version} com.google.code.findbugs jsr305 ${project.jsr305.version} javax.jdo jdo2-api ${project.jdo2-api.version} javax.servlet servlet-api ${project.servlet-api.version} com.google.http-client google-http-client ${project.http.version} com.google.http-client google-http-client-assembly ${project.http.version} pom com.google.http-client google-http-client-android ${project.http.version} com.google.http-client google-http-client-appengine ${project.http.version} com.google.http-client google-http-client-gson ${project.http.version} com.google.http-client google-http-client-jackson2 ${project.http.version} com.google.http-client google-http-client-protobuf ${project.http.version} com.google.http-client google-http-client-jackson ${project.http.version} com.google.http-client google-http-client-xml ${project.http.version} com.google.oauth-client google-oauth-client ${project.oauth.version} com.google.oauth-client google-oauth-client-assembly ${project.oauth.version} pom com.google.oauth-client google-oauth-client-appengine ${project.oauth.version} com.google.oauth-client google-oauth-client-java6 ${project.oauth.version} com.google.oauth-client google-oauth-client-java7 ${project.oauth.version} com.google.oauth-client google-oauth-client-servlet ${project.oauth.version} com.google.api-client google-api-client ${project.version} com.google.api-client google-api-client-appengine ${project.version} com.google.api-client google-api-client-servlet ${project.version} com.google.api-client google-api-client-android ${project.version} com.google.api-client google-api-client-java6 ${project.version} com.google.api-client google-api-client-gson ${project.version} com.google.api-client google-api-client-jackson2 ${project.version} com.google.api-client google-api-client-protobuf ${project.version} com.google.api-client google-api-client-xml ${project.version} com.google.android.google-play-services google-play-services 1 org.sonatype.plugins nexus-staging-maven-plugin 1.6.6 true ossrh https://oss.sonatype.org/ false maven-assembly-plugin 2.2 maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar-no-fork org.apache.maven.plugins maven-javadoc-plugin 2.9.1 attach-javadocs jar org.apache.maven.plugins maven-jar-plugin 3.0.2 test-jar maven-surefire-plugin 2.19.1 -Xmx1024m sponge_log maven-checkstyle-plugin 2.6 org.codehaus.mojo findbugs-maven-plugin 2.5.2 org.codehaus.mojo clirr-maven-plugin 2.8 org.codehaus.mojo animal-sniffer-maven-plugin 1.9 org.apache.maven.plugins maven-project-info-reports-plugin 2.7 maven-javadoc-plugin -Xdoclint:none aggregate aggregate site http://download.oracle.com/javase/6/docs/api/ http://cloud.google.com/appengine/docs/java/javadoc https://googleapis.github.io/google-http-java-client/releases/${project.http.version}/javadoc/ https://googleapis.github.io/google-oauth-java-client/releases/${project.oauth.version}/javadoc/ Google API Client Library for Java ${project.version} ${basedir}/overview.html google-api-client com.google.api.client.googleapis* google-api-client-android com.google.api.client.googleapis.extensions.android.* google-api-client-appengine com.google.api.client.googleapis.extensions.appengine* google-api-client-gson com.google.api.client.googleapis.notifications.json.gson.* google-api-client-jackson2 com.google.api.client.googleapis.notifications.json.jackson2.* google-api-client-java6 com.google.api.client.googleapis.extensions.java6.* google-api-client-protobuf com.google.api.client.googleapis.services.protobuf*:com.google.api.client.googleapis.testing.services.protobuf* google-api-client-servlet com.google.api.client.googleapis.extensions.servlet* google-api-client-xml com.google.api.client.googleapis.xml.* google-api-java-client ${project.version} org.apache.maven.plugins maven-checkstyle-plugin checkstyle.xml true ${basedir}/../checkstyle-suppressions.xml check org.codehaus.mojo findbugs-maven-plugin ${basedir}/../findbugs-exclude.xml com.google.http-client google-http-client-findbugs ${project.http.version} org.codehaus.mojo clirr-maven-plugin 1.19.0 ${basedir}/../clirr-ignored-differences.xml true check org.codehaus.mojo animal-sniffer-maven-plugin org.codehaus.mojo.signature java16 1.0 check org.sonatype.plugins nexus-staging-maven-plugin UTF-8 1.27.0 1.27.0 3.0.2 2.1 1.9.13 2.9.6 2.6.1 20.0 1.9.64 1.1.4c 1.1.1 4.5.5 4.4.10 2.3-eb 3.2.2 3.2.1 4.0.3 2.5 1.1 release-sign-artifacts performRelease true org.apache.maven.plugins maven-gpg-plugin 1.6 sign-artifacts verify sign --pinentry-mode loopback google-api-java-client-1.27.1/versions.txt000066400000000000000000000002301350651464300204330ustar00rootroot00000000000000# Format: # module:released-version:current-version google-api-client:1.27.1:1.27.1 google-http-client:1.27.1:1.27.1 google-oauth-client:1.27.1:1.27.1