Update HighAvailabilityCassandraCluster.java Add numAvailabilityZones and initialSize as catalog options.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/569dcc57 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/569dcc57 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/569dcc57 Branch: refs/heads/0.6.0 Commit: 569dcc5716c5685183e6a27857c62908829753c3 Parents: 25b37b3 Author: David Toy <[email protected]> Authored: Fri Nov 1 10:33:13 2013 +0000 Committer: David Toy <[email protected]> Committed: Fri Nov 1 10:33:13 2013 +0000 ---------------------------------------------------------------------- .../demo/HighAvailabilityCassandraCluster.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/569dcc57/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java ---------------------------------------------------------------------- diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java index 73d6e2c..cdb4926 100644 --- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java +++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java @@ -17,6 +17,10 @@ package brooklyn.demo; import java.util.List; +import brooklyn.catalog.Catalog; +import brooklyn.catalog.CatalogConfig; +import brooklyn.config.ConfigKey; +import brooklyn.entity.basic.ConfigKeys; import brooklyn.entity.basic.AbstractApplication; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; @@ -32,17 +36,27 @@ import brooklyn.util.CommandLineUtil; import com.google.common.collect.Lists; +@Catalog(name="HA Cassandra Cluster Application", description="Deploy a Cassandra cluster with a High Availability architecture.") public class HighAvailabilityCassandraCluster extends AbstractApplication { public static final String DEFAULT_LOCATION_SPEC = "aws-ec2:us-east-1"; + + @CatalogConfig(label="Number of Availability Zones", priority=1) + public static final ConfigKey<Integer> NUM_AVAILABILITY_ZONES = ConfigKeys.newConfigKey( + "cassandra.cluster.numAvailabilityZones", "Number of availability zones to spread the cluster across", 3); + + @CatalogConfig(label="Initial Cluster Size", priority=2) + public static final ConfigKey<Integer> CASSANDRA_CLUSTER_SIZE = ConfigKeys.newConfigKey( + "cassandra.cluster.initialSize", "Initial size of the Cassandra cluster", 6); + @Override public void init() { addChild(EntitySpec.create(CassandraCluster.class) .configure(CassandraCluster.CLUSTER_NAME, "Brooklyn") - .configure(CassandraCluster.INITIAL_SIZE, 6) + .configure(CassandraCluster.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE)) .configure(CassandraCluster.ENABLE_AVAILABILITY_ZONES, true) - .configure(CassandraCluster.NUM_AVAILABILITY_ZONES, 3) + .configure(CassandraCluster.NUM_AVAILABILITY_ZONES, getConfig(NUM_AVAILABILITY_ZONES)) //See https://github.com/brooklyncentral/brooklyn/issues/973 //.configure(CassandraCluster.AVAILABILITY_ZONE_NAMES, ImmutableList.of("us-east-1b", "us-east-1c", "us-east-1e")) .configure(CassandraCluster.ENDPOINT_SNITCH_NAME, "GossipingPropertyFileSnitch")
