diff --git a/.gitignore b/.gitignore index 90ec22be..3a9f4e98 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ .svn +.classpath +.project +.settings +target +.idea/ +*.iml +**/*.log diff --git a/BUILD.txt b/BUILD.txt index 1a7373f1..25906c87 100644 --- a/BUILD.txt +++ b/BUILD.txt @@ -10,7 +10,7 @@ BUILDING To run unit tests and install artifacts locally: -mvn clean install +mvn install To build a source package: diff --git a/CHANGES.txt b/CHANGES.txt index 5adda2e0..5da0b2a9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,456 @@ Apache Whirr Change Log Trunk (unreleased changes) + NEW FEATURES + + WHIRR-313. Add Hama as a Service. (Edward J. Yoon via tomwhite) + + WHIRR-326. Use jclouds provider metadata to help with cloud + provider configuration (asavu) + + WHIRR-76. Support spot instances in python scripts (Soren Macbeth via asavu) + + WHIRR-260. Support Spot Instances (asavu) + + IMPROVEMENTS + + WHIRR-28. Add examples module (asavu) + + WHIRR-319. Run rat & checkstyle before packaging (tomwhite and asavu) + + WHIRR-311. Allow services to register new CLI commands (asavu) + + WHIRR-320. Convert site documentation to xdoc format (asavu) + + WHIRR-323. Allow user to specify a blobstore container to be used + for caching local files (asavu) + + WHIRR-327. Upgrade to jclouds 1.0.0 (Adrian Cole and asavu) + + WHIRR-331. Add the ability to specify tarball URLs that are local + to the remote machine (asavu) + + WHIRR-338. byon cluster with hostnames defined in /etc/hosts. + (Bruno Dumon via tomwhite) + + WHIRR-345. Add Hama service information to the website + (Edward J. Yoon via asavu) + + BUG FIXES + + WHIRR-315. Temporary override Providers#withIds until jclouds + beta-10 is out (asavu and Adrian Cole) + + WHIRR-249. Firewall authorization should be idempotent (asavu) + + WHIRR-330. BYON doesn't work with HadoopConfigurationBuilder + (John Amos and asavu) + + WHIRR-334. Support for CDH3u0 HBase (Geoff Black, Andrei Savu, Bruno Dumon) + +Release 0.5.0 - 2011-05-16 + + INCOMPATIBLE CHANGES + + WHIRR-245. Clearly demarcate the user and service provider APIs. There + are some incompatible API changes which affect clients and service writers: + * The client API has moved from the org.apache.whirr.service package to the + org.apache.whirr package. + * Service(Factory) has been renamed to ClusterController(Factory). + * org.apache.whirr.cluster.actions has been renamed to + org.apache.whirr.actions. + (tomwhite) + + NEW FEATURES + + WHIRR-261. Add ElasticSearch as a service (asavu) + + WHIRR-222. Support multiple versions of Hadoop. (tomwhite) + + WHIRR-237. Add Voldemort as a service. (Kirk True via asavu) + + WHIRR-220. Support local tarball upload (asavu) + + WHIRR-285. Add support for BYON. (tomwhite) + + WHIRR-191. Start other services based on CDH, not just HDFS and MR. + (tomwhite) + + IMPROVEMENTS + + WHIRR-262. Services should not have to do reverse DNS lookups. (tomwhite) + + WHIRR-275. Improve firewall API for services. (tomwhite) + + WHIRR-278. Refactor ClusterSpec and extract InstanceTemplate class. (asavu) + + WHIRR-269. Improve error msg "Key pair is encrypted" (tomwhite via asavu) + + WHIRR-277. Support multiple versions of ZooKeeper (asavu) + + WHIRR-282. Set number of Hadoop slots based on hardware (tomwhite via asavu) + + WHIRR-284. Runurl should only be installed when needed (tomwhite via asavu) + + WHIRR-283. Whirr in 5 minutes. (tomwhite) + + WHIRR-279. Create ClusterSpec aware BlobStoreContext factory class (asavu) + + WHIRR-280. Create a blob cache that could be used for storing local + files (asavu) + + WHIRR-173. Add ClusterAction for generic script execution (asavu) + + WHIRR-246. Single place to store/load cluster state (David Alves and asavu) + + WHIRR-289. Display role names in list-cluster command (asavu) + + WHIRR-287. Script for running YCSB on HBase (asavu) + + WHIRR-291. Add "noop" role useful just for provisioning (asavu) + + WHIRR-297. Separate ZooKeeper and ElasticSearch install and configuration + scripts into more generic functions (asavu) + + WHIRR-288. Add blob store persistence for cluster state (asavu) + + WHIRR-300. FAQ entry for noop role. (asavu via tomwhite) + + WHIRR-216. Improve error message if whirr.instance-templates left out of + config. (asavu via tomwhite) + + WHIRR-299. Recipe for BYON provider (asavu) + + WHIRR-292. Separate Cassandra install and configuration scripts + into more generic functions (asavu) + + WHIRR-296. Separate Voldemort install and configuration scripts into more + generic functions. (asavu via tomwhite) + + WHIRR-61. Make more efficient use of ComputeServiceContext. (adriancole and + asavu via tomwhite) + + WHIRR-304. Upgrade to jclouds 1.0-beta-9c. (adriancole via tomwhite) + + WHIRR-236. Update Configuration Guides with Recipe Info. (tomwhite) + + WHIRR-141. Create a logo. (Alison Wong via tomwhite) + + WHIRR-310. Improve Configuration Guide. (asavu via tomwhite) + + WHIRR-312. Destroy instance removes all entries from the instances file + except the one that is being terminated. (asavu + + BUG FIXES + + WHIRR-253. ZooKeeper service should only authorize ingress to ZooKeeper + instances (tomwhite via asavu) + + WHIRR-268. whirr hangs when the file '$HOME/.ssh/known_hosts' includes + an obsolete identifier for a certain ip address host. + (Hyunsik Choi via asavu) + + WHIRR-271. Classpath needs to be quoted in whirr script. (asavu) + + WHIRR-274. Add wagon-ssh-external as a maven build extension. (asavu) + + WHIRR-172. Log warning for unrecognized service names. (tomwhite) + + WHIRR-298. Use all cluster spec properties for hash and + equality (tomwhite and asavu) + + WHIRR-314. HBase integration test can fail due to Thrift server race. + (tomwhite) + +Release 0.4.0 - 2011-03-15 + + NEW FEATURES + + WHIRR-226. Add the ability to destroy a cluster instance (asavu) + + WHIRR-225. Support locally-supplied scripts. + With this change the properties whirr.hadoop-install-runurl and + whirr.hadoop-configure-runurl are replaced by whirr.hadoop-install-function + and whirr.hadoop-configure-function. See recipes for details. (tomwhite) + + WHIRR-198. Support user-defined images (Adrian Cole via asavu) + + WHIRR-158. Allow users to log into clusters as themselves + (Adrian Cole and asavu) + + IMPROVEMENTS + + WHIRR-139. upgrade to version 1 of the "enforcer" plugin (Jakob Homan + via asavu) + + WHIRR-193. Recipe for a HBase Cluster. (asavu) + + WHIRR-219. Support dynamic addition of services to CLI. (tomwhite) + + WHIRR-195. Display available roles instead of service names + when running ./bin/whirr (asavu) + + WHIRR-199. Add aliases for short role names like nn, jt, tt, dn, zk. + (asavu via tomwhite) + + WHIRR-183. ZooKeeper Data Directory Cleanup. (asavu via tomwhite) + + WHIRR-124. Upgrade to jclouds 1.0-beta-9 (Adrian Cole via larsgeorge) + + WHIRR-124. Show warning messages before converting ec2->aws-ec2 and + cloudservers -> clouservers-us (Adrian Cole via asavu) + + WHIRR-167. Improve bootstrapping and configuration to be able to + isolate and repair or evict failing nodes on EC2 (Tibor Kiss via asavu) + + WHIRR-55. Users should be able to override an arbitrary Hadoop property + before launch. (tomwhite) + + WHIRR-242. Update documentation for overriding locally supplied + scripts (tomwhite via asavu) + + WHIRR-248. Upgrade to jclouds 1.0-beta-9b (adriancole) + + WHIRR-244. Add package-level javadoc. (tomwhite) + + WHIRR-254. Document limitation that a role may only appear in + one instance template group (tomwhite via asavu) + + WHIRR-259. Disable configuration list handling for Hadoop + properties (asavu) + + WHIRR-233. Change test properties to be less provider bound and + improve TemplateBuilder defaults (asavu) + + WHIRR-265. Missing SVN EOL properties (Sebb via asavu) + + BUG FIXES + + WHIRR-170. Instances should be started in the order specified in + the template (tomwhite via asavu) + + WHIRR-186. [HBase] Add version support configurable in properties file. + (largsgeorge) + + WHIRR-201. [HBase] Integration test fails. (largsgeorge via tomwhite) + + WHIRR-217. Log files should not be included in tarball or checked + by RAT (tomwhite via asavu) + + WHIRR-232. NPE for stopped instances on EC2. (tomwhite) + + WHIRR-234. Resource functions/install_cdh_hadoop.sh not found when + running from the CLI (tomwhite via asavu) + + WHIRR-235. fix whirr.provider in recipes/* (Eugene Koontz via asavu) + + WHIRR-207. Handle curl timeouts better (asavu) + + WHIRR-241. Update to use CDH3B4. (tomwhite) + + WHIRR-247. Add license headers to service install and configure + scripts (asavu) + + WHIRR-251. Handle Apache cryptography requirements for release + (tomwhite via asavu) + + WHIRR-250. Ensure all libraries in binary distribution have + associated licenses where stipulated (tomwhite via asavu) + + WHIRR-263. Default tarball not found for Cassandra (broken link + in install_cassandra.sh) (asavu) + + WHIRR-267. Update NOTICE and LICENSE files to mention 3rd party + products (tomwhite via asavu) + +Release 0.3.0 - 2011-01-15 + + NEW FEATURES + + WHIRR-117. Composable services. (tomwhite) + + WHIRR-176. Set AWS credentials in the local site file for Hadoop S3 access. + (Lars George via tomwhite) + + WHIRR-25. Add HBase service. (Lars George via tomwhite) + + IMPROVEMENTS + + WHIRR-87. Parallelize Hadoop cluster creation. (tomwhite) + + WHIRR-92. Add a benchmark for Hadoop clusters. (tomwhite) + + WHIRR-153. Add documentation for WHIRR-87 (Parallelize Hadoop cluster + creation). (tomwhite) + + WHIRR-115. Distribution should include documentation. (tomwhite) + + WHIRR-154. Cassandra: expose JMX port. (Kelvin Kakugawa via tomwhite) + + WHIRR-160. Improve SSH key diagnostics. (Andrei Savu via tomwhite) + + WHIRR-150. Allow retrieval of instance roles. (tomwhite) + + WHIRR-163. Support environment variable interpolation in configuration + properties. (tomwhite) + + WHIRR-157. Remove service name property. (tomwhite) + + WHIRR-166. Improve docs regarding private keys. (Stu Hood via tomwhite) + + WHIRR-174. Fix ZooKeeper to allow stand-alone mode setups. + (Lars George via tomwhite) + + WHIRR-145. Add Whirr recipes for common configurations. (tomwhite) + + WHIRR-178. [Hadoop] Guard useradd against existing user account. + (Lars George via tomwhite) + + WHIRR-187. [HBase] Change hbase.tmp.dir to be in line with Hadoop service. + (Lars George via tomwhite) + + WHIRR-181. Add descriptions for CLI command options. + (Andrei Savu via tomwhite) + + WHIRR-161. Check that both SSH keys belong to the same pair. + (Andrei Savu via tomwhite) + + WHIRR-155. Support multiple versions of Cassandra. + (Stu Hood via johan) + + WHIRR-190. Create /tmp in HDFS for Pig. (Andrei Savu and tomwhite via + tomwhite) + + WHIRR-202. Improve instance template syntax checking. (tomwhite) + + WHIRR-205. Override service.provider for integration tests. + (Andrei Savu via tomwhite) + + WHIRR-203. General documentation improvements for 0.3.0. (tomwhite) + + WHIRR-206. [HBase] Extract strings to a HBaseServiceConstants interface. + (Lars George via tomwhite) + + WHIRR-194. Update the list of supported services on the home page. + (asavu via tomwhite) + + BUG FIXES + + WHIRR-128. Fix DNS resolution for clients running within EC2. + (Tibor Kiss via tomwhite) + + WHIRR-137. Allow use of an arbitrary AMI on EC2. (tomwhite) + + WHIRR-146. Changing the mapred.child.java.opts value does not change the + heap size from a default one. (Tibor Kiss via tomwhite) + + WHIRR-147. Regression on launching clusters from EC2. (tomwhite) + + WHIRR-151. Credentials not set correctly for Hadoop service configure step. + (tomwhite) + + WHIRR-159. Cassandra and ZooKeeper fail on Ubuntu on Rackspace. (tomwhite) + + WHIRR-123. Cassandra integration tests hang if whirr's scripts bucket is + missing. (tomwhite) + + WHIRR-156. Cli script doesn't launch post-modularization. (Andrei Savu and + tomwhite via tomwhite) + + WHIRR-162. DnsUtilTest fails when offline or for slow connections. + (Andrei Savu via tomwhite) + + WHIRR-175. ZooKeeper service does not honor instance roles. + (Lars George via tomwhite) + + WHIRR-165. Hadoop integration tests fail due to WHIRR-160 changes. + (tomwhite) + + WHIRR-180. ListClusterCommand.run throws a NullPointerException for + unrecognized service names. (Andrei Savu via tomwhite) + + WHIRR-179. [Hadoop] Guard $MOUNT/tmp mkdir call against existing directory. + (Lars George via tomwhite) + + WHIRR-185. [ZooKeeper] Fix selection of instances for getHosts() call. + (Lars George via tomwhite) + + WHIRR-164. Tests fail if there is no ~/.ssh/id_rsa keypair. + (Andrei Savu via tomwhite) + + WHIRR-200. Cassandra integration test hangs. (Stu Hood via tomwhite) + + WHIRR-204. CDH Hadoop integration test fails on Rackspace. (tomwhite) + + WHIRR-210. Remove unneeded dependent libraries. (tomwhite) + + WHIRR-211. Fix checkstyle errors for 0.3.0. (tomwhite) + +Release 0.2.0 - 2010-11-04 + + NEW FEATURES + + WHIRR-100. Create a binary distribution of Whirr. (tomwhite) + + WHIRR-73. Add a list command to the CLI. (tomwhite) + + IMPROVEMENTS + + WHIRR-89. Support maven 3 builds. (Adrian Cole via tomwhite) + + WHIRR-90. Scripts should be versioned. (tomwhite) + + WHIRR-66. Upgrade to jclouds 1.0-beta-7. (Adrian Cole via tomwhite) + + WHIRR-103. Add more to .gitignore. (phunt via tomwhite) + + WHIRR-105. Add version command to the CLI. (tomwhite) + + WHIRR-109. Unit tests fail if there is no private key found at + ~/.ssh/id_rsa. (Adrian Cole via tomwhite) + + WHIRR-110. Create client-side Hadoop configuration file during cluster + launch. (tomwhite) + + WHIRR-112. Expand documentation. (tomwhite) + + WHIRR-52. Support all services on Rackspace Cloud Servers. (tomwhite) + + BUG FIXES + + WHIRR-93. Fail on checkstyle violation. (tomwhite) + + WHIRR-97. Lucid is not stable on EC2. Default is now the Amazon Linux AMI + on EC2. (tomwhite) + + WHIRR-102. unknown service NPEs cli, should print the bad service + to console (phunt) + + WHIRR-104. print available services in cli help string (phunt) + + WHIRR-108. Fix checkstyle and rat violations. (tomwhite) + + WHIRR-101. Hadoop on EC2 does not use the /mnt partition. (tomwhite) + + WHIRR-107. Test failing due to not matching Amazon Linux AMI on EC2. + (tomwhite) + + WHIRR-106. Improve logging in whirr cli. (tomwhite) + + WHIRR-113. Hadoop cluster instances should all start in the same location. + (tomwhite) + + WHIRR-114. Support + character in version number. (tomwhite) + + WHIRR-91. Add DISCLAIMER file to CLI JAR (phunt) + + WHIRR-122. whirr site has two FAQ links + + WHIRR-126. Deployment process does not deploy required test JARs + (tomwhite) + +Release 0.1.0 - 2010-09-02 + INCOMPATIBLE CHANGES NEW FEATURES @@ -60,6 +510,9 @@ Trunk (unreleased changes) WHIRR-80. Clean up POM dependencies. (tomwhite) + WHIRR-85. Publish Maven artifacts to http://repository.apache.org. + (tomwhite) + BUG FIXES WHIRR-50. Cassandra POM should depend on top-level. (tomwhite) @@ -74,3 +527,9 @@ Trunk (unreleased changes) WHIRR-79. Hadoop service is broken. (tomwhite) WHIRR-82. Integration tests should not run on "mvn install". (tomwhite) + + WHIRR-84. Log4j is missing from the CLI JAR. (tomwhite) + + WHIRR-86. Update quick start documentation to work with release 0.1.0. + (tomwhite) + diff --git a/LICENSE.txt b/LICENSE.txt index 5e4a8e5f..06621f38 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -201,9 +201,180 @@ See the License for the specific language governing permissions and limitations under the License. -License for the Jansson C JSON parser used in the C implementation: -Copyright (c) 2009 Petri Lehtinen +========================================================================== +The Apache License, Version 2.0 applies to the following libraries: +Gson, Guava, Guice, javax.inject, jclouds, Not-Yet-Commons-SSL, Oauth (Java), +XML Builder + +========================================================================== +The following license applies to the dnsjava library +-------------------------------------------------------------------------- + +dnsjava is placed under the BSD license. Several files are also under +additional licenses; see the individual files for details. + +Copyright (c) 1999-2005, Brian Wellington +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the dnsjava project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +========================================================================== +The following license applies to the Jersey library and the Common Annotations +(JSR 250) library +-------------------------------------------------------------------------- + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + +1. Definitions. + + 1.1. Contributor. means each individual or entity that creates or contributes to the creation of Modifications. + + 1.2. Contributor Version. means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. + + 1.3. Covered Software. means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. + + 1.4. Executable. means the Covered Software in any form other than Source Code. + + 1.5. Initial Developer. means the individual or entity that first makes Original Software available under this License. + + 1.6. Larger Work. means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. + + 1.7. License. means this document. + + 1.8. Licensable. means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. + + 1.9. Modifications. means the Source Code and Executable form of any of the following: + + A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; + + B. Any new file that contains any part of the Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made available under the terms of this License. + + 1.10. Original Software. means the Source Code and Executable form of computer software code that is originally released under this License. + + 1.11. Patent Claims. means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. + + 1.12. Source Code. means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. + + 1.13. You. (or .Your.) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, .You. includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, .control. means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. + + 3.2. Modifications. + The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients. rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient.s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. + + 4.2. Effect of New Versions. + You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN .AS IS. BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as .Participant.) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY.S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a .commercial item,. as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of .commercial computer software. (as that term is defined at 48 C.F.R. º 252.227-7014(a)(1)) and .commercial computer software documentation. as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction.s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys. fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. + + NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + + The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. + +========================================================================== +The following license applies to the JOpt Simple library +-------------------------------------------------------------------------- + +Copyright (C) by Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -222,3 +393,97 @@ 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. + +========================================================================== +The following license applies to the JSch library +-------------------------------------------------------------------------- + +JSch 0.0.* was released under the GNU LGPL license. Later, we have switched +over to a BSD-style license. + +------------------------------------------------------------------------------ +Copyright (c) 2002,2003,2004,2005,2006,2007,2008,2009 Atsuhiko Yamanaka, JCraft,Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + + 3. The names of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, +INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE 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 following license applies to the JSR-305 library +-------------------------------------------------------------------------- + +Copyright (c) 2007-2009, JSR305 expert group +All rights reserved. + +http://www.opensource.org/licenses/bsd-license.php + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the JSR305 expert group nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +========================================================================== +The following license applies to the SLF4J library +-------------------------------------------------------------------------- +Copyright (c) 2004-2008 QOS.ch +All rights reserved. + +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. + diff --git a/NOTICE-src.txt b/NOTICE-src.txt new file mode 100644 index 00000000..4c69b7c6 --- /dev/null +++ b/NOTICE-src.txt @@ -0,0 +1,5 @@ +Apache Whirr +Copyright 2010-2011 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). diff --git a/NOTICE.txt b/NOTICE.txt index ec97fb30..c4ca2f66 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,6 +1,12 @@ Apache Whirr -Copyright 2010 The Apache Software Foundation +Copyright 2010-2011 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). +This product includes Common Annotations (JSR 250, https://jsr250.dev.java.net/) +distributed under the CDDL Version 1.0 license. + +This product includes Jersey (https://jersey.dev.java.net/) +distributed under the CDDL Version 1.0 license. + diff --git a/README.txt b/README.txt index 099db2a9..90862117 100644 --- a/README.txt +++ b/README.txt @@ -1,8 +1,45 @@ Apache Whirr - +------------ Whirr is a set of libraries for running cloud services. Release notes are in src/site/xdoc/release-notes.xml. Website: http://incubator.apache.org/whirr Quick start: http://incubator.apache.org/whirr/quick-start-guide.html + +Cryptographic Software Notice +----------------------------- +This distribution includes cryptographic software. The country in +which you currently reside may have restrictions on the import, +possession, use, and/or re-export to another country, of +encryption software. BEFORE using any encryption software, please +check your country's laws, regulations and policies concerning the +import, possession, or use, and re-export of encryption software, to +see if this is permitted. See for more +information. + +The U.S. Government Department of Commerce, Bureau of Industry and +Security (BIS), has classified this software as Export Commodity +Control Number (ECCN) 5D002.C.1, which includes information security +software using or performing cryptographic functions with asymmetric +algorithms. The form and manner of this Apache Software Foundation +distribution makes it eligible for export under the License Exception +ENC Technology Software Unrestricted (TSU) exception (see the BIS +Export Administration Regulations, Section 740.13) for both object +code and source code. + +The following provides more details on the included cryptographic +software: + + Whirr requires the JSch library for SSH support: + http://www.jcraft.com/jsch/index.html + + Whirr requires Not-Yet-Commons-SSL for SSH keypair checking: + http://juliusdavies.ca/commons-ssl/ + + The jclouds enterprise module requires the BouncyCastle Java cryptography APIs: + http://www.bouncycastle.org/java.html + + Export classifications and source links can be found + at http://www.apache.org/licenses/exports/. + diff --git a/bin/examples b/bin/examples new file mode 100755 index 00000000..52302dc5 --- /dev/null +++ b/bin/examples @@ -0,0 +1,28 @@ +#!/usr/bin/env 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. + +bin=`dirname "$0"` +bin=`cd "$bin"; pwd` + +if [ -d "$bin/../examples/target/lib" ]; then + classpath="$bin/..:$bin/../examples/target/lib/*:$bin/../examples/target/*" +else + classpath="$bin/..:$bin/../lib/*" +fi + +java -cp "$classpath" org.apache.whirr.examples.Main "$@" + diff --git a/bin/whirr b/bin/whirr new file mode 100755 index 00000000..2df3bced --- /dev/null +++ b/bin/whirr @@ -0,0 +1,28 @@ +#!/usr/bin/env 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. + +bin=`dirname "$0"` +bin=`cd "$bin"; pwd` + +if [ -d "$bin/../cli/target/lib" ]; then + classpath="$bin/..:$bin/../cli/target/lib/*:$bin/../cli/target/*" +else + classpath="$bin/..:$bin/../lib/*" +fi + +java -cp "$classpath" org.apache.whirr.cli.Main "$@" + diff --git a/build-tools/pom.xml b/build-tools/pom.xml index ff8892b6..d9eb842b 100644 --- a/build-tools/pom.xml +++ b/build-tools/pom.xml @@ -20,12 +20,12 @@ org.apache.whirr whirr - 0.1.0-incubating-SNAPSHOT + 0.6.0-incubating-SNAPSHOT ../pom.xml org.apache.whirr whirr-build-tools jar - 0.1.0-incubating-SNAPSHOT + 0.6.0-incubating-SNAPSHOT Apache Whirr Build Tools diff --git a/build-tools/src/assemble-bin.xml b/build-tools/src/assemble-bin.xml new file mode 100644 index 00000000..225e0f05 --- /dev/null +++ b/build-tools/src/assemble-bin.xml @@ -0,0 +1,58 @@ + + + bin + + tar.gz + + + + + true + lib + false + + + + + + + + + ${project.basedir} + true + + NOTICE-src.txt + **/.project + **/.gitignore + **/${project.build.directory}/** + **/dependency-reduced-pom.xml + **/*.log + **/*.log.* + **/*.rej + **/*.classpath + **/whirr-logo.ai + + + + ${project.build.directory}/site + docs + + + diff --git a/build-tools/src/assemble.xml b/build-tools/src/assemble-src.xml similarity index 78% rename from build-tools/src/assemble.xml rename to build-tools/src/assemble-src.xml index 938fca86..abde4cb3 100644 --- a/build-tools/src/assemble.xml +++ b/build-tools/src/assemble-src.xml @@ -21,16 +21,29 @@ tar.gz + ${project.build.finalName}-src ${project.basedir} true + NOTICE*.txt **/.project **/.gitignore **/${project.build.directory}/** **/dependency-reduced-pom.xml + **/*.log + **/*.log.* + **/*.rej + **/*.classpath + **/whirr-logo.ai + + + NOTICE-src.txt + NOTICE.txt + + diff --git a/cli/pom.xml b/cli/pom.xml index cfdec9f9..e13736b4 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -20,15 +20,20 @@ org.apache.whirr whirr - 0.1.0-incubating-SNAPSHOT + 0.6.0-incubating-SNAPSHOT ../pom.xml org.apache.whirr whirr-cli jar - 0.1.0-incubating-SNAPSHOT + 0.6.0-incubating-SNAPSHOT Apache Whirr CLI + + ${project.groupId} + whirr-voldemort + ${project.version} + ${project.groupId} whirr-core @@ -39,6 +44,11 @@ whirr-cassandra ${project.version} + + ${project.groupId} + whirr-cdh + ${project.version} + ${project.groupId} whirr-hadoop @@ -50,23 +60,30 @@ ${project.version} - org.jclouds - jclouds-aws + ${project.groupId} + whirr-elasticsearch + ${project.version} - org.jclouds - jclouds-compute + ${project.groupId} + whirr-hbase + ${project.version} - org.jclouds - jclouds-enterprise + ${project.groupId} + whirr-hama + ${project.version} org.jclouds + jclouds-compute + + + org.jclouds.driver jclouds-jsch - org.jclouds + org.jclouds.driver jclouds-log4j @@ -81,6 +98,18 @@ org.mockito mockito-all + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + + + com.jcraft + jsch + log4j log4j @@ -96,43 +125,28 @@ + + + ${project.basedir}/src/main/resources + true + + + - org.apache.maven.plugins - maven-shade-plugin - 1.4 - - - package - - shade - - - whirr-cli-${project.version} - - - - Apache Whirr - - - - org.apache.whirr.cli.Main - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - + maven-dependency-plugin + + + install + + copy-dependencies + + + ${project.build.directory}/lib + + + + diff --git a/cli/src/main/java/org/apache/whirr/cli/Main.java b/cli/src/main/java/org/apache/whirr/cli/Main.java index 35d65712..e4b04704 100644 --- a/cli/src/main/java/org/apache/whirr/cli/Main.java +++ b/cli/src/main/java/org/apache/whirr/cli/Main.java @@ -18,7 +18,11 @@ package org.apache.whirr.cli; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import org.apache.whirr.command.Command; +import org.apache.whirr.service.ClusterActionHandler; import java.io.IOException; import java.io.InputStream; @@ -26,9 +30,8 @@ import java.util.Arrays; import java.util.List; import java.util.Map; - -import org.apache.whirr.cli.command.DestroyClusterCommand; -import org.apache.whirr.cli.command.LaunchClusterCommand; +import java.util.ServiceLoader; +import java.util.SortedSet; /** * The entry point for the Whirr CLI. @@ -48,24 +51,49 @@ public class Main { int run(InputStream in, PrintStream out, PrintStream err, List list) throws Exception { if (list.isEmpty()) { - out.println("Usage: whirr COMMAND [ARGS]"); - out.println("where COMMAND may be one of:"); - out.println(); - for (Command command : commandMap.values()) { - out.printf("%" + maxLen + "s %s\n", command.getName(), - command.getDescription()); - } + printUsage(out); return -1; } Command command = commandMap.get(list.get(0)); + if (command == null) { + err.printf("Unrecognized command '%s'\n", list.get(0)); + err.println(); + printUsage(err); + return -1; + } return command.run(in, out, err, list.subList(1, list.size())); } + + private void printUsage(PrintStream stream) { + stream.println("Usage: whirr COMMAND [ARGS]"); + stream.println("where COMMAND may be one of:"); + stream.println(); + for (Command command : commandMap.values()) { + stream.printf("%" + maxLen + "s %s\n", command.getName(), + command.getDescription()); + } + stream.println(); + stream.println("Available roles for instances:"); + for(String roleName : getSortedRoleNames()) { + stream.println(" " + roleName); + } + } + + private static SortedSet getSortedRoleNames() { + ServiceLoader loader = + ServiceLoader.load(ClusterActionHandler.class); + + SortedSet roles = Sets.newTreeSet(); + for(ClusterActionHandler handler : loader) { + roles.add(handler.getRole()); + } + return roles; + } public static void main(String... args) throws Exception { - Main main = new Main( - new LaunchClusterCommand(), - new DestroyClusterCommand() - ); + ServiceLoader loader = ServiceLoader.load(Command.class); + Main main = new Main(Lists.newArrayList(loader).toArray(new Command[0])); + int rc = main.run(System.in, System.out, System.err, Arrays.asList(args)); System.exit(rc); } diff --git a/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java index a866f76f..56b8506f 100644 --- a/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java +++ b/cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java @@ -26,20 +26,21 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; -import org.apache.whirr.service.ClusterSpec; -import org.apache.whirr.service.Service; -import org.apache.whirr.service.ServiceFactory; +import org.apache.whirr.ClusterController; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.ClusterSpec; +import org.apache.whirr.command.AbstractClusterCommand; /** * A command to destroy a running cluster (terminate and cleanup). */ -public class DestroyClusterCommand extends ClusterSpecCommand { +public class DestroyClusterCommand extends AbstractClusterCommand { public DestroyClusterCommand() throws IOException { - this(new ServiceFactory()); + this(new ClusterControllerFactory()); } - public DestroyClusterCommand(ServiceFactory factory) { + public DestroyClusterCommand(ClusterControllerFactory factory) { super("destroy-cluster", "Terminate and cleanup resources for a running cluster.", factory); } @@ -56,8 +57,8 @@ public int run(InputStream in, PrintStream out, PrintStream err, try { ClusterSpec clusterSpec = getClusterSpec(optionSet); - Service service = factory.create(clusterSpec.getServiceName()); - service.destroyCluster(clusterSpec); + ClusterController controller = createClusterController(clusterSpec.getServiceName()); + controller.destroyCluster(clusterSpec); return 0; } catch (IllegalArgumentException e) { err.println(e.getMessage()); diff --git a/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java new file mode 100644 index 00000000..ca187c41 --- /dev/null +++ b/cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java @@ -0,0 +1,87 @@ +/** + * 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. + */ + +package org.apache.whirr.cli.command; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.util.List; + +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + +import org.apache.whirr.ClusterController; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.ClusterSpec; +import org.apache.whirr.command.AbstractClusterCommand; + +/** + * A command to destroy an instance from a cluster + */ +public class DestroyInstanceCommand extends AbstractClusterCommand { + + private OptionSpec instanceOption = parser + .accepts("instance-id", "Cluster instance ID") + .withRequiredArg() + .ofType(String.class); + + public DestroyInstanceCommand() throws IOException { + this(new ClusterControllerFactory()); + } + + public DestroyInstanceCommand(ClusterControllerFactory factory) { + super("destroy-instance", "Terminate and cleanup resources " + + "for a single instance.", factory); + } + + @Override + public int run(InputStream in, PrintStream out, + PrintStream err, List args) throws Exception { + + OptionSet optionSet = parser.parse(args.toArray(new String[0])); + if (!optionSet.nonOptionArguments().isEmpty()) { + printUsage(parser, err); + return -1; + } + try { + if (!optionSet.hasArgument(instanceOption)) { + throw new IllegalArgumentException("You need to specify an instance ID."); + } + ClusterSpec clusterSpec = getClusterSpec(optionSet); + ClusterController controller = createClusterController(clusterSpec.getServiceName()); + + String instanceId = optionSet.valueOf(instanceOption); + controller.destroyInstance(clusterSpec, instanceId); + + return 0; + + } catch(IllegalArgumentException e) { + err.println(e.getMessage()); + printUsage(parser, err); + return -1; + } + } + + private void printUsage(OptionParser parser, PrintStream stream) throws IOException { + stream.println("Usage: whirr destroy-instance --instance-id [OPTIONS]"); + stream.println(); + parser.printHelpOn(stream); + } +} diff --git a/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java index 6331162b..a3e2dc51 100644 --- a/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java +++ b/cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java @@ -26,21 +26,22 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; -import org.apache.whirr.service.Cluster; -import org.apache.whirr.service.ClusterSpec; -import org.apache.whirr.service.Service; -import org.apache.whirr.service.ServiceFactory; +import org.apache.whirr.Cluster; +import org.apache.whirr.ClusterController; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.ClusterSpec; +import org.apache.whirr.command.AbstractClusterCommand; /** * A command to launch a new cluster. */ -public class LaunchClusterCommand extends ClusterSpecCommand { +public class LaunchClusterCommand extends AbstractClusterCommand { public LaunchClusterCommand() throws IOException { - this(new ServiceFactory()); + this(new ClusterControllerFactory()); } - public LaunchClusterCommand(ServiceFactory factory) { + public LaunchClusterCommand(ClusterControllerFactory factory) { super("launch-cluster", "Launch a new cluster running a service.", factory); } @@ -57,8 +58,8 @@ public int run(InputStream in, PrintStream out, PrintStream err, try { ClusterSpec clusterSpec = getClusterSpec(optionSet); - Service service = factory.create(clusterSpec.getServiceName()); - Cluster cluster = service.launchCluster(clusterSpec); + ClusterController controller = createClusterController(clusterSpec.getServiceName()); + Cluster cluster = controller.launchCluster(clusterSpec); out.printf("Started cluster of %s instances\n", cluster.getInstances().size()); out.println(cluster); diff --git a/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java new file mode 100644 index 00000000..5aa3cdbf --- /dev/null +++ b/cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java @@ -0,0 +1,97 @@ +/** + * 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. + */ + +package org.apache.whirr.cli.command; + +import com.google.common.base.Joiner; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.util.List; + +import joptsimple.OptionParser; +import joptsimple.OptionSet; + +import org.apache.whirr.Cluster; +import org.apache.whirr.ClusterController; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.ClusterSpec; +import org.apache.whirr.command.AbstractClusterCommand; +import org.apache.whirr.service.ClusterStateStore; +import org.apache.whirr.service.ClusterStateStoreFactory; + +/** + * A command to list the nodes in a cluster. + */ +public class ListClusterCommand extends AbstractClusterCommand { + + public ListClusterCommand() throws IOException { + this(new ClusterControllerFactory()); + } + + public ListClusterCommand(ClusterControllerFactory factory) { + this(factory, new ClusterStateStoreFactory()); + } + + public ListClusterCommand(ClusterControllerFactory factory, + ClusterStateStoreFactory stateStoreFactory) { + super("list-cluster", "List the nodes in a cluster.", factory, stateStoreFactory); + } + + @Override + public int run(InputStream in, PrintStream out, PrintStream err, + List args) throws Exception { + + OptionSet optionSet = parser.parse(args.toArray(new String[0])); + + if (!optionSet.nonOptionArguments().isEmpty()) { + printUsage(parser, err); + return -1; + } + try { + ClusterSpec clusterSpec = getClusterSpec(optionSet); + ClusterStateStore stateStore = createClusterStateStore(clusterSpec); + ClusterController controller = createClusterController(clusterSpec.getServiceName()); + + for (Cluster.Instance instance : controller.getInstances(clusterSpec, stateStore)) { + out.println(Joiner.on('\t').join( + instance.getId(), + instance.getNodeMetadata().getImageId(), + instance.getPublicIp(), + instance.getPrivateIp(), + instance.getNodeMetadata().getState(), + instance.getNodeMetadata().getLocation().getId(), + Joiner.on(",").join(instance.getRoles()) + ) + ); + } + return 0; + } catch (IllegalArgumentException e) { + err.println(e.getMessage()); + printUsage(parser, err); + return -1; + } + } + + private void printUsage(OptionParser parser, PrintStream stream) throws IOException { + stream.println("Usage: whirr list-cluster [OPTIONS]"); + stream.println(); + parser.printHelpOn(stream); + } +} diff --git a/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java new file mode 100644 index 00000000..c5be0a28 --- /dev/null +++ b/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java @@ -0,0 +1,101 @@ +/* + * 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. + */ + +package org.apache.whirr.cli.command; + +import com.google.common.collect.ImmutableSet; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.command.AbstractClusterCommand; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.providers.Providers; + +import java.io.InputStream; +import java.io.PrintStream; +import java.util.List; +import java.util.Set; + +public class ListProvidersCommand extends AbstractClusterCommand { + + Set testedComputeProviders = ImmutableSet.of("aws-ec2", + "cloudservers-us", "cloudservers-uk", "byon"); + + public ListProvidersCommand() { + super("list-providers", "Show a list of the supported providers", + new ClusterControllerFactory()); + } + + @Override + public int run(InputStream in, PrintStream out, + PrintStream err, List args) throws Exception { + + if (args.size() == 0) { + printUsage(out); + + } else { + String type = args.get(0); + + if ("compute".equals(type)) { + listComputeProviders(out); + } else if ("blobstore".equals(type)) { + listBlobstoreProviders(out); + } + } + + return 0; + } + + private void printUsage(PrintStream out) { + out.println("whirr list-providers "); + } + + private void listBlobstoreProviders(PrintStream out) { + for(ProviderMetadata blobstore : Providers.allBlobStore()) { + out.println("* " + blobstore.getName()); + + out.println("\tHomepage: " + blobstore.getHomepage()); + out.println("\tConsole: " + blobstore.getConsole()); + out.println("\tAPI: " + blobstore.getApiDocumentation()); + + out.println("\tConfiguration options:"); + + out.println("\t\twhirr.blobstore-provider = " + blobstore.getId()); + out.println("\t\twhirr.blobstore-identity = <" + blobstore.getIdentityName() +">"); + out.println("\t\twhirr.blobstore-credential = <" + blobstore.getCredentialName() + ">\n"); + } + } + + private void listComputeProviders(PrintStream out) { + for(ProviderMetadata provider : Providers.allCompute()) { + if (testedComputeProviders.contains(provider.getId())) { + out.println("* " + provider.getName() + " - tested"); + } else { + out.println("* " + provider.getName()); + } + + out.println("\tHomepage: " + provider.getHomepage()); + out.println("\tConsole: " + provider.getConsole()); + out.println("\tAPI: " + provider.getApiDocumentation()); + + out.println("\tConfiguration options:"); + + out.println("\t\twhirr.provider = " + provider.getId()); + out.println("\t\twhirr.identity = <" + provider.getIdentityName() + ">"); + out.println("\t\twhirr.credential = <" + provider.getCredentialName() + ">\n"); + } + } +} diff --git a/cli/src/main/java/org/apache/whirr/cli/command/RunScriptCommand.java b/cli/src/main/java/org/apache/whirr/cli/command/RunScriptCommand.java new file mode 100644 index 00000000..8ec7dde0 --- /dev/null +++ b/cli/src/main/java/org/apache/whirr/cli/command/RunScriptCommand.java @@ -0,0 +1,179 @@ +/** + * 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. + */ + +package org.apache.whirr.cli.command; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import com.google.common.io.Files; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; +import org.apache.commons.lang.StringUtils; +import org.apache.whirr.Cluster; +import org.apache.whirr.ClusterController; +import org.apache.whirr.ClusterControllerFactory; +import org.apache.whirr.ClusterSpec; +import org.apache.whirr.command.AbstractClusterCommand; +import org.apache.whirr.service.ClusterStateStoreFactory; +import org.jclouds.compute.domain.ExecResponse; +import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.scriptbuilder.domain.Statement; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.nio.charset.Charset; +import java.util.List; +import java.util.Map; + +import static org.apache.whirr.RolePredicates.anyRoleIn; +import static org.jclouds.compute.predicates.NodePredicates.withIds; +import static org.jclouds.scriptbuilder.domain.Statements.exec; + +public class RunScriptCommand extends AbstractClusterCommand { + + private OptionSpec rolesOption = parser + .accepts("roles", "List of comma separated role names. " + + "E.g. zookeeper,hadoop-namenode") + .withRequiredArg() + .ofType(String.class); + + private OptionSpec instancesOption = parser + .accepts("instances", "List of comma separated instance IDs") + .withRequiredArg() + .ofType(String.class); + + private OptionSpec scriptOption = parser + .accepts("script", "Path to script file to execute.") + .withRequiredArg() + .ofType(String.class); + + public RunScriptCommand() { + this(new ClusterControllerFactory()); + } + + public RunScriptCommand(ClusterControllerFactory factory) { + this(factory, new ClusterStateStoreFactory()); + } + + public RunScriptCommand(ClusterControllerFactory factory, + ClusterStateStoreFactory stateStoreFactory) { + super("run-script", "Run a script on a specific instance or a " + + "group of instances matching a role name", factory, stateStoreFactory); + } + + @Override + public int run(InputStream in, PrintStream out, PrintStream err, + List args) throws Exception { + + OptionSet optionSet = parser.parse(args.toArray(new String[0])); + if (!optionSet.has(scriptOption)) { + err.println("Please specify a script file to be executed."); + printUsage(parser, err); + return -1; + } + + if (!(new File(optionSet.valueOf(scriptOption))).exists()) { + err.printf("Script file '%s' not found.", optionSet.valueOf(scriptOption)); + printUsage(parser, err); + return -2; + } + + try { + ClusterSpec spec = getClusterSpec(optionSet); + ClusterController controller = createClusterController(spec.getServiceName()); + + Predicate condition = buildFilterPredicate(optionSet, spec); + + return handleScriptOutput(out, err, controller.runScriptOnNodesMatching( + spec, condition, execFile(optionSet.valueOf(scriptOption)))); + + } catch(IllegalArgumentException e) { + err.println(e.getMessage()); + printUsage(parser, err); + return -3; + } + } + + private Predicate buildFilterPredicate(OptionSet optionSet, ClusterSpec spec) + throws IOException { + + Predicate condition = Predicates.alwaysTrue(); + + if (optionSet.has(instancesOption)) { + String[] ids = optionSet.valueOf(instancesOption).split(","); + return Predicates.and(condition, withIds(ids)); + + } else if(optionSet.has(rolesOption)) { + String[] roles = optionSet.valueOf(rolesOption).split(","); + List ids = Lists.newArrayList(); + + Cluster cluster = createClusterStateStore(spec).load(); + for (Cluster.Instance instance : cluster.getInstancesMatching( + anyRoleIn(Sets.newHashSet(roles)))) { + ids.add(instance.getId()); + } + + condition = Predicates.and(condition, + withIds(ids.toArray(new String[0]))); + } + return condition; + } + + private int handleScriptOutput(PrintStream out, PrintStream err, + Map responses) { + int rc = 0; + for (Map.Entry entry : responses.entrySet()) { + out.printf("** Node %s: %s%n", entry.getKey().getId(), + Iterables.concat(entry.getKey().getPrivateAddresses(), + entry.getKey().getPublicAddresses())); + + ExecResponse response = entry.getValue(); + if (response.getExitCode() != 0) { + rc = response.getExitCode(); + } + out.printf("%s%n", response.getOutput()); + err.printf("%s%n", response.getError()); + } + return rc; + } + + private Statement execFile(String filePath) throws IOException { + return exec(getFileContent(filePath)); + } + + private String getFileContent(String filePath) throws IOException { + return StringUtils.join(Files.readLines(new File(filePath), + Charset.defaultCharset()), + "\n"); + } + + private void printUsage(OptionParser parser, + PrintStream stream) throws IOException { + stream.println("Usage: whirr run-script [OPTIONS] --script