diff --git a/flexible/CONTRIBUTING.md b/flexible/CONTRIBUTING.md deleted file mode 100644 index d9365cc8f82..00000000000 --- a/flexible/CONTRIBUTING.md +++ /dev/null @@ -1,35 +0,0 @@ -# How to become a contributor and submit your own code - -## Contributor License Agreements - -We'd love to accept your patches! Before we can take them, we -have to jump a couple of legal hurdles. - -Please fill out either the individual or corporate Contributor License Agreement -(CLA). - - * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual CLA] - (https://developers.google.com/open-source/cla/individual). - * If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a [corporate CLA] - (https://developers.google.com/open-source/cla/corporate). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. Once we receive it, we'll be able to -accept your pull requests. - -## Contributing A Patch - -1. Submit an issue describing your proposed change to the repo in question. -1. The repo owner will respond to your issue promptly. -1. If your proposed change is accepted, and you haven't already done so, sign a - Contributor License Agreement (see details above). -1. Fork the desired repo, develop and test your code changes. -1. Ensure that your code adheres to the existing style in the sample to which - you are contributing. Refer to the - [Google Cloud Platform Samples Style Guide] - (https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the - recommended coding standards for this organization. -1. Ensure that your code has an appropriate set of unit tests which all pass. -1. Submit a pull request. diff --git a/flexible/LICENSE b/flexible/LICENSE deleted file mode 100644 index 57bc88a15a0..00000000000 --- a/flexible/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - 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. - diff --git a/flexible/README.mdpp b/flexible/README.mdpp deleted file mode 100644 index 6a014ae9f07..00000000000 --- a/flexible/README.mdpp +++ /dev/null @@ -1,24 +0,0 @@ -# Google App Engine Flexible Environment Java Samples - -This is a repository that contains Java code samples for [Google App Engine -flexible environment][aeflex-docs]. - -See our other [Google Cloud Platform GitHub -repos](https://github.com/GoogleCloudPlatform) for sample applications and -scaffolding for other frameworks and use cases. - -[aeflex-docs]: https://cloud.google.com/appengine/docs/flexible/ - -!INCLUDE "../.github/templates/getting-sample-code.mdpp" - -!INCLUDE "../.github/templates/appengine-flexible-before-you-begin.mdpp" - -!INCLUDE "../.github/templates/appengine-flexible-deploy.mdpp" - -## Contributing changes - -* See [CONTRIBUTING.md](CONTRIBUTING.md) - -## Licensing - -* See [LICENSE](LICENSE) diff --git a/flexible/analytics/src/main/appengine/app.yaml b/flexible/analytics/src/main/appengine/app.yaml deleted file mode 100644 index 3273b02a0e8..00000000000 --- a/flexible/analytics/src/main/appengine/app.yaml +++ /dev/null @@ -1,11 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - GA_TRACKING_ID: YOUR-GA-TRACKING-ID -# [END env_variables] diff --git a/flexible/async-rest/LICENSE b/flexible/async-rest/LICENSE deleted file mode 100644 index 04cb0d70775..00000000000 --- a/flexible/async-rest/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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 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. diff --git a/flexible/cloudsql/.gitignore b/flexible/cloudsql/.gitignore deleted file mode 100644 index 83926cdbcaa..00000000000 --- a/flexible/cloudsql/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ -target diff --git a/flexible/cloudsql/README.md b/flexible/cloudsql/README.md deleted file mode 100644 index d2c3f3e6e67..00000000000 --- a/flexible/cloudsql/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Cloud SQL sample for Google App Engine Flexible -This sample demonstrates how to use [Cloud SQL](https://cloud.google.com/sql/) on Google App Engine -Flexible. - -## Setup -Before you can run or deploy the sample, you will need to create a [Cloud SQL instance)](https://cloud.google.com/sql/docs/create-instance) - -1. Create a new user and database for the application. The easiest way to do this is via the [Google -Developers Console](https://console.cloud.google.com/sql/instances). Alternatively, you can use -MySQL tools such as the command line client or workbench. -2. Change the root password (under Access Control) and / or create a new user / password. -3. Create a Database (under Databases) (or use MySQL with `gcloud sql connect --user=root`) -4. Note the **Instance connection name** under Overview > Properties -(It will look like project:region:zone for 2nd Generation) - -## Deploying - -```bash -$ mvn clean appengine:deploy -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root --Dpassword=myPassword -Ddatabase=myDatabase -``` - -Or you can update the properties in `pom.xml` - -## Running locally - -```bash -$ mvn clean jetty:run -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase -``` diff --git a/flexible/cloudstorage/README.md b/flexible/cloudstorage/README.md deleted file mode 100644 index 1d0ee071298..00000000000 --- a/flexible/cloudstorage/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Cloud Storage sample for Google Managed VMs -This sample demonstrates how to use [Cloud Storage](https://cloud.google.com/storage/) on Google Managed VMs. - -## Setup -Before you can run or deploy the sample, you will need to do the following: - -1. Enable the Cloud Storage API in the [Google Developers Console](https://console.developers.google.com/project/_/apiui/apiview/storage/overview). -2. Create a Cloud Storage Bucket. You can do this with the [Google Cloud SDK](https://cloud.google.com/sdk) using the following command: - - ``` - $ gsutil mb gs://[your-bucket-name] - ``` -3. Set the default ACL on your bucket to public read in order to serve files directly from Cloud Storage. You can do this with the [Google Cloud SDK](https://cloud.google.com/sdk) using the following command: - - ``` - $ gsutil defacl set public-read gs://[your-bucket-name] - ``` -4. Update the bucket name in `src/main/appengine/app.yaml`. This makes the bucket name an environment variable in deployment. You still need to set the environment variable when running locally, as shown below. - -## Running locally - $ export BUCKET_NAME=[your-bucket-name] - $ mvn clean jetty:run - -## Deploying - $ mvn clean appengine:deploy diff --git a/flexible/cloudstorage/src/main/appengine/app.yaml b/flexible/cloudstorage/src/main/appengine/app.yaml deleted file mode 100644 index da52dfa3ff2..00000000000 --- a/flexible/cloudstorage/src/main/appengine/app.yaml +++ /dev/null @@ -1,11 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - BUCKET_NAME: YOUR-BUCKET-NAME -# [END env_variables] diff --git a/flexible/cron/README.md b/flexible/cron/README.md deleted file mode 100644 index 3535287907f..00000000000 --- a/flexible/cron/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# App Engine Cron Service sample for Google App Engine -This sample demonstrates how to deploy App Engine Cron Service to ping a servlet deployed in the app. - -## Running locally - $ mvn jetty:run - -## Deploying app - $ mvn gcloud:deploy - -## Deploying cron job - $ gcloud app deploy cron.yaml \ No newline at end of file diff --git a/flexible/cron/src/main/appengine/app.yaml b/flexible/cron/src/main/appengine/app.yaml deleted file mode 100644 index d7890aaff58..00000000000 --- a/flexible/cron/src/main/appengine/app.yaml +++ /dev/null @@ -1,6 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored diff --git a/flexible/cron/src/main/appengine/cron.yaml b/flexible/cron/src/main/appengine/cron.yaml deleted file mode 100644 index 989f1fe8b3f..00000000000 --- a/flexible/cron/src/main/appengine/cron.yaml +++ /dev/null @@ -1,4 +0,0 @@ -cron: - - description: sample cron job - url: /cron - schedule: every 1 mins \ No newline at end of file diff --git a/flexible/async-rest/README.md b/flexible/custom-runtime/async-rest/README.md similarity index 99% rename from flexible/async-rest/README.md rename to flexible/custom-runtime/async-rest/README.md index d88caad417e..7eff0ca6f1f 100644 --- a/flexible/async-rest/README.md +++ b/flexible/custom-runtime/async-rest/README.md @@ -45,4 +45,3 @@ To automatically stage and deploy the webapp to your project in the cloud do: mvn appengine:deploy See here for more information on the [GCloud Maven Plugin](https://github.com/GoogleCloudPlatform/gcloud-maven-plugin). - diff --git a/flexible/async-rest/pom.xml b/flexible/custom-runtime/async-rest/pom.xml similarity index 96% rename from flexible/async-rest/pom.xml rename to flexible/custom-runtime/async-rest/pom.xml index 121d083b84c..b477f3138ca 100644 --- a/flexible/async-rest/pom.xml +++ b/flexible/custom-runtime/async-rest/pom.xml @@ -16,14 +16,14 @@ --> 4.0.0 - com.google.appengine.demos + com.example.flexible async-rest 1.0.0-SNAPSHOT war - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 ../.. diff --git a/flexible/async-rest/src/main/appengine/app.yaml b/flexible/custom-runtime/async-rest/src/main/appengine/app.yaml similarity index 100% rename from flexible/async-rest/src/main/appengine/app.yaml rename to flexible/custom-runtime/async-rest/src/main/appengine/app.yaml diff --git a/flexible/async-rest/src/main/docker/Dockerfile b/flexible/custom-runtime/async-rest/src/main/docker/Dockerfile similarity index 100% rename from flexible/async-rest/src/main/docker/Dockerfile rename to flexible/custom-runtime/async-rest/src/main/docker/Dockerfile diff --git a/flexible/async-rest/src/main/docker/jetty-logging.properties b/flexible/custom-runtime/async-rest/src/main/docker/jetty-logging.properties similarity index 99% rename from flexible/async-rest/src/main/docker/jetty-logging.properties rename to flexible/custom-runtime/async-rest/src/main/docker/jetty-logging.properties index fd14a1d4c87..19ee58ff79f 100644 --- a/flexible/async-rest/src/main/docker/jetty-logging.properties +++ b/flexible/custom-runtime/async-rest/src/main/docker/jetty-logging.properties @@ -16,4 +16,3 @@ org.eclipse.jetty.STACKS=true ## If LONG is true, fully qualified package names are used rather than abbreviations org.eclipse.jetty.LONG=false - diff --git a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AbstractRestServlet.java similarity index 99% rename from flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java rename to flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AbstractRestServlet.java index 101e511245b..36dde4c623a 100644 --- a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java +++ b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AbstractRestServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.appengine.demos.asyncrest; +package com.example.flexible.asyncrest; import java.io.IOException; import java.math.BigDecimal; diff --git a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AsyncRestServlet.java b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AsyncRestServlet.java similarity index 99% rename from flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AsyncRestServlet.java rename to flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AsyncRestServlet.java index 712e3587cd8..b0716f0798d 100644 --- a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AsyncRestServlet.java +++ b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/AsyncRestServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.appengine.demos.asyncrest; +package com.example.flexible.asyncrest; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.Response; diff --git a/flexible/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/DumpServlet.java similarity index 98% rename from flexible/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java rename to flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/DumpServlet.java index 7907f5207cc..eeb4d593dc5 100644 --- a/flexible/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java +++ b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/DumpServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.appengine.demos; +package com.example.flexible.asyncrest; import java.io.IOException; import java.io.PrintWriter; diff --git a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/SerialRestServlet.java b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/SerialRestServlet.java similarity index 98% rename from flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/SerialRestServlet.java rename to flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/SerialRestServlet.java index 9717300e340..4729626ea6b 100644 --- a/flexible/async-rest/src/main/java/com/google/appengine/demos/asyncrest/SerialRestServlet.java +++ b/flexible/custom-runtime/async-rest/src/main/java/com/example/flexible/asyncrest/SerialRestServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.appengine.demos.asyncrest; +package com.example.flexible.asyncrest; import org.eclipse.jetty.util.ajax.JSON; diff --git a/flexible/async-rest/src/main/webapp/WEB-INF/jetty-web.xml b/flexible/custom-runtime/async-rest/src/main/webapp/WEB-INF/jetty-web.xml similarity index 100% rename from flexible/async-rest/src/main/webapp/WEB-INF/jetty-web.xml rename to flexible/custom-runtime/async-rest/src/main/webapp/WEB-INF/jetty-web.xml diff --git a/flexible/async-rest/src/main/webapp/WEB-INF/web.xml b/flexible/custom-runtime/async-rest/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from flexible/async-rest/src/main/webapp/WEB-INF/web.xml rename to flexible/custom-runtime/async-rest/src/main/webapp/WEB-INF/web.xml diff --git a/flexible/async-rest/src/main/webapp/asyncrest/green.png b/flexible/custom-runtime/async-rest/src/main/webapp/asyncrest/green.png similarity index 100% rename from flexible/async-rest/src/main/webapp/asyncrest/green.png rename to flexible/custom-runtime/async-rest/src/main/webapp/asyncrest/green.png diff --git a/flexible/async-rest/src/main/webapp/asyncrest/red.png b/flexible/custom-runtime/async-rest/src/main/webapp/asyncrest/red.png similarity index 100% rename from flexible/async-rest/src/main/webapp/asyncrest/red.png rename to flexible/custom-runtime/async-rest/src/main/webapp/asyncrest/red.png diff --git a/flexible/async-rest/src/main/webapp/index.html b/flexible/custom-runtime/async-rest/src/main/webapp/index.html similarity index 99% rename from flexible/async-rest/src/main/webapp/index.html rename to flexible/custom-runtime/async-rest/src/main/webapp/index.html index 1c4966e8185..f8ed1b5b2ae 100644 --- a/flexible/async-rest/src/main/webapp/index.html +++ b/flexible/custom-runtime/async-rest/src/main/webapp/index.html @@ -57,6 +57,5 @@

