http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.basic.LocationInternal.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.LocationInternal.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.LocationInternal.html
index 009a41d..1a71db3 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.LocationInternal.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.LocationInternal.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - brooklyn.location.basic.LocationInternal</title>
+    <title>Brooklyn Location - LocationInternal</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.basic.LocationInternal</h1>
+        <h1>LocationInternal</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == "brooklyn.location.basic.LocationInternal";
+            return entity.type == "LocationInternal";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.basic.MultiLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.MultiLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.MultiLocation.html
index cefe218..cf5a497 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.MultiLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.MultiLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - brooklyn.location.basic.MultiLocation</title>
+    <title>Brooklyn Location - MultiLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.basic.MultiLocation</h1>
+        <h1>MultiLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == "brooklyn.location.basic.MultiLocation";
+            return entity.type == "MultiLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SimulatedLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SimulatedLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SimulatedLocation.html
index 5fe7a58..b08d8a7 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SimulatedLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SimulatedLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.basic.SimulatedLocation</title>
+    <title>Brooklyn Location - SimulatedLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.basic.SimulatedLocation</h1>
+        <h1>SimulatedLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == "brooklyn.location.basic.SimulatedLocation";
+            return entity.type == "SimulatedLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SingleMachineProvisioningLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SingleMachineProvisioningLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SingleMachineProvisioningLocation.html
index 29abdf8..168929f 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SingleMachineProvisioningLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SingleMachineProvisioningLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.basic.SingleMachineProvisioningLocation</title>
+    <title>Brooklyn Location - SingleMachineProvisioningLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.basic.SingleMachineProvisioningLocation</h1>
+        <h1>SingleMachineProvisioningLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == 
"brooklyn.location.basic.SingleMachineProvisioningLocation";
+            return entity.type == "SingleMachineProvisioningLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SshMachineLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SshMachineLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SshMachineLocation.html
index 3ee27ab..b6edac1 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SshMachineLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.basic.SshMachineLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.basic.SshMachineLocation</title>
+    <title>Brooklyn Location - SshMachineLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.basic.SshMachineLocation</h1>
+        <h1>SshMachineLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == "brooklyn.location.basic.SshMachineLocation";
+            return entity.type == "SshMachineLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation.html
index 6a41d3f..958594e 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation</title>
+    <title>Brooklyn Location - AbstractCloudMachineProvisioningLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        
<h1>brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation</h1>
+        <h1>AbstractCloudMachineProvisioningLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == 
"brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation";
+            return entity.type == "AbstractCloudMachineProvisioningLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation.html
index 7240131..c2de588 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation</title>
+    <title>Brooklyn Location - AbstractJcloudsSubnetSshMachineLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        
<h1>brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation</h1>
+        <h1>AbstractJcloudsSubnetSshMachineLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == 
"brooklyn.location.jclouds.AbstractJcloudsSubnetSshMachineLocation";
+            return entity.type == "AbstractJcloudsSubnetSshMachineLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsLocation.html
index de80bcb..4491b02 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.jclouds.JcloudsLocation</title>
+    <title>Brooklyn Location - JcloudsLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.jclouds.JcloudsLocation</h1>
+        <h1>JcloudsLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == "brooklyn.location.jclouds.JcloudsLocation";
+            return entity.type == "JcloudsLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsSshMachineLocation.html
----------------------------------------------------------------------
diff --git 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsSshMachineLocation.html
 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsSshMachineLocation.html
index 6ae6cc0..c7fd198 100644
--- 
a/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsSshMachineLocation.html
+++ 
b/docs/website/learnmore/catalog/locations/brooklyn.location.jclouds.JcloudsSshMachineLocation.html
@@ -18,7 +18,7 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>
-    <title>Brooklyn Location - 
brooklyn.location.jclouds.JcloudsSshMachineLocation</title>
+    <title>Brooklyn Location - JcloudsSshMachineLocation</title>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
     <link rel="stylesheet" href="../items.css" type="text/css" media="screen"/>
 </head>
@@ -30,7 +30,7 @@ under the License.
         </div>
     </div>
     <div id="content" class="objectContent">
-        <h1>brooklyn.location.jclouds.JcloudsSshMachineLocation</h1>
+        <h1>JcloudsSshMachineLocation</h1>
         <h2 class="typeLabel">Type:</h2><span id="type"></span>
 
         <h2>Config Keys</h2>
