[SPLITPREP] rearranged to have structure of new repositories
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/29757eea Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/29757eea Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/29757eea Branch: refs/heads/master Commit: 29757eea4a3e397ac7ae272a22ce62808caf4983 Parents: ba4d990 Author: John McCabe <[email protected]> Authored: Wed Dec 16 11:25:27 2015 +0000 Committer: John McCabe <[email protected]> Committed: Wed Dec 16 20:42:34 2015 +0000 ---------------------------------------------------------------------- brooklyn-dist/.gitattributes | 6 + brooklyn-dist/.gitignore | 32 + brooklyn-dist/LICENSE | 455 ++++ brooklyn-dist/NOTICE | 5 + brooklyn-dist/README.md | 21 + brooklyn-dist/all/pom.xml | 117 + brooklyn-dist/archetypes/quickstart/NOTES.txt | 76 + brooklyn-dist/archetypes/quickstart/pom.xml | 232 ++ .../quickstart/src/brooklyn-sample/README.md | 73 + .../quickstart/src/brooklyn-sample/pom.xml | 102 + .../src/main/assembly/assembly.xml | 88 + .../src/main/assembly/files/README.txt | 96 + .../src/main/assembly/files/conf/logback.xml | 11 + .../src/main/assembly/scripts/start.sh | 40 + .../com/acme/sample/brooklyn/SampleMain.java | 81 + .../app/ClusterWebServerDatabaseSample.java | 137 ++ .../sample/app/SingleWebServerSample.java | 32 + .../src/main/resources/logback-custom.xml | 10 + .../src/main/resources/sample-icon.png | Bin 0 -> 46490 bytes .../main/resources/visitors-creation-script.sql | 35 + .../app/SampleLocalhostIntegrationTest.java | 81 + .../brooklyn/sample/app/SampleUnitTest.java | 69 + .../quickstart/src/main/resources/.gitignore | 1 + .../META-INF/maven/archetype-metadata.xml | 65 + .../projects/integration-test-1/.gitignore | 1 + .../integration-test-1/archetype.properties | 22 + .../projects/integration-test-1/goal.txt | 1 + brooklyn-dist/dist/licensing/.gitignore | 2 + brooklyn-dist/dist/licensing/MAIN_LICENSE_ASL2 | 176 ++ brooklyn-dist/dist/licensing/README.md | 78 + brooklyn-dist/dist/licensing/extras-files | 1 + .../dist/licensing/licenses/binary/ASL2 | 177 ++ .../dist/licensing/licenses/binary/BSD-2-Clause | 23 + .../dist/licensing/licenses/binary/BSD-3-Clause | 27 + .../dist/licensing/licenses/binary/CDDL1 | 381 ++++ .../dist/licensing/licenses/binary/CDDL1.1 | 304 +++ .../dist/licensing/licenses/binary/EPL1 | 212 ++ .../dist/licensing/licenses/binary/MIT | 20 + .../dist/licensing/licenses/binary/WTFPL | 15 + .../dist/licensing/licenses/binary/bouncycastle | 23 + .../dist/licensing/licenses/binary/jtidy | 53 + .../dist/licensing/licenses/binary/jython | 27 + .../licenses/binary/metastuff-bsd-style | 43 + .../licenses/binary/xpp3_indiana_university | 45 + brooklyn-dist/dist/licensing/licenses/cli/MIT | 20 + .../dist/licensing/licenses/jsgui/BSD-2-Clause | 23 + .../dist/licensing/licenses/jsgui/BSD-3-Clause | 27 + brooklyn-dist/dist/licensing/licenses/jsgui/MIT | 20 + .../dist/licensing/licenses/source/BSD-2-Clause | 23 + .../dist/licensing/licenses/source/BSD-3-Clause | 27 + .../dist/licensing/licenses/source/MIT | 20 + .../dist/licensing/make-all-licenses.sh | 61 + .../dist/licensing/make-one-license.sh | 79 + brooklyn-dist/dist/licensing/overrides.yaml | 383 ++++ .../licensing/projects-with-custom-licenses | 2 + brooklyn-dist/dist/pom.xml | 158 ++ .../dist/src/main/config/build-distribution.xml | 96 + .../dist/src/main/dist/bin/.gitattributes | 3 + brooklyn-dist/dist/src/main/dist/bin/brooklyn | 51 + .../dist/src/main/dist/bin/brooklyn.bat | 111 + .../dist/src/main/dist/bin/brooklyn.ps1 | 135 ++ .../dist/src/main/dist/conf/logback.xml | 14 + brooklyn-dist/dist/src/main/license/README.md | 2 + .../dist/src/main/license/files/DISCLAIMER | 8 + .../dist/src/main/license/files/LICENSE | 2149 ++++++++++++++++++ .../dist/src/main/license/files/NOTICE | 5 + .../brooklyn/cli/BaseCliIntegrationTest.java | 189 ++ .../apache/brooklyn/cli/CliIntegrationTest.java | 219 ++ brooklyn-dist/downstream-parent/pom.xml | 506 +++++ brooklyn-dist/release/.gitignore | 2 + brooklyn-dist/release/README.md | 50 + brooklyn-dist/release/Vagrantfile | 66 + brooklyn-dist/release/change-version.sh | 70 + brooklyn-dist/release/gpg-agent.conf | 2 + brooklyn-dist/release/make-release-artifacts.sh | 257 +++ brooklyn-dist/release/print-vote-email.sh | 130 ++ .../release/pull-request-reports/Gemfile | 5 + .../release/pull-request-reports/Gemfile.lock | 38 + .../release/pull-request-reports/pr_report.rb | 12 + brooklyn-dist/release/settings.xml | 29 + brooklyn-dist/scripts/buildAndTest | 102 + brooklyn-dist/scripts/grep-in-poms.sh | 25 + .../scripts/release-branch-from-master | 114 + brooklyn-dist/scripts/release-make | 83 + release/.gitignore | 2 - release/README.md | 50 - release/Vagrantfile | 66 - release/change-version.sh | 70 - release/gpg-agent.conf | 2 - release/make-release-artifacts.sh | 257 --- release/print-vote-email.sh | 130 -- release/pull-request-reports/Gemfile | 5 - release/pull-request-reports/Gemfile.lock | 38 - release/pull-request-reports/pr_report.rb | 12 - release/settings.xml | 29 - usage/all/pom.xml | 117 - usage/archetypes/quickstart/NOTES.txt | 76 - usage/archetypes/quickstart/pom.xml | 232 -- .../quickstart/src/brooklyn-sample/README.md | 73 - .../quickstart/src/brooklyn-sample/pom.xml | 102 - .../src/main/assembly/assembly.xml | 88 - .../src/main/assembly/files/README.txt | 96 - .../src/main/assembly/files/conf/logback.xml | 11 - .../src/main/assembly/scripts/start.sh | 40 - .../com/acme/sample/brooklyn/SampleMain.java | 81 - .../app/ClusterWebServerDatabaseSample.java | 137 -- .../sample/app/SingleWebServerSample.java | 32 - .../src/main/resources/logback-custom.xml | 10 - .../src/main/resources/sample-icon.png | Bin 46490 -> 0 bytes .../main/resources/visitors-creation-script.sql | 35 - .../app/SampleLocalhostIntegrationTest.java | 81 - .../brooklyn/sample/app/SampleUnitTest.java | 69 - .../quickstart/src/main/resources/.gitignore | 1 - .../META-INF/maven/archetype-metadata.xml | 65 - .../projects/integration-test-1/.gitignore | 1 - .../integration-test-1/archetype.properties | 22 - .../projects/integration-test-1/goal.txt | 1 - usage/dist/licensing/.gitignore | 2 - usage/dist/licensing/MAIN_LICENSE_ASL2 | 176 -- usage/dist/licensing/README.md | 78 - usage/dist/licensing/extras-files | 1 - usage/dist/licensing/licenses/binary/ASL2 | 177 -- .../dist/licensing/licenses/binary/BSD-2-Clause | 23 - .../dist/licensing/licenses/binary/BSD-3-Clause | 27 - usage/dist/licensing/licenses/binary/CDDL1 | 381 ---- usage/dist/licensing/licenses/binary/CDDL1.1 | 304 --- usage/dist/licensing/licenses/binary/EPL1 | 212 -- usage/dist/licensing/licenses/binary/MIT | 20 - usage/dist/licensing/licenses/binary/WTFPL | 15 - .../dist/licensing/licenses/binary/bouncycastle | 23 - usage/dist/licensing/licenses/binary/jtidy | 53 - usage/dist/licensing/licenses/binary/jython | 27 - .../licenses/binary/metastuff-bsd-style | 43 - .../licenses/binary/xpp3_indiana_university | 45 - usage/dist/licensing/licenses/cli/MIT | 20 - .../dist/licensing/licenses/jsgui/BSD-2-Clause | 23 - .../dist/licensing/licenses/jsgui/BSD-3-Clause | 27 - usage/dist/licensing/licenses/jsgui/MIT | 20 - .../dist/licensing/licenses/source/BSD-2-Clause | 23 - .../dist/licensing/licenses/source/BSD-3-Clause | 27 - usage/dist/licensing/licenses/source/MIT | 20 - usage/dist/licensing/make-all-licenses.sh | 61 - usage/dist/licensing/make-one-license.sh | 79 - usage/dist/licensing/overrides.yaml | 383 ---- .../licensing/projects-with-custom-licenses | 2 - usage/dist/pom.xml | 158 -- .../dist/src/main/config/build-distribution.xml | 96 - usage/dist/src/main/dist/bin/.gitattributes | 3 - usage/dist/src/main/dist/bin/brooklyn | 51 - usage/dist/src/main/dist/bin/brooklyn.bat | 111 - usage/dist/src/main/dist/bin/brooklyn.ps1 | 135 -- usage/dist/src/main/dist/conf/logback.xml | 14 - usage/dist/src/main/license/README.md | 2 - usage/dist/src/main/license/files/DISCLAIMER | 8 - usage/dist/src/main/license/files/LICENSE | 2149 ------------------ usage/dist/src/main/license/files/NOTICE | 5 - .../brooklyn/cli/BaseCliIntegrationTest.java | 189 -- .../apache/brooklyn/cli/CliIntegrationTest.java | 219 -- usage/downstream-parent/pom.xml | 506 ----- usage/jsgui/src/main/license/files/LICENSE | 482 ---- usage/jsgui/src/main/license/files/NOTICE | 5 - usage/jsgui/src/test/license/DISCLAIMER | 8 - usage/jsgui/src/test/license/NOTICE | 5 - usage/scripts/buildAndTest | 102 - usage/scripts/grep-in-poms.sh | 25 - usage/scripts/release-branch-from-master | 114 - usage/scripts/release-make | 83 - 167 files changed, 8812 insertions(+), 8793 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/.gitattributes ---------------------------------------------------------------------- diff --git a/brooklyn-dist/.gitattributes b/brooklyn-dist/.gitattributes new file mode 100644 index 0000000..7920d0e --- /dev/null +++ b/brooklyn-dist/.gitattributes @@ -0,0 +1,6 @@ +#Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) +* text=auto +*.sh text eol=lf +*.bat text eol=crlf +*.ps1 text eol=crlf +*.ini text eol=crlf http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/.gitignore ---------------------------------------------------------------------- diff --git a/brooklyn-dist/.gitignore b/brooklyn-dist/.gitignore new file mode 100644 index 0000000..ed439f2 --- /dev/null +++ b/brooklyn-dist/.gitignore @@ -0,0 +1,32 @@ +\#*\# +*~ +*.bak +*.swp +*.swo +.DS_Store + +atlassian-ide-plugin.xml +*.class + +target/ +test-output/ + +.project +.classpath +.settings/ +.metadata/ + +.idea/ +*.iml + +nbactions.xml +nb-configuration.xml + +prodDb.* + +*.log +brooklyn*.log.* + +*brooklyn-persisted-state/ + +ignored http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/LICENSE ---------------------------------------------------------------------- diff --git a/brooklyn-dist/LICENSE b/brooklyn-dist/LICENSE new file mode 100644 index 0000000..ca60394 --- /dev/null +++ b/brooklyn-dist/LICENSE @@ -0,0 +1,455 @@ + +This software is distributed under the Apache License, version 2.0. See (1) below. +This software is copyright (c) The Apache Software Foundation and contributors. + +Contents: + + (1) This software license: Apache License, version 2.0 + (2) Notices for bundled software + (3) Licenses for bundled software + + +--------------------------------------------------- + +(1) This software license: Apache License, version 2.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. + + +--------------------------------------------------- + +(2) Notices for bundled software + +This project includes the software: async.js + Available at: https://github.com/p15martin/google-maps-hello-world/blob/master/js/libs/async.js + Developed by: Miller Medeiros (https://github.com/millermedeiros/) + Version used: 0.1.1 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Miller Medeiros (2011) + +This project includes the software: backbone.js + Available at: http://backbonejs.org + Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) + Version used: 1.0.0 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2013) + +This project includes the software: bootstrap.js + Available at: http://twitter.github.com/bootstrap/javascript.html#transitions + Version used: 2.0.4 + Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + Copyright (c) Twitter, Inc. (2012) + +This project includes the software: handlebars.js + Available at: https://github.com/wycats/handlebars.js + Developed by: Yehuda Katz (https://github.com/wycats/) + Inclusive of: handlebars*.js + Version used: 1.0-rc1 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Yehuda Katz (2012) + +This project includes the software: jQuery JavaScript Library + Available at: http://jquery.com/ + Developed by: The jQuery Foundation (http://jquery.org/) + Inclusive of: jquery.js + Version used: 1.7.2 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) John Resig (2005-2011) + Includes code fragments from sizzle.js: + Copyright (c) The Dojo Foundation + Available at http://sizzlejs.com + Used under the MIT license + +This project includes the software: jQuery BBQ: Back Button & Query Library + Available at: http://benalman.com/projects/jquery-bbq-plugin/ + Developed by: "Cowboy" Ben Alman (http://benalman.com/) + Inclusive of: jquery.ba-bbq*.js + Version used: 1.2.1 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) "Cowboy" Ben Alman (2010)" + +This project includes the software: DataTables Table plug-in for jQuery + Available at: http://www.datatables.net/ + Developed by: SpryMedia Ltd (http://sprymedia.co.uk/) + Inclusive of: jquery.dataTables.{js,css} + Version used: 1.9.4 + Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause) + Copyright (c) Allan Jardine (2008-2012) + +This project includes the software: jQuery Form Plugin + Available at: https://github.com/malsup/form + Developed by: Mike Alsup (http://malsup.com/) + Inclusive of: jquery.form.js + Version used: 3.09 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) M. Alsup (2006-2013) + +This project includes the software: jQuery Wiggle + Available at: https://github.com/jordanthomas/jquery-wiggle + Inclusive of: jquery.wiggle.min.js + Version used: swagger-ui:1.0.1 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) WonderGroup and Jordan Thomas (2010) + Previously online at http://labs.wondergroup.com/demos/mini-ui/index.html. + The version included here is from the Swagger UI distribution. + +This project includes the software: js-uri + Available at: http://code.google.com/p/js-uri/ + Developed by: js-uri contributors (https://code.google.com/js-uri) + Inclusive of: URI.js + Version used: 0.1 + Used under the following license: The BSD 3-Clause (New BSD) License (http://opensource.org/licenses/BSD-3-Clause) + Copyright (c) js-uri contributors (2013) + +This project includes the software: js-yaml.js + Available at: https://github.com/nodeca/ + Developed by: Vitaly Puzrin (https://github.com/nodeca/) + Version used: 3.2.7 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Vitaly Puzrin (2011-2015) + +This project includes the software: moment.js + Available at: http://momentjs.com + Developed by: Tim Wood (http://momentjs.com) + Version used: 2.1.0 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Tim Wood, Iskren Chernev, Moment.js contributors (2011-2014) + +This project includes the software: RequireJS + Available at: http://requirejs.org/ + Developed by: The Dojo Foundation (http://dojofoundation.org/) + Inclusive of: require.js, text.js + Version used: 2.0.6 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) The Dojo Foundation (2010-2012) + +This project includes the software: RequireJS (r.js maven plugin) + Available at: http://github.com/jrburke/requirejs + Developed by: The Dojo Foundation (http://dojofoundation.org/) + Inclusive of: r.js + Version used: 2.1.6 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) The Dojo Foundation (2009-2013) + Includes code fragments for source-map and other functionality: + Copyright (c) The Mozilla Foundation and contributors (2011) + Used under the BSD 2-Clause license. + Includes code fragments for parse-js and other functionality: + Copyright (c) Mihai Bazon (2010, 2012) + Used under the BSD 2-Clause license. + Includes code fragments for uglifyjs/consolidator: + Copyright (c) Robert Gust-Bardon (2012) + Used under the BSD 2-Clause license. + Includes code fragments for the esprima parser: + Copyright (c): + Ariya Hidayat (2011, 2012) + Mathias Bynens (2012) + Joost-Wim Boekesteijn (2012) + Kris Kowal (2012) + Yusuke Suzuki (2012) + Arpad Borsos (2012) + Used under the BSD 2-Clause license. + +This project includes the software: Swagger JS + Available at: https://github.com/wordnik/swagger-js + Inclusive of: swagger.js + Version used: 1.0.1 + Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + Copyright (c) SmartBear Software (2011-2015) + +This project includes the software: Swagger UI + Available at: https://github.com/wordnik/swagger-ui + Inclusive of: swagger-ui.js + Version used: 1.0.1 + Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + Copyright (c) SmartBear Software (2011-2015) + +This project includes the software: typeahead.js + Available at: https://github.com/twitter/typeahead.js + Developed by: Twitter, Inc (http://twitter.com) + Version used: 0.10.5 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Twitter, Inc. and other contributors (2013-2014) + +This project includes the software: underscore.js + Available at: http://underscorejs.org + Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) + Inclusive of: underscore*.{js,map} + Version used: 1.4.4 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2009-2013) + +This project includes the software: underscore.js:1.7.0 + Available at: http://underscorejs.org + Developed by: DocumentCloud Inc. (http://www.documentcloud.org/) + Inclusive of: underscore*.{js,map} + Version used: 1.7.0 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (2009-2014) + +This project includes the software: ZeroClipboard + Available at: http://zeroclipboard.org/ + Developed by: ZeroClipboard contributors (https://github.com/zeroclipboard) + Inclusive of: ZeroClipboard.* + Version used: 1.3.1 + Used under the following license: The MIT License (http://opensource.org/licenses/MIT) + Copyright (c) Jon Rohan, James M. Greene (2014) + + +--------------------------------------------------- + +(3) Licenses for bundled software + +Contents: + + The BSD 2-Clause License + The BSD 3-Clause License ("New BSD") + The MIT License ("MIT") + + +The BSD 2-Clause License + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +The BSD 3-Clause License ("New BSD") + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + +The MIT License ("MIT") + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/NOTICE ---------------------------------------------------------------------- diff --git a/brooklyn-dist/NOTICE b/brooklyn-dist/NOTICE new file mode 100644 index 0000000..f790f13 --- /dev/null +++ b/brooklyn-dist/NOTICE @@ -0,0 +1,5 @@ +Apache Brooklyn +Copyright 2014-2015 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/README.md ---------------------------------------------------------------------- diff --git a/brooklyn-dist/README.md b/brooklyn-dist/README.md new file mode 100644 index 0000000..6b66cf2 --- /dev/null +++ b/brooklyn-dist/README.md @@ -0,0 +1,21 @@ + +# [](http://brooklyn.apache.org/) + +### Apache Brooklyn helps to model, deploy, and manage systems. + +It supports blueprints in YAML or Java, and deploys them to many clouds and other target environments. +It monitors those deployments, maintains a live model, and runs autonomic policies to maintain their health. + +For more information see **[brooklyn.apache.org](https://brooklyn.apache.org/)**. + + +### To Build + +The code can be built with a: + + mvn clean install + +This creates a build in `usage/dist/target/brooklyn-dist`. Run with `bin/brooklyn launch`. + +The **[developer guide](https://brooklyn.apache.org/v/latest/dev/)** +has more information about the source code. http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/all/pom.xml ---------------------------------------------------------------------- diff --git a/brooklyn-dist/all/pom.xml b/brooklyn-dist/all/pom.xml new file mode 100644 index 0000000..289d4a6 --- /dev/null +++ b/brooklyn-dist/all/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + + <artifactId>brooklyn-all</artifactId> + + <name>Brooklyn All Things</name> + <description> + A meta-dependency for all the major Brooklyn modules. + </description> + + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-parent</artifactId> + <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> + <relativePath>../../parent/pom.xml</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-policy</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-locations-jclouds</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-webapp</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-messaging</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-monitoring</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-database</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-osgi</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-nosql</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-software-network</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-launcher</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-cli</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-test-framework</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- bring in all jclouds-supported cloud providers --> + <dependency> + <groupId>${jclouds.groupId}</groupId> + <artifactId>jclouds-allcompute</artifactId> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/NOTES.txt ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/NOTES.txt b/brooklyn-dist/archetypes/quickstart/NOTES.txt new file mode 100644 index 0000000..4028bf6 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/NOTES.txt @@ -0,0 +1,76 @@ + +This file contains notes for anyone working on the archetype. + + +Some things to keep in mind: + +* The sample project in `src/brooklyn-sample` is what populates the + archetype source (in `src/main/resources/archetype-resources`, + copied there by the `pom.xml` in this directory, in `clean` phase). + (You can open and edit it in your IDE.) + +* That archetype source then becomes the archetype (in `install` phase) + according to the copy and filter rules in `src/main/resources/META-INF/maven/archetype-metadata.xml` + +* For any changes to the project: + + * ensure `brooklyn-sample` builds as you would like + * ensure the resulting archetype builds as you would like + (should be reasonably safe and automated, but check that the 2 sets of + copy/translation rules above do what you intended!) + * update the `README.*` files in the root of `brooklyn-sample` and the + `src/main/assembly/files` within that + * update the docs under `use/guide/defining-applications/archetype.md` and `use/guide/quickstart/index.md` + + +To build: + + mvn clean install + + +To test a build: + + pushd /tmp + rm -rf brooklyn-sample + export BV=0.9.0-SNAPSHOT # BROOKLYN_VERSION + + mvn archetype:generate \ + \ + -DarchetypeGroupId=org.apache.brooklyn \ + -DarchetypeArtifactId=brooklyn-archetype-quickstart \ + -DarchetypeVersion=${BV} \ + \ + -DgroupId=com.acme.sample \ + -DartifactId=brooklyn-sample \ + -Dversion=0.1.0-SNAPSHOT \ + -Dpackage=com.acme.sample.brooklyn \ + \ + --batch-mode + + cd brooklyn-sample + mvn clean assembly:assembly + cd target/brooklyn-sample-0.1.0-SNAPSHOT-dist/brooklyn-sample-0.1.0-SNAPSHOT/ + ./start.sh launch --cluster --location localhost + + +References + + * http://stackoverflow.com/questions/4082643/how-can-i-test-a-maven-archetype-that-ive-just-created/18916065#18916065 + +---- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/pom.xml ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/pom.xml b/brooklyn-dist/archetypes/quickstart/pom.xml new file mode 100644 index 0000000..6caa79e --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/pom.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>brooklyn-archetype-quickstart</artifactId> + <packaging>maven-archetype</packaging> + <name>Brooklyn Quick-Start Project Archetype</name> + <description> + This project defines an archetype for creating new projects which consume brooklyn, + including an example application and an example new entity type, + able to build an OSGi JAR and a binary assembly, with logging and READMEs. + </description> + + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-parent</artifactId> + <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> + <relativePath>../../../parent/pom.xml</relativePath> + </parent> + + <build> + <plugins> + <plugin> + <artifactId>maven-archetype-plugin</artifactId> + <!-- all we want to do is skip _integration tests_ when skipTests is set, not other phases; + but for some reason this seems to do it, and it still builds the archetype (!?). + whereas setting skip inside the integration-test execution goal does NOT work. + + TODO promote to root pom.xml when we better understand why + --> + <configuration> + <skip>${skipTests}</skip> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>src/test/resources/projects/integration-test-1/reference</directory> + <includes><include>**/*</include></includes> + </fileset> + <fileset> + <directory>src/main/resources/archetype-resources/</directory> + <includes><include>**/*</include></includes> + </fileset> + </filesets> + </configuration> + </plugin> + + <plugin> + <groupId>com.google.code.maven-replacer-plugin</groupId> + <artifactId>maven-replacer-plugin</artifactId> + <executions> + <execution> + <id>copy-brooklyn-sample-to-integration-test-reference</id> + <phase>clean</phase> + <goals> <goal>replace</goal> </goals> + <configuration> + <basedir>${basedir}/src/brooklyn-sample</basedir> + <outputBasedir>${basedir}</outputBasedir> + <outputDir>src/test/resources/projects/integration-test-1/reference</outputDir> + <includes> <include>**</include> </includes> + <excludes> + <exclude>.*</exclude> + <exclude>.*/**</exclude> + <exclude>target/**</exclude> + <exclude>*.log</exclude> + </excludes> + + <replacements /> + </configuration> + </execution> + <!-- would be nice to reduce the repetion below, but don't see how; + have tried with valueTokenMap but it must lie beneath basedir; + and tried with {input,output}FilePattern but that doesn't apply to dirs --> + <execution> + <!-- copy creating variables and unpackaged, for src/main/java --> + <id>copy-brooklyn-sample-to-archetype-src-main-java</id> + <phase>clean</phase> + <goals> <goal>replace</goal> </goals> + <configuration> + <basedir>${basedir}/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn</basedir> + <outputBasedir>${basedir}</outputBasedir> + <outputDir>src/main/resources/archetype-resources/src/main/java</outputDir> + <includes> <include>**/*</include> </includes> + <replacements> + <replacement> <token>brooklyn-sample</token> <value>\$\{artifactId}</value> </replacement> + <replacement> <token>com\.acme\.sample\.brooklyn</token> <value>\$\{package}</value> </replacement> + <replacement> <token>com/acme/sample/brooklyn</token> <value>\$\{packageInPathFormat}</value> </replacement> + <replacement> <token>com\.acme\.sample</token> <value>\$\{groupId}</value> </replacement> + <replacement> <token>0.1.0-SNAPSHOT</token> <value>\$\{version}</value> </replacement> + </replacements> + </configuration> + </execution> + <execution> + <!-- copy creating variables and unpackaged, for src/test/java --> + <id>copy-brooklyn-sample-to-archetype-src-test-java</id> + <phase>clean</phase> + <goals> <goal>replace</goal> </goals> + <configuration> + <basedir>${basedir}/src/brooklyn-sample/src/test/java/com/acme/sample/brooklyn</basedir> + <outputBasedir>${basedir}</outputBasedir> + <outputDir>src/main/resources/archetype-resources/src/test/java</outputDir> + <includes> <include>**/*</include> </includes> + <replacements> + <replacement> <token>brooklyn-sample</token> <value>\$\{artifactId}</value> </replacement> + <replacement> <token>com\.acme\.sample\.brooklyn</token> <value>\$\{package}</value> </replacement> + <replacement> <token>com/acme/sample/brooklyn</token> <value>\$\{packageInPathFormat}</value> </replacement> + <replacement> <token>com\.acme\.sample</token> <value>\$\{groupId}</value> </replacement> + <replacement> <token>0.1.0-SNAPSHOT</token> <value>\$\{version}</value> </replacement> + </replacements> + </configuration> + </execution> + <execution> + <!-- copy creating variables, for all other places --> + <id>copy-brooklyn-sample-to-archetype-resources</id> + <phase>clean</phase> + <goals> <goal>replace</goal> </goals> + <configuration> + <basedir>${basedir}/src/brooklyn-sample/</basedir> + <outputBasedir>${basedir}</outputBasedir> + <outputDir>src/main/resources/archetype-resources/</outputDir> + <includes> <include>**/*</include> </includes> + <excludes> + <exclude>src/main/java/**</exclude> + <exclude>src/test/java/**</exclude> + <exclude>target/**</exclude> + <exclude>test-output/**</exclude> + <exclude>.*</exclude> + <exclude>**/*.png</exclude> + <exclude>.*/**</exclude> + <exclude>*.log</exclude> + <exclude>**/*.sh</exclude> + </excludes> + <replacements> + <!-- special chars in velocity have to be escaped. + fortunately we only use fairly simple examples so we don't need to solve the general case! --> + <!-- escaping # is ugly --> + <replacement> <token>(#+)</token> <value>#set\(\$H='$1'\)\${H}</value> </replacement> + <!-- and escaping $ doesn't even seem to work; perhaps an old version of velocity in use? + (however velocity ignores $ except for variables which are defined, so we're okay) + <replacement> <token>\$</token> <value>\\\$</value> </replacement> + --> + + <replacement> <token>brooklyn-sample</token> <value>\$\{artifactId}</value> </replacement> + <replacement> <token>com\.acme\.sample\.brooklyn</token> <value>\$\{package}</value> </replacement> + <replacement> <token>com/acme/sample/brooklyn</token> <value>\$\{packageInPathFormat}</value> </replacement> + <replacement> <token>com\.acme\.sample</token> <value>\$\{groupId}</value> </replacement> + <replacement> <token>0.1.0-SNAPSHOT</token> <value>\$\{version}</value> </replacement> + </replacements> + </configuration> + </execution> + <execution> + <!-- copy creating variables, for all other places --> + <id>copy-brooklyn-sample-to-archetype-resources-binary</id> + <phase>clean</phase> + <goals> <goal>replace</goal> </goals> + <configuration> + <basedir>${basedir}/src/brooklyn-sample/</basedir> + <outputBasedir>${basedir}</outputBasedir> + <outputDir>src/main/resources/archetype-resources/</outputDir> + <includes> + <include>**/*.png</include> + <include>**/*.sh</include> + </includes> + <excludes> + <exclude>target/**</exclude> + <exclude>test-output/**</exclude> + <exclude>.*</exclude> + <exclude>.*/**</exclude> + </excludes> + <!-- no replacements for binary (put one just so we can use this plugin for consistency) --> + <replacements><replacement> <token>NONCE_123456789XYZ</token> <value>NONCE_123456789XYZ</value> </replacement></replacements> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <!-- + The maven archetype are files "without any degree of creativity". They are intended + purely as a template to generate a new project for a user, where upon the user can + write their code within this new project. + The exclusions seem to need to include code that is auto-generated during a test run. + --> + <exclude>**/src/main/resources/archetype-resources/**/*</exclude> + <exclude>**/src/test/resources/projects/integration-test-1/goal.txt</exclude> + <exclude>**/src/test/resources/projects/integration-test-1/reference/**/*</exclude> + <exclude>**/src/main/java/sample/**/*Sample*.java</exclude> + <exclude>**/src/main/resources/logback-custom.xml</exclude> + <exclude>**/src/brooklyn-sample/README.md</exclude> + <exclude>**/src/brooklyn-sample/pom.xml</exclude> + <exclude>**/src/brooklyn-sample/src/main/assembly/files/conf/*</exclude> + <exclude>**/src/brooklyn-sample/src/main/java/**/*.java</exclude> + <exclude>**/src/brooklyn-sample/src/main/resources/logback-custom.xml</exclude> + <exclude>**/src/brooklyn-sample/src/test/java/**/*.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </pluginManagement> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/README.md ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/README.md b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/README.md new file mode 100644 index 0000000..b40df41 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/README.md @@ -0,0 +1,73 @@ +brooklyn-sample +=== + +This is a Sample Brooklyn project, showing how to define an application +which Brooklyn will deploy and manage. + +This sample project is intended to be customized to suit your purposes: but +search for all lines containing the word "sample" to make sure all the +references to this being a sample are removed! + +To build an assembly, simply run: + + mvn clean assembly:assembly + +This creates a tarball with a full standalone application which can be installed in any *nix machine at: + target/brooklyn-sample-0.1.0-SNAPSHOT-dist.tar.gz + +It also installs an unpacked version which you can run locally: + + cd target/brooklyn-sample-0.1.0-SNAPSHOT-dist/brooklyn-sample-0.1.0-SNAPSHOT + ./start.sh server + +For more information see the README (or `./start.sh help`) in that directory. +On OS X and Linux, this application will deploy to localhost *if* you have key-based +password-less (and passphrase-less) ssh enabled. + +To configure cloud and fixed-IP locations, see the README file in the built application directly. +For more information you can run `./start.sh help`) in that directory. + + +### Opening in an IDE + +To open this project in an IDE, you will need maven support enabled +(e.g. with the relevant plugin). You should then be able to develop +it and run it as usual. For more information on IDE support, visit: + + https://brooklyn.incubator.apache.org/v/latest/dev/env/ide/ + + +### Customizing the Assembly + +The artifacts (directory and tar.gz by default) which get built into +`target/` can be changed. Simply edit the relevant files under +`src/main/assembly`. + +You will likely wish to customize the `SampleMain` class as well as +the `Sample*App` classes provided. That is the intention! +You will also likely want to update the `start.sh` script and +the `README.*` files. + +To easily find the bits you should customize, do a: + + grep -ri sample src/ *.* + + +### More About Apache Brooklyn + +Apache Brooklyn is a code library and framework for managing applications in a +cloud-first dev-ops-y way. It has been used to create this sample project +which shows how to define an application and entities for Brooklyn. + +This project can be extended for more complex topologies and more +interesting applications, and to develop the policies to scale or tune the +deployment depending on what the application needs. + +For more information consider: + +* Visiting the Apache Brooklyn home page at https://brooklyn.incubator.apache.org +* Finding us on IRC #brooklyncentral or email (click "Community" at the site above) +* Forking the project at http://github.com/apache/incubator-brooklyn/ + +A sample Brooklyn project should specify its license. + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/pom.xml ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/pom.xml b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/pom.xml new file mode 100644 index 0000000..44f5f93 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/pom.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-downstream-parent</artifactId> + <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> + </parent> + + <groupId>com.acme.sample</groupId> + <artifactId>brooklyn-sample</artifactId> + <version>0.1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>Sample Brooklyn Project com.acme.sample:brooklyn-sample v0.1.0-SNAPSHOT</name> + <description> + Sample optional description goes here. + </description> + + <!-- Optional metadata (commented out in this sample) + + <url>https://github.com/sample/sample</url> + + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + + <developers> + <developer> + <name>Sample Project Committers</name> + </developer> + </developers> + + <scm> + <connection>scm:git:git://github.com/sample/sample</connection> + <developerConnection>scm:git:[email protected]:sample/sample.git</developerConnection> + <url>http://github.com/sample/sample</url> + </scm> + + --> + + <properties> + <project.entry>com.acme.sample.brooklyn.SampleMain</project.entry> + </properties> + + <repositories> + <repository> + <id>apache.snapshots</id> + <name>Apache Snapshot Repository</name> + <url>http://repository.apache.org/snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + </repository> + </repositories> + + <dependencies> + <dependency> + <!-- this pulls in all brooklyn entities and clouds; + you can cherry pick selected ones instead (for a smaller build) --> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-all</artifactId> + <version>${brooklyn.version}</version> + </dependency> + + <dependency> + <!-- includes testng and useful logging for tests --> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-test-support</artifactId> + <version>${brooklyn.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <!-- this gives us flexible and easy-to-use logging; just edit logback-custom.xml! --> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-logback-xml</artifactId> + <version>${brooklyn.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </descriptors> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml new file mode 100644 index 0000000..2875a8a --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<assembly> + <id>dist</id> + <!-- Generates an archive and a dir containing the needed files; + can add e.g. zip to the following + (but executable bit is not preserved) --> + <formats> + <format>dir</format> + <format>tar.gz</format> + </formats> + + <!-- Adds dependencies to zip package under lib directory --> + <dependencySets> + <dependencySet> + <!-- + Project artifact is not copied under library directory since + it is added to the root directory of the zip package. + --> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>lib</outputDirectory> + <unpack>false</unpack> + </dependencySet> + </dependencySets> + + <!-- + Adds startup scripts to the root directory of zip package. The startup + scripts are located to src/main/scripts directory as stated by Maven + conventions. + --> + <files> + <file> + <source>src/main/assembly/scripts/start.sh</source> + <outputDirectory></outputDirectory> + <fileMode>0755</fileMode> + <filtered>true</filtered> + </file> + </files> + <fileSets> + <fileSet> + <directory>src/main/assembly/scripts</directory> + <outputDirectory></outputDirectory> + <fileMode>0755</fileMode> + <includes> + <include>*</include> + </includes> + <excludes> + <exclude>start.sh</exclude> + </excludes> + </fileSet> + <!-- add additional files (but not marked executable) --> + <fileSet> + <directory>src/main/assembly/files</directory> + <outputDirectory></outputDirectory> + <includes> + <include>**</include> + </includes> + </fileSet> + <!-- adds jar package to the root directory of zip package --> + <fileSet> + <directory>target</directory> + <outputDirectory></outputDirectory> + <includes> + <include>*.jar</include> + </includes> + <excludes> + <exclude>*-tests.jar</exclude> + </excludes> + </fileSet> + </fileSets> +</assembly> http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/README.txt ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/README.txt b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/README.txt new file mode 100644 index 0000000..8ba14f1 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/README.txt @@ -0,0 +1,96 @@ +brooklyn-sample +=== + +This is a sample application which is launched and managed by Brooklyn. +This README file is at the root of the built assembly, which can be uploaded +and run most anywhere. This file provides end-user instructions. + +To use this, configure any cloud credentials then run ./start.sh in this +directory. You can then access the management context in your browser, +typically on http://localhost:8081 , and through that console deploy the +applications contained in this archive. + + +### Cloud Credentials + +To run, you'll need to specify credentials for your preferred cloud. This +can be done in `~/.brooklyn/brooklyn.properties`. + +A recommended starting point is the file at: + + https://brooklyn.incubator.apache.org/v/latest/use/guide/quickstart/brooklyn.properties + +As a quick-start, you can specify: + + brooklyn.location.jclouds.aws-ec2.identity=AKXXXXXXXXXXXXXXXXXX + brooklyn.location.jclouds.aws-ec2.credential=secret01xxxxxxxxxxxxxxxxxxxxxxxxxxx + + brooklyn.location.named.My_Amazon_US_west=jclouds:aws-ec2:us-west-1 + brooklyn.location.named.My_Amazon_EU=jclouds:aws-ec2:eu-west-1 + +Alternatively these can be set as shell environment parameters or JVM system properties. + +Many other clouds are supported also, as well as pre-existing machines +("bring your own nodes"), custom endpoints for private clouds, and specifying +custom keys and passphrases. For more information see: + + https://brooklyn.incubator.apache.org/v/latest/use/guide/defining-applications/common-usage#locations + + +### Run + +Usage: + + ./start.sh launch [--WHAT] \ + [--port 8081+] \ + [--location location] + +The optional port argument specifies the port where the Brooklyn console +will be running, such as localhost:8081. (The console is only bound to +localhost, unless you set up users and security, as described at +https://brooklyn.incubator.apache.org/v/latest/use/guide/management/ .) + +In the console, you can access the catalog and deploy applications to +configured locations. + +In this sample application, `--cluster` and `--single` are supported in place of `--WHAT`, +corresponding to sample blueprints in the project. This can be left blank to have nothing +launched; note that the blueprints can be launched at runtime via the GUI or API. + +Use `./start.sh help` or `./start.sh help launch` for more detailed help. + +The location might be `localhost` (the default), `aws-ec2:us-east-1`, +`openstack:endpoint`, `softlayer`, or based on names, such as +`named:My_Amazon_US_west`, so long as it is configured as above. +(Localhost does not need any configuration in `~/brooklyn/brooklyn.properties`, +provided you have password-less ssh access enabled to localhost, using a +private key with no passphrase.) + + +### More About Brooklyn + +Brooklyn is a code library and framework for managing applications in a +cloud-first dev-ops-y way. It has been used to create this sample project +which shows how to define an application and entities for Brooklyn. + +This project can be extended for more complex topologies and more +interesting applications, and to develop the policies to scale or tune the +deployment depending on what the application needs. + +For more information consider: + +* Visiting the open-source Brooklyn home page at http://brooklyncentral.github.com +* Forking the Brooklyn project at http://github.com/brooklyncentral/brooklyn +* Emailing [email protected] + +For commercial enquiries -- including bespoke development and paid support -- +contact Cloudsoft, the supporters of Brooklyn, at: + +* www.CloudsoftCorp.com +* [email protected] + +Brooklyn is (c) 2014 Cloudsoft Corporation and released as open source under +the Apache License v2.0. + +A sample Brooklyn project should specify its license here. + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/conf/logback.xml ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/conf/logback.xml b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/conf/logback.xml new file mode 100644 index 0000000..7b7a972 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/files/conf/logback.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <!-- logging configuration for this project; edit this file as required, or override the files + this includes as described in the Logging section of the brooklyn users guide. + this project already supplies a logback-custom.xml which gets included to log our + classes at debug level and write to a log file named after this project --> + + <include resource="logback-main.xml"/> + +</configuration> http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh new file mode 100755 index 0000000..2879b6d --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +if [ ! -z "$JAVA_HOME" ] ; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=`which java` +fi + +if [ ! -x "$JAVA" ] ; then + echo Cannot find java. Set JAVA_HOME or add java to path. + exit 1 +fi + +if [[ ! `ls ${project.artifactId}-*.jar 2> /dev/null` ]] ; then + echo Command must be run from the directory where the JAR is installed. + exit 4 +fi + +$JAVA -Xms256m -Xmx1024m -XX:MaxPermSize=1024m \ + -classpath "conf/:patch/*:*:lib/*" \ + ${project.entry} \ + "$@" http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/SampleMain.java ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/SampleMain.java b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/SampleMain.java new file mode 100644 index 0000000..253f657 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/SampleMain.java @@ -0,0 +1,81 @@ +package com.acme.sample.brooklyn; + +import java.util.Arrays; + +import io.airlift.command.Command; +import io.airlift.command.Option; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.brooklyn.api.catalog.BrooklynCatalog; +import org.apache.brooklyn.cli.Main; + +import com.google.common.base.Objects.ToStringHelper; + +import com.acme.sample.brooklyn.sample.app.*; + +/** + * This class provides a static main entry point for launching a custom Brooklyn-based app. + * <p> + * It inherits the standard Brooklyn CLI options from {@link Main}, + * plus adds a few more shortcuts for favourite blueprints to the {@link LaunchCommand}. + */ +public class SampleMain extends Main { + + private static final Logger log = LoggerFactory.getLogger(SampleMain.class); + + public static final String DEFAULT_LOCATION = "localhost"; + + public static void main(String... args) { + log.debug("CLI invoked with args "+Arrays.asList(args)); + new SampleMain().execCli(args); + } + + @Override + protected String cliScriptName() { + return "start.sh"; + } + + @Override + protected Class<? extends BrooklynCommand> cliLaunchCommand() { + return LaunchCommand.class; + } + + @Command(name = "launch", description = "Starts a server, and optionally an application. " + + "Use e.g. --single or --cluster to launch one-node and clustered variants of the sample web application.") + public static class LaunchCommand extends Main.LaunchCommand { + + // add these options to the LaunchCommand as shortcuts for our favourite applications + + @Option(name = { "--single" }, description = "Launch a single web-server instance") + public boolean single; + + @Option(name = { "--cluster" }, description = "Launch a web-server cluster") + public boolean cluster; + + @Override + public Void call() throws Exception { + // process our CLI arguments + if (single) setAppToLaunch( SingleWebServerSample.class.getCanonicalName() ); + if (cluster) setAppToLaunch( ClusterWebServerDatabaseSample.class.getCanonicalName() ); + + // now process the standard launch arguments + return super.call(); + } + + @Override + protected void populateCatalog(BrooklynCatalog catalog) { + super.populateCatalog(catalog); + catalog.addItem(SingleWebServerSample.class); + catalog.addItem(ClusterWebServerDatabaseSample.class); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("single", single) + .add("cluster", cluster); + } + } +} http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/ClusterWebServerDatabaseSample.java ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/ClusterWebServerDatabaseSample.java b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/ClusterWebServerDatabaseSample.java new file mode 100644 index 0000000..11d977f --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/ClusterWebServerDatabaseSample.java @@ -0,0 +1,137 @@ +package com.acme.sample.brooklyn.sample.app; + +import java.util.concurrent.TimeUnit; + +import org.apache.brooklyn.api.catalog.Catalog; +import org.apache.brooklyn.api.catalog.CatalogConfig; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.AbstractApplication; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.location.PortRanges; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.enricher.stock.SensorPropagatingEnricher; +import org.apache.brooklyn.enricher.stock.SensorTransformingEnricher; +import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon; +import org.apache.brooklyn.entity.database.mysql.MySqlNode; +import org.apache.brooklyn.entity.group.DynamicCluster; +import org.apache.brooklyn.entity.java.JavaEntityMethods; +import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster; +import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster; +import org.apache.brooklyn.entity.webapp.JavaWebAppService; +import org.apache.brooklyn.entity.webapp.WebAppService; +import org.apache.brooklyn.entity.webapp.WebAppServiceConstants; +import org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy; +import org.apache.brooklyn.policy.enricher.HttpLatencyDetector; +import org.apache.brooklyn.util.maven.MavenArtifact; +import org.apache.brooklyn.util.maven.MavenRetriever; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Functions; + +import static org.apache.brooklyn.core.sensor.DependentConfiguration.attributeWhenReady; +import static org.apache.brooklyn.core.sensor.DependentConfiguration.formatString; + + +/** This sample builds a 3-tier application with an elastic app-server cluster, + * and it sets it up for use in the Brooklyn catalog. + * <p> + * Note that root access (and xcode etc) may be required to install nginx. + **/ +@Catalog(name="Elastic Java Web + DB", + description="Deploys a WAR to a load-balanced elastic Java AppServer cluster, " + + "with an auto-scaling policy, " + + "wired to a database initialized with the provided SQL; " + + "defaults to a 'Hello World' chatroom app.", + iconUrl="classpath://sample-icon.png") +public class ClusterWebServerDatabaseSample extends AbstractApplication { + + public static final Logger LOG = LoggerFactory.getLogger(ClusterWebServerDatabaseSample.class); + + // ---------- WAR configuration --------------- + + public static final String DEFAULT_WAR_URL = + // can supply any URL -- this loads a stock example from maven central / sonatype + MavenRetriever.localUrl(MavenArtifact.fromCoordinate("io.brooklyn.example:brooklyn-example-hello-world-sql-webapp:war:0.5.0")); + + @CatalogConfig(label="WAR (URL)", priority=2) + public static final ConfigKey<String> WAR_URL = ConfigKeys.newConfigKey( + "app.war", "URL to the application archive which should be deployed", DEFAULT_WAR_URL); + + + // ---------- DB configuration ---------------- + + // this is included in src/main/resources. if in an IDE, ensure your build path is set appropriately. + public static final String DEFAULT_DB_SETUP_SQL_URL = "classpath://visitors-creation-script.sql"; + + @CatalogConfig(label="DB Setup SQL (URL)", priority=1) + public static final ConfigKey<String> DB_SETUP_SQL_URL = ConfigKeys.newConfigKey( + "app.db_sql", "URL to the SQL script to set up the database", + DEFAULT_DB_SETUP_SQL_URL); + + public static final String DB_TABLE = "visitors"; + public static final String DB_USERNAME = "brooklyn"; + public static final String DB_PASSWORD = "br00k11n"; + + + // --------- Custom Sensor -------------------- + + AttributeSensor<Integer> APPSERVERS_COUNT = Sensors.newIntegerSensor( + "appservers.count", "Number of app servers deployed"); + + + // --------- Initialization ------------------- + + /** Initialize our application. In this case it consists of + * a single DB, with a load-balanced cluster (nginx + multiple JBosses, by default), + * with some sensors and a policy. */ + @Override + public void init() { + DatastoreCommon db = addChild( + EntitySpec.create(MySqlNode.class) + .configure(MySqlNode.CREATION_SCRIPT_URL, Entities.getRequiredUrlConfig(this, DB_SETUP_SQL_URL))); + + ControlledDynamicWebAppCluster web = addChild( + EntitySpec.create(ControlledDynamicWebAppCluster.class) + // set WAR to use, and port to use + .configure(JavaWebAppService.ROOT_WAR, getConfig(WAR_URL)) + .configure(WebAppService.HTTP_PORT, PortRanges.fromString("8080+")) + +// // optionally - use Tomcat instead of JBoss (default: +// .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(TomcatServer.class)) + + // inject a JVM system property to point to the DB + .configure(JavaEntityMethods.javaSysProp("brooklyn.example.db.url"), + formatString("jdbc:%s%s?user=%s\\&password=%s", + attributeWhenReady(db, DatastoreCommon.DATASTORE_URL), DB_TABLE, DB_USERNAME, DB_PASSWORD)) + + // start with 2 appserver nodes, initially + .configure(DynamicCluster.INITIAL_SIZE, 2) + ); + + // add an enricher which measures latency + web.addEnricher(HttpLatencyDetector.builder(). + url(WebAppServiceConstants.ROOT_URL). + rollup(10, TimeUnit.SECONDS). + build()); + + // add a policy which scales out based on Reqs/Sec + web.getCluster().addPolicy(AutoScalerPolicy.builder(). + metric(DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW_PER_NODE). + metricRange(10, 100). + sizeRange(2, 5). + build()); + + // add a few more sensors at the top-level (KPI's at the root of the application) + addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web, + WebAppServiceConstants.ROOT_URL, + DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW, + HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)); + addEnricher(SensorTransformingEnricher.newInstanceTransforming(web, + DynamicWebAppCluster.GROUP_SIZE, Functions.<Integer>identity(), APPSERVERS_COUNT)); + } + +} http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/29757eea/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/SingleWebServerSample.java ---------------------------------------------------------------------- diff --git a/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/SingleWebServerSample.java b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/SingleWebServerSample.java new file mode 100644 index 0000000..3cc9426 --- /dev/null +++ b/brooklyn-dist/archetypes/quickstart/src/brooklyn-sample/src/main/java/com/acme/sample/brooklyn/sample/app/SingleWebServerSample.java @@ -0,0 +1,32 @@ +package com.acme.sample.brooklyn.sample.app; + +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.AbstractApplication; +import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.location.PortRanges; +import org.apache.brooklyn.entity.webapp.JavaWebAppService; +import org.apache.brooklyn.entity.webapp.jboss.JBoss7Server; +import org.apache.brooklyn.util.maven.MavenArtifact; +import org.apache.brooklyn.util.maven.MavenRetriever; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** This example starts one web app on 8080. */ +public class SingleWebServerSample extends AbstractApplication { + + public static final Logger LOG = LoggerFactory.getLogger(SingleWebServerSample.class); + + public static final String DEFAULT_WAR_URL = + // can supply any URL -- this loads a stock example from maven central / sonatype + MavenRetriever.localUrl(MavenArtifact.fromCoordinate("io.brooklyn.example:brooklyn-example-hello-world-sql-webapp:war:0.5.0")); + + /** Initialize our application. In this case it consists of + * a single JBoss entity, configured to run the WAR above. */ + @Override + public void init() { + addChild(EntitySpec.create(JBoss7Server.class) + .configure(JavaWebAppService.ROOT_WAR, DEFAULT_WAR_URL) + .configure(Attributes.HTTP_PORT, PortRanges.fromString("8080+"))); + } + +}