Blocking vs Asynchronous REST

- diff --git a/flexible/endpoints/README.md b/flexible/custom-runtime/endpoints/README.md similarity index 100% rename from flexible/endpoints/README.md rename to flexible/custom-runtime/endpoints/README.md diff --git a/flexible/endpoints/pom.xml b/flexible/custom-runtime/endpoints/pom.xml similarity index 77% rename from flexible/endpoints/pom.xml rename to flexible/custom-runtime/endpoints/pom.xml index 17a01909014..e566e464a24 100644 --- a/flexible/endpoints/pom.xml +++ b/flexible/custom-runtime/endpoints/pom.xml @@ -1,4 +1,19 @@ + @@ -9,8 +24,8 @@ flexible-endpoints - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 ../.. diff --git a/flexible/endpoints/src/main/appengine/Dockerfile b/flexible/custom-runtime/endpoints/src/main/appengine/Dockerfile similarity index 100% rename from flexible/endpoints/src/main/appengine/Dockerfile rename to flexible/custom-runtime/endpoints/src/main/appengine/Dockerfile diff --git a/flexible/custom-runtime/endpoints/src/main/appengine/app.yaml b/flexible/custom-runtime/endpoints/src/main/appengine/app.yaml new file mode 100644 index 00000000000..4ff36f4f50c --- /dev/null +++ b/flexible/custom-runtime/endpoints/src/main/appengine/app.yaml @@ -0,0 +1,27 @@ +# 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. +# [START appyaml] +runtime: custom +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +beta_settings: + # Enable Google Cloud Endpoints API management. + use_endpoints_api_management: true + # Specify the Open API specification. + endpoints_swagger_spec_file: openapi.yaml +# [END appyaml] diff --git a/flexible/endpoints/src/main/appengine/openapi.yaml b/flexible/custom-runtime/endpoints/src/main/appengine/openapi.yaml similarity index 83% rename from flexible/endpoints/src/main/appengine/openapi.yaml rename to flexible/custom-runtime/endpoints/src/main/appengine/openapi.yaml index 71bac9ce62f..df9d42c65d3 100644 --- a/flexible/endpoints/src/main/appengine/openapi.yaml +++ b/flexible/custom-runtime/endpoints/src/main/appengine/openapi.yaml @@ -1,3 +1,17 @@ +# 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. +# [START openapiyaml] swagger: "2.0" info: description: "A simple Google Cloud Endpoints API example." @@ -104,3 +118,4 @@ securityDefinitions: type: "oauth2" x-issuer: "accounts.google.com" x-jwks_uri: "https://www.googleapis.com/oauth2/v1/certs" +# [END openapiyaml] diff --git a/flexible/endpoints/src/main/java/com/example/endpoints/AuthInfoServlet.java b/flexible/custom-runtime/endpoints/src/main/java/com/example/endpoints/AuthInfoServlet.java similarity index 100% rename from flexible/endpoints/src/main/java/com/example/endpoints/AuthInfoServlet.java rename to flexible/custom-runtime/endpoints/src/main/java/com/example/endpoints/AuthInfoServlet.java diff --git a/flexible/endpoints/src/main/java/com/example/endpoints/EchoServlet.java b/flexible/custom-runtime/endpoints/src/main/java/com/example/endpoints/EchoServlet.java similarity index 100% rename from flexible/endpoints/src/main/java/com/example/endpoints/EchoServlet.java rename to flexible/custom-runtime/endpoints/src/main/java/com/example/endpoints/EchoServlet.java diff --git a/flexible/extending-runtime/README.md b/flexible/custom-runtime/extending-runtime/README.md similarity index 88% rename from flexible/extending-runtime/README.md rename to flexible/custom-runtime/extending-runtime/README.md index a1c5801e06a..7f6c8389703 100644 --- a/flexible/extending-runtime/README.md +++ b/flexible/custom-runtime/extending-runtime/README.md @@ -1,6 +1,2 @@ # Java extending runtime sample for Google App Engine Flexible This sample demonstrates how to use custom runtime on Google App Engine Flexible - -## Setup - -... ?? diff --git a/flexible/extending-runtime/pom.xml b/flexible/custom-runtime/extending-runtime/pom.xml similarity index 95% rename from flexible/extending-runtime/pom.xml rename to flexible/custom-runtime/extending-runtime/pom.xml index 1d4a53209e3..3d6b6e3f673 100644 --- a/flexible/extending-runtime/pom.xml +++ b/flexible/custom-runtime/extending-runtime/pom.xml @@ -21,8 +21,8 @@ extendingruntime - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 ../.. diff --git a/flexible/extending-runtime/src/main/appengine/Dockerfile b/flexible/custom-runtime/extending-runtime/src/main/appengine/Dockerfile similarity index 100% rename from flexible/extending-runtime/src/main/appengine/Dockerfile rename to flexible/custom-runtime/extending-runtime/src/main/appengine/Dockerfile diff --git a/flexible/custom-runtime/extending-runtime/src/main/appengine/app.yaml b/flexible/custom-runtime/extending-runtime/src/main/appengine/app.yaml new file mode 100644 index 00000000000..c495cf879ca --- /dev/null +++ b/flexible/custom-runtime/extending-runtime/src/main/appengine/app.yaml @@ -0,0 +1,21 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# [START appyaml] +runtime: custom +env: flexible + +handlers: +- url: /.* + script: this field is required, but ignored +# [END appyaml] diff --git a/flexible/extending-runtime/src/main/java/com/example/extendingruntime/FortuneServlet.java b/flexible/custom-runtime/extending-runtime/src/main/java/com/example/extendingruntime/FortuneServlet.java similarity index 100% rename from flexible/extending-runtime/src/main/java/com/example/extendingruntime/FortuneServlet.java rename to flexible/custom-runtime/extending-runtime/src/main/java/com/example/extendingruntime/FortuneServlet.java diff --git a/flexible/sparkjava/README.md b/flexible/custom-runtime/sparkjava/README.md similarity index 100% rename from flexible/sparkjava/README.md rename to flexible/custom-runtime/sparkjava/README.md diff --git a/flexible/sparkjava/jenkins.sh b/flexible/custom-runtime/sparkjava/jenkins.sh similarity index 100% rename from flexible/sparkjava/jenkins.sh rename to flexible/custom-runtime/sparkjava/jenkins.sh diff --git a/flexible/sparkjava/pom.xml b/flexible/custom-runtime/sparkjava/pom.xml similarity index 96% rename from flexible/sparkjava/pom.xml rename to flexible/custom-runtime/sparkjava/pom.xml index dd42ad918dd..990eb27bc7c 100644 --- a/flexible/sparkjava/pom.xml +++ b/flexible/custom-runtime/sparkjava/pom.xml @@ -18,13 +18,13 @@ limitations under the License. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.google.appengine.sparkdemo + com.example.flexible spark 1.0 - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 ../.. diff --git a/flexible/custom-runtime/sparkjava/src/main/appengine/app.yaml b/flexible/custom-runtime/sparkjava/src/main/appengine/app.yaml new file mode 100644 index 00000000000..796c4c2ab26 --- /dev/null +++ b/flexible/custom-runtime/sparkjava/src/main/appengine/app.yaml @@ -0,0 +1,17 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# [START appyaml] +runtime: custom +env: flex +# [END appyaml] diff --git a/flexible/sparkjava/src/main/docker/Dockerfile b/flexible/custom-runtime/sparkjava/src/main/docker/Dockerfile similarity index 100% rename from flexible/sparkjava/src/main/docker/Dockerfile rename to flexible/custom-runtime/sparkjava/src/main/docker/Dockerfile diff --git a/flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/Main.java b/flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/Main.java similarity index 100% rename from flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/Main.java rename to flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/Main.java diff --git a/flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/ResponseError.java b/flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/ResponseError.java similarity index 100% rename from flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/ResponseError.java rename to flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/ResponseError.java diff --git a/flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/User.java b/flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/User.java similarity index 100% rename from flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/User.java rename to flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/User.java diff --git a/flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/UserController.java b/flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/UserController.java similarity index 100% rename from flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/UserController.java rename to flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/UserController.java diff --git a/flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/UserService.java b/flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/UserService.java similarity index 100% rename from flexible/sparkjava/src/main/java/com/google/appengine/sparkdemo/UserService.java rename to flexible/custom-runtime/sparkjava/src/main/java/com/example/flexible/sparkdemo/UserService.java diff --git a/flexible/sparkjava/src/main/resources/public/index.html b/flexible/custom-runtime/sparkjava/src/main/resources/public/index.html similarity index 100% rename from flexible/sparkjava/src/main/resources/public/index.html rename to flexible/custom-runtime/sparkjava/src/main/resources/public/index.html diff --git a/flexible/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserControllerTest.java b/flexible/custom-runtime/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserControllerTest.java similarity index 100% rename from flexible/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserControllerTest.java rename to flexible/custom-runtime/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserControllerTest.java diff --git a/flexible/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserServiceTest.java b/flexible/custom-runtime/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserServiceTest.java similarity index 100% rename from flexible/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserServiceTest.java rename to flexible/custom-runtime/sparkjava/src/test/java/com/google/appengine/sparkdemo/UserServiceTest.java diff --git a/flexible/disk/src/main/appengine/app.yaml b/flexible/disk/src/main/appengine/app.yaml deleted file mode 100644 index d7890aaff58..00000000000 --- a/flexible/disk/src/main/appengine/app.yaml +++ /dev/null @@ -1,6 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored diff --git a/flexible/endpoints/src/main/appengine/app.yaml b/flexible/endpoints/src/main/appengine/app.yaml deleted file mode 100644 index a3f52eb360f..00000000000 --- a/flexible/endpoints/src/main/appengine/app.yaml +++ /dev/null @@ -1,12 +0,0 @@ -runtime: custom -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -beta_settings: - # Enable Google Cloud Endpoints API management. - use_endpoints_api_management: true - # Specify the Open API specification. - endpoints_swagger_spec_file: openapi.yaml diff --git a/flexible/extending-runtime/src/main/appengine/app.yaml b/flexible/extending-runtime/src/main/appengine/app.yaml deleted file mode 100644 index 3eaf1aa012c..00000000000 --- a/flexible/extending-runtime/src/main/appengine/app.yaml +++ /dev/null @@ -1,6 +0,0 @@ -runtime: custom -env: flexible - -handlers: -- url: /.* - script: this field is required, but ignored diff --git a/flexible/helloworld/README.md b/flexible/java-runtime/helloworld/README.md similarity index 100% rename from flexible/helloworld/README.md rename to flexible/java-runtime/helloworld/README.md diff --git a/flexible/helloworld/build.gradle b/flexible/java-runtime/helloworld/build.gradle similarity index 100% rename from flexible/helloworld/build.gradle rename to flexible/java-runtime/helloworld/build.gradle diff --git a/flexible/helloworld/gradle/wrapper/gradle-wrapper.properties b/flexible/java-runtime/helloworld/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from flexible/helloworld/gradle/wrapper/gradle-wrapper.properties rename to flexible/java-runtime/helloworld/gradle/wrapper/gradle-wrapper.properties diff --git a/flexible/helloworld/gradlew b/flexible/java-runtime/helloworld/gradlew similarity index 100% rename from flexible/helloworld/gradlew rename to flexible/java-runtime/helloworld/gradlew diff --git a/flexible/helloworld/gradlew.bat b/flexible/java-runtime/helloworld/gradlew.bat similarity index 100% rename from flexible/helloworld/gradlew.bat rename to flexible/java-runtime/helloworld/gradlew.bat diff --git a/flexible/helloworld/pom.xml b/flexible/java-runtime/helloworld/pom.xml similarity index 96% rename from flexible/helloworld/pom.xml rename to flexible/java-runtime/helloworld/pom.xml index 3c43fb9a9f1..31179adb21b 100644 --- a/flexible/helloworld/pom.xml +++ b/flexible/java-runtime/helloworld/pom.xml @@ -22,8 +22,8 @@ flexible-helloworld - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 ../.. diff --git a/flexible/helloworld/src/main/appengine/app.yaml b/flexible/java-runtime/helloworld/src/main/appengine/app.yaml similarity index 100% rename from flexible/helloworld/src/main/appengine/app.yaml rename to flexible/java-runtime/helloworld/src/main/appengine/app.yaml diff --git a/flexible/helloworld/src/main/java/com/example/flexible/helloworld/HelloServlet.java b/flexible/java-runtime/helloworld/src/main/java/com/example/flexible/helloworld/HelloServlet.java similarity index 100% rename from flexible/helloworld/src/main/java/com/example/flexible/helloworld/HelloServlet.java rename to flexible/java-runtime/helloworld/src/main/java/com/example/flexible/helloworld/HelloServlet.java diff --git a/flexible/README.md b/flexible/java-runtime/samples/README.md similarity index 81% rename from flexible/README.md rename to flexible/java-runtime/samples/README.md index cba94155022..8aac62d452f 100644 --- a/flexible/README.md +++ b/flexible/java-runtime/samples/README.md @@ -16,7 +16,6 @@ Get the latest sample code from GitHub using Git or download the repository as a git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git - ## Before you begin 1. Follow the [quickstart for Java in the App Engine flexible @@ -34,6 +33,15 @@ Get the latest sample code from GitHub using Git or download the repository as a ## Deploying to App Engine +To run all or a group of the samples as a single Flex application, use the `flexible.samples` +parameter in [pom.xml](pom.xml). +`flexible.samples` accepts `all`as default, or a string separated list of package names, + eg. `cloudsql, analytics` + +To build and deploy individual samples, navigate to the appropriate samples directory under + [samples](samples-source) and follow the instructions below. + + To run the application locally, use the Maven Jetty plugin. mvn clean jetty:run @@ -56,8 +64,8 @@ environment](https://cloud.google.com/java/getting-started/hello-world). ## Contributing changes -* See [CONTRIBUTING.md](CONTRIBUTING.md) +* See [CONTRIBUTING.md](../../../CONTRIBUTING.md) ## Licensing -* See [LICENSE](LICENSE) +* See [LICENSE](../../../LICENSE) diff --git a/flexible/analytics/pom.xml b/flexible/java-runtime/samples/analytics/pom.xml similarity index 94% rename from flexible/analytics/pom.xml rename to flexible/java-runtime/samples/analytics/pom.xml index ede4af06a43..fd7e91b5a54 100644 --- a/flexible/analytics/pom.xml +++ b/flexible/java-runtime/samples/analytics/pom.xml @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> + 4.0.0 war @@ -21,10 +22,10 @@ flexible-analytics - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. @@ -33,10 +34,10 @@ 1.2.1 9.3.8.v20160314 - false + 3.3.9 diff --git a/flexible/java-runtime/samples/analytics/src/main/appengine/app.yaml b/flexible/java-runtime/samples/analytics/src/main/appengine/app.yaml new file mode 100644 index 00000000000..d6fe45ff48f --- /dev/null +++ b/flexible/java-runtime/samples/analytics/src/main/appengine/app.yaml @@ -0,0 +1,24 @@ +# 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. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + GA_TRACKING_ID: YOUR-GA-TRACKING-ID +# [END env_variables] \ No newline at end of file diff --git a/flexible/analytics/src/main/java/com/example/analytics/AnalyticsServlet.java b/flexible/java-runtime/samples/analytics/src/main/java/com/example/flexible/analytics/AnalyticsServlet.java similarity index 95% rename from flexible/analytics/src/main/java/com/example/analytics/AnalyticsServlet.java rename to flexible/java-runtime/samples/analytics/src/main/java/com/example/flexible/analytics/AnalyticsServlet.java index 200b593bd31..4d41ebbe21f 100644 --- a/flexible/analytics/src/main/java/com/example/analytics/AnalyticsServlet.java +++ b/flexible/java-runtime/samples/analytics/src/main/java/com/example/flexible/analytics/AnalyticsServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.analytics; +package com.example.flexible.analytics; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; @@ -24,7 +24,6 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -33,7 +32,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "analytics", value = "") +@WebServlet(name = "Add Google Analytics event", value = {"/analytics.html"}) public class AnalyticsServlet extends HttpServlet { @Override diff --git a/flexible/cloudsql/pom.xml b/flexible/java-runtime/samples/cloudsql/pom.xml similarity index 80% rename from flexible/cloudsql/pom.xml rename to flexible/java-runtime/samples/cloudsql/pom.xml index 11c835c67af..82dce7da66b 100644 --- a/flexible/cloudsql/pom.xml +++ b/flexible/java-runtime/samples/cloudsql/pom.xml @@ -21,14 +21,23 @@ flexible-cloudsql - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. - + 1.8 + 1.8 + + 1.2.1 + 9.3.8.v20160314 + + false + + + - 1.8 - 1.8 - - 1.2.1 - 9.3.8.v20160314 - - false - jdbc:mysql://google/${database}?cloudSqlInstance=${INSTANCE_CONNECTION_NAME}&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=${user}&password=${password}&useSSL=false + - @@ -74,7 +74,7 @@ provided - + mysql mysql-connector-java 6.0.5 @@ -86,35 +86,11 @@ + - - - src/main/resources - true - - ${project.build.directory}/${project.build.finalName}/WEB-INF/classes - - - - com.google.cloud.tools appengine-maven-plugin @@ -127,5 +103,11 @@ ${jetty.maven.plugin} + + + src/main/resources + true + + diff --git a/flexible/cloudsql/src/main/appengine/app.yaml b/flexible/java-runtime/samples/cloudsql/src/main/appengine/app.yaml similarity index 96% rename from flexible/cloudsql/src/main/appengine/app.yaml rename to flexible/java-runtime/samples/cloudsql/src/main/appengine/app.yaml index ca251053293..68134485b6d 100644 --- a/flexible/cloudsql/src/main/appengine/app.yaml +++ b/flexible/java-runtime/samples/cloudsql/src/main/appengine/app.yaml @@ -1,5 +1,4 @@ # Copyright 2016 Google Inc. -# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -21,4 +20,4 @@ handlers: automatic_scaling: min_num_instances: 1 - max_num_instances: 2 + max_num_instances: 2 \ No newline at end of file diff --git a/flexible/cloudsql/src/main/java/com/example/cloudsql/CloudSqlServlet.java b/flexible/java-runtime/samples/cloudsql/src/main/java/com/example/flexible/cloudsql/CloudSqlServlet.java similarity index 97% rename from flexible/cloudsql/src/main/java/com/example/cloudsql/CloudSqlServlet.java rename to flexible/java-runtime/samples/cloudsql/src/main/java/com/example/flexible/cloudsql/CloudSqlServlet.java index 45558bb24f8..00d34bd346e 100644 --- a/flexible/cloudsql/src/main/java/com/example/cloudsql/CloudSqlServlet.java +++ b/flexible/java-runtime/samples/cloudsql/src/main/java/com/example/flexible/cloudsql/CloudSqlServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.cloudsql; +package com.example.flexible.cloudsql; import java.io.IOException; import java.io.PrintWriter; @@ -29,7 +29,6 @@ import java.sql.Timestamp; import java.util.Date; import java.util.Properties; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -38,7 +37,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "cloudsql", value = "") +@WebServlet(name = "CloudSQL Sample", value = {"/cloudsql.html"}) public class CloudSqlServlet extends HttpServlet { String url; diff --git a/flexible/cloudsql/src/main/resources/config.properties b/flexible/java-runtime/samples/cloudsql/src/main/resources/cloudsql/config.properties similarity index 100% rename from flexible/cloudsql/src/main/resources/config.properties rename to flexible/java-runtime/samples/cloudsql/src/main/resources/cloudsql/config.properties diff --git a/flexible/cloudstorage/pom.xml b/flexible/java-runtime/samples/cloudstorage/pom.xml similarity index 87% rename from flexible/cloudstorage/pom.xml rename to flexible/java-runtime/samples/cloudstorage/pom.xml index 1189db81d20..51abeccd648 100644 --- a/flexible/cloudstorage/pom.xml +++ b/flexible/java-runtime/samples/cloudstorage/pom.xml @@ -21,12 +21,13 @@ flexible-cloudstorage - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. + 1.8 1.8 @@ -52,6 +53,13 @@ 0.13.0-beta + + + junit + junit + 4.12 + test + diff --git a/flexible/java-runtime/samples/cloudstorage/src/main/appengine/app.yaml b/flexible/java-runtime/samples/cloudstorage/src/main/appengine/app.yaml new file mode 100644 index 00000000000..5aac05e790b --- /dev/null +++ b/flexible/java-runtime/samples/cloudstorage/src/main/appengine/app.yaml @@ -0,0 +1,24 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + BUCKET_NAME: YOUR-BUCKET-NAME +# [END env_variables] \ No newline at end of file diff --git a/flexible/cloudstorage/src/main/java/com/example/cloudstorage/UploadServlet.java b/flexible/java-runtime/samples/cloudstorage/src/main/java/com/example/flexible/UploadServlet.java similarity index 92% rename from flexible/cloudstorage/src/main/java/com/example/cloudstorage/UploadServlet.java rename to flexible/java-runtime/samples/cloudstorage/src/main/java/com/example/flexible/UploadServlet.java index 6b7aebb0d8b..afcce64d290 100644 --- a/flexible/cloudstorage/src/main/java/com/example/cloudstorage/UploadServlet.java +++ b/flexible/java-runtime/samples/cloudstorage/src/main/java/com/example/flexible/UploadServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.cloudstorage; +package com.example.flexible.cloudstorage; import com.google.cloud.storage.Acl; import com.google.cloud.storage.Blob; @@ -34,9 +34,9 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; -// [START example] +// [START cloudstorage] @SuppressWarnings("serial") -@WebServlet(name = "upload", value = "/upload") +@WebServlet(name = "Upload a file to a GCS bucket", value = "/cloudstorage/upload") @MultipartConfig() public class UploadServlet extends HttpServlet { @@ -67,4 +67,4 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx resp.getWriter().print(blob.getMediaLink()); } } -// [END example] +// [END cloudstorage] diff --git a/flexible/cloudstorage/src/main/webapp/index.html b/flexible/java-runtime/samples/cloudstorage/src/main/webapp/cloudstorage/upload.html similarity index 57% rename from flexible/cloudstorage/src/main/webapp/index.html rename to flexible/java-runtime/samples/cloudstorage/src/main/webapp/cloudstorage/upload.html index 78e9c675a9b..b8cf4082bef 100644 --- a/flexible/cloudstorage/src/main/webapp/index.html +++ b/flexible/java-runtime/samples/cloudstorage/src/main/webapp/cloudstorage/upload.html @@ -1,9 +1,10 @@ - Google Managed VMs Cloud Storage Sample + Cloud Storage Sample

