You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:46:31 UTC

[13/50] brooklyn-library git commit: Examples extend AbstractApplication instead of ApplicationBuilder

Examples extend AbstractApplication instead of ApplicationBuilder


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/3c0f5e60
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/3c0f5e60
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/3c0f5e60

Branch: refs/heads/0.5.0
Commit: 3c0f5e60b45be72d0afc2acebc3e9111b73a4cd0
Parents: 576b649
Author: Aled Sage <al...@gmail.com>
Authored: Thu Mar 28 16:45:00 2013 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Apr 1 12:41:41 2013 +0100

----------------------------------------------------------------------
 .../java/brooklyn/demo/GlobalWebFabricExample.java     | 11 ++++++-----
 .../extras/whirr/WebClusterWithHadoopExample.java      |  2 +-
 .../extras/whirr/WebFabricWithHadoopExample.java       |  2 +-
 .../main/java/brooklyn/extras/whirr/WhirrExample.java  |  9 +++++----
 .../java/brooklyn/extras/whirr/WhirrHadoopExample.java |  8 ++++----
 .../demo/MonitoredCassandraClusterExample.java         |  6 +++---
 .../MovableCloudFoundryClusterExample.java             |  8 ++++----
 .../java/brooklyn/demo/StandaloneBrokerExample.java    |  9 +++++----
 .../java/brooklyn/demo/SingleWebServerExample.java     |  8 ++++----
 .../java/brooklyn/demo/WebClusterDatabaseExample.java  | 13 +++++++------
 .../demo/WebClusterDatabaseExampleGroovy.groovy        | 11 ++++++-----
 .../src/main/java/brooklyn/demo/WebClusterExample.java |  9 +++++----
 12 files changed, 51 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java b/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