@@ -50,7 +50,7 @@ under the License.
 <script type="text/javascript">
     $(document).ready(function () {
         var item = $.grep((items.locations), function (entity) {
-            return entity.type == 
"brooklyn.location.jclouds.JcloudsSshMachineLocation";
+            return entity.type == "JcloudsSshMachineLocation";
         })[0];
         $("#type").html(item.type);
         item.config.forEach(function (element) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
----------------------------------------------------------------------
diff --git 
a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
 
b/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
index 4332ef5..d53cf44 100644
--- 
a/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
+++ 
b/examples/global-web-fabric/src/main/java/org/apache/brooklyn/demo/GlobalWebFabricExample.java
@@ -44,7 +44,7 @@ import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
 
 import org.apache.brooklyn.launcher.BrooklynLauncher;
 
-import brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.basic.PortRanges;
 import brooklyn.util.BrooklynMavenArtifacts;
 import brooklyn.util.CommandLineUtil;
 import brooklyn.util.ResourceUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
----------------------------------------------------------------------
diff --git 
a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
 
b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
index 23fb28a..9c3edad 100644
--- 
a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
+++ 
b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java
@@ -57,8 +57,8 @@ import org.apache.brooklyn.launcher.BrooklynLauncher;
 import org.apache.brooklyn.policy.EnricherSpec;
 import org.apache.brooklyn.policy.PolicySpec;
 
-import brooklyn.location.Location;
-import brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.Location;
+import org.apache.brooklyn.location.basic.PortRanges;
 import brooklyn.policy.ha.ServiceFailureDetector;
 import brooklyn.policy.ha.ServiceReplacer;
 import brooklyn.policy.ha.ServiceRestarter;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
----------------------------------------------------------------------
diff --git 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
index 27657f3..5523286 100644
--- 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
+++ 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/SingleWebServerExample.java
@@ -33,7 +33,7 @@ import org.apache.brooklyn.entity.webapp.JavaWebAppService;
 import org.apache.brooklyn.entity.webapp.jboss.JBoss7Server;
 import org.apache.brooklyn.launcher.BrooklynLauncher;
 
-import brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.basic.PortRanges;
 import brooklyn.util.CommandLineUtil;
 
 import com.google.common.collect.Lists;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
----------------------------------------------------------------------
diff --git 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
index a013484..7084b74 100644
--- 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
+++ 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java
@@ -45,7 +45,7 @@ import org.apache.brooklyn.entity.webapp.WebAppService;
 import org.apache.brooklyn.entity.webapp.WebAppServiceConstants;
 import org.apache.brooklyn.launcher.BrooklynLauncher;
 
-import brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.basic.PortRanges;
 import brooklyn.policy.autoscaling.AutoScalerPolicy;
 import brooklyn.util.CommandLineUtil;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
----------------------------------------------------------------------
diff --git 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
index 22672f5..5b72a58 100644
--- 
a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
+++ 
b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java
@@ -50,7 +50,7 @@ import brooklyn.event.basic.Sensors;
 
 import org.apache.brooklyn.launcher.BrooklynLauncher;
 
-import brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.basic.PortRanges;
 import brooklyn.policy.autoscaling.AutoScalerPolicy;
 import brooklyn.util.BrooklynMavenArtifacts;
 import brooklyn.util.CommandLineUtil;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
 
b/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
index 1e10164..900ba4a 100644
--- 
a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
+++ 
b/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java
@@ -20,7 +20,6 @@ package org.apache.brooklyn.demo;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
-import org.apache.brooklyn.demo.WebClusterDatabaseExampleApp;
 import org.apache.brooklyn.entity.proxy.nginx.NginxController;
 import org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster;
 import org.apache.brooklyn.entity.webapp.DynamicWebAppCluster;
@@ -56,7 +55,7 @@ import brooklyn.entity.group.DynamicCluster;
 import brooklyn.entity.java.JavaEntityMethods;
 import brooklyn.entity.rebind.RebindOptions;
 import brooklyn.entity.rebind.RebindTestFixture;
-import brooklyn.location.Location;
+import org.apache.brooklyn.location.Location;
 import brooklyn.policy.autoscaling.AutoScalerPolicy;
 import brooklyn.test.Asserts;
 import brooklyn.util.collections.MutableMap;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/entity/rebind/persister/jclouds/JcloudsBlobStoreBasedObjectStore.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/entity/rebind/persister/jclouds/JcloudsBlobStoreBasedObjectStore.java
 
b/locations/jclouds/src/main/java/brooklyn/entity/rebind/persister/jclouds/JcloudsBlobStoreBasedObjectStore.java
index b72dca2..ca6f757 100644
--- 
a/locations/jclouds/src/main/java/brooklyn/entity/rebind/persister/jclouds/JcloudsBlobStoreBasedObjectStore.java
+++ 
b/locations/jclouds/src/main/java/brooklyn/entity/rebind/persister/jclouds/JcloudsBlobStoreBasedObjectStore.java
@@ -35,10 +35,10 @@ import org.slf4j.LoggerFactory;
 import brooklyn.config.BrooklynServerConfig;
 import brooklyn.entity.rebind.persister.PersistMode;
 import brooklyn.entity.rebind.persister.PersistenceObjectStore;
-import brooklyn.location.basic.LocationConfigKeys;
-import brooklyn.location.cloud.CloudLocationConfig;
-import brooklyn.location.jclouds.JcloudsLocation;
-import brooklyn.location.jclouds.JcloudsUtil;
+import org.apache.brooklyn.location.basic.LocationConfigKeys;
+import org.apache.brooklyn.location.cloud.CloudLocationConfig;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.location.jclouds.JcloudsUtil;
 import brooklyn.util.exceptions.FatalConfigurationRuntimeException;
 import brooklyn.util.text.Strings;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/AbstractJcloudsSubnetSshMachineLocation.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/AbstractJcloudsSubnetSshMachineLocation.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/AbstractJcloudsSubnetSshMachineLocation.java
deleted file mode 100644
index a528b6a..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/AbstractJcloudsSubnetSshMachineLocation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import java.util.Map;
-
-import org.jclouds.compute.domain.NodeMetadata;
-
-import brooklyn.location.basic.SupportsPortForwarding.RequiresPortForwarding;
-
-public abstract class AbstractJcloudsSubnetSshMachineLocation extends 
JcloudsSshMachineLocation implements RequiresPortForwarding {
-
-    public AbstractJcloudsSubnetSshMachineLocation() {
-    }
-
-    /** @deprecated since 0.6.0 use no-arg constructor, as per parent */
-    @Deprecated
-    public AbstractJcloudsSubnetSshMachineLocation(Map flags, JcloudsLocation 
parent, NodeMetadata node) {
-        super(flags, parent, node);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/BasicJcloudsLocationCustomizer.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BasicJcloudsLocationCustomizer.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/BasicJcloudsLocationCustomizer.java
deleted file mode 100644
index 502c40c..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BasicJcloudsLocationCustomizer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.options.TemplateOptions;
-
-import com.google.common.annotations.Beta;
-
-
-/**
- * A default no-op implementation, which can be extended to override the 
appropriate methods.
- * 
- * Sub-classing will give the user some protection against future API changes 
- note that 
- * {@link JcloudsLocationCustomizer} is marked {@link Beta}.
- * 
- * @author aled
- */
-public class BasicJcloudsLocationCustomizer implements 
JcloudsLocationCustomizer {
-
-    @Override
-    public void customize(JcloudsLocation location, ComputeService 
computeService, TemplateBuilder templateBuilder) {
-        // no-op
-    }
-
-    @Override
-    public void customize(JcloudsLocation location, ComputeService 
computeService, Template template) {
-        // no-op
-    }
-
-    @Override
-    public void customize(JcloudsLocation location, ComputeService 
computeService, TemplateOptions templateOptions) {
-        // no-op
-    }
-
-    @Override
-    public void customize(JcloudsLocation location, ComputeService 
computeService, JcloudsMachineLocation machine) {
-        if (machine instanceof JcloudsSshMachineLocation) {
-            customize(location, computeService, 
(JcloudsSshMachineLocation)machine);
-        } else {
-            // no-op
-        }
-    }
-    
-    @Override
-    public void preRelease(JcloudsMachineLocation machine) {
-        if (machine instanceof JcloudsSshMachineLocation) {
-            preRelease((JcloudsSshMachineLocation)machine);
-        } else {
-            // no-op
-        }
-    }
-
-    @Override
-    public void postRelease(JcloudsMachineLocation machine) {
-        if (machine instanceof JcloudsSshMachineLocation) {
-            postRelease((JcloudsSshMachineLocation)machine);
-        } else {
-            // no-op
-        }
-    }
-    
-    @Override
-    @Deprecated
-    public void customize(JcloudsLocation location, ComputeService 
computeService, JcloudsSshMachineLocation machine) {
-        // no-op
-    }
-
-    @Override
-    @Deprecated
-    public void preRelease(JcloudsSshMachineLocation machine) {
-        // no-op
-    }
-
-    @Override
-    @Deprecated
-    public void postRelease(JcloudsSshMachineLocation machine) {
-        // no-op
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
deleted file mode 100644
index 75cd3a7..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.util.collections.MutableList;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.collect.ComparisonChain;
-import com.google.common.collect.Ordering;
-import com.google.common.math.DoubleMath;
-
-@Beta
-/** NB: subclasses must implement {@link #clone()} */
-public class BrooklynImageChooser implements Cloneable {
-
-    private static final Logger log = 
LoggerFactory.getLogger(BrooklynImageChooser.class);
-    
-    protected ComputeService computeService;
-    protected String cloudProviderName;
-    
-    protected static int compare(double left, double right) {
-        return DoubleMath.fuzzyCompare(left, right, 0.00000001);
-    }
-    
-    protected static boolean imageNameContains(Image img, String pattern) {
-        if (img.getName()==null) return false;
-        return img.getName().contains(pattern);
-    }
-    
-    protected static boolean imageNameContainsCaseInsensitive(Image img, 
String pattern) {
-        if (img.getName()==null) return false;
-        return img.getName().toLowerCase().contains(pattern.toLowerCase());
-    }
-    
-    protected static boolean imageNameContainsWordCaseInsensitive(Image img, 
String pattern) {
-        if (img.getName()==null) return false;
-        return 
img.getName().toLowerCase().matches("(.*[^a-z])?"+pattern.toLowerCase()+"([^a-z].*)?");
-    }
-    
-    public double punishmentForOldOsVersions(Image img, OsFamily family, 
double minVersion) {
-        OperatingSystem os = img.getOperatingSystem();
-        if (os!=null && family.equals(os.getFamily())) {
-            String v = os.getVersion();
-            if (v!=null) {
-                try {
-                    double vd = Double.parseDouble(v);
-                    // punish older versions, with a -log function (so 0.5 
version behind is -log(1.5)=-0.5 and 2 versions behind is -log(3)=-1.2  
-                    if (vd < minVersion) return -Math.log(1+(minVersion - vd));
-                } catch (Exception e) {
-                    /* ignore unparseable versions */
-                }
-            }
-        }
-        return 0;
-    }
-    
-    public List<String> blackListedImageIds() {
-        return Arrays.asList(
-                // bad natty image - causes 403 on attempts to apt-get; 
https://bugs.launchpad.net/ubuntu/+bug/987182
-                "us-east-1/ami-1cb30875",
-                // wrong login user advertised, causes "Error Invalid packet: 
indicated length 1349281121 too large"
-                // from sshj due to message coming back "Plea"(se log in as 
another user), according to https://github.com/jclouds/legacy-jclouds/issues/748
-                "us-east-1/ami-08faa660"
-            );
-    }
-
-    public List<String> whilelistedImageIds() {
-        return Arrays.asList(
-        // these are the ones we recommend in brooklyn.properties, but now 
autodetection should be more reliable
-//                "us-east-1/ami-d0f89fb9",
-//                "us-west-1/ami-fe002cbb",
-//                "us-west-2/ami-70f96e40",
-//                "eu-west-1/ami-ce7b6fba",
-//                "sa-east-1/ami-a3da00be",
-//                "ap-southeast-1/ami-64084736",
-//                "ap-southeast-2/ami-04ea7a3e",
-//                "ap-northeast-1/ami-fe6ceeff"
-            );
-    }
-    
-    public double score(Image img) {
-        double score = 0;
-
-        if (blackListedImageIds().contains(img.getId()))
-            score -= 50;
-
-        if (whilelistedImageIds().contains(img.getId()))
-            // NB: this should be less than deprecated punishment to catch 
deprecation of whitelisted items
-            score += 20;
-
-        score += punishmentForDeprecation(img);
-
-    
-        // prefer these guys, in stock brooklyn provisioning
-        score += punishmentForOldOsVersions(img, OsFamily.UBUNTU, 11);
-        score += punishmentForOldOsVersions(img, OsFamily.CENTOS, 6);
-
-        OperatingSystem os = img.getOperatingSystem();
-        if (os!=null) {
-            if (os.getFamily()!=null) {
-                // preference for these open, popular OS (but only wrt 
versions above) 
-                if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
-                else if (os.getFamily().equals(OsFamily.UBUNTU)) {
-                    score += 2;
-
-                    // prefer these LTS releases slightly above others 
(including above CentOS)
-                    // (but note in AWS Virginia, at least, version is empty 
for the 14.04 images for some reason, as of Aug 2014)
-                    if ("14.04".equals(os.getVersion())) score += 0.2;
-                    else if ("12.04".equals(os.getVersion())) score += 0.1;
-
-                    // NB some 13.10 images take 20m+ before they are sshable 
on AWS
-                    // with "vesafb: module verification error" showing in the 
AWS system log
-                }
-
-                // slight preference for these 
-                else if (os.getFamily().equals(OsFamily.RHEL)) score += 1;
-                else if (os.getFamily().equals(OsFamily.AMZN_LINUX)) score += 
1;
-                else if (os.getFamily().equals(OsFamily.DEBIAN)) score += 1;
-
-                // prefer to take our chances with unknown / unlabelled linux 
than something explicitly windows
-                else if (os.getFamily().equals(OsFamily.WINDOWS)) score -= 1;
-                
-                if ("softlayer".equals(cloudProviderName)) {
-                    // on softlayer, prefer images where family is part of the 
image id
-                    // (this is the only way to identiy official images; but 
in other clouds
-                    // it can cause not-so-good images to get selected!)
-                    if 
(img.getId().toLowerCase().indexOf(os.getFamily().toString().toLowerCase()) >= 
0)
-                        score += 0.5;
-                }
-            }
-            // prefer 64-bit
-            if (os.is64Bit()) score += 0.5;
-        }
-
-        // TODO prefer known providerIds
-
-        if (log.isTraceEnabled())
-            log.trace("initial score "+score+" for "+img);
-        
-        return score;
-    }
-
-    protected double punishmentForDeprecation(Image img) {
-        // google deprecation strategy
-        //        userMetadata={deprecatedState=DEPRECATED}}
-        String deprecated = img.getUserMetadata().get("deprecatedState");
-        if (deprecated!=null) {
-            if ("deprecated".equalsIgnoreCase(deprecated))
-                return -30;
-            log.warn("Unrecognised 'deprecatedState' value '"+deprecated+"' 
when scoring "+img+"; ignoring that metadata");
-        }
-        
-        // common strategies
-        if (imageNameContainsWordCaseInsensitive(img, "deprecated")) return 
-30;
-        if (imageNameContainsWordCaseInsensitive(img, "alpha")) return -10;
-        if (imageNameContainsWordCaseInsensitive(img, "beta")) return -5;
-        if (imageNameContainsWordCaseInsensitive(img, "testing")) return -5;
-        if (imageNameContainsWordCaseInsensitive(img, "rc")) return -3;
-
-        // no indication this is deprecated
-        return 0;
-    }
-
-    public BrooklynImageChooser clone() {
-        return new BrooklynImageChooser();
-    }
-    
-    protected void use(ComputeService service) {
-        if (this.computeService!=null && !this.computeService.equals(service))
-            throw new IllegalStateException("ImageChooser must be cloned to 
set a compute service");
-        this.computeService = service;
-        if (computeService!=null) {
-            cloudProviderName = computeService.getContext().unwrap().getId();
-        }
-    }
-    
-    public BrooklynImageChooser cloneFor(ComputeService service) {
-        BrooklynImageChooser result = clone();
-        result.use(service);
-        return result;
-    }
-    
-    public static class OrderingScoredWithoutDefaults extends Ordering<Image> 
implements ComputeServiceAwareChooser<OrderingScoredWithoutDefaults> {
-        private BrooklynImageChooser chooser;
-        public OrderingScoredWithoutDefaults(BrooklynImageChooser chooser) {
-            this.chooser = chooser;
-        }
-        public int compare(Image left, Image right) {
-            return BrooklynImageChooser.compare(chooser.score(left), 
chooser.score(right));
-        }
-        @Override
-        public OrderingScoredWithoutDefaults cloneFor(ComputeService service) {
-            return new 
OrderingScoredWithoutDefaults(chooser.cloneFor(service));
-        }        
-    }
-    
-    public Ordering<Image> orderingScoredWithoutDefaults() {
-        return new OrderingScoredWithoutDefaults(this);
-    }
-    
-    /** @deprecated since 0.7.0 kept in case persisted */
-    @Deprecated
-    public Ordering<Image> orderingScoredWithoutDefaultsDeprecated() {
-        return new Ordering<Image>() {
-            @Override
-            public int compare(Image left, Image right) {
-                return BrooklynImageChooser.compare(score(left), score(right));
-            }
-        };
-    }
-    
-    public static class OrderingWithDefaults extends Ordering<Image> 
implements ComputeServiceAwareChooser<OrderingWithDefaults> {
-        Ordering<Image> primaryOrdering;
-        public OrderingWithDefaults(final Ordering<Image> primaryOrdering) {
-            this.primaryOrdering = primaryOrdering;
-        }
-        @Override
-        public int compare(Image left, Image right) {
-            return ComparisonChain.start()
-                .compare(left, right, primaryOrdering)
-                // fall back to default strategy otherwise, except preferring 
*non*-null values
-                // TODO use AlphaNum string comparator
-                .compare(left.getName(), right.getName(), Ordering.<String> 
natural().nullsFirst())
-                .compare(left.getVersion(), right.getVersion(), 
Ordering.<String> natural().nullsFirst())
-                .compare(left.getDescription(), right.getDescription(), 
Ordering.<String> natural().nullsFirst())
-                .compare(left.getOperatingSystem().getName(), 
right.getOperatingSystem().getName(), Ordering.<String> natural().nullsFirst())
-                .compare(left.getOperatingSystem().getVersion(), 
right.getOperatingSystem().getVersion(), Ordering.<String> 
natural().nullsFirst())
-                .compare(left.getOperatingSystem().getDescription(), 
right.getOperatingSystem().getDescription(), Ordering.<String> 
natural().nullsFirst())
-                .compare(left.getOperatingSystem().getArch(), 
right.getOperatingSystem().getArch(), Ordering.<String> 
natural().nullsFirst()).result();
-        }    
-        @Override
-        public OrderingWithDefaults cloneFor(ComputeService service) {
-            if (primaryOrdering instanceof ComputeServiceAwareChooser) {
-                return new OrderingWithDefaults( 
BrooklynImageChooser.cloneFor(primaryOrdering, service) );
-            }
-            return this;
-        }        
-    }
-    
-    public static Ordering<Image> orderingWithDefaults(final Ordering<Image> 
primaryOrdering) {
-        return new OrderingWithDefaults(primaryOrdering);
-    }
-    
-    /** @deprecated since 0.7.0 kept in case persisted */
-    @Deprecated
-    public static Ordering<Image> orderingWithDefaultsDeprecated(final 
Ordering<Image> primaryOrdering) {
-        return new Ordering<Image>() {
-            @Override
-            public int compare(Image left, Image right) {
-                return ComparisonChain.start()
-                    .compare(left, right, primaryOrdering)
-                    // fall back to default strategy otherwise, except 
preferring *non*-null values
-                    // TODO use AlphaNum string comparator
-                    .compare(left.getName(), right.getName(), 
Ordering.<String> natural().nullsFirst())
-                    .compare(left.getVersion(), right.getVersion(), 
Ordering.<String> natural().nullsFirst())
-                    .compare(left.getDescription(), right.getDescription(), 
Ordering.<String> natural().nullsFirst())
-                    .compare(left.getOperatingSystem().getName(), 
right.getOperatingSystem().getName(), Ordering.<String> natural().nullsFirst())
-                    .compare(left.getOperatingSystem().getVersion(), 
right.getOperatingSystem().getVersion(), Ordering.<String> 
natural().nullsFirst())
-                    .compare(left.getOperatingSystem().getDescription(), 
right.getOperatingSystem().getDescription(), Ordering.<String> 
natural().nullsFirst())
-                    .compare(left.getOperatingSystem().getArch(), 
right.getOperatingSystem().getArch(), Ordering.<String> 
natural().nullsFirst()).result();
-            }
-        };
-    }
-    
-    public static class ImageChooserFromOrdering implements 
Function<Iterable<? extends Image>, Image>, 
ComputeServiceAwareChooser<ImageChooserFromOrdering> {
-        final Ordering<Image> ordering;
-        public ImageChooserFromOrdering(final Ordering<Image> ordering) { 
this.ordering = ordering; }
-        @Override
-        public Image apply(Iterable<? extends Image> input) {
-            List<? extends Image> maxImages = multiMax(ordering, input);
-            return maxImages.get(maxImages.size() - 1);
-        }
-        @Override
-        public ImageChooserFromOrdering cloneFor(ComputeService service) {
-            if (ordering instanceof ComputeServiceAwareChooser) {
-                return new ImageChooserFromOrdering( 
BrooklynImageChooser.cloneFor(ordering, service) );
-            }
-            return this;
-        }        
-    }
-
-    public static Function<Iterable<? extends Image>, Image> 
imageChooserFromOrdering(final Ordering<Image> ordering) {
-        return new ImageChooserFromOrdering(ordering);
-    }
-    
-    /** @deprecated since 0.7.0 kept in case persisted */
-    @Deprecated
-    public static Function<Iterable<? extends Image>, Image> 
imageChooserFromOrderingDeprecated(final Ordering<Image> ordering) {
-        return new Function<Iterable<? extends Image>, Image>() {
-            @Override
-            public Image apply(Iterable<? extends Image> input) {
-                List<? extends Image> maxImages = multiMax(ordering, input);
-                return maxImages.get(maxImages.size() - 1);
-            }
-        };
-    }
-    
-    protected interface ComputeServiceAwareChooser<T> {
-        public T cloneFor(ComputeService service);
-    }
-
-    /** Attempts to clone the given item for use with the given {@link 
ComputeService}, if
-     * the item is {@link ComputeServiceAwareChooser}; otherwise it returns 
the item unchanged */
-    @SuppressWarnings("unchecked")
-    public static <T> T cloneFor(T item, ComputeService service) {
-        if (item instanceof ComputeServiceAwareChooser) {
-            return ((ComputeServiceAwareChooser<T>)item).cloneFor(service);
-        }
-        return item;
-    }
-    
-    // from jclouds
-    static <T, E extends T> List<E> multiMax(Comparator<T> ordering, 
Iterable<E> iterable) {
-        Iterator<E> iterator = iterable.iterator();
-        List<E> maxes = MutableList.of(iterator.next());
-        E maxSoFar = maxes.get(0);
-        while (iterator.hasNext()) {
-           E current = iterator.next();
-           int comparison = ordering.compare(maxSoFar, current);
-           if (comparison == 0) {
-              maxes.add(current);
-           } else if (comparison < 0) {
-              maxes = MutableList.of(current);
-              maxSoFar = current;
-           }
-        }
-        return maxes;
-     }
-    
-    public Ordering<Image> ordering() {
-        return orderingWithDefaults(orderingScoredWithoutDefaults());
-    }
-
-    public Function<Iterable<? extends Image>,Image> chooser() {
-        return imageChooserFromOrdering(ordering());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynMachinePool.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynMachinePool.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynMachinePool.java
deleted file mode 100644
index 6fc2076..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynMachinePool.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import static brooklyn.location.jclouds.pool.MachinePoolPredicates.matching;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.management.Task;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.entity.trait.Startable;
-import brooklyn.location.MachineLocation;
-import brooklyn.location.basic.SshMachineLocation;
-import brooklyn.location.basic.WinRmMachineLocation;
-import brooklyn.location.jclouds.pool.MachinePool;
-import brooklyn.location.jclouds.pool.MachineSet;
-import brooklyn.location.jclouds.pool.ReusableMachineTemplate;
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.task.BasicExecutionContext;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-
-/**
- * @deprecated since 0.6.0; never used in production setting, and thus of 
dubious value; best avoided as unlikely to be supported in future versions
- */
-@Deprecated
-public class BrooklynMachinePool extends MachinePool {
-
-    private static final Logger log = 
LoggerFactory.getLogger(BrooklynMachinePool.class);
-    
-    protected final JcloudsLocation location;
-    final List<Task<?>> activeTasks = new ArrayList<Task<?>>();
-    final String providerLocationId;
-    
-    public BrooklynMachinePool(JcloudsLocation l) {
-        super(l.getComputeService());
-        providerLocationId = l.getRegion();
-        this.location = l;
-    }
-    
-    /** claims a machine with the indicated spec, creating if necessary */
-    public SshMachineLocation obtain(ReusableMachineTemplate t) {
-        MachineSet previous = unclaimed(matching(t));
-        
-        while (true) {
-            NodeMetadata m = claim(1, t).iterator().next();
-            // TODO ideally shouldn't have to rebind
-            SshMachineLocation result = null;
-            try {
-                result = toSshMachineLocation( m );
-            } catch (Exception e) {
-                if (previous.contains(m)) {
-                    log.debug("attempt to bind to previous existing machine 
"+m+" failed (will blacklist and retry another): "+e);
-                } else {
-                    log.warn("attempt to bind to machine "+m+" failed: "+e);
-                    throw Throwables.propagate(e);
-                }
-            }
-            if (result!=null) return result;
-            if (previous.contains(m)) {
-                log.debug("could not bind to previous existing machine "+m+"; 
blacklisting and trying a new one");
-                addToBlacklist(new MachineSet(m));
-            } else {
-                throw new IllegalStateException("cannot bind/connect to newly 
created machine; error in configuration");
-            }
-        }
-    }
-    
-    protected MachineSet filterForAllowedMachines(MachineSet input) {
-        MachineSet result = super.filterForAllowedMachines(input);
-        if (providerLocationId!=null) {
-            result = result.filtered(matching( new 
ReusableMachineTemplate().locationId(providerLocationId).strict(false) ));
-        }
-        return result;
-    }
-
-    /** returns an SshMachineLocation, if one can be created and accessed; 
returns null if it cannot be created */
-    protected SshMachineLocation toSshMachineLocation(NodeMetadata m) {
-        try {
-            JcloudsSshMachineLocation sshM = location.rebindMachine(m);
-            if (sshM.execCommands("check-reachable", Arrays.asList("whoami")) 
!= 0) {
-                log.warn("cannot bind to machine "+m);
-                return null;
-            }
-            return sshM;
-        } catch (Exception e) {
-            throw Throwables.propagate(e);
-        }
-    }
-    
-    @Override
-    public MachineSet create(int count, ReusableMachineTemplate template) {
-        List<NodeMetadata> nodes = new ArrayList<NodeMetadata>();
-        for (int i=0; i<count; i++) {
-            // TODO this in parallel
-            JcloudsSshMachineLocation m;
-            try {
-                MachineLocation machineLocation = 
location.obtain(MutableMap.of("callerContext", ""+this+"("+template+")"), 
template);
-                // Class has been deprecated since 0.6.0, and prior to that, 
obtain would have returned a JcloudsSshMachineLocation
-                if (machineLocation instanceof JcloudsSshMachineLocation) {
-                    m = (JcloudsSshMachineLocation) machineLocation;
-                } else {
-                    throw new UnsupportedOperationException("Cannot create 
WinRmMachineLocation");
-                }
-            } catch (Exception e) {
-                throw Throwables.propagate(e);
-            }
-            nodes.add(m.getNode());
-        }
-        MachineSet result = new MachineSet(nodes);
-        registerNewNodes(result, template);
-        return result;
-    }
-
-    public boolean unclaim(SshMachineLocation location) {
-        init();
-        if (location instanceof JcloudsSshMachineLocation)
-            return unclaim(new MachineSet( 
((JcloudsSshMachineLocation)location).getNode()) ) > 0;
-        return false;
-    }
-    public boolean destroy(SshMachineLocation location) {
-        init();
-        if (location instanceof JcloudsSshMachineLocation)
-            return destroy(new MachineSet( 
((JcloudsSshMachineLocation)location).getNode()) ) > 0;
-        return false;
-    }
-
-    // TODO we need to remove stale tasks somewhere
-    protected <T> Task<T> addTask(Task<T> t) {
-        synchronized (activeTasks) { activeTasks.add(t); }
-        return t;
-    }
-    
-    public List<Task<?>> getActiveTasks() {
-        List<Task<?>> result;
-        synchronized (activeTasks) { result = 
ImmutableList.<Task<?>>copyOf(activeTasks); }
-        return result;
-    }
-
-    public void blockUntilTasksEnded() {
-        while (true) {
-            boolean allDone = true;
-            List<Task<?>> tt = getActiveTasks();
-            for (Task<?> t: tt) {
-                if (!t.isDone()) {
-                    allDone = false;
-                    if (log.isDebugEnabled()) log.debug("Pool "+this+", 
blocking for completion of: "+t);
-                    t.blockUntilEnded();
-                }
-            }
-            synchronized (activeTasks) {
-                List<Task> newTT = new ArrayList<Task>(getActiveTasks());
-                newTT.removeAll(tt);
-                if (allDone && tt.isEmpty()) {
-                    //task list has stabilized, and there are no active tasks; 
clear and exit
-                    if (log.isDebugEnabled()) log.debug("Pool "+this+", all 
known tasks have completed, clearing list");
-                    activeTasks.clear();
-                    break;
-                }
-                if (log.isDebugEnabled()) log.debug("Pool "+this+", all 
previously known tasks have completed, but there are new tasks ("+newTT+") 
checking them");
-            }
-        }
-    }
-
-    /** starts the given template; for use only within a task (e.g. 
application's start effector).
-     * returns a child task of the current task.
-     * <p>
-     * throws exception if not in a task. (you will have to claim, then invoke 
the effectors manually.) */
-    public Task<?> start(final ReusableMachineTemplate template, final List<? 
extends Startable> entities) {
-        BasicExecutionContext ctx = 
BasicExecutionContext.getCurrentExecutionContext();
-        if (ctx==null) throw new IllegalStateException("Pool.start is only 
permitted within a task (effector)");
-        final AtomicReference<Task<?>> t = new AtomicReference<Task<?>>();
-        synchronized (t) {
-            t.set(ctx.submit(new Runnable() {
-                public void run() {
-                    synchronized (t) {
-                        if (log.isDebugEnabled()) log.debug("Pool "+this+", 
task "+t.get()+" claiming a "+template);
-                        SshMachineLocation m = obtain(template);
-                        if (log.isDebugEnabled()) log.debug("Pool "+this+", 
task "+t.get()+" got "+m+"; starting "+entities);
-                        for (Startable entity: entities)
-                            addTask( ((Entity)entity).invoke(Startable.START, 
MutableMap.of("locations", Arrays.asList(m))) );
-                    }
-                }
-            }));
-        }
-        addTask(t.get());
-        return t.get();
-    }
-
-    /** @see #start(ReusableMachineTemplate, List) */
-    public Task<?> start(ReusableMachineTemplate template, Startable 
...entities) {
-        return start(template, Arrays.asList(entities));
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistry.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistry.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistry.java
deleted file mode 100644
index 519fa01..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistry.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import org.jclouds.compute.ComputeService;
-
-import brooklyn.util.config.ConfigBag;
-
-public interface ComputeServiceRegistry {
-    
-    public ComputeService findComputeService(ConfigBag conf, boolean 
allowReuse);
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
deleted file mode 100644
index a1786ec..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/ComputeServiceRegistryImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import static brooklyn.util.JavaGroovyEquivalents.groovyTruth;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static 
org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_AMI_QUERY;
-import static 
org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMI_QUERY;
-
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jclouds.Constants;
-import org.jclouds.ContextBuilder;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.ec2.reference.EC2Constants;
-import org.jclouds.encryption.bouncycastle.config.BouncyCastleCryptoModule;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.entity.basic.Sanitizer;
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.config.ConfigBag;
-import brooklyn.util.time.Duration;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.inject.Module;
-
-public class ComputeServiceRegistryImpl implements ComputeServiceRegistry, 
JcloudsLocationConfig {
-    
-    private static final Logger LOG = 
LoggerFactory.getLogger(ComputeServiceRegistryImpl.class);
-
-    public static final ComputeServiceRegistryImpl INSTANCE = new 
ComputeServiceRegistryImpl();
-        
-    protected ComputeServiceRegistryImpl() {
-    }
-    
-    protected final Map<Map<?,?>,ComputeService> cachedComputeServices = new 
ConcurrentHashMap<Map<?,?>,ComputeService>();
-
-    protected final Object createComputeServicesMutex = new Object();
-
-    @Override
-    public ComputeService findComputeService(ConfigBag conf, boolean 
allowReuse) {
-        String provider = checkNotNull(conf.get(CLOUD_PROVIDER), "provider 
must not be null");
-        String identity = checkNotNull(conf.get(ACCESS_IDENTITY), "identity 
must not be null");
-        String credential = checkNotNull(conf.get(ACCESS_CREDENTIAL), 
"credential must not be null");
-        
-        Properties properties = new Properties();
-        properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, 
Boolean.toString(true));
-        properties.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, 
Boolean.toString(true));
-        properties.setProperty("jclouds.ssh.max-retries", 
conf.getStringKey("jclouds.ssh.max-retries") != null ? 
-                conf.getStringKey("jclouds.ssh.max-retries").toString() : 
"50");
-        // Enable aws-ec2 lazy image fetching, if given a specific imageId; 
otherwise customize for specific owners; or all as a last resort
-        // See https://issues.apache.org/jira/browse/WHIRR-416
-        if ("aws-ec2".equals(provider)) {
-            // TODO convert AWS-only flags to config keys
-            if (groovyTruth(conf.get(IMAGE_ID))) {
-                properties.setProperty(PROPERTY_EC2_AMI_QUERY, "");
-                properties.setProperty(PROPERTY_EC2_CC_AMI_QUERY, "");
-            } else if (groovyTruth(conf.getStringKey("imageOwner"))) {
-                properties.setProperty(PROPERTY_EC2_AMI_QUERY, 
"owner-id="+conf.getStringKey("imageOwner")+";state=available;image-type=machine");
-            } else if (groovyTruth(conf.getStringKey("anyOwner"))) {
-                // set `anyOwner: true` to override the default query (which 
is restricted to certain owners as per below), 
-                // allowing the AMI query to bind to any machine
-                // (note however, we sometimes pick defaults in 
JcloudsLocationFactory);
-                // (and be careful, this can give a LOT of data back, taking 
several minutes,
-                // and requiring extra memory allocated on the command-line)
-                properties.setProperty(PROPERTY_EC2_AMI_QUERY, 
"state=available;image-type=machine");
-                /*
-                 * by default the following filters are applied:
-                 * Filter.1.Name=owner-id&Filter.1.Value.1=137112412989&
-                 * Filter.1.Value.2=063491364108&
-                 * Filter.1.Value.3=099720109477&
-                 * Filter.1.Value.4=411009282317&
-                 * Filter.2.Name=state&Filter.2.Value.1=available&
-                 * Filter.3.Name=image-type&Filter.3.Value.1=machine&
-                 */
-            }
-            
-            // occasionally can get 
com.google.common.util.concurrent.UncheckedExecutionException: 
java.lang.RuntimeException: 
-            //     security group 
eu-central-1/jclouds#brooklyn-bxza-alex-eu-central-shoul-u2jy-nginx-ielm is not 
available after creating
-            // the default timeout was 500ms so let's raise it in case that 
helps
-            
properties.setProperty(EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT, 
""+Duration.seconds(30).toMilliseconds());
-        }
-
-        // FIXME Deprecated mechanism, should have a ConfigKey for overrides
-        Map<String, Object> extra = Maps.filterKeys(conf.getAllConfig(), 
Predicates.containsPattern("^jclouds\\."));
-        if (extra.size() > 0) {
-            LOG.warn("Jclouds using deprecated property overrides: 
"+Sanitizer.sanitize(extra));
-        }
-        properties.putAll(extra);
-
-        String endpoint = conf.get(CLOUD_ENDPOINT);
-        if (!groovyTruth(endpoint)) endpoint = getDeprecatedProperty(conf, 
Constants.PROPERTY_ENDPOINT);
-        if (groovyTruth(endpoint)) 
properties.setProperty(Constants.PROPERTY_ENDPOINT, endpoint);
-
-        Map<?,?> cacheKey = MutableMap.builder()
-                .putAll(properties)
-                .put("provider", provider)
-                .put("identity", identity)
-                .put("credential", credential)
-                .putIfNotNull("endpoint", endpoint)
-                .build()
-                .asUnmodifiable();
-
-        if (allowReuse) {
-            ComputeService result = cachedComputeServices.get(cacheKey);
-            if (result!=null) {
-                LOG.trace("jclouds ComputeService cache hit for compute 
service, for "+Sanitizer.sanitize(properties));
-                return result;
-            }
-            LOG.debug("jclouds ComputeService cache miss for compute service, 
creating, for "+Sanitizer.sanitize(properties));
-        }
-
-        Iterable<Module> modules = getCommonModules();
-
-        // Synchronizing to avoid deadlock from 
sun.reflect.annotation.AnnotationType.
-        // See https://github.com/brooklyncentral/brooklyn/issues/974
-        ComputeServiceContext computeServiceContext;
-        synchronized (createComputeServicesMutex) {
-            computeServiceContext = ContextBuilder.newBuilder(provider)
-                    .modules(modules)
-                    .credentials(identity, credential)
-                    .overrides(properties)
-                    .build(ComputeServiceContext.class);
-        }
-        final ComputeService computeService = 
computeServiceContext.getComputeService();
-        if (allowReuse) {
-            synchronized (cachedComputeServices) {
-                ComputeService result = cachedComputeServices.get(cacheKey);
-                if (result != null) {
-                    LOG.debug("jclouds ComputeService cache recovery for 
compute service, for "+Sanitizer.sanitize(cacheKey));
-                    //keep the old one, discard the new one
-                    computeService.getContext().close();
-                    return result;
-                }
-                LOG.debug("jclouds ComputeService created "+computeService+", 
adding to cache, for "+Sanitizer.sanitize(properties));
-                cachedComputeServices.put(cacheKey, computeService);
-            }
-        }
-        return computeService;
-     }
-
-    /** returns the jclouds modules we typically install */ 
-    protected ImmutableSet<Module> getCommonModules() {
-        return ImmutableSet.<Module> of(
-                new SshjSshClientModule(), 
-                new SLF4JLoggingModule(),
-                new BouncyCastleCryptoModule());
-    }
-     
-    protected String getDeprecatedProperty(ConfigBag conf, String key) {
-        if (conf.containsKey(key)) {
-            LOG.warn("Jclouds using deprecated brooklyn-jclouds property 
"+key+": "+Sanitizer.sanitize(conf.getAllConfig()));
-            return (String) conf.getStringKey(key);
-        } else {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e2c57058/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
 
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
deleted file mode 100644
index a027907..0000000
--- 
a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsByonLocationResolver.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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 brooklyn.location.jclouds;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.brooklyn.api.management.ManagementContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.location.LocationRegistry;
-import brooklyn.location.LocationResolver;
-import brooklyn.location.LocationSpec;
-import brooklyn.location.NoMachinesAvailableException;
-import brooklyn.location.basic.BasicLocationRegistry;
-import brooklyn.location.basic.FixedListMachineProvisioningLocation;
-import brooklyn.location.basic.LocationConfigKeys;
-import brooklyn.location.basic.LocationConfigUtils;
-import brooklyn.location.basic.LocationInternal;
-import brooklyn.location.basic.LocationPropertiesFromBrooklynProperties;
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.config.ConfigBag;
-import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.text.KeyValueParser;
-import brooklyn.util.text.Strings;
-import brooklyn.util.text.WildcardGlobs;
-import brooklyn.util.text.WildcardGlobs.PhraseTreatment;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * Examples of valid specs:
- *   <ul>
- *     <li>byon:(hosts=myhost)
- *     <li>byon:(hosts="myhost, myhost2")
- *     <li>byon:(hosts="myhost, myhost2", name="my location name")
- *   </ul>
- * 
- * @author aled
- */
-@SuppressWarnings({"unchecked","rawtypes"})
-public class JcloudsByonLocationResolver implements LocationResolver {
-
-    public static final Logger log = 
LoggerFactory.getLogger(JcloudsByonLocationResolver.class);
-    
-    public static final String BYON = "jcloudsByon";
-
-    private static final Pattern PATTERN = 
Pattern.compile("("+BYON+"|"+BYON.toUpperCase()+")" + ":" + "\\((.*)\\)$");
-
-    private ManagementContext managementContext;
-
-    @Override
-    public void init(ManagementContext managementContext) {
-        this.managementContext = checkNotNull(managementContext, 
"managementContext");
-    }
-    
-    // TODO Remove some duplication from JcloudsResolver; needs more careful 
review
-    @Override
-    public FixedListMachineProvisioningLocation<JcloudsSshMachineLocation> 
newLocationFromString(Map locationFlags, String spec, 
brooklyn.location.LocationRegistry registry) {
-        Map globalProperties = registry.getProperties();
-
-        Matcher matcher = PATTERN.matcher(spec);
-        if (!matcher.matches()) {
-            throw new IllegalArgumentException("Invalid location '"+spec+"'; 
must specify something like 
jcloudsByon(provider=\"aws-ec2\",region=\"us-east-1\",hosts=\"i-f2014593,i-d1234567\")");
-        }
-        
-        String argsPart = matcher.group(2);
-        Map<String, String> argsMap = KeyValueParser.parseMap(argsPart);
-        
-        // prefer args map over location flags
-        
-        String namedLocation = (String) 
locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
-
-        String providerOrApi = argsMap.containsKey("provider") ? 
argsMap.get("provider") : (String)locationFlags.get("provider");
-
-        String regionName = argsMap.containsKey("region") ? 
argsMap.get("region") : (String)locationFlags.get("region");
-        
-        String endpoint = argsMap.containsKey("endpoint") ? 
argsMap.get("endpoint") : (String)locationFlags.get("endpoint");
-        
-        String name = argsMap.containsKey("name") ? argsMap.get("name") : 
(String)locationFlags.get("name");
-
-        String user = argsMap.containsKey("user") ? argsMap.get("user") : 
(String)locationFlags.get("user");
-
-        String privateKeyFile = argsMap.containsKey("privateKeyFile") ? 
argsMap.get("privateKeyFile") : (String)locationFlags.get("privateKeyFile");
-        
-        String hosts = argsMap.get("hosts");
-        
-        if (Strings.isEmpty(providerOrApi)) {
-            throw new IllegalArgumentException("Invalid location '"+spec+"'; 
provider must be defined");
-        }
-        if (hosts == null || hosts.isEmpty()) {
-            throw new IllegalArgumentException("Invalid location '"+spec+"'; 
at least one host must be defined");
-        }
-        if (argsMap.containsKey("name") && (Strings.isEmpty(name))) {
-            throw new IllegalArgumentException("Invalid location '"+spec+"'; 
if name supplied then value must be non-empty");
-        }
-
-        // For everything in brooklyn.properties, only use things with correct 
prefix (and remove that prefix).
-        // But for everything passed in via locationFlags, pass those as-is.
-        // TODO Should revisit the locationFlags: where are these actually 
used? Reason accepting properties without
-        //      full prefix is that the map's context is explicitly this 
location, rather than being generic properties.
-        Map allProperties = getAllProperties(registry, globalProperties);
-        Map jcloudsProperties = new 
JcloudsPropertiesFromBrooklynProperties().getJcloudsProperties(providerOrApi, 
regionName, namedLocation, allProperties);
-        jcloudsProperties.putAll(locationFlags);
-        jcloudsProperties.putAll(argsMap);
-        
-        String jcloudsSpec = "jclouds:"+providerOrApi + (regionName != null ? 
":"+regionName : "") + (endpoint != null ? ":"+endpoint : "");
-        JcloudsLocation jcloudsLocation = (JcloudsLocation) 
registry.resolve(jcloudsSpec, jcloudsProperties);
-
-        List<String> hostIdentifiers = 
WildcardGlobs.getGlobsAfterBraceExpansion("{"+hosts+"}",
-                true /* numeric */, /* no quote support though */ 
PhraseTreatment.NOT_A_SPECIAL_CHAR, PhraseTreatment.NOT_A_SPECIAL_CHAR);
-        List<JcloudsSshMachineLocation> machines = Lists.newArrayList();
-        
-        for (String hostIdentifier : hostIdentifiers) {
-            Map<?, ?> machineFlags = MutableMap.builder()
-                    .put("id", hostIdentifier)
-                    .putIfNotNull("user", user)
-                    .putIfNotNull("privateKeyFile", privateKeyFile)
-                    .build();
-            try {
-                JcloudsSshMachineLocation machine = 
jcloudsLocation.rebindMachine(jcloudsLocation.config().getBag().putAll(machineFlags));
-                machines.add(machine);
-            } catch (NoMachinesAvailableException e) {
-                log.warn("Error rebinding to jclouds machine 
"+hostIdentifier+" in "+jcloudsLocation, e);
-                Exceptions.propagate(e);
-            }
-        }
-        
-        ConfigBag flags = ConfigBag.newInstance(jcloudsProperties);
-
-        flags.putStringKey("machines", machines);
-        flags.putIfNotNull(LocationConfigKeys.USER, user);
-        flags.putStringKeyIfNotNull("name", name);
-        
-        if (registry != null) 
-            
LocationPropertiesFromBrooklynProperties.setLocalTempDir(registry.getProperties(),
 flags);
-
-        log.debug("Created Jclouds BYON location "+name+": "+machines);
-        
-        return 
managementContext.getLocationManager().createLocation(LocationSpec.create(FixedListMachineProvisioningLocation.class)
-                .configure(flags.getAllConfig())
-                .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, 
locationFlags, globalProperties, namedLocation)));
-    }
-    
-    private Map getAllProperties(brooklyn.location.LocationRegistry registry, 
Map<?,?> properties) {
-        Map<Object,Object> allProperties = Maps.newHashMap();
-        if (registry!=null) allProperties.putAll(registry.getProperties());
-        allProperties.putAll(properties);
-        return allProperties;
-    }
-    
-    @Override
-    public String getPrefix() {
-        return BYON;
-    }
-    
-    @Override
-    public boolean accepts(String spec, LocationRegistry registry) {
-        return BasicLocationRegistry.isResolverPrefixForSpec(this, spec, true);
-    }
-}
\ No newline at end of file

Reply via email to