Select a file to upload to your Google Cloud Storage bucket.

-
+
+ diff --git a/flexible/cron/pom.xml b/flexible/java-runtime/samples/cron/pom.xml similarity index 91% rename from flexible/cron/pom.xml rename to flexible/java-runtime/samples/cron/pom.xml index 1053175a8ac..d480951bc06 100644 --- a/flexible/cron/pom.xml +++ b/flexible/java-runtime/samples/cron/pom.xml @@ -21,10 +21,10 @@ managed-vms-cron - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. @@ -37,7 +37,6 @@ false - javax.servlet @@ -47,7 +46,6 @@ provided - diff --git a/flexible/java-runtime/samples/cron/src/main/appengine/cron.yaml b/flexible/java-runtime/samples/cron/src/main/appengine/cron.yaml new file mode 100644 index 00000000000..62bf2a137e6 --- /dev/null +++ b/flexible/java-runtime/samples/cron/src/main/appengine/cron.yaml @@ -0,0 +1,17 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cron: + - description: sample cron job + url: /cron + schedule: every 1 mins \ No newline at end of file diff --git a/flexible/cron/src/main/java/com/example/cron/CronServlet.java b/flexible/java-runtime/samples/cron/src/main/java/com/example/flexible/cron/CronServlet.java similarity index 92% rename from flexible/cron/src/main/java/com/example/cron/CronServlet.java rename to flexible/java-runtime/samples/cron/src/main/java/com/example/flexible/cron/CronServlet.java index 1ef6dcbfc41..54a0aa49161 100644 --- a/flexible/cron/src/main/java/com/example/cron/CronServlet.java +++ b/flexible/java-runtime/samples/cron/src/main/java/com/example/flexible/cron/CronServlet.java @@ -14,18 +14,17 @@ * limitations under the License. */ -package com.example.cron; +package com.example.flexible.cron; import java.io.IOException; import java.io.PrintWriter; - import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; // [START example] -@WebServlet(name = "cron", value = "/cron") +@WebServlet(name = "cron", value = {"/cron.html"}) @SuppressWarnings("serial") public class CronServlet extends HttpServlet { diff --git a/flexible/datastore/pom.xml b/flexible/java-runtime/samples/datastore/pom.xml similarity index 94% rename from flexible/datastore/pom.xml rename to flexible/java-runtime/samples/datastore/pom.xml index 3046d50d48e..4bc455b131a 100644 --- a/flexible/datastore/pom.xml +++ b/flexible/java-runtime/samples/datastore/pom.xml @@ -21,10 +21,10 @@ flexible-datastore - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/java-runtime/samples/datastore/src/main/appengine/app.yaml b/flexible/java-runtime/samples/datastore/src/main/appengine/app.yaml new file mode 100644 index 00000000000..747f54080db --- /dev/null +++ b/flexible/java-runtime/samples/datastore/src/main/appengine/app.yaml @@ -0,0 +1,20 @@ +# Copyright 2017 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. +# + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored \ No newline at end of file diff --git a/flexible/datastore/src/main/java/com/example/datastore/DatastoreServlet.java b/flexible/java-runtime/samples/datastore/src/main/java/com/example/flexible/datastore/DatastoreServlet.java similarity index 96% rename from flexible/datastore/src/main/java/com/example/datastore/DatastoreServlet.java rename to flexible/java-runtime/samples/datastore/src/main/java/com/example/flexible/datastore/DatastoreServlet.java index e4c02b338a2..93d48803f54 100644 --- a/flexible/datastore/src/main/java/com/example/datastore/DatastoreServlet.java +++ b/flexible/java-runtime/samples/datastore/src/main/java/com/example/flexible/datastore/DatastoreServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.managedvms.datastore; +package com.example.flexible.datastore; import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreOptions; @@ -32,16 +32,16 @@ import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + // [START example] @SuppressWarnings("serial") -@WebServlet(name = "datastore", value = "") +@WebServlet(name = "Datastore Sample", value = {"/datastore.html"}) public class DatastoreServlet extends HttpServlet { @Override diff --git a/flexible/disk/pom.xml b/flexible/java-runtime/samples/disk/pom.xml similarity index 93% rename from flexible/disk/pom.xml rename to flexible/java-runtime/samples/disk/pom.xml index ba69f28749c..8e862f08876 100644 --- a/flexible/disk/pom.xml +++ b/flexible/java-runtime/samples/disk/pom.xml @@ -4,7 +4,6 @@ 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 @@ -21,10 +20,10 @@ flexible-disk - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/datastore/src/main/appengine/app.yaml b/flexible/java-runtime/samples/disk/src/main/appengine/app.yaml similarity index 99% rename from flexible/datastore/src/main/appengine/app.yaml rename to flexible/java-runtime/samples/disk/src/main/appengine/app.yaml index da7604717b7..a5b26773008 100644 --- a/flexible/datastore/src/main/appengine/app.yaml +++ b/flexible/java-runtime/samples/disk/src/main/appengine/app.yaml @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - runtime: java env: flex diff --git a/flexible/disk/src/main/java/com/example/disk/DiskServlet.java b/flexible/java-runtime/samples/disk/src/main/java/com/example/flexible/java/disk/DiskServlet.java similarity index 96% rename from flexible/disk/src/main/java/com/example/disk/DiskServlet.java rename to flexible/java-runtime/samples/disk/src/main/java/com/example/flexible/java/disk/DiskServlet.java index 5434063c309..a061c5574db 100644 --- a/flexible/disk/src/main/java/com/example/disk/DiskServlet.java +++ b/flexible/java-runtime/samples/disk/src/main/java/com/example/flexible/java/disk/DiskServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.disk; +package com.example.flexible.disk; import java.io.IOException; import java.io.PrintWriter; @@ -27,7 +27,6 @@ import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.List; - import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -35,7 +34,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "disk", value = "") +@WebServlet(name = "Read/Write to disk", value = {"/disk.html"}) public class DiskServlet extends HttpServlet { @Override diff --git a/flexible/java-runtime/samples/index.jsp b/flexible/java-runtime/samples/index.jsp new file mode 100644 index 00000000000..28a870c40a7 --- /dev/null +++ b/flexible/java-runtime/samples/index.jsp @@ -0,0 +1,54 @@ +<%@ page import="java.util.Arrays" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Map" %> +<%@ page import="java.util.HashSet" %> +<%@ page import="java.util.Set" %> +<%@ page import="java.lang.StringBuilder" %> + + + GAE Flex Samples + + +
    + <%! static final Set ignorePatterns = new HashSet<>(); + static { + ignorePatterns.addAll(Arrays.asList("jsp", "default", "cron")); + } + %> + + <%! List getSamples(HttpServletRequest request) { + List samplesList = new ArrayList<>(); + StringBuilder sb = new StringBuilder(); + Map servletRegistrations = + request.getServletContext().getServletRegistrations(); + for (Map.Entry registrationEntry : + servletRegistrations.entrySet()) { + if (!ignorePatterns.contains(registrationEntry.getKey())) { + for (String mapping : registrationEntry.getValue().getMappings()) { + sb.append(""); + sb.append(registrationEntry.getKey()); + sb.append(""); + samplesList.add(sb.toString()); + sb.setLength(0); + } + } + } + return samplesList; + } %> + <% + for (String sample : getSamples(request)) { + %> +
  • <%= sample %> +
  • + <% + } + %> +