index d57d9e3..dbfab17 100644
--- a/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
+++ b/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
@@ -9,7 +9,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import brooklyn.config.StringConfigMap;
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Attributes;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.dns.geoscaling.GeoscalingDnsService;
@@ -27,7 +27,7 @@ import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
-public class GlobalWebFabricExample extends ApplicationBuilder {
+public class GlobalWebFabricExample extends AbstractApplication {
 
     public static final Logger log = LoggerFactory.getLogger(GlobalWebFabricExample.class);
     
@@ -39,8 +39,9 @@ public class GlobalWebFabricExample extends ApplicationBuilder {
             "aws-ec2:us-west-1" 
 //            "cloudfoundry:https://api.aws.af.cm/",
         );
-    
-    protected void doBuild() {
+
+    @Override
+    public void postConstruct() {
         StringConfigMap config = getManagementContext().getConfig();
         
         GeoscalingDnsService geoDns = addChild(EntitySpecs.spec(GeoscalingDnsService.class)
@@ -74,7 +75,7 @@ public class GlobalWebFabricExample extends ApplicationBuilder {
         String locations = CommandLineUtil.getCommandLineOption(args, "--locations", Joiner.on(",").join(DEFAULT_LOCATIONS));
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new GlobalWebFabricExample().appDisplayName("Brooklyn Global Web Fabric Example"))
+                .application(EntitySpecs.appSpec(GlobalWebFabricExample.class).displayName("Brooklyn Global Web Fabric Example"))
                 .webconsolePort(port)
                 .locations(Arrays.asList(locations))
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebClusterWithHadoopExample.java
----------------------------------------------------------------------
diff --git a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebClusterWithHadoopExample.java b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebClusterWithHadoopExample.java
index 683938d..0a0f849 100644
--- a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebClusterWithHadoopExample.java
+++ b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebClusterWithHadoopExample.java
@@ -182,7 +182,7 @@ public class WebClusterWithHadoopExample extends AbstractApplication implements
         String location = CommandLineUtil.getCommandLineOption(args, "--location", Joiner.on(",").join(DEFAULT_LOCATIONS));
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(EntitySpecs.spec(StartableApplication.class)
+                .application(EntitySpecs.appSpec(StartableApplication.class)
                         .displayName("Brooklyn Global Web Fabric with Hadoop Example")
                         .impl(WebClusterWithHadoopExample.class))
                 .webconsolePort(port)

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebFabricWithHadoopExample.java
----------------------------------------------------------------------
diff --git a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebFabricWithHadoopExample.java b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebFabricWithHadoopExample.java
index d53b798..11916a1 100644
--- a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebFabricWithHadoopExample.java
+++ b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WebFabricWithHadoopExample.java
@@ -256,7 +256,7 @@ public class WebFabricWithHadoopExample extends AbstractApplication implements S
         String location = CommandLineUtil.getCommandLineOption(args, "--location", Joiner.on(",").join(DEFAULT_LOCATIONS));
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(EntitySpecs.spec(StartableApplication.class)
+                .application(EntitySpecs.appSpec(StartableApplication.class)
                         .displayName("Brooklyn Global Web Fabric with Hadoop Example")
                         .impl(WebFabricWithHadoopExample.class))
                 .webconsolePort(port)

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrExample.java
----------------------------------------------------------------------
diff --git a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrExample.java b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrExample.java
index a3fe74c..d01bc4c 100644
--- a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrExample.java
+++ b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrExample.java
@@ -5,7 +5,7 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.StartableApplication;
 import brooklyn.entity.proxying.EntitySpecs;
@@ -15,7 +15,7 @@ import brooklyn.util.CommandLineUtil;
 
 import com.google.common.collect.Lists;
 
-public class WhirrExample extends ApplicationBuilder {
+public class WhirrExample extends AbstractApplication {
 
     private static final Logger LOG = LoggerFactory.getLogger(WhirrExample.class);
 
@@ -26,7 +26,8 @@ public class WhirrExample extends ApplicationBuilder {
             "whirr.hardware-min-ram=1024"+"\n"+
             "whirr.instance-templates=1 noop, 1 elasticsearch"+"\n";
 
-    protected void doBuild() {
+    @Override
+    public void postConstruct() {
         WhirrCluster cluster = addChild(EntitySpecs.spec(WhirrCluster.class)
                 .configure("recipe", RECIPE));
     }
@@ -37,7 +38,7 @@ public class WhirrExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new WhirrExample())
+                .application(EntitySpecs.appSpec(WhirrExample.class))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrHadoopExample.java
----------------------------------------------------------------------
diff --git a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrHadoopExample.java b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrHadoopExample.java
index fbaa636..7a51b0c 100644
--- a/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrHadoopExample.java
+++ b/examples/hadoop-and-whirr/src/main/java/brooklyn/extras/whirr/WhirrHadoopExample.java
@@ -5,7 +5,7 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.StartableApplication;
 import brooklyn.entity.proxying.EntitySpecs;
@@ -16,14 +16,14 @@ import brooklyn.util.CommandLineUtil;
 
 import com.google.common.collect.Lists;
 
-public class WhirrHadoopExample extends ApplicationBuilder {
+public class WhirrHadoopExample extends AbstractApplication {
 
     private static final Logger LOG = LoggerFactory.getLogger(WhirrHadoopExample.class);
 
     public static final String DEFAULT_LOCATION = "aws-ec2:eu-west-1";
 
     @Override
-    protected void doBuild() {
+    public void postConstruct() {
         WhirrCluster cluster = addChild(EntitySpecs.spec(WhirrHadoopCluster.class)
                 .displayName("brooklyn-hadoop-example")
                 .configure("size", 2)
@@ -36,7 +36,7 @@ public class WhirrHadoopExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new WhirrHadoopExample())
+                .application(EntitySpecs.appSpec(WhirrHadoopExample.class))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/monitored-cassandra-cluster/src/main/java/brooklyn/demo/MonitoredCassandraClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/monitored-cassandra-cluster/src/main/java/brooklyn/demo/MonitoredCassandraClusterExample.java b/examples/monitored-cassandra-cluster/src/main/java/brooklyn/demo/MonitoredCassandraClusterExample.java
index 3c1a05f..6c475b2 100644
--- a/examples/monitored-cassandra-cluster/src/main/java/brooklyn/demo/MonitoredCassandraClusterExample.java
+++ b/examples/monitored-cassandra-cluster/src/main/java/brooklyn/demo/MonitoredCassandraClusterExample.java
@@ -1,14 +1,14 @@
 package brooklyn.demo;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.nosql.cassandra.CassandraCluster;
 import brooklyn.entity.proxying.EntitySpecs;
 
 /** Cassandra Application */
-public class MonitoredCassandraClusterExample extends ApplicationBuilder {
+public class MonitoredCassandraClusterExample extends AbstractApplication {
 
     @Override
-    protected void doBuild() {
+    public void postConstruct() {
         addChild(EntitySpecs.spec(CassandraCluster.class)
                 .configure("initialSize", "2")
                 .configure("clusterName", "CassandraDemo")

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/portable-cloudfoundry/src/main/java/brooklyn/example/cloudfoundry/MovableCloudFoundryClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/portable-cloudfoundry/src/main/java/brooklyn/example/cloudfoundry/MovableCloudFoundryClusterExample.java b/examples/portable-cloudfoundry/src/main/java/brooklyn/example/cloudfoundry/MovableCloudFoundryClusterExample.java
index 4b6dbb1..ee96826 100644
--- a/examples/portable-cloudfoundry/src/main/java/brooklyn/example/cloudfoundry/MovableCloudFoundryClusterExample.java
+++ b/examples/portable-cloudfoundry/src/main/java/brooklyn/example/cloudfoundry/MovableCloudFoundryClusterExample.java
@@ -2,7 +2,7 @@ package brooklyn.example.cloudfoundry;
 
 import java.util.List;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpecs;
 import brooklyn.launcher.BrooklynLauncher;
@@ -10,13 +10,13 @@ import brooklyn.util.CommandLineUtil;
 
 import com.google.common.collect.Lists;
 
-public class MovableCloudFoundryClusterExample extends ApplicationBuilder {
+public class MovableCloudFoundryClusterExample extends AbstractApplication {
 
     public static final String DEFAULT_LOCATION = "cloudfoundry";
     public static final String WAR_FILE_URL = "classpath://hello-world-webapp.war";
 
     @Override
-    protected void doBuild() {
+    public void postConstruct() {
         addChild(EntitySpecs.spec(MovableElasticWebAppCluster.class)
                 .configure("war", WAR_FILE_URL));
     }
@@ -27,7 +27,7 @@ public class MovableCloudFoundryClusterExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new MovableCloudFoundryClusterExample().appDisplayName("Movable Web Cluster"))
+                .application(EntitySpecs.appSpec(MovableCloudFoundryClusterExample.class).displayName("Movable Web Cluster"))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneBrokerExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneBrokerExample.java b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneBrokerExample.java
index 014e3c8..3d9b903 100644
--- a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneBrokerExample.java
+++ b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneBrokerExample.java
@@ -2,7 +2,7 @@ package brooklyn.demo;
 
 import java.util.List;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.messaging.amqp.AmqpServer;
 import brooklyn.entity.messaging.qpid.QpidBroker;
@@ -14,7 +14,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
 
 /** Qpid Broker Application */
-public class StandaloneBrokerExample extends ApplicationBuilder {
+public class StandaloneBrokerExample extends AbstractApplication {
 
     public static final String CUSTOM_CONFIG_PATH = "classpath://custom-config.xml";
     public static final String PASSWD_PATH = "classpath://passwd";
@@ -23,7 +23,8 @@ public class StandaloneBrokerExample extends ApplicationBuilder {
 
     public static final String DEFAULT_LOCATION = "localhost";
     
-    protected void doBuild() {
+    @Override
+    public void postConstruct() {
         // Configure the Qpid broker entity
     	QpidBroker broker = addChild(EntitySpecs.spec(QpidBroker.class)
     	        .configure("amqpPort", 5672)
@@ -43,7 +44,7 @@ public class StandaloneBrokerExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new StandaloneBrokerExample().appDisplayName("Qpid app"))
+                .application(EntitySpecs.appSpec(StandaloneBrokerExample.class).displayName("Qpid app"))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java b/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
index 2290497..10905e1 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
@@ -5,7 +5,7 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpecs;
 import brooklyn.entity.webapp.jboss.JBoss7Server;
@@ -15,14 +15,14 @@ import brooklyn.util.CommandLineUtil;
 import com.google.common.collect.Lists;
 
 /** This example starts one web app on 8080, waits for a keypress, then stops it. */
-public class SingleWebServerExample extends ApplicationBuilder {
+public class SingleWebServerExample extends AbstractApplication {
 
     public static final Logger LOG = LoggerFactory.getLogger(SingleWebServerExample.class);
 
     private static final String WAR_PATH = "classpath://hello-world-webapp.war";
 
     @Override
-    protected void doBuild() {
+    public void postConstruct() {
         addChild(EntitySpecs.spec(JBoss7Server.class)
                 .configure("war", WAR_PATH)
                 .configure("httpPort", "8080+"));
@@ -35,7 +35,7 @@ public class SingleWebServerExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", "localhost");
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new SingleWebServerExample().appDisplayName("Brooklyn WebApp Cluster with Database example"))
+                .application(EntitySpecs.appSpec(SingleWebServerExample.class).displayName("Brooklyn WebApp Cluster with Database example"))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
index fb9b9f6..5436ee6 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
@@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory;
 
 import brooklyn.enricher.basic.SensorPropagatingEnricher;
 import brooklyn.enricher.basic.SensorTransformingEnricher;
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.database.mysql.MySqlNode;
 import brooklyn.entity.proxying.EntitySpecs;
@@ -32,7 +32,7 @@ import com.google.common.collect.Lists;
 /**
  * Launches a 3-tier app with nginx, clustered jboss, and mysql.
  **/
-public class WebClusterDatabaseExample extends ApplicationBuilder {
+public class WebClusterDatabaseExample extends AbstractApplication {
     
     public static final Logger LOG = LoggerFactory.getLogger(WebClusterDatabaseExample.class);
     
@@ -47,7 +47,8 @@ public class WebClusterDatabaseExample extends ApplicationBuilder {
     public static final BasicAttributeSensor<Integer> APPSERVERS_COUNT = new BasicAttributeSensor<Integer>(Integer.class, 
             "appservers.count", "Number of app servers deployed");
 
-    protected void doBuild() {
+    @Override
+    public void postConstruct() {
         MySqlNode mysql = addChild(EntitySpecs.spec(MySqlNode.class)
                 .configure("creationScriptUrl", DB_SETUP_SQL_URL));
         
@@ -67,10 +68,10 @@ public class WebClusterDatabaseExample extends ApplicationBuilder {
                 build());
 
         // expose some KPI's
-        getApp().addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web,  
+        addEnricher(SensorPropagatingEnricher.newInstanceListeningTo(web,  
                 WebAppServiceConstants.ROOT_URL,
                 DynamicWebAppCluster.REQUESTS_PER_SECOND_IN_WINDOW));
-        getApp().addEnricher(new SensorTransformingEnricher<Integer,Integer>(web, 
+        addEnricher(new SensorTransformingEnricher<Integer,Integer>(web, 
                 DynamicWebAppCluster.GROUP_SIZE, APPSERVERS_COUNT, Functions.<Integer>identity()));
     }
 
@@ -80,7 +81,7 @@ public class WebClusterDatabaseExample extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", "localhost");
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new WebClusterDatabaseExample().appDisplayName("Brooklyn WebApp Cluster with Database example"))
+                .application(EntitySpecs.appSpec(WebClusterDatabaseExample.class).displayName("Brooklyn WebApp Cluster with Database example"))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
index 5aa0d3c..ee2652c 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
@@ -7,10 +7,10 @@ import static brooklyn.event.basic.DependentConfiguration.formatString
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import brooklyn.entity.basic.ApplicationBuilder
+import brooklyn.entity.basic.AbstractApplication
 import brooklyn.entity.basic.Entities
-import brooklyn.entity.basic.StartableApplication
 import brooklyn.entity.database.mysql.MySqlNode
+import brooklyn.entity.proxying.EntitySpecs
 import brooklyn.entity.webapp.ControlledDynamicWebAppCluster
 import brooklyn.entity.webapp.DynamicWebAppCluster
 import brooklyn.launcher.BrooklynLauncher
@@ -24,7 +24,7 @@ import com.google.common.collect.Lists
  * <p>
  * This variant of {@link WebClusterDatabaseExample} demonstrates <i>Groovy</i> language conveniences.
  **/
-public class WebClusterDatabaseExampleGroovy extends ApplicationBuilder {
+public class WebClusterDatabaseExampleGroovy extends AbstractApplication {
     
     public static final Logger LOG = LoggerFactory.getLogger(WebClusterDatabaseExampleGroovy.class);
     
@@ -38,7 +38,8 @@ public class WebClusterDatabaseExampleGroovy extends ApplicationBuilder {
     public static final String DB_USERNAME = "brooklyn";
     public static final String DB_PASSWORD = "br00k11n";
     
-    protected void doBuild() {
+    @Override
+    public void postConstruct() {
         MySqlNode mysql = addChild(MySqlNode,
                 creationScriptUrl: DB_SETUP_SQL_URL);
         
@@ -63,7 +64,7 @@ public class WebClusterDatabaseExampleGroovy extends ApplicationBuilder {
         String location = CommandLineUtil.getCommandLineOption(args, "--location", DEFAULT_LOCATION);
 
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new WebClusterDatabaseExampleGroovy().appDisplayName("Brooklyn WebApp Cluster with Database example"))
+                .application(EntitySpecs.appSpec(WebClusterDatabaseExampleGroovy.class).displayName("Brooklyn WebApp Cluster with Database example"))
                 .webconsolePort(port)
                 .location(location)
                 .start();

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3c0f5e60/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
index 97cb4e9..8e6f670 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
@@ -6,7 +6,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import brooklyn.config.BrooklynProperties;
-import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.AbstractApplication;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxy.nginx.NginxController;
 import brooklyn.entity.proxying.EntitySpecs;
@@ -28,7 +28,7 @@ import com.google.common.collect.Lists;
  * -Xmx512m -Xms128m -XX:MaxPermSize=256m
  * and brooklyn-all jar, and this jar or classes dir, on classpath. 
  **/
-public class WebClusterExample extends ApplicationBuilder {
+public class WebClusterExample extends AbstractApplication {
     public static final Logger LOG = LoggerFactory.getLogger(WebClusterExample.class);
     
     static BrooklynProperties config = BrooklynProperties.Factory.newDefault();
@@ -40,7 +40,8 @@ public class WebClusterExample extends ApplicationBuilder {
     private NginxController nginxController;
     private ControlledDynamicWebAppCluster web;
     
-    protected void doBuild() {
+    @Override
+    public void postConstruct() {
         nginxController = addChild(EntitySpecs.spec(NginxController.class)
                 //.configure("domain", "webclusterexample.brooklyn.local")
                 .configure("port", "8000+"));
@@ -67,7 +68,7 @@ public class WebClusterExample extends ApplicationBuilder {
 
         // TODO Want to parse, to handle multiple locations
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
-                .application(new WebClusterExample().appDisplayName("Brooklyn WebApp Cluster example"))
+                .application(EntitySpecs.appSpec(WebClusterExample.class).displayName("Brooklyn WebApp Cluster example"))
                 .webconsolePort(port)
                 .location(location)
                 .start();