Merge branch 'master' of github.com:grkvlt/brooklyn-central into
feature/resourceutils-static
* 'master' of github.com:grkvlt/brooklyn-central: (37 commits)
Replaced erroneous magic number with constant
Fixed indentation following PR comments
Changed pubsub message text to be in line with new Subscribe output
Update following PR comments
Fixed addition of elasticsearch dependency that had broken whirr/base/pom.xml
Fixed another reference to StandaloneBrokerExample vs
StandaloneQpidBrokerExample
Fixed issue that mean example subscriber would quit after 101 messages, not
100
Added message to the example message subscriber to clarify why it run, then
quit
Added call to super.connectSensors() in QpidBrokerImpl (its ommission meant
the BROKER_URL sensor was never set)
Updated example text to use same classname as provided class
Updated whirr example to add whirr-elasticsearch jar to BROOKLYN_CLASSPATH
and added note about including whirr-elasticsearch as a dependency
Added whirr-elasticsearch dependency to hadoop-and-whirr example pom and test
dependency to whirr/base/pom
Updated screenshots in whirr hadoop example
Fixed typo in whirrhadoop example
Added explicit call to Entities.manage() for whirr entities (fixes entity
display issue in web console)
Added version-specific dependency for jclouds-enterprise (required by whirr)
Update WideAreaCassandraCluster.java
Update HighAvailabilityCassandraCluster.java
fix test for removal of delete button from home page js gui
tweak web example sql so it is more portable
...
Conflicts:
examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/b6eb7c0b
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/b6eb7c0b
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/b6eb7c0b
Branch: refs/heads/0.6.0
Commit: b6eb7c0badbed671c85c7f00a6baea6372d5599c
Parents: 36604f7 b462f8d
Author: Andrew Kennedy <[email protected]>
Authored: Tue Nov 5 13:09:12 2013 +0000
Committer: Andrew Kennedy <[email protected]>
Committed: Tue Nov 5 13:09:12 2013 +0000
----------------------------------------------------------------------
examples/hadoop-and-whirr/pom.xml | 5 +
.../src/main/java/brooklyn/demo/Publish.java | 2 +-
.../src/main/java/brooklyn/demo/Subscribe.java | 19 +-
.../brooklyn/demo/CumulusRDFApplication.java | 178 +++++++++++++------
.../demo/HighAvailabilityCassandraCluster.java | 18 +-
.../brooklyn/demo/WideAreaCassandraCluster.java | 15 +-
.../main/resources/visitors-creation-script.sql | 10 +-
.../test/resources/visitors-creation-script.sql | 10 +-
.../entity/database/mysql/MySqlNodeImpl.java | 2 -
.../entity/messaging/qpid/QpidBrokerImpl.java | 1 +
.../nosql/cassandra/CassandraCluster.java | 101 ++++++-----
.../entity/nosql/cassandra/CassandraFabric.java | 39 ++--
12 files changed, 272 insertions(+), 128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/b6eb7c0b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
----------------------------------------------------------------------
diff --cc
examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
index 6fb69de,879fe66..af6e469
---
a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
+++
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
@@@ -74,55 -99,65 +99,65 @@@ public class CumulusRDFApplication exte
.description("Configure the CumulusRDF web application")
.buildAbstract();
- private CassandraCluster cassandra;
- private TomcatServer tomcat;
-
- /** Create entities. */
+ private Entity cassandra;
+ private TomcatServer webapp;
+ private HostAndPort endpoint;
+
+ /**
+ * Create the application entities:
+ * <ul>
+ * <li>A {@link CassandraFabric} of {@link CassandraCluster}s containing
{@link CassandraNode}s
+ * <li>A {@link TomcatServer}
+ * </ul>
+ */
+ @Override
public void init() {
- // The cassandra cluster entity
- cassandra = addChild(EntitySpec.create(CassandraCluster.class)
- .configure("initialSize", getConfig(CASSANDRA_CLUSTER_SIZE))
- .configure("clusterName", "CumulusRDF")
- .configure("memberSpec",
EntitySpec.create(CassandraNode.class)
- .configure("jmxAgentMode",
UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
- .configure("jmxPort", "11099+")
- .configure("rmiServerPort", "9001+")
- .configure("thriftPort",
getConfig(CASSANDRA_THRIFT_PORT))));
-
- // The tomcat server entity
- tomcat = addChild(EntitySpec.create(TomcatServer.class)
- .configure("version", "7.0.42")
- .configure("jmxAgentMode",
UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
- .configure("jmxPort", "11099+")
- .configure("rmiServerPort", "9001+")
- .configure("war", "classpath://cumulusrdf.war")
- .configure("javaSysProps",
MutableMap.of("cumulusrdf.config-file", "/tmp/cumulus.yaml")));
+ // Cassandra cluster
+ EntitySpec<CassandraCluster> clusterSpec =
EntitySpec.create(CassandraCluster.class)
+ .configure(CassandraCluster.MEMBER_SPEC,
EntitySpec.create(CassandraNode.class)
+ .configure(UsesJmx.JMX_AGENT_MODE,
UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
+ .configure(UsesJmx.JMX_PORT,
PortRanges.fromString("11099+"))
+ .configure(UsesJmx.RMI_REGISTRY_PORT,
PortRanges.fromString("9001+"))
+ .configure(CassandraNode.THRIFT_PORT,
PortRanges.fromInteger(getConfig(CASSANDRA_THRIFT_PORT)))
+
.policy(PolicySpec.create(ServiceFailureDetector.class))
+ .policy(PolicySpec.create(ServiceRestarter.class)
+
.configure(ServiceRestarter.FAILURE_SENSOR_TO_MONITOR,
ServiceFailureDetector.ENTITY_FAILED)))
+ .policy(PolicySpec.create(ServiceReplacer.class)
+ .configure(ServiceReplacer.FAILURE_SENSOR_TO_MONITOR,
ServiceRestarter.ENTITY_RESTART_FAILED));
+
+ if (getConfig(MULTI_REGION_FABRIC)) {
+ cassandra = addChild(EntitySpec.create(CassandraFabric.class)
+ .configure(CassandraCluster.CLUSTER_NAME, "Brooklyn")
+ .configure(CassandraCluster.INITIAL_SIZE,
getConfig(CASSANDRA_CLUSTER_SIZE)) // per location
+ .configure(CassandraCluster.ENDPOINT_SNITCH_NAME,
"brooklyn.entity.nosql.cassandra.customsnitch.MultiCloudSnitch")
+ .configure(CassandraNode.CUSTOM_SNITCH_JAR_URL,
"classpath://brooklyn/entity/nosql/cassandra/cassandra-multicloud-snitch.jar")
+ .configure(CassandraFabric.MEMBER_SPEC, clusterSpec));
+ } else {
+ cassandra = addChild(EntitySpec.create(clusterSpec)
+ .configure(CassandraCluster.CLUSTER_NAME, "Brooklyn")
+ .configure(CassandraCluster.INITIAL_SIZE,
getConfig(CASSANDRA_CLUSTER_SIZE)));
+ }
+
+ // Tomcat web-app server
+ webapp = addChild(EntitySpec.create(TomcatServer.class)
+ .configure(SoftwareProcess.SUGGESTED_VERSION, "7.0.42")
+ .configure(UsesJmx.JMX_AGENT_MODE,
UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT)
+ .configure(UsesJmx.JMX_PORT, PortRanges.fromString("11099+"))
+ .configure(UsesJmx.RMI_REGISTRY_PORT,
PortRanges.fromString("9001+"))
+ .configure(JavaWebAppService.ROOT_WAR,
"classpath://cumulusrdf.war")
+ .configure(UsesJava.JAVA_SYSPROPS,
MutableMap.of("cumulusrdf.config-file", "/tmp/cumulus.yaml")));
// Add an effector to tomcat to reconfigure with a new YAML config
file
- ((EntityInternal)
tomcat).getMutableEntityType().addEffector(cumulusConfig, new
EffectorBody<Void>() {
- private HostAndPort clusterEndpoint;
-
+ ((EntityInternal)
webapp).getMutableEntityType().addEffector(cumulusConfig, new
EffectorBody<Void>() {
@Override
public Void call(ConfigBag parameters) {
- String hostname =
cassandra.getAttribute(CassandraCluster.HOSTNAME);
- Integer thriftPort =
cassandra.getAttribute(CassandraCluster.THRIFT_PORT);
- HostAndPort currentEndpoint = HostAndPort.fromParts(hostname,
thriftPort);
-
- // Check if the cluster access point has changed
- if (!currentEndpoint.equals(clusterEndpoint)) {
- log.info("Setting cluster endpoint to {}",
currentEndpoint.toString());
- clusterEndpoint = currentEndpoint;
-
- // Process the YAML template given in the application
config
- String url =
Entities.getRequiredUrlConfig(CumulusRDFApplication.this,
CUMULUS_RDF_CONFIG_URL);
- Map<String, Object> config = MutableMap.<String,
Object>of("cassandraHostname", clusterEndpoint.getHostText(),
"cassandraThriftPort", clusterEndpoint.getPort());
- String contents =
TemplateProcessor.processTemplateContents(ResourceUtils.create(this).getResourceAsString(url),
config);
-
- // Copy the file contents to the remote machine
-
DynamicTasks.queue(SshEffectorTasks.put("/tmp/cumulus.yaml").contents(contents));
- }
+ // Process the YAML template given in the application config
+ String url =
Entities.getRequiredUrlConfig(CumulusRDFApplication.this,
CUMULUS_RDF_CONFIG_URL);
+ Map<String, Object> config = MutableMap.<String,
Object>of("cassandraHostname", endpoint.getHostText(), "cassandraThriftPort",
endpoint.getPort());
- String contents =
TemplateProcessor.processTemplateContents(new
ResourceUtils(CumulusRDFApplication.this).getResourceAsString(url), config);
++ String contents =
TemplateProcessor.processTemplateContents(ResourceUtils.create(CumulusRDFApplication.this).getResourceAsString(url),
config);
- return null;
+ // Copy the file contents to the remote machine
+ return
DynamicTasks.queue(SshEffectorTasks.put("/tmp/cumulus.yaml").contents(contents)).get();
}
});