+ + diff --git a/flexible/mailgun/pom.xml b/flexible/java-runtime/samples/mailgun/pom.xml similarity index 95% rename from flexible/mailgun/pom.xml rename to flexible/java-runtime/samples/mailgun/pom.xml index d624b1ca4c9..2dc7a5cf18e 100644 --- a/flexible/mailgun/pom.xml +++ b/flexible/java-runtime/samples/mailgun/pom.xml @@ -4,7 +4,6 @@ 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 @@ -21,10 +20,10 @@ mailgun - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/java-runtime/samples/mailgun/src/main/appengine/app.yaml b/flexible/java-runtime/samples/mailgun/src/main/appengine/app.yaml new file mode 100644 index 00000000000..76362dc5163 --- /dev/null +++ b/flexible/java-runtime/samples/mailgun/src/main/appengine/app.yaml @@ -0,0 +1,25 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + MAILGUN_DOMAIN_NAME: YOUR-MAILGUN-DOMAIN-NAME + MAILGUN_API_KEY: YOUR-MAILGUN-API-KEY +# [END env_variables] \ No newline at end of file diff --git a/flexible/mailgun/src/main/java/com/example/mailgun/MailgunServlet.java b/flexible/java-runtime/samples/mailgun/src/main/java/com/example/flexible/mailgun/MailgunServlet.java similarity index 96% rename from flexible/mailgun/src/main/java/com/example/mailgun/MailgunServlet.java rename to flexible/java-runtime/samples/mailgun/src/main/java/com/example/flexible/mailgun/MailgunServlet.java index d5845190013..267322b3c26 100644 --- a/flexible/mailgun/src/main/java/com/example/mailgun/MailgunServlet.java +++ b/flexible/java-runtime/samples/mailgun/src/main/java/com/example/flexible/mailgun/MailgunServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.mailgun; +package com.example.flexible.mailgun; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; @@ -26,7 +26,6 @@ import java.io.File; import java.io.IOException; - import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -35,7 +34,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "mailgun", value = "/send/email") +@WebServlet(name = "Send an email using MailGun", value = {"/mailgun/email/send"}) public class MailgunServlet extends HttpServlet { private static final String MAILGUN_DOMAIN_NAME = System.getenv("MAILGUN_DOMAIN_NAME"); diff --git a/flexible/mailgun/src/main/webapp/index.html b/flexible/java-runtime/samples/mailgun/src/main/webapp/mailgun/email/send.html similarity index 87% rename from flexible/mailgun/src/main/webapp/index.html rename to flexible/java-runtime/samples/mailgun/src/main/webapp/mailgun/email/send.html index 96d9a88b936..804030b7955 100644 --- a/flexible/mailgun/src/main/webapp/index.html +++ b/flexible/java-runtime/samples/mailgun/src/main/webapp/mailgun/email/send.html @@ -5,7 +5,7 @@ -
+ diff --git a/flexible/mailjet/pom.xml b/flexible/java-runtime/samples/mailjet/pom.xml similarity index 92% rename from flexible/mailjet/pom.xml rename to flexible/java-runtime/samples/mailjet/pom.xml index a12be479917..39fcdd61837 100644 --- a/flexible/mailjet/pom.xml +++ b/flexible/java-runtime/samples/mailjet/pom.xml @@ -4,9 +4,7 @@ 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. @@ -21,10 +19,10 @@ mailjet - com.google.cloud - doc-samples + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. @@ -35,8 +33,9 @@ 9.3.8.v20160314 false - + 4.0.5 + diff --git a/flexible/java-runtime/samples/mailjet/src/main/appengine/app.yaml b/flexible/java-runtime/samples/mailjet/src/main/appengine/app.yaml new file mode 100644 index 00000000000..62cc70ec004 --- /dev/null +++ b/flexible/java-runtime/samples/mailjet/src/main/appengine/app.yaml @@ -0,0 +1,25 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + MAILJET_API_KEY: YOUR-MAILJET-API-KEY + MAILJET_SECRET_KEY: YOUR-MAILJET-SECRET-KEY +# [END env_variables] \ No newline at end of file diff --git a/flexible/mailjet/src/main/java/com/example/mailjet/MailjetServlet.java b/flexible/java-runtime/samples/mailjet/src/main/java/com/example/flexible/mailjet/MailjetServlet.java similarity index 95% rename from flexible/mailjet/src/main/java/com/example/mailjet/MailjetServlet.java rename to flexible/java-runtime/samples/mailjet/src/main/java/com/example/flexible/mailjet/MailjetServlet.java index 72efc229545..e43a11d4353 100644 --- a/flexible/mailjet/src/main/java/com/example/mailjet/MailjetServlet.java +++ b/flexible/java-runtime/samples/mailjet/src/main/java/com/example/flexible/mailjet/MailjetServlet.java @@ -15,7 +15,7 @@ */ // [START mailjet_imports] -package com.example.mailjet; +package com.example.flexible.mailjet; import com.mailjet.client.MailjetClient; import com.mailjet.client.MailjetRequest; @@ -24,7 +24,6 @@ import com.mailjet.client.errors.MailjetSocketTimeoutException; import com.mailjet.client.resource.Email; // [END mailjet_imports] - import org.json.JSONArray; import org.json.JSONObject; @@ -38,7 +37,7 @@ // [START app] @SuppressWarnings("serial") -@WebServlet(name = "mailjet", value = "/send/email") +@WebServlet(name = "Send an email using MailJet", value = {"/mailjet/email/send"}) public class MailjetServlet extends HttpServlet { private static final String MAILJET_API_KEY = System.getenv("MAILJET_API_KEY"); private static final String MAILJET_SECRET_KEY = System.getenv("MAILJET_SECRET_KEY"); diff --git a/flexible/java-runtime/samples/mailjet/src/main/webapp/mailjet/email/send.html b/flexible/java-runtime/samples/mailjet/src/main/webapp/mailjet/email/send.html new file mode 100644 index 00000000000..b9ed81cc177 --- /dev/null +++ b/flexible/java-runtime/samples/mailjet/src/main/webapp/mailjet/email/send.html @@ -0,0 +1,15 @@ + + + Mailgun on Google App Engine Flexible + + + + + + + + + + + + diff --git a/flexible/memcache/pom.xml b/flexible/java-runtime/samples/memcache/pom.xml similarity index 94% rename from flexible/memcache/pom.xml rename to flexible/java-runtime/samples/memcache/pom.xml index 4da8e2ca533..05f8021be6f 100644 --- a/flexible/memcache/pom.xml +++ b/flexible/java-runtime/samples/memcache/pom.xml @@ -4,7 +4,6 @@ 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 @@ -21,12 +20,13 @@ memcache - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. + 1.8 1.8 diff --git a/flexible/java-runtime/samples/memcache/src/main/appengine/app.yaml b/flexible/java-runtime/samples/memcache/src/main/appengine/app.yaml new file mode 100644 index 00000000000..44db2adaa10 --- /dev/null +++ b/flexible/java-runtime/samples/memcache/src/main/appengine/app.yaml @@ -0,0 +1,24 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START config] +beta_settings: + use_memcache_proxy: true +# [END config] \ No newline at end of file diff --git a/flexible/memcache/src/main/java/com/example/memcache/MemcacheServlet.java b/flexible/java-runtime/samples/memcache/src/main/java/com/example/memcache/MemcacheServlet.java similarity index 84% rename from flexible/memcache/src/main/java/com/example/memcache/MemcacheServlet.java rename to flexible/java-runtime/samples/memcache/src/main/java/com/example/memcache/MemcacheServlet.java index 4621d91f3ca..66dd9f54a54 100644 --- a/flexible/memcache/src/main/java/com/example/memcache/MemcacheServlet.java +++ b/flexible/java-runtime/samples/memcache/src/main/java/com/example/memcache/MemcacheServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.memcache; +package com.example.flexible.memcache; import net.rubyeye.xmemcached.MemcachedClient; import net.rubyeye.xmemcached.MemcachedClientBuilder; @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.concurrent.TimeoutException; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -33,18 +32,20 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "memcache", value = "") +@WebServlet(name = "Memcache sample", value = {"/memcache.html"}) public class MemcacheServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { - String addr = - System.getenv().containsKey("GAE_MEMCACHE_HOST") - ? System.getenv("GAE_MEMCACHE_HOST") : "localhost"; - String port = - System.getenv().containsKey("GAE_MEMCACHE_HOST") - ? System.getenv("GAE_MEMCACHE_PORT") : "11211"; + String addr = System.getenv("GAE_MEMCACHE_HOST"); + String port = System.getenv("GAE_MEMCACHE_PORT"); + if (addr == null) { + addr = "localhost"; + } + if (port == null) { + port = "11211"; + } String key = "count"; MemcachedClientBuilder builder = new XMemcachedClientBuilder( AddrUtil.getAddresses(addr + ":" + port)); diff --git a/flexible/java-runtime/samples/pom-base.xml b/flexible/java-runtime/samples/pom-base.xml new file mode 100644 index 00000000000..d8348a52905 --- /dev/null +++ b/flexible/java-runtime/samples/pom-base.xml @@ -0,0 +1,131 @@ + + + 4.0.0 + jar + 1.0-SNAPSHOT + com.example + flex-java-runtime-samples + + + com.example.flexible + flex-java-runtime-samples-pom + 1.0-SNAPSHOT + .. + + + + 1.8 + 1.8 + false + + + + + + ${project.basedir}/../target/${project.build.finalName}/WEB-INF/classes + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-source + generate-sources + + add-source + + + + + + + + + + add-test-source + generate-test-sources + + add-test-source + + + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-artifact + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + + + ${project.parent.build.directory} + + + + + + + + src/main/resources + true + + + + + + + org.apache.httpcomponents + httpclient + 4.5.3 + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + + + junit + junit + 4.12 + test + + + + diff --git a/flexible/java-runtime/samples/pom.xml b/flexible/java-runtime/samples/pom.xml new file mode 100644 index 00000000000..b9540baa6a6 --- /dev/null +++ b/flexible/java-runtime/samples/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + 1.0-SNAPSHOT + com.example.flexible + flex-java-runtime-samples-pom + pom + + + com.example.flexible + flex-docs-samples + 1.0.0 + ../.. + + + + 1.8 + 1.8 + 1.0.0 + 9.3.8.v20160314 + all + + + + samples-builder + + + + + + ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + + + maven-clean-plugin + 3.0.0 + + false + + + ${basedir}/samples-runner + + + ${basedir}/src/main/appengine + + + ${basedir}/src/main/webapp + + + ${basedir}/src/main/resources + + + + + + com.google.cloud.tools + appengine-maven-plugin + ${appengine.maven.plugin} + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.maven.plugin} + + + + + + junit + junit + 4.12 + test + + + \ No newline at end of file diff --git a/flexible/pubsub/README.md b/flexible/java-runtime/samples/pubsub/README.md similarity index 93% rename from flexible/pubsub/README.md rename to flexible/java-runtime/samples/pubsub/README.md index a1706e14aad..56bdb55ef63 100644 --- a/flexible/pubsub/README.md +++ b/flexible/java-runtime/samples/pubsub/README.md @@ -30,7 +30,7 @@ gcloud beta pubsub subscriptions create \ ## Run Set the following environment variables and run using shown Maven command. You can then -direct your browser to `http://localhost:8080/` +direct your browser to `http://localhost:8080/pubsub` ``` export PUBSUB_TOPIC= @@ -56,4 +56,4 @@ mvn appengine:deploy ``` The home page of this application provides a form to publish messages and also provides a view of the most recent messages -received over the push endpoint and persisted in storage. \ No newline at end of file +received over the push endpoint and persisted in storage. diff --git a/flexible/pubsub/pom.xml b/flexible/java-runtime/samples/pubsub/pom.xml similarity index 96% rename from flexible/pubsub/pom.xml rename to flexible/java-runtime/samples/pubsub/pom.xml index c0ec8748ab8..d8944806337 100644 --- a/flexible/pubsub/pom.xml +++ b/flexible/java-runtime/samples/pubsub/pom.xml @@ -22,10 +22,10 @@ flexible-pubsub - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/pubsub/sample_message.json b/flexible/java-runtime/samples/pubsub/sample_message.json similarity index 100% rename from flexible/pubsub/sample_message.json rename to flexible/java-runtime/samples/pubsub/sample_message.json diff --git a/flexible/pubsub/src/main/appengine/app.yaml b/flexible/java-runtime/samples/pubsub/src/main/appengine/app.yaml similarity index 100% rename from flexible/pubsub/src/main/appengine/app.yaml rename to flexible/java-runtime/samples/pubsub/src/main/appengine/app.yaml diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/Message.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/Message.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/Message.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/Message.java diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepository.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepository.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepository.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepository.java diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepositoryImpl.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepositoryImpl.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepositoryImpl.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/MessageRepositoryImpl.java diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubHome.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubHome.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubHome.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubHome.java diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPublish.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPublish.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPublish.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPublish.java diff --git a/flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPush.java b/flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPush.java similarity index 100% rename from flexible/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPush.java rename to flexible/java-runtime/samples/pubsub/src/main/java/com/example/flexible/pubsub/PubSubPush.java diff --git a/flexible/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPublishTest.java b/flexible/java-runtime/samples/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPublishTest.java similarity index 100% rename from flexible/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPublishTest.java rename to flexible/java-runtime/samples/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPublishTest.java diff --git a/flexible/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPushTest.java b/flexible/java-runtime/samples/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPushTest.java similarity index 100% rename from flexible/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPushTest.java rename to flexible/java-runtime/samples/pubsub/src/main/test/com/example/flexible/pubsub/PubSubPushTest.java diff --git a/flexible/pubsub/src/main/webapp/index.jsp b/flexible/java-runtime/samples/pubsub/src/main/webapp/pubsub/index.jsp similarity index 100% rename from flexible/pubsub/src/main/webapp/index.jsp rename to flexible/java-runtime/samples/pubsub/src/main/webapp/pubsub/index.jsp diff --git a/flexible/java-runtime/samples/samples-builder/README.md b/flexible/java-runtime/samples/samples-builder/README.md new file mode 100644 index 00000000000..73be2870ee0 --- /dev/null +++ b/flexible/java-runtime/samples/samples-builder/README.md @@ -0,0 +1,9 @@ +# Samples Builder + +Creates a single deployable Flex application from Flex sample applications under +[samples-source](../samples-source). + +# Run +`mvn package` creates the single Flex application under [samples](..). +Packages included in the application can be configured using `flexible.samples` property +in the parent [pom.xml](../pom.xml) diff --git a/flexible/java-runtime/samples/samples-builder/pom.xml b/flexible/java-runtime/samples/samples-builder/pom.xml new file mode 100644 index 00000000000..08350e04098 --- /dev/null +++ b/flexible/java-runtime/samples/samples-builder/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + flex-java-runtime-samples-builder + 1.0-SNAPSHOT + jar + + + com.example.flexible + flex-java-runtime-samples-pom + 1.0-SNAPSHOT + .. + + + + 1.8 + 1.8 + ${project.parent.basedir}/samples-runner + + + + + org.yaml + snakeyaml + 1.18 + + + commons-io + commons-io + 2.5 + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + build-samples + compile + + java + + false + + com.example.flexible.base.SamplesBuilder + + + ${project.basedir}/.. + + + ${flexible.samples} + + + + + + compile-samples + package + + exec + + false + + ${samples-output.dir} + mvn + + + package + + + + + + verify-samples + verify + + exec + + false + + ${samples-output.dir} + mvn + + + verify + + + + + + + + + diff --git a/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/MergeYaml.java b/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/MergeYaml.java new file mode 100644 index 00000000000..279fbca990c --- /dev/null +++ b/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/MergeYaml.java @@ -0,0 +1,142 @@ +/** + * Copyright 2017 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.example.flexible.base; + +import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.nodes.Tag; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +class MergeYaml { + + Yaml yaml; + + MergeYaml() { + this.yaml = new Yaml(); + } + + @SuppressWarnings("unchecked") + public void merge(Map mergedResult, List files) throws IOException { + for (File file : files) { + if (file.isDirectory() && file.listFiles() != null) { + merge(mergedResult, Arrays.asList(file.listFiles())); + return; + } + InputStream in = null; + try { + in = new FileInputStream(file); + + final Map yamlContents = (Map) yaml.load(in); + + merge(mergedResult, yamlContents); + + } catch (IOException e) { + // ignore + } finally { + if (in != null) { + in.close(); + } + } + } + } + + @SuppressWarnings("unchecked") + private void merge(Map mergedResult, Map yamlContents) { + if (yamlContents == null) { + return; + } + + for (String key : yamlContents.keySet()) { + Object yamlValue = yamlContents.get(key); + if (yamlValue == null) { + addToMergedResult(mergedResult, key, yamlValue); + continue; + } + + Object existingValue = mergedResult.get(key); + if (existingValue != null) { + if (yamlValue instanceof Map) { + if (existingValue instanceof Map) { + merge((Map) existingValue, (Map) yamlValue); + } else if (existingValue instanceof String) { + throw new IllegalArgumentException( + "Cannot flexible.base complex element into a simple element: " + key); + } else { + throw unknownValueType(key, yamlValue); + } + } else if (yamlValue instanceof List) { + mergeLists(mergedResult, key, yamlValue); + + } else if (yamlValue instanceof String + || yamlValue instanceof Boolean + || yamlValue instanceof Double + || yamlValue instanceof Integer) { + addToMergedResult(mergedResult, key, yamlValue); + + } else { + throw unknownValueType(key, yamlValue); + } + + } else { + if (yamlValue instanceof Map + || yamlValue instanceof List + || yamlValue instanceof String + || yamlValue instanceof Boolean + || yamlValue instanceof Integer + || yamlValue instanceof Double) { + addToMergedResult(mergedResult, key, yamlValue); + } else { + throw unknownValueType(key, yamlValue); + } + } + } + } + + private IllegalArgumentException unknownValueType(String key, Object yamlValue) { + final String msg = + "Cannot flexible.base element of unknown type: " + key + ": " + yamlValue.getClass() + .getName(); + return new IllegalArgumentException(msg); + } + + private Object addToMergedResult(Map mergedResult, String key, Object yamlValue) { + return mergedResult.put(key, yamlValue); + } + + @SuppressWarnings("unchecked") + private void mergeLists(Map mergedResult, String key, Object yamlValue) { + if (!(yamlValue instanceof List && mergedResult.get(key) instanceof List)) { + throw new IllegalArgumentException("Cannot base a list with a non-list: " + key); + } + List originalList = (List) mergedResult.get(key); + originalList.addAll((List) yamlValue); + mergedResult.put(key, originalList.stream().distinct().collect(Collectors.toList())); + } + + public String getYaml(Map mergedResult) { + return yaml.dumpAs(mergedResult, Tag.MAP, DumperOptions.FlowStyle.BLOCK); + } +} + diff --git a/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/SamplesBuilder.java b/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/SamplesBuilder.java new file mode 100644 index 00000000000..8e7bc45949d --- /dev/null +++ b/flexible/java-runtime/samples/samples-builder/src/main/java/com/example/flexible/base/SamplesBuilder.java @@ -0,0 +1,232 @@ +/** + * Copyright 2017 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.example.flexible.base; + +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +class SamplesBuilder { + + private final MergeYaml mergeYaml; + private final String sourcePath; + private final String destinationPath; + private final String basePath; + private final String[] packageNames; + private final String appYamlFile = "app.yaml"; + private final String cronYamlFile = "cron.yaml"; + + private SamplesBuilder(String basePath, String[] packageNames) + throws Exception { + this.mergeYaml = new MergeYaml(); + this.basePath = basePath; + this.sourcePath = basePath; + this.destinationPath = basePath + "/samples-runner"; + this.packageNames = packageNames; + } + + private void mergeAndWriteAppYaml() throws Exception { + List appEngineFiles = new ArrayList<>(); + List cronFiles = new ArrayList<>(); + for (String packageName : packageNames) { + appEngineFiles.add( + new File(sourcePath + "/" + packageName + "/src/main/appengine/" + appYamlFile)); + cronFiles.add( + new File(sourcePath + "/" + packageName + "/src/main/appengine/" + cronYamlFile)); + + } + Map mergedResult = new LinkedHashMap<>(); + mergeYaml.merge(mergedResult, appEngineFiles); + if (mergedResult.size() > 0) { + write(mergedResult, appYamlFile); + } + + mergedResult.clear(); + mergeYaml.merge(mergedResult, cronFiles); + if (mergedResult.size() > 0) { + write(mergedResult, cronYamlFile); + } + } + + private List read(String fileName) throws IOException { + return Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8); + } + + private List extractBlock(String packageName, List lines, String blockName) + throws IllegalArgumentException { + boolean inBlock = false; + List block = new LinkedList<>(); + for (String line : lines) { + if (inBlock) { + if (line.contains("END " + blockName)) { + inBlock = false; + break; + } + block.add(line); + } + if (line.contains("START " + blockName)) { + inBlock = true; + } + } + + if (inBlock) { + throw new IllegalArgumentException(blockName + " not closed in " + packageName + " pom.xml"); + } + if (block.size() > 0) { + String indent = " "; + block.add(0, indent + ""); + block.add(indent + ""); + } + return block; + } + + private void parsePom(String packageName, List properties, List dependencies) + throws IllegalArgumentException, IOException { + List pom = read(sourcePath + "/" + packageName + "/pom.xml"); + properties.addAll(extractBlock(packageName, pom, "properties")); + dependencies.addAll(extractBlock(packageName, pom, "dependencies")); + } + + private void copyFile(String fileName) throws IOException { + FileUtils.copyFile(new File(sourcePath + "/" + fileName), + new File(basePath + "/" + fileName)); + } + + private void copyPackageFiles(String path) { + for (String packageName : packageNames) { + try { + FileUtils.copyDirectory( + new File(sourcePath + "/" + packageName + "/" + path + "/" + packageName), + new File(basePath + "/" + path + "/" + packageName)); + } catch (IOException e) { + // ignore if no directory exists + } + } + } + + private void addToPom(List pom, String blockTag, List lines) throws Exception { + int i; + String blockName = "[START " + blockTag + "]"; + for (i = 0; i < pom.size(); i++) { + if (pom.get(i).contains(blockName)) { + break; + } + } + if (i == pom.size()) { + throw new Exception(blockName + " block not found"); + } + + pom.addAll(i + 1, lines); + } + + private void generatePom() throws Exception { + List pom = read(sourcePath + "/pom-base.xml"); + List dependencies = new ArrayList<>(); + List properties = new ArrayList<>(); + List sourceDirs = new ArrayList<>(); + List testSourceDirs = new ArrayList<>(); + for (String packageName : packageNames) { + parsePom(packageName, properties, dependencies); + sourceDirs.add(" " + sourcePath + "/" + packageName + "/src/main/java" + ""); + testSourceDirs.add( + "" + sourcePath + "/" + packageName + "/src/main/test" + ""); + } + addToPom(pom, "properties", properties); + addToPom(pom, "dependencies", dependencies); + addToPom(pom, "source-dirs", sourceDirs); + addToPom(pom, "test-source-dirs", testSourceDirs); + write(pom, destinationPath + "/pom.xml"); + } + + private void write(List lines, String fileName) throws Exception { + File outputFile = new File(fileName); + outputFile.getParentFile().mkdirs(); + PrintWriter pw = new PrintWriter(new PrintWriter(fileName)); + for (String line : lines) { + pw.write(line); + pw.write("\n"); + } + pw.close(); + } + + private void write(Map mergedResult, String outputFileName) { + String yamlOutput = mergeYaml.getYaml(mergedResult); + PrintWriter writer = null; + File outputFile = new File( + basePath + "/src/main/appengine/" + outputFileName); + outputFile.getParentFile().mkdirs(); + try { + writer = new PrintWriter(outputFile, "UTF-8"); + writer.write(yamlOutput); + } catch (Exception e) { + System.err.println("Error writing to output file : " + e.getMessage()); + } finally { + if (writer != null) { + writer.close(); + } + } + } + + private static String[] getAllDirectories(String path) { + File[] files = new File(path).listFiles(); + List fileNamesList = Arrays.stream(files) + .filter(File::isDirectory) + .filter(x -> !x.getName().equals("samples-runner") + && !x.getName().equals("samples-builder") + && !x.getName().equals("src") + && !x.getName().equals("target")) + .map(File::getName) + .collect(Collectors.toList()); + String[] fileNames = new String[fileNamesList.size()]; + fileNamesList.toArray(fileNames); + return fileNames; + } + + public static void main(String[] args) throws Exception { + System.out.println(args[0]); + String baseDir = args[0]; + String[] packageNames; + if (args[1] == null || args[1].equals("all")) { + packageNames = getAllDirectories(args[0]); + } else { + packageNames = args[1].split(","); + } + SamplesBuilder samplesBuilder = new SamplesBuilder(baseDir, packageNames); + System.out.println("Merging app.yaml files"); + samplesBuilder.mergeAndWriteAppYaml(); + + System.out.println("Generating pom.xml"); + samplesBuilder.generatePom(); + + System.out.println("Copying source and webapp files"); + samplesBuilder.copyPackageFiles("src/main/webapp"); + samplesBuilder.copyPackageFiles("src/main/resources"); + } +} + diff --git a/flexible/sendgrid/pom.xml b/flexible/java-runtime/samples/sendgrid/pom.xml similarity index 94% rename from flexible/sendgrid/pom.xml rename to flexible/java-runtime/samples/sendgrid/pom.xml index 1eeea7f01ad..f2c6ceedca1 100644 --- a/flexible/sendgrid/pom.xml +++ b/flexible/java-runtime/samples/sendgrid/pom.xml @@ -4,7 +4,6 @@ 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 @@ -21,10 +20,10 @@ managed-vms-sendgrid - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/java-runtime/samples/sendgrid/src/main/appengine/app.yaml b/flexible/java-runtime/samples/sendgrid/src/main/appengine/app.yaml new file mode 100644 index 00000000000..697c75d682c --- /dev/null +++ b/flexible/java-runtime/samples/sendgrid/src/main/appengine/app.yaml @@ -0,0 +1,25 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + SENDGRID_API_KEY: YOUR-SENDGRID-API-KEY + SENDGRID_SENDER: YOUR-SENDGRID-SENDER +# [END env_variables] \ No newline at end of file diff --git a/flexible/sendgrid/src/main/java/com/example/sendgrid/SendEmailServlet.java b/flexible/java-runtime/samples/sendgrid/src/main/java/sendgrid/SendEmailServlet.java similarity index 94% rename from flexible/sendgrid/src/main/java/com/example/sendgrid/SendEmailServlet.java rename to flexible/java-runtime/samples/sendgrid/src/main/java/sendgrid/SendEmailServlet.java index cc8e0bdf1cb..a3a18ccd1d9 100644 --- a/flexible/sendgrid/src/main/java/com/example/sendgrid/SendEmailServlet.java +++ b/flexible/java-runtime/samples/sendgrid/src/main/java/sendgrid/SendEmailServlet.java @@ -14,13 +14,12 @@ * limitations under the License. */ -package com.example.sendgrid; +package com.example.flexible.sendgrid; import com.sendgrid.SendGrid; import com.sendgrid.SendGridException; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -29,7 +28,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "sendemail", value = "/send/email") +@WebServlet(name = "Send an email using SendGrid", value = {"/sendgrid/email/send"}) public class SendEmailServlet extends HttpServlet { @Override diff --git a/flexible/mailgun/src/main/resources/example-attachment.txt b/flexible/java-runtime/samples/sendgrid/src/main/resources/sendgrid/example-attachment.txt similarity index 100% rename from flexible/mailgun/src/main/resources/example-attachment.txt rename to flexible/java-runtime/samples/sendgrid/src/main/resources/sendgrid/example-attachment.txt diff --git a/flexible/java-runtime/samples/sendgrid/src/main/webapp/sendgrid/email/send.html b/flexible/java-runtime/samples/sendgrid/src/main/webapp/sendgrid/email/send.html new file mode 100644 index 00000000000..c34b890ae67 --- /dev/null +++ b/flexible/java-runtime/samples/sendgrid/src/main/webapp/sendgrid/email/send.html @@ -0,0 +1,10 @@ + +Send an email using SendGrid + +
+

Enter an email address :

+ + +
+ + diff --git a/flexible/static-files/pom.xml b/flexible/java-runtime/samples/static/pom.xml similarity index 93% rename from flexible/static-files/pom.xml rename to flexible/java-runtime/samples/static/pom.xml index 93cb679f1f1..7112ee62bdb 100644 --- a/flexible/static-files/pom.xml +++ b/flexible/java-runtime/samples/static/pom.xml @@ -3,8 +3,8 @@ 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 + 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 @@ -21,10 +21,10 @@ staticfiles - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/java-runtime/samples/static/src/main/appengine/app.yaml b/flexible/java-runtime/samples/static/src/main/appengine/app.yaml new file mode 100644 index 00000000000..fe0169ff7bc --- /dev/null +++ b/flexible/java-runtime/samples/static/src/main/appengine/app.yaml @@ -0,0 +1,19 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored \ No newline at end of file diff --git a/flexible/java-runtime/samples/static/src/main/webapp/static/index.html b/flexible/java-runtime/samples/static/src/main/webapp/static/index.html new file mode 100644 index 00000000000..76f59e86158 --- /dev/null +++ b/flexible/java-runtime/samples/static/src/main/webapp/static/index.html @@ -0,0 +1,10 @@ + + + + Static Files + + + +

This is a static file serving example.

+ + diff --git a/flexible/static-files/src/main/webapp/stylesheets/styles.css b/flexible/java-runtime/samples/static/src/main/webapp/static/stylesheets/styles.css similarity index 100% rename from flexible/static-files/src/main/webapp/stylesheets/styles.css rename to flexible/java-runtime/samples/static/src/main/webapp/static/stylesheets/styles.css diff --git a/flexible/twilio/pom.xml b/flexible/java-runtime/samples/twilio/pom.xml similarity index 94% rename from flexible/twilio/pom.xml rename to flexible/java-runtime/samples/twilio/pom.xml index 22c92770a78..06f9fcf8533 100644 --- a/flexible/twilio/pom.xml +++ b/flexible/java-runtime/samples/twilio/pom.xml @@ -4,7 +4,6 @@ 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 @@ -21,10 +20,10 @@ twilio - doc-samples - com.google.cloud + com.example.flexible + flex-docs-samples 1.0.0 - ../.. + ../../.. diff --git a/flexible/java-runtime/samples/twilio/src/main/appengine/app.yaml b/flexible/java-runtime/samples/twilio/src/main/appengine/app.yaml new file mode 100644 index 00000000000..d4235a4be35 --- /dev/null +++ b/flexible/java-runtime/samples/twilio/src/main/appengine/app.yaml @@ -0,0 +1,26 @@ +# Copyright 2016 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: java +env: flex + +handlers: +- url: /.* + script: this field is required, but ignored + +# [START env_variables] +env_variables: + TWILIO_ACCOUNT_SID: YOUR-TWILIO-ACCOUNT-SID + TWILIO_AUTH_TOKEN: YOUR-TWILIO-AUTH-TOKEN + TWILIO_NUMBER: YOUR-TWILIO-NUMBER +# [END env_variables] \ No newline at end of file diff --git a/flexible/twilio/src/main/java/com/example/twilio/ReceiveCallServlet.java b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveCallServlet.java similarity index 93% rename from flexible/twilio/src/main/java/com/example/twilio/ReceiveCallServlet.java rename to flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveCallServlet.java index 83c099cda42..b01f7d9b19d 100644 --- a/flexible/twilio/src/main/java/com/example/twilio/ReceiveCallServlet.java +++ b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveCallServlet.java @@ -14,14 +14,13 @@ * limitations under the License. */ -package com.example.twilio; +package com.example.flexible.twilio; import com.twilio.sdk.verbs.Say; import com.twilio.sdk.verbs.TwiMLException; import com.twilio.sdk.verbs.TwiMLResponse; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -30,7 +29,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "receivecall", value = "/call/receive") +@WebServlet(name = "Receive a call", value = {"/twilio/call/receive.html"}) public class ReceiveCallServlet extends HttpServlet { @Override diff --git a/flexible/twilio/src/main/java/com/example/twilio/ReceiveSmsServlet.java b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveSmsServlet.java similarity index 94% rename from flexible/twilio/src/main/java/com/example/twilio/ReceiveSmsServlet.java rename to flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveSmsServlet.java index 6868040e7eb..2f44006b727 100644 --- a/flexible/twilio/src/main/java/com/example/twilio/ReceiveSmsServlet.java +++ b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/ReceiveSmsServlet.java @@ -14,14 +14,13 @@ * limitations under the License. */ -package com.example.twilio; +package com.example.flexible.twilio; import com.twilio.sdk.verbs.Message; import com.twilio.sdk.verbs.TwiMLException; import com.twilio.sdk.verbs.TwiMLResponse; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; @@ -30,7 +29,7 @@ // [START example] @SuppressWarnings("serial") -@WebServlet(name = "receivesms", value = "/sms/receive") +@WebServlet(name = "Receive an SMS", value = {"/twilio/sms/receive"}) public class ReceiveSmsServlet extends HttpServlet { @Override diff --git a/flexible/twilio/src/main/java/com/example/twilio/SendSmsServlet.java b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/SendSmsServlet.java similarity index 96% rename from flexible/twilio/src/main/java/com/example/twilio/SendSmsServlet.java rename to flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/SendSmsServlet.java index 7371124dd8e..c16e317644a 100644 --- a/flexible/twilio/src/main/java/com/example/twilio/SendSmsServlet.java +++ b/flexible/java-runtime/samples/twilio/src/main/java/com/example/flexible/twilio/SendSmsServlet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.twilio; +package com.example.flexible.twilio; import com.twilio.sdk.TwilioRestClient; import com.twilio.sdk.TwilioRestException; @@ -27,16 +27,16 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; - import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + // [START example] @SuppressWarnings("serial") -@WebServlet(name = "sendsms", value = "/sms/send") +@WebServlet(name = "Send an SMS", value = "/twilio/sms/send") public class SendSmsServlet extends HttpServlet { @Override diff --git a/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/receive.html b/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/receive.html new file mode 100644 index 00000000000..9857afa5982 --- /dev/null +++ b/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/receive.html @@ -0,0 +1,10 @@ + +Twilio Code Samples + +
+

Enter sender's name : +

Enter a message +

+

+ + diff --git a/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/send.html b/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/send.html new file mode 100644 index 00000000000..bf70df438c3 --- /dev/null +++ b/flexible/java-runtime/samples/twilio/src/main/webapp/twilio/sms/send.html @@ -0,0 +1,9 @@ + +Twilio Code Samples + +
+

Enter a name : +

+

+ + diff --git a/flexible/mailgun/README.md b/flexible/mailgun/README.md deleted file mode 100644 index cbd6b6d3460..00000000000 --- a/flexible/mailgun/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Java Mailgun email sample for Google App Engine Managed VMs -This sample demonstrates how to use [Mailgun](https://www.mailgun.com) on [Google App Engine Managed VMs](https://cloud.google.com/appengine). -For more information about Mailgun, see their [documentation](https://documentation.mailgun.com/). - -## Setup -Before you can run or deploy the sample, you will need to do the following: -1. [Create a Mailgun Account](http://www.mailgun.com/google). As of September 2015, Google users start with 30,000 free emails per month. -2. Configure your Mailgun settings in the environment variables section in ``app.yaml``. - -## Running locally -Refer to the [top-level README](../README.md) for instructions on running and deploying. -You can run the application locally and send emails from your local machine. You -will need to set environment variables before starting your application: - $ export MAILGUN_API_KEY=[your-mailgun-api-key] - $ export MAILGUN_DOMAIN_NAME=[your-mailgun-domain-name] - $ mvn clean jetty:run - -## Deployment -update values above in your `src/main/appengine/app.yaml` - - $ mvn clean appengine:deploy diff --git a/flexible/mailgun/src/main/appengine/app.yaml b/flexible/mailgun/src/main/appengine/app.yaml deleted file mode 100644 index 542b11b162f..00000000000 --- a/flexible/mailgun/src/main/appengine/app.yaml +++ /dev/null @@ -1,12 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - MAILGUN_DOMAIN_NAME: YOUR-MAILGUN-DOMAIN-NAME - MAILGUN_API_KEY: YOUR-MAILGUN-API-KEY -# [END env_variables] diff --git a/flexible/mailjet/README.md b/flexible/mailjet/README.md deleted file mode 100644 index 0f51f24cf69..00000000000 --- a/flexible/mailjet/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Mailjet sample for Google Managed VMs -This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google Managed VMs to -send emails from a verified sender you own. - -## Setup -1. Before using, ensure the address you plan to send from has been verified in Mailjet. - -## Running locally - $ export MAILJET_API_KEY=[your mailjet api key] - $ export MAILJET_SECRET_KEY=[your mailjet secret key] - $ mvn clean jetty:run - -## Deploying -1. Edit the environment variables in the app.yaml with the appropriate Mailjet values. - $ mvn clean appengine:deploy diff --git a/flexible/mailjet/src/main/appengine/app.yaml b/flexible/mailjet/src/main/appengine/app.yaml deleted file mode 100644 index a41ea04614a..00000000000 --- a/flexible/mailjet/src/main/appengine/app.yaml +++ /dev/null @@ -1,12 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - MAILJET_API_KEY: YOUR-MAILJET-API-KEY - MAILJET_SECRET_KEY: YOUR-MAILJET-SECRET-KEY -# [END env_variables] diff --git a/flexible/mailjet/src/main/webapp/WEB-INF/lib/client-3.1.1-jar-with-dependencies.jar b/flexible/mailjet/src/main/webapp/WEB-INF/lib/client-3.1.1-jar-with-dependencies.jar deleted file mode 100644 index e3b58094cf6..00000000000 Binary files a/flexible/mailjet/src/main/webapp/WEB-INF/lib/client-3.1.1-jar-with-dependencies.jar and /dev/null differ diff --git a/flexible/mailjet/src/main/webapp/index.html b/flexible/mailjet/src/main/webapp/index.html deleted file mode 100644 index 4827faac07b..00000000000 --- a/flexible/mailjet/src/main/webapp/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Mailgun on Google App Engine Flexible - - - -
- - - -
- - - diff --git a/flexible/memcache/README.md b/flexible/memcache/README.md deleted file mode 100644 index aab8ddf0d2e..00000000000 --- a/flexible/memcache/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# flexible/memcache - -How to use memcache on flexible. - -# NEEDS WORK - -This sample needs to be updated to use redis-memcache diff --git a/flexible/memcache/src/main/appengine/app.yaml b/flexible/memcache/src/main/appengine/app.yaml deleted file mode 100644 index 2bf46125d17..00000000000 --- a/flexible/memcache/src/main/appengine/app.yaml +++ /dev/null @@ -1,11 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START config] -beta_settings: - use_memcache_proxy: true -# [END config] diff --git a/flexible/pom.xml b/flexible/pom.xml new file mode 100644 index 00000000000..4be447ed4b8 --- /dev/null +++ b/flexible/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + com.example.flexible + flex-docs-samples + 1.0.0 + pom + + + + doc-samples + com.google.cloud + 1.0.0 + .. + + + + + custom-runtime/async-rest + custom-runtime/endpoints + custom-runtime/extending-runtime + custom-runtime/sparkjava + java-runtime/samples + + diff --git a/flexible/sendgrid/README.md b/flexible/sendgrid/README.md deleted file mode 100644 index d7786659624..00000000000 --- a/flexible/sendgrid/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Java SendGrid Email Sample for Google App Engine Flexible Environment - -This sample demonstrates how to use [SendGrid](https://www.sendgrid.com) on -[Google App Engine flexible environment][aeflex-docs]. - -See the [sample application documentaion][sample-docs] for more detailed -instructions. - -For more information about SendGrid, see their -[documentation](https://sendgrid.com/docs/User_Guide/index.html). - -[aeflex-docs]: https://cloud.google.com/appengine/docs/flexible/ -[sample-docs]: https://cloud.google.com/appengine/docs/flexible/java/sending-emails-with-sendgrid - -## Setup - -Before you can run or deploy the sample, you will need to do the following: - -1. [Create a SendGrid Account](http://sendgrid.com/partner/google). As of - September 2015, Google users start with 25,000 free emails per month. -1. Configure your SendGrid settings in the environment variables section in - [`src/main/appengine/app.yaml`](src/main/appengine/app.yaml). - -## Running locally - -You can run the application locally and send emails from your local machine. You -will need to set environment variables before starting your application: - - $ export SENDGRID_API_KEY=[your-sendgrid-api-key] - $ export SENDGRID_SENDER=[your-sendgrid-sender-email-address] - $ mvn clean jetty:run diff --git a/flexible/sendgrid/src/main/appengine/app.yaml b/flexible/sendgrid/src/main/appengine/app.yaml deleted file mode 100644 index 0efc5d7b4d2..00000000000 --- a/flexible/sendgrid/src/main/appengine/app.yaml +++ /dev/null @@ -1,12 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - SENDGRID_API_KEY: YOUR-SENDGRID-API-KEY - SENDGRID_SENDER: YOUR-SENDGRID-SENDER -# [END env_variables] diff --git a/flexible/sparkjava/src/main/appengine/app.yaml b/flexible/sparkjava/src/main/appengine/app.yaml deleted file mode 100644 index ce2a124359b..00000000000 --- a/flexible/sparkjava/src/main/appengine/app.yaml +++ /dev/null @@ -1,2 +0,0 @@ -runtime: custom -env: flex diff --git a/flexible/static-files/src/main/appengine/app.yaml b/flexible/static-files/src/main/appengine/app.yaml deleted file mode 100644 index d7890aaff58..00000000000 --- a/flexible/static-files/src/main/appengine/app.yaml +++ /dev/null @@ -1,6 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored diff --git a/flexible/static-files/src/main/webapp/index.html b/flexible/static-files/src/main/webapp/index.html deleted file mode 100644 index d1643e9a6b1..00000000000 --- a/flexible/static-files/src/main/webapp/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - -Static Files - - - -

This is a static file serving example.

- - diff --git a/flexible/twilio/README.md b/flexible/twilio/README.md deleted file mode 100644 index a1234c78af6..00000000000 --- a/flexible/twilio/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Java Twilio Voice and SMS Sample for Google App Engine Flexible Environment - -This sample demonstrates how to use [Twilio](https://www.twilio.com) on [Google -App flexible environment][aeflex-docs]. - -See the [sample application documentaion][sample-docs] for more detailed -instructions. - -For more information about Twilio, see their [Java quickstart -tutorials](https://www.twilio.com/docs/quickstart/java). - -[aeflex-docs]: https://cloud.google.com/appengine/docs/flexible/ -[sample-docs]: https://cloud.google.com/appengine/docs/flexible/java/using-sms-and-voice-services-via-twilio - - -## Setup - -Before you can run or deploy the sample, you will need to do the following: - -1. [Create a Twilio Account](http://ahoy.twilio.com/googlecloudplatform). Google - App Engine customers receive a complimentary credit for SMS messages and - inbound messages. -1. Create a number on twilio, and configure the voice request URL to be - ``https://your-app-id.appspot.com/call/receive`` and the SMS request URL to - be ``https://your-app-id.appspot.com/sms/receive``. -1. Configure your Twilio settings in the environment variables section in - ``src/main/appengine/app.yaml``. - -## Running locally - -You can run the application locally to test the callbacks and SMS sending. You -will need to set environment variables before starting your application: - - $ export TWILIO_ACCOUNT_SID=[your-twilio-accoun-sid] - $ export TWILIO_AUTH_TOKEN=[your-twilio-auth-token] - $ export TWILIO_NUMBER=[your-twilio-number] - $ mvn clean jetty:run diff --git a/flexible/twilio/src/main/appengine/app.yaml b/flexible/twilio/src/main/appengine/app.yaml deleted file mode 100644 index 1ee3836bcef..00000000000 --- a/flexible/twilio/src/main/appengine/app.yaml +++ /dev/null @@ -1,13 +0,0 @@ -runtime: java -env: flex - -handlers: -- url: /.* - script: this field is required, but ignored - -# [START env_variables] -env_variables: - TWILIO_ACCOUNT_SID: YOUR-TWILIO-ACCOUNT-SID - TWILIO_AUTH_TOKEN: YOUR-TWILIO-AUTH-TOKEN - TWILIO_NUMBER: YOUR-TWILIO-NUMBER -# [END env_variables] diff --git a/pom.xml b/pom.xml index cd46ab51242..5cc07f821d9 100644 --- a/pom.xml +++ b/pom.xml @@ -49,23 +49,7 @@ appengine - flexible/analytics - flexible/async-rest - flexible/cloudsql - flexible/cloudstorage - flexible/cron - flexible/datastore - flexible/disk - flexible/extending-runtime - flexible/helloworld - flexible/mailgun - flexible/mailjet - flexible/memcache - flexible/pubsub - flexible/sendgrid - flexible/sparkjava - flexible/static-files - flexible/twilio + flexible bigquery/cloud-client bigquery/rest @@ -75,6 +59,7 @@ compute/sendgrid datastore datastore/cloud-client + kms language/analysis language/cloud-client