brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [50/62] [abbrv] incubator-brooklyn git commit: rename core’s o.a.b.location to o.a.b.core.location
Date Wed, 19 Aug 2015 21:21:24 GMT
rename core’s o.a.b.location to o.a.b.core.location
    
- except for things that truly are locations, such as .localhost, 
  .ssh, .winrm etc
- also extract .multi from o.a.b.core.location to o.a.b.location.multi



Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/538324e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/538324e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/538324e1

Branch: refs/heads/master
Commit: 538324e1a4fbeddb1d923354c6d72b7fbeb8a1e2
Parents: 33abfc1
Author: Aled Sage <aled.sage@gmail.com>
Authored: Wed Aug 19 16:45:04 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Aug 19 16:45:04 2015 +0100

----------------------------------------------------------------------
 .../catalog/internal/BasicBrooklynCatalog.java  |   2 +-
 .../brooklyn/core/entity/AbstractEntity.java    |   2 +-
 .../apache/brooklyn/core/entity/Entities.java   |   4 +-
 .../brooklyn/core/entity/EntitySuppliers.java   |   2 +-
 .../core/internal/BrooklynInitialization.java   |   2 +-
 .../core/location/AbstractLocation.java         | 709 +++++++++++++++++++
 .../core/location/AbstractLocationResolver.java | 188 +++++
 .../AggregatingMachineProvisioningLocation.java | 141 ++++
 .../core/location/BasicHardwareDetails.java     |  56 ++
 .../core/location/BasicLocationDefinition.java  |  85 +++
 .../core/location/BasicLocationRegistry.java    | 489 +++++++++++++
 .../core/location/BasicMachineDetails.java      | 183 +++++
 .../core/location/BasicMachineMetadata.java     |  84 +++
 .../brooklyn/core/location/BasicOsDetails.java  | 123 ++++
 .../core/location/CatalogLocationResolver.java  |  79 +++
 .../location/DefinedLocationByIdResolver.java   |  74 ++
 .../location/DeprecatedKeysMappingBuilder.java  |  66 ++
 .../core/location/HasSubnetHostname.java        |  32 +
 .../core/location/LocationConfigKeys.java       |  79 +++
 .../core/location/LocationConfigUtils.java      | 559 +++++++++++++++
 .../core/location/LocationPredicates.java       | 108 +++
 ...ocationPropertiesFromBrooklynProperties.java | 223 ++++++
 .../brooklyn/core/location/Locations.java       | 160 +++++
 .../apache/brooklyn/core/location/Machines.java | 191 +++++
 .../core/location/NamedLocationResolver.java    |  97 +++
 .../brooklyn/core/location/PortRanges.java      | 257 +++++++
 .../core/location/RegistryLocationResolver.java |  42 ++
 .../core/location/SupportsPortForwarding.java   |  39 +
 .../location/access/BrooklynAccessUtils.java    | 154 ++++
 .../location/access/PortForwardManager.java     | 328 +++++++++
 .../access/PortForwardManagerAuthority.java     |  46 ++
 .../access/PortForwardManagerClient.java        | 405 +++++++++++
 .../location/access/PortForwardManagerImpl.java | 505 +++++++++++++
 .../PortForwardManagerLocationResolver.java     |  89 +++
 .../core/location/access/PortMapping.java       | 101 +++
 .../AbstractAvailabilityZoneExtension.java      |  82 +++
 ...bstractCloudMachineProvisioningLocation.java |  97 +++
 .../cloud/AvailabilityZoneExtension.java        |  54 ++
 .../location/cloud/CloudLocationConfig.java     | 116 +++
 .../cloud/names/AbstractCloudMachineNamer.java  | 150 ++++
 .../cloud/names/BasicCloudMachineNamer.java     |  91 +++
 .../location/cloud/names/CloudMachineNamer.java |  61 ++
 .../cloud/names/CustomMachineNamer.java         |  72 ++
 .../core/location/dynamic/DynamicLocation.java  |  50 ++
 .../core/location/dynamic/LocationOwner.java    |  85 +++
 .../location/geo/GeoBytesHostGeoLookup.java     | 104 +++
 .../core/location/geo/HasHostGeoInfo.java       |  25 +
 .../brooklyn/core/location/geo/HostGeoInfo.java | 205 ++++++
 .../core/location/geo/HostGeoLookup.java        |  27 +
 .../location/geo/LocalhostExternalIpLoader.java | 177 +++++
 .../location/geo/MaxMind2HostGeoLookup.java     | 114 +++
 .../core/location/geo/UtraceHostGeoLookup.java  | 209 ++++++
 .../location/internal/LocationDynamicType.java  |  40 ++
 .../location/internal/LocationInternal.java     |  93 +++
 .../location/internal/LocationTypeSnapshot.java |  40 ++
 .../internal/AbstractManagementContext.java     |   2 +-
 .../mgmt/internal/LocalLocationManager.java     |   4 +-
 .../core/mgmt/internal/LocalUsageManager.java   |   6 +-
 .../mgmt/rebind/BasicLocationRebindSupport.java |   2 +-
 .../rebind/ImmediateDeltaChangeListener.java    |   2 +-
 .../core/mgmt/rebind/RebindIteration.java       |   4 +-
 .../mgmt/rebind/dto/MementosGenerators.java     |   2 +-
 .../objs/proxy/InternalLocationFactory.java     |   4 +-
 .../brooklyn/effector/core/EffectorTasks.java   |   2 +-
 .../entity/group/DynamicClusterImpl.java        |   4 +-
 .../brooklyn/entity/stock/BasicStartable.java   |   2 +-
 .../entity/stock/BasicStartableImpl.java        |   2 +-
 .../location/access/BrooklynAccessUtils.java    | 154 ----
 .../location/access/PortForwardManager.java     | 328 ---------
 .../access/PortForwardManagerAuthority.java     |  46 --
 .../access/PortForwardManagerClient.java        | 405 -----------
 .../location/access/PortForwardManagerImpl.java | 505 -------------
 .../PortForwardManagerLocationResolver.java     |  89 ---
 .../brooklyn/location/access/PortMapping.java   | 101 ---
 .../location/byon/ByonLocationResolver.java     |   2 +-
 .../FixedListMachineProvisioningLocation.java   |   4 +-
 .../location/byon/HostLocationResolver.java     |   8 +-
 .../byon/SingleMachineLocationResolver.java     |   8 +-
 .../AbstractAvailabilityZoneExtension.java      |  82 ---
 ...bstractCloudMachineProvisioningLocation.java |  97 ---
 .../cloud/AvailabilityZoneExtension.java        |  54 --
 .../location/cloud/CloudLocationConfig.java     | 116 ---
 .../cloud/names/AbstractCloudMachineNamer.java  | 150 ----
 .../cloud/names/BasicCloudMachineNamer.java     |  91 ---
 .../location/cloud/names/CloudMachineNamer.java |  61 --
 .../cloud/names/CustomMachineNamer.java         |  72 --
 .../location/core/AbstractLocation.java         | 709 -------------------
 .../location/core/AbstractLocationResolver.java | 188 -----
 .../AggregatingMachineProvisioningLocation.java | 141 ----
 .../location/core/BasicHardwareDetails.java     |  56 --
 .../location/core/BasicLocationDefinition.java  |  85 ---
 .../location/core/BasicLocationRegistry.java    | 489 -------------
 .../location/core/BasicMachineDetails.java      | 183 -----
 .../location/core/BasicMachineMetadata.java     |  84 ---
 .../brooklyn/location/core/BasicOsDetails.java  | 123 ----
 .../location/core/CatalogLocationResolver.java  |  79 ---
 .../core/DefinedLocationByIdResolver.java       |  74 --
 .../core/DeprecatedKeysMappingBuilder.java      |  66 --
 .../location/core/HasSubnetHostname.java        |  32 -
 .../location/core/LocationConfigKeys.java       |  79 ---
 .../location/core/LocationConfigUtils.java      | 559 ---------------
 .../location/core/LocationPredicates.java       | 108 ---
 ...ocationPropertiesFromBrooklynProperties.java | 223 ------
 .../brooklyn/location/core/Locations.java       | 160 -----
 .../apache/brooklyn/location/core/Machines.java | 191 -----
 .../brooklyn/location/core/MultiLocation.java   | 166 -----
 .../location/core/MultiLocationResolver.java    | 145 ----
 .../location/core/NamedLocationResolver.java    |  97 ---
 .../brooklyn/location/core/PortRanges.java      | 257 -------
 .../location/core/RegistryLocationResolver.java |  42 --
 .../location/core/SupportsPortForwarding.java   |  39 -
 .../core/internal/LocationDynamicType.java      |  40 --
 .../core/internal/LocationInternal.java         |  93 ---
 .../core/internal/LocationTypeSnapshot.java     |  40 --
 .../location/dynamic/DynamicLocation.java       |  50 --
 .../location/dynamic/LocationOwner.java         |  85 ---
 .../location/geo/GeoBytesHostGeoLookup.java     | 104 ---
 .../brooklyn/location/geo/HasHostGeoInfo.java   |  25 -
 .../brooklyn/location/geo/HostGeoInfo.java      | 205 ------
 .../brooklyn/location/geo/HostGeoLookup.java    |  27 -
 .../location/geo/LocalhostExternalIpLoader.java | 177 -----
 .../location/geo/MaxMind2HostGeoLookup.java     | 114 ---
 .../location/geo/UtraceHostGeoLookup.java       | 209 ------
 .../localhost/LocalhostLocationResolver.java    |   4 +-
 .../LocalhostMachineProvisioningLocation.java   |   6 +-
 ...calhostPropertiesFromBrooklynProperties.java |   2 +-
 .../brooklyn/location/multi/MultiLocation.java  | 167 +++++
 .../location/multi/MultiLocationResolver.java   | 149 ++++
 .../location/ssh/SshMachineLocation.java        |  12 +-
 .../location/winrm/WinRmMachineLocation.java    |   4 +-
 .../core/PortAttributeSensorAndConfigKey.java   |   2 +-
 .../brooklyn/sensor/feed/ssh/SshFeed.java       |   4 +-
 .../util/core/BrooklynNetworkUtils.java         |   2 +-
 .../brooklyn/util/core/task/ssh/SshTasks.java   |   4 +-
 ...apListAndOtherStructuredConfigKeyTest.groovy |   2 +-
 .../entity/AbstractApplicationLegacyTest.java   |   3 +-
 .../core/entity/AbstractEntityLegacyTest.java   |   2 +-
 .../brooklyn/core/entity/EntitiesTest.java      |   2 +-
 .../core/entity/EntitySetFromFlagTest.java      |   2 +-
 .../brooklyn/core/entity/EntitySpecTest.java    |   2 +-
 .../core/entity/EntitySubscriptionTest.java     |   2 +-
 .../drivers/BasicEntityDriverManagerTest.java   |   2 +-
 .../ReflectiveEntityDriverFactoryTest.java      |   2 +-
 .../RegistryEntityDriverFactoryTest.java        |   2 +-
 .../downloads/BasicDownloadsRegistryTest.java   |   2 +-
 .../DownloadProducerFromLocalRepoTest.java      |   2 +-
 .../DownloadProducerFromPropertiesTest.java     |   2 +-
 .../downloads/DownloadSubstitutersTest.java     |   2 +-
 .../core/entity/hello/LocalEntitiesTest.java    |   2 +-
 .../EntityConfigMapUsageLegacyTest.java         |   2 +-
 .../internal/EntityConfigMapUsageTest.java      |   2 +-
 .../core/entity/trait/StartableMethodsTest.java |   2 +-
 .../core/location/AbstractLocationTest.java     | 185 +++++
 ...regatingMachineProvisioningLocationTest.java | 117 +++
 .../location/LegacyAbstractLocationTest.java    | 151 ++++
 .../core/location/LocationConfigTest.java       | 204 ++++++
 .../core/location/LocationConfigUtilsTest.java  | 156 ++++
 .../core/location/LocationExtensionsTest.java   | 187 +++++
 .../core/location/LocationManagementTest.java   |  82 +++
 .../core/location/LocationPredicatesTest.java   | 102 +++
 ...ionPropertiesFromBrooklynPropertiesTest.java | 122 ++++
 .../core/location/LocationRegistryTest.java     | 161 +++++
 .../core/location/MachineDetailsTest.java       |  83 +++
 .../brooklyn/core/location/PortRangesTest.java  | 130 ++++
 .../RecordingMachineLocationCustomizer.java     |  71 ++
 .../core/location/SimulatedLocation.java        | 141 ++++
 .../core/location/TestPortSupplierLocation.java |  90 +++
 .../access/BrooklynAccessUtilsTest.java         | 139 ++++
 .../PortForwardManagerLocationResolverTest.java |  83 +++
 .../access/PortForwardManagerRebindTest.java    | 195 +++++
 .../location/access/PortForwardManagerTest.java | 193 +++++
 .../location/cloud/CloudMachineNamerTest.java   | 161 +++++
 .../location/cloud/CustomMachineNamerTest.java  |  79 +++
 .../core/location/geo/HostGeoInfoTest.java      |  52 ++
 .../geo/HostGeoLookupIntegrationTest.java       |  87 +++
 ...ocalhostExternalIpLoaderIntegrationTest.java |  54 ++
 .../core/mgmt/internal/AccessManagerTest.java   |   2 +-
 .../mgmt/persist/XmlMementoSerializerTest.java  |   2 +-
 .../core/mgmt/rebind/RebindEnricherTest.java    |   2 +-
 .../core/mgmt/rebind/RebindEntityTest.java      |   2 +-
 .../core/mgmt/rebind/RebindLocationTest.java    |   2 +-
 .../core/mgmt/rebind/RebindPolicyTest.java      |   2 +-
 .../policy/basic/PolicySubscriptionTest.java    |   2 +-
 .../core/server/entity/BrooklynMetricsTest.java |   2 +-
 .../core/test/entity/TestApplication.java       |   2 +-
 .../core/test/entity/TestApplicationImpl.java   |   2 +-
 .../core/test/location/TestPaasLocation.java    |  32 -
 .../longevity/EntityCleanupLongevityTest.java   |   2 +-
 .../EntityCleanupLongevityTestFixture.java      |   2 +-
 .../test/qa/longevity/EntityCleanupTest.java    |   2 +-
 .../qa/performance/AbstractPerformanceTest.java |   2 +-
 .../EntityPersistencePerformanceTest.java       |   2 +-
 .../effector/core/EffectorBasicTest.java        |   2 +-
 .../entity/group/DynamicClusterTest.java        |   2 +-
 ...DynamicClusterWithAvailabilityZonesTest.java |   8 +-
 .../entity/group/DynamicFabricTest.java         |   4 +-
 .../entity/group/DynamicMultiGroupTest.java     |   2 +-
 .../entity/group/DynamicRegionsFabricTest.java  |   2 +-
 .../apache/brooklyn/entity/group/GroupTest.java |   3 +-
 .../group/MembershipTrackingPolicyTest.java     |   2 +-
 .../entity/group/QuarantineGroupTest.java       |   2 +-
 .../BalancingNodePlacementStrategyTest.java     |   2 +-
 .../ProportionalZoneFailureDetectorTest.java    |   2 +-
 .../entity/stock/BasicStartableTest.java        |   5 +-
 .../brooklyn/entity/stock/DataEntityTest.java   |   2 +-
 .../access/BrooklynAccessUtilsTest.java         | 137 ----
 .../PortForwardManagerLocationResolverTest.java |  82 ---
 .../access/PortForwardManagerRebindTest.java    | 194 -----
 .../location/access/PortForwardManagerTest.java | 192 -----
 .../location/byon/ByonLocationResolverTest.java |   8 +-
 ...stMachineProvisioningLocationRebindTest.java |   2 +-
 ...ixedListMachineProvisioningLocationTest.java |   4 +-
 .../location/cloud/CloudMachineNamerTest.java   | 160 -----
 .../location/cloud/CustomMachineNamerTest.java  |  78 --
 .../location/core/AbstractLocationTest.java     | 185 -----
 ...regatingMachineProvisioningLocationTest.java | 117 ---
 .../core/LegacyAbstractLocationTest.java        | 151 ----
 .../location/core/LocationConfigTest.java       | 204 ------
 .../location/core/LocationConfigUtilsTest.java  | 156 ----
 .../location/core/LocationExtensionsTest.java   | 187 -----
 .../location/core/LocationManagementTest.java   |  82 ---
 .../location/core/LocationPredicatesTest.java   | 102 ---
 ...ionPropertiesFromBrooklynPropertiesTest.java | 122 ----
 .../location/core/LocationRegistryTest.java     | 161 -----
 .../location/core/MachineDetailsTest.java       |  83 ---
 .../location/core/MultiLocationRebindTest.java  | 122 ----
 .../core/MultiLocationResolverTest.java         | 203 ------
 .../location/core/MultiLocationTest.java        | 121 ----
 .../location/core/PaasLocationTest.java         |  35 -
 .../brooklyn/location/core/PortRangesTest.java  | 130 ----
 .../RecordingMachineLocationCustomizer.java     |  71 --
 .../location/core/SimulatedLocation.java        | 141 ----
 .../location/core/TestPortSupplierLocation.java |  90 ---
 .../LocalhostLocationResolverTest.java          | 269 -------
 ...ocalhostMachineProvisioningLocationTest.java | 215 ------
 .../LocalhostProvisioningAndAccessTest.java     |  59 --
 .../brooklyn/location/geo/HostGeoInfoTest.java  |  51 --
 .../geo/HostGeoLookupIntegrationTest.java       |  83 ---
 ...ocalhostExternalIpLoaderIntegrationTest.java |  53 --
 .../LocalhostLocationResolverTest.java          | 269 +++++++
 ...ocalhostMachineProvisioningLocationTest.java | 215 ++++++
 .../LocalhostProvisioningAndAccessTest.java     |  59 ++
 .../location/multi/MultiLocationRebindTest.java | 122 ++++
 .../multi/MultiLocationResolverTest.java        | 203 ++++++
 .../location/multi/MultiLocationTest.java       | 121 ++++
 .../location/paas/PaasLocationTest.java         |  34 +
 .../location/paas/TestPaasLocation.java         |  32 +
 .../location/ssh/SshMachineLocationTest.java    |  10 +-
 ...stomAggregatingEnricherDeprecatedTest.groovy |   2 +-
 .../enricher/CustomAggregatingEnricherTest.java |   2 +-
 .../TransformingEnricherDeprecatedTest.groovy   |   2 +-
 .../enricher/TransformingEnricherTest.java      |   2 +-
 .../feed/http/HttpFeedIntegrationTest.java      |   2 +-
 .../util/core/http/HttpToolIntegrationTest.java |   2 +-
 .../brooklyn/demo/GlobalWebFabricExample.java   |   2 +-
 .../brooklyn/demo/CumulusRDFApplication.java    |   2 +-
 .../brooklyn/demo/SingleWebServerExample.java   |   2 +-
 .../demo/WebClusterDatabaseExample.java         |   2 +-
 .../demo/WebClusterDatabaseExampleApp.java      |   2 +-
 .../JcloudsBlobStoreBasedObjectStore.java       |   4 +-
 ...AbstractJcloudsSubnetSshMachineLocation.java |   2 +-
 .../jclouds/ComputeServiceRegistryImpl.java     |   2 +-
 .../jclouds/JcloudsByonLocationResolver.java    |  10 +-
 .../location/jclouds/JcloudsLocation.java       |  22 +-
 .../location/jclouds/JcloudsLocationConfig.java |   8 +-
 .../jclouds/JcloudsLocationResolver.java        |   8 +-
 .../jclouds/JcloudsMachineLocation.java         |   2 +-
 .../location/jclouds/JcloudsMachineNamer.java   |   2 +-
 ...JcloudsPropertiesFromBrooklynProperties.java |   6 +-
 .../jclouds/JcloudsSshMachineLocation.java      |   6 +-
 .../JcloudsLocationSecurityGroupCustomizer.java |   2 +-
 .../JcloudsPortForwarderExtension.java          |   4 +-
 .../zone/AwsAvailabilityZoneExtension.java      |   4 +-
 .../mgmt/persist/jclouds/BlobStoreCleaner.java  |   4 +-
 .../persist/jclouds/BlobStoreExpiryTest.java    |   4 +-
 .../mgmt/persist/jclouds/BlobStoreTest.java     |   4 +-
 .../jclouds/JcloudsAddressesLiveTest.java       |   2 +-
 .../jclouds/JcloudsLocationMetadataTest.java    |   2 +-
 .../jclouds/JcloudsLocationResolverTest.java    |   4 +-
 .../location/jclouds/JcloudsLocationTest.java   |   6 +-
 .../location/jclouds/LiveTestEntity.java        |   2 +-
 .../JcloudsPortForwardingStubbedLiveTest.java   |   4 +-
 .../followthesun/DefaultFollowTheSunModel.java  |   2 +-
 .../policy/ha/SshMachineFailureDetector.java    |   2 +-
 .../autoscaling/AutoScalerPolicyRebindTest.java |   2 +-
 .../AbstractFollowTheSunPolicyTest.java         |   2 +-
 .../followthesun/FollowTheSunModelTest.java     |   2 +-
 .../FollowTheSunPolicySoakTest.java             |   2 +-
 .../followthesun/FollowTheSunPolicyTest.java    |   2 +-
 .../brooklyn/policy/ha/HaPolicyRebindTest.java  |   2 +-
 .../brooklyn/policy/ha/ServiceReplacerTest.java |   2 +-
 .../AbstractLoadBalancingPolicyTest.java        |   2 +-
 .../BalanceableWorkerPoolTest.java              |   2 +-
 .../ItemsInContainersGroupTest.java             |   2 +-
 .../postgresql/PostgreSqlSaltLiveTest.java      |   2 +-
 .../entity/monitoring/zabbix/ZabbixFeed.java    |   4 +-
 .../entity/nosql/hazelcast/HazelcastNode.java   |   3 +-
 .../nosql/hazelcast/HazelcastNodeImpl.java      |   2 +-
 .../entity/brooklynnode/BrooklynNodeImpl.java   |   4 +-
 .../entity/chef/ChefLifecycleEffectorTasks.java |   2 +-
 .../apache/brooklyn/entity/java/JmxSupport.java |   4 +-
 .../apache/brooklyn/entity/java/UsesJmx.java    |   2 +-
 .../entity/machine/MachineEntityImpl.java       |   2 +-
 .../entity/machine/pool/ServerPool.java         |   4 +-
 .../entity/machine/pool/ServerPoolImpl.java     |   6 +-
 .../entity/machine/pool/ServerPoolLocation.java |   4 +-
 .../pool/ServerPoolLocationResolver.java        |   8 +-
 .../SameServerDriverLifecycleEffectorTasks.java |   2 +-
 .../software/base/SoftwareProcessImpl.java      |   4 +-
 .../MachineLifecycleEffectorTasks.java          |   8 +-
 .../system_service/InitdServiceInstaller.java   |   2 +-
 .../brooklyn/sensor/ssh/SshEffectorTasks.java   |   2 +-
 .../BrooklynNodeIntegrationTest.java            |   4 +-
 .../entity/java/VanillaJavaAppTest.java         |   2 +-
 .../pool/ServerPoolLocationResolverTest.java    |   2 +-
 .../base/SoftwareProcessEntityRebindTest.java   |   2 +-
 .../base/SoftwareProcessEntityTest.java         |   4 +-
 ...rWithAvailabilityZonesMultiLocationTest.java |   2 +-
 .../location/MachineDetailsEc2LiveTest.java     |   4 +-
 .../MachineDetailsGoogleComputeLiveTest.java    |   4 +-
 .../mysql/DynamicToyMySqlEntityBuilder.java     |   2 +-
 .../brooklyn/sensor/feed/jmx/JmxFeedTest.java   |   4 +-
 .../sensor/feed/jmx/RebindJmxFeedTest.java      |   2 +-
 .../entity/database/crate/CrateNode.java        |   2 +-
 .../entity/database/mariadb/MariaDbNode.java    |   2 +-
 .../database/mariadb/MariaDbNodeImpl.java       |   2 +-
 .../entity/database/mysql/MySqlNode.java        |   2 +-
 .../entity/database/mysql/MySqlNodeImpl.java    |   2 +-
 .../entity/database/mysql/MySqlSshDriver.java   |   2 +-
 .../database/postgresql/PostgreSqlNode.java     |   2 +-
 .../PostgreSqlNodeChefImplFromScratch.java      |   2 +-
 .../database/postgresql/PostgreSqlChefTest.java |   2 +-
 .../postgresql/PostgreSqlRackspaceLiveTest.java |   2 +-
 .../database/rubyrep/RubyRepEc2LiveTest.java    |   2 +-
 .../rubyrep/RubyRepIntegrationTest.java         |   2 +-
 .../rubyrep/RubyRepRackspaceLiveTest.java       |   2 +-
 .../entity/messaging/kafka/KafkaBroker.java     |   2 +-
 .../entity/messaging/storm/StormSshDriver.java  |   2 +-
 .../entity/network/bind/BindDnsServer.java      |   2 +-
 .../entity/network/bind/BindDnsServerImpl.java  |   2 +-
 .../cassandra/CassandraDatacenterImpl.java      |   2 +-
 .../entity/nosql/cassandra/CassandraNode.java   |   2 +-
 .../nosql/cassandra/CassandraNodeImpl.java      |   4 +-
 .../nosql/cassandra/CassandraNodeSshDriver.java |   4 +-
 .../nosql/couchbase/CouchbaseClusterImpl.java   |   2 +-
 .../nosql/couchbase/CouchbaseNodeImpl.java      |   4 +-
 .../nosql/couchbase/CouchbaseNodeSshDriver.java |   2 +-
 .../couchbase/CouchbaseSyncGatewayImpl.java     |   2 +-
 .../nosql/elasticsearch/ElasticSearchNode.java  |   2 +-
 .../elasticsearch/ElasticSearchNodeImpl.java    |   2 +-
 .../nosql/mongodb/MongoDBClientSupport.java     |   3 +-
 .../entity/nosql/mongodb/MongoDBServerImpl.java |   2 +-
 .../entity/nosql/mongodb/ReplicaSetConfig.java  |   3 +-
 .../entity/nosql/riak/RiakNodeImpl.java         |   4 +-
 .../brooklyn/entity/nosql/solr/SolrServer.java  |   2 +-
 .../entity/nosql/solr/SolrServerImpl.java       |   2 +-
 .../nosql/couchbase/CouchbaseOfflineTest.java   |   4 +-
 .../entity/nosql/mongodb/MongoDBTestHelper.java |   3 +-
 .../nosql/redis/RedisIntegrationTest.java       |   2 +-
 .../entity/dns/AbstractGeoDnsService.java       |   2 +-
 .../entity/dns/AbstractGeoDnsServiceImpl.java   |   2 +-
 .../geoscaling/GeoscalingDnsServiceImpl.java    |   2 +-
 .../geoscaling/GeoscalingScriptGenerator.java   |   2 +-
 .../entity/proxy/AbstractControllerImpl.java    |   4 +-
 .../entity/webapp/WebAppServiceMethods.java     |   2 +-
 .../entity/webapp/jboss/JBoss7ServerImpl.java   |   2 +-
 .../webapp/nodejs/NodeJsWebAppService.java      |   2 +-
 .../webapp/nodejs/NodeJsWebAppServiceImpl.java  |   2 +-
 .../entity/webapp/tomcat/TomcatServer.java      |   2 +-
 .../entity/dns/AbstractGeoDnsServiceTest.java   |  12 +-
 .../geoscaling/GeoscalingIntegrationTest.java   |   8 +-
 .../GeoscalingScriptGeneratorTest.java          |   2 +-
 .../nginx/NginxClusterIntegrationTest.java      |   2 +-
 .../nginx/NginxHttpsSslIntegrationTest.java     |   2 +-
 .../proxy/nginx/NginxWebClusterEc2LiveTest.java |   2 +-
 .../entity/webapp/DynamicWebAppClusterTest.java |   2 +-
 .../entity/webapp/DynamicWebAppFabricTest.java  |   2 +-
 .../webapp/ElasticCustomLocationTest.java       |   2 +-
 .../webapp/WebAppLiveIntegrationTest.groovy     |   2 +-
 ...ultiVersionWebAppFixtureIntegrationTest.java |   2 +-
 .../JettyWebAppFixtureIntegrationTest.java      |   2 +-
 .../NodeJsWebAppFixtureIntegrationTest.java     |   3 +-
 .../NodeJsWebAppSimpleIntegrationTest.java      |   2 +-
 ...mcat8ServerWebAppFixtureIntegrationTest.java |   2 +-
 ...omcatServerWebAppFixtureIntegrationTest.java |   2 +-
 .../camp/brooklyn/ByonLocationsYamlTest.java    |   8 +-
 .../camp/brooklyn/LocationsYamlTest.java        |   2 +-
 .../org/apache/brooklyn/cli/CloudExplorer.java  |   4 +-
 .../java/org/apache/brooklyn/cli/CliTest.java   |   2 +-
 .../brooklyn/launcher/BrooklynLauncher.java     |   2 +-
 .../brooklyn/launcher/BrooklynWebServer.java    |   2 +-
 .../launcher/config/BrooklynGlobalConfig.java   |   2 +-
 .../qa/load/SimulatedJBoss7ServerImpl.java      |   2 +-
 .../brooklyn/qa/load/SimulatedTheeTierApp.java  |   2 +-
 .../ApplicationResourceIntegrationTest.java     |   2 +-
 .../rest/client/BrooklynApiRestClientTest.java  |   2 +-
 .../rest/resources/LocationResource.java        |   2 +-
 .../rest/transform/LocationTransformer.java     |   6 +-
 .../brooklyn/rest/util/EntityLocationUtils.java |   2 +-
 .../rest/resources/ApplicationResourceTest.java |   8 +-
 .../rest/resources/LocationResourceTest.java    |   2 +-
 .../rest/testing/BrooklynRestApiTest.java       |   2 +-
 .../rest/util/EntityLocationUtilsTest.java      |   6 +-
 403 files changed, 12331 insertions(+), 12322 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
index 951c183..a25bc73 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
@@ -39,10 +39,10 @@ import org.apache.brooklyn.api.location.LocationSpec;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
+import org.apache.brooklyn.core.location.BasicLocationRegistry;
 import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
 import org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContext;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.location.core.BasicLocationRegistry;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.flags.TypeCoercions;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 8e24fd0..ee4ad56 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -67,6 +67,7 @@ import org.apache.brooklyn.core.internal.BrooklynInitialization;
 import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
 import org.apache.brooklyn.core.internal.storage.Reference;
 import org.apache.brooklyn.core.internal.storage.impl.BasicReference;
+import org.apache.brooklyn.core.location.Locations;
 import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
 import org.apache.brooklyn.core.mgmt.internal.EntityManagementSupport;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
@@ -75,7 +76,6 @@ import org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport;
 import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
 import org.apache.brooklyn.core.objs.AbstractEntityAdjunct;
 import org.apache.brooklyn.core.objs.AbstractEntityAdjunct.AdjunctTagSupport;
-import org.apache.brooklyn.location.core.Locations;
 import org.apache.brooklyn.policy.core.AbstractPolicy;
 import org.apache.brooklyn.sensor.core.AttributeMap;
 import org.apache.brooklyn.sensor.core.AttributeSensorAndConfigKey;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
index 56393c2..e35205a 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/Entities.java
@@ -65,6 +65,8 @@ import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.core.entity.trait.Startable;
 import org.apache.brooklyn.core.entity.trait.StartableMethods;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.location.Locations;
+import org.apache.brooklyn.core.location.internal.LocationInternal;
 import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
 import org.apache.brooklyn.core.mgmt.internal.BrooklynShutdownHooks;
 import org.apache.brooklyn.core.mgmt.internal.EffectorUtils;
@@ -75,8 +77,6 @@ import org.apache.brooklyn.core.mgmt.internal.NonDeploymentManagementContext;
 import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
 import org.apache.brooklyn.core.objs.proxy.EntityProxyImpl;
 import org.apache.brooklyn.effector.core.Effectors;
-import org.apache.brooklyn.location.core.Locations;
-import org.apache.brooklyn.location.core.internal.LocationInternal;
 import org.apache.brooklyn.sensor.core.DependentConfiguration;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.ResourceUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
index 0e99f27..4469d24 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntitySuppliers.java
@@ -19,7 +19,7 @@
 package org.apache.brooklyn.core.entity;
 
 import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.location.core.Machines;
+import org.apache.brooklyn.core.location.Machines;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
 
 import com.google.common.base.Supplier;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java b/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
index e28be77..6dc825d 100644
--- a/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
+++ b/core/src/main/java/org/apache/brooklyn/core/internal/BrooklynInitialization.java
@@ -20,7 +20,7 @@ package org.apache.brooklyn.core.internal;
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.brooklyn.location.core.PortRanges;
+import org.apache.brooklyn.core.location.PortRanges;
 import org.apache.brooklyn.util.core.crypto.SecureKeys;
 import org.apache.brooklyn.util.core.flags.TypeCoercions;
 import org.apache.brooklyn.util.net.Networking;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
new file mode 100644
index 0000000..0b29126
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java
@@ -0,0 +1,709 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.location;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.brooklyn.util.GroovyJavaMethods.elvis;
+import static org.apache.brooklyn.util.JavaGroovyEquivalents.groovyTruth;
+
+import java.io.Closeable;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.mgmt.rebind.RebindSupport;
+import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento;
+import org.apache.brooklyn.api.objs.Configurable;
+import org.apache.brooklyn.config.ConfigInheritance;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
+import org.apache.brooklyn.core.BrooklynFeatureEnablement;
+import org.apache.brooklyn.core.config.BasicConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.internal.storage.BrooklynStorage;
+import org.apache.brooklyn.core.internal.storage.Reference;
+import org.apache.brooklyn.core.internal.storage.impl.BasicReference;
+import org.apache.brooklyn.core.location.geo.HasHostGeoInfo;
+import org.apache.brooklyn.core.location.geo.HostGeoInfo;
+import org.apache.brooklyn.core.location.internal.LocationDynamicType;
+import org.apache.brooklyn.core.location.internal.LocationInternal;
+import org.apache.brooklyn.core.mgmt.internal.LocalLocationManager;
+import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
+import org.apache.brooklyn.core.mgmt.rebind.BasicLocationRebindSupport;
+import org.apache.brooklyn.core.objs.AbstractBrooklynObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.brooklyn.util.collections.SetFromLiveMap;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.flags.FlagUtils;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.stream.Streams;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * A basic implementation of the {@link Location} interface.
+ *
+ * This provides an implementation which works according to the requirements of
+ * the interface documentation, and is ready to be extended to make more specialized locations.
+ * 
+ * Override {@link #configure(Map)} to add special initialization logic.
+ */
+public abstract class AbstractLocation extends AbstractBrooklynObject implements LocationInternal, HasHostGeoInfo, Configurable {
+    
+    private static final long serialVersionUID = -7495805474138619830L;
+
+    /** @deprecated since 0.7.0 shouldn't be public */
+    @Deprecated
+    public static final Logger LOG = LoggerFactory.getLogger(AbstractLocation.class);
+
+    public static final ConfigKey<Location> PARENT_LOCATION = new BasicConfigKey<Location>(Location.class, "parentLocation");
+
+    public static final ConfigKey<Boolean> TEMPORARY_LOCATION = ConfigKeys.newBooleanConfigKey("temporaryLocation",
+            "Indicates that the location is a temporary location that has been created to test connectivity, and that" +
+            "the location's events should not be recorded by usage listeners", false);
+
+    private final AtomicBoolean configured = new AtomicBoolean();
+    
+    private Reference<Long> creationTimeUtc = new BasicReference<Long>(System.currentTimeMillis());
+    
+    // _not_ set from flag; configured explicitly in configure, because we also need to update the parent's list of children
+    private Reference<Location> parent = new BasicReference<Location>();
+    
+    // NB: all accesses should be synchronized
+    private Set<Location> children = Sets.newLinkedHashSet();
+
+    private Reference<String> name = new BasicReference<String>();
+    private boolean displayNameAutoGenerated = true;
+
+    private Reference<HostGeoInfo> hostGeoInfo = new BasicReference<HostGeoInfo>();
+
+    private BasicConfigurationSupport config = new BasicConfigurationSupport();
+    
+    private ConfigBag configBag = new ConfigBag();
+
+    private volatile boolean managed;
+
+    private boolean inConstruction;
+
+    private Reference<Map<Class<?>, Object>> extensions = new BasicReference<Map<Class<?>, Object>>(Maps.<Class<?>, Object>newConcurrentMap());
+
+    private final LocationDynamicType locationType;
+
+    /**
+     * Construct a new instance of an AbstractLocation.
+     */
+    public AbstractLocation() {
+        this(Maps.newLinkedHashMap());
+    }
+    
+    /**
+     * Construct a new instance of an AbstractLocation.
+     *
+     * The properties map recognizes the following keys:
+     * <ul>
+     * <li>name - a name for the location
+     * <li>parentLocation - the parent {@link Location}
+     * </ul>
+     * 
+     * Other common properties (retrieved via get/findLocationProperty) include:
+     * <ul>
+     * <li>latitude
+     * <li>longitude
+     * <li>displayName
+     * <li>iso3166 - list of iso3166-2 code strings
+     * <li>timeZone
+     * <li>abbreviatedName
+     * </ul>
+     */
+    public AbstractLocation(Map<?,?> properties) {
+        super(properties);
+        inConstruction = true;
+        
+        // When one calls getConfig(key), we want to use the default value specified on *this* location
+        // if it overrides the default config, by using the type object 
+        locationType = new LocationDynamicType(this);
+        
+        if (isLegacyConstruction()) {
+            AbstractBrooklynObject checkWeGetThis = configure(properties);
+            assert this.equals(checkWeGetThis) : this+" configure method does not return itself; returns "+checkWeGetThis+" instead of "+this;
+
+            boolean deferConstructionChecks = (properties.containsKey("deferConstructionChecks") && TypeCoercions.coerce(properties.get("deferConstructionChecks"), Boolean.class));
+            if (!deferConstructionChecks) {
+                FlagUtils.checkRequiredFields(this);
+            }
+        }
+        
+        inConstruction = false;
+    }
+
+    protected void assertNotYetManaged() {
+        if (!inConstruction && Locations.isManaged(this)) {
+            LOG.warn("Configuration being made to {} after deployment; may not be supported in future versions", this);
+        }
+        //throw new IllegalStateException("Cannot set configuration "+key+" on active location "+this)
+    }
+
+    public void setManagementContext(ManagementContextInternal managementContext) {
+        super.setManagementContext(managementContext);
+        if (displayNameAutoGenerated && getId() != null) name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
+
+        if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_USE_BROOKLYN_LIVE_OBJECTS_DATAGRID_STORAGE)) {
+            Location oldParent = parent.get();
+            Set<Location> oldChildren = children;
+            Map<String, Object> oldConfig = configBag.getAllConfig();
+            Long oldCreationTimeUtc = creationTimeUtc.get();
+            String oldDisplayName = name.get();
+            HostGeoInfo oldHostGeoInfo = hostGeoInfo.get();
+
+            parent = managementContext.getStorage().getReference(getId()+"-parent");
+            children = SetFromLiveMap.create(managementContext.getStorage().<Location,Boolean>getMap(getId()+"-children"));
+            creationTimeUtc = managementContext.getStorage().getReference(getId()+"-creationTime");
+            hostGeoInfo = managementContext.getStorage().getReference(getId()+"-hostGeoInfo");
+            name = managementContext.getStorage().getReference(getId()+"-displayName");
+
+            // Only override stored defaults if we have actual values. We might be in setManagementContext
+            // because we are reconstituting an existing entity in a new brooklyn management-node (in which
+            // case believe what is already in the storage), or we might be in the middle of creating a new 
+            // entity. Normally for a new entity (using EntitySpec creation approach), this will get called
+            // before setting the parent etc. However, for backwards compatibility we still support some
+            // things calling the entity's constructor directly.
+            if (oldParent != null) parent.set(oldParent);
+            if (oldChildren.size() > 0) children.addAll(oldChildren);
+            if (creationTimeUtc.isNull()) creationTimeUtc.set(oldCreationTimeUtc);
+            if (hostGeoInfo.isNull()) hostGeoInfo.set(oldHostGeoInfo);
+            if (name.isNull()) {
+                name.set(oldDisplayName);
+            } else {
+                displayNameAutoGenerated = false;
+            }
+
+            configBag = ConfigBag.newLiveInstance(managementContext.getStorage().<String,Object>getMap(getId()+"-config"));
+            if (oldConfig.size() > 0) {
+                configBag.putAll(oldConfig);
+            }
+        }
+    }
+
+    /**
+     * @deprecated since 0.7.0; only used for legacy brooklyn types where constructor is called directly;
+     * see overridden method for more info
+     */
+    @SuppressWarnings("serial")
+    @Override
+    @Deprecated
+    public AbstractLocation configure(Map<?,?> properties) {
+        assertNotYetManaged();
+        
+        boolean firstTime = !configured.getAndSet(true);
+            
+        configBag.putAll(properties);
+        
+        if (properties.containsKey(PARENT_LOCATION.getName())) {
+            // need to ensure parent's list of children is also updated
+            setParent(configBag.get(PARENT_LOCATION));
+            
+            // don't include parentLocation in configBag, as breaks rebind
+            configBag.remove(PARENT_LOCATION);
+        }
+
+        // NB: flag-setting done here must also be done in BasicLocationRebindSupport 
+        FlagUtils.setFieldsFromFlagsWithBag(this, properties, configBag, firstTime);
+        FlagUtils.setAllConfigKeys(this, configBag, false);
+
+        if (properties.containsKey("displayName")) {
+            name.set((String) removeIfPossible(properties, "displayName"));
+            displayNameAutoGenerated = false;
+        } else if (properties.containsKey("name")) {
+            name.set((String) removeIfPossible(properties, "name"));
+            displayNameAutoGenerated = false;
+        } else if (isLegacyConstruction()) {
+            name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
+            displayNameAutoGenerated = true;
+        }
+
+        // TODO Explicitly dealing with iso3166 here because want custom splitter rule comma-separated string.
+        // Is there a better way to do it (e.g. more similar to latitude, where configKey+TypeCoercion is enough)?
+        if (groovyTruth(properties.get("iso3166"))) {
+            Object rawCodes = removeIfPossible(properties, "iso3166");
+            Set<String> codes;
+            if (rawCodes instanceof CharSequence) {
+                codes = ImmutableSet.copyOf(Splitter.on(",").trimResults().split((CharSequence)rawCodes));
+            } else {
+                codes = TypeCoercions.coerce(rawCodes, new TypeToken<Set<String>>() {});
+            }
+            configBag.put(LocationConfigKeys.ISO_3166, codes);
+        }
+        
+        return this;
+    }
+
+    // TODO ensure no callers rely on 'remove' semantics, and don't remove;
+    // or perhaps better use a config bag so we know what is used v unused
+    private static Object removeIfPossible(Map<?,?> map, Object key) {
+        try {
+            return map.remove(key);
+        } catch (Exception e) {
+            return map.get(key);
+        }
+    }
+    
+    public boolean isManaged() {
+        return getManagementContext() != null && managed;
+    }
+
+    public void onManagementStarted() {
+        if (displayNameAutoGenerated) name.set(getClass().getSimpleName()+":"+getId().substring(0, Math.min(getId().length(),4)));
+        this.managed = true;
+    }
+    
+    public void onManagementStopped() {
+        this.managed = false;
+        if (getManagementContext().isRunning()) {
+            BrooklynStorage storage = ((ManagementContextInternal)getManagementContext()).getStorage();
+            storage.remove(getId()+"-parent");
+            storage.remove(getId()+"-children");
+            storage.remove(getId()+"-creationTime");
+            storage.remove(getId()+"-hostGeoInfo");
+            storage.remove(getId()+"-displayName");
+            storage.remove(getId()+"-config");
+        }
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return name.get();
+    }
+    
+    protected boolean isDisplayNameAutoGenerated() {
+        return displayNameAutoGenerated;
+    }
+    
+    @Override
+    public Location getParent() {
+        return parent.get();
+    }
+    
+    @Override
+    public Collection<Location> getChildren() {
+        synchronized (children) {
+            return ImmutableList.copyOf(children);
+        }
+    }
+
+    @Override
+    public void setParent(Location newParent) {
+        setParent(newParent, true);
+    }
+    
+    public void setParent(Location newParent, boolean updateChildListParents) {
+        if (newParent == this) {
+            throw new IllegalArgumentException("Location cannot be its own parent: "+this);
+        }
+        if (newParent == parent.get()) {
+            return; // no-op; already have desired parent
+        }
+        
+        if (parent.get() != null) {
+            Location oldParent = parent.get();
+            parent.set(null);
+            if (updateChildListParents)
+                ((AbstractLocation)oldParent).removeChild(this);
+        }
+        // TODO Should we support a location changing parent? The resulting unmanage/manage might cause problems.
+        // The code above suggests we do, but maybe we should warn or throw error, or at least test it!
+        
+        parent.set(newParent);
+        if (newParent != null) {
+            if (updateChildListParents)
+                ((AbstractLocation)newParent).addChild(this);
+        }
+        
+        onChanged();
+    }
+
+    @Override
+    public ConfigurationSupportInternal config() {
+        return config ;
+    }
+
+    private class BasicConfigurationSupport implements ConfigurationSupportInternal {
+
+        @Override
+        public <T> T get(ConfigKey<T> key) {
+            if (hasConfig(key, false)) return getLocalBag().get(key);
+            if (getParent() != null && isInherited(key)) {
+                return getParent().getConfig(key);
+            }
+            
+            // In case this entity class has overridden the given key (e.g. to set default), then retrieve this entity's key
+            // TODO when locations become entities, the duplication of this compared to EntityConfigMap.getConfig will disappear.
+            @SuppressWarnings("unchecked")
+            ConfigKey<T> ownKey = (ConfigKey<T>) elvis(locationType.getConfigKey(key.getName()), key);
+
+            return ownKey.getDefaultValue();
+        }
+
+        @Override
+        public <T> T get(HasConfigKey<T> key) {
+            return get(key.getConfigKey());
+        }
+
+        @Override
+        public <T> T set(ConfigKey<T> key, T val) {
+            T result = configBag.put(key, val);
+            onChanged();
+            return result;
+        }
+
+        @Override
+        public <T> T set(HasConfigKey<T> key, T val) {
+            return set(key.getConfigKey(), val);
+        }
+
+        @Override
+        public <T> T set(ConfigKey<T> key, Task<T> val) {
+            // TODO Support for locations
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T set(HasConfigKey<T> key, Task<T> val) {
+            // TODO Support for locations
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public ConfigBag getBag() {
+            ConfigBag result = ConfigBag.newInstanceExtending(configBag, ImmutableMap.of());
+            Location p = getParent();
+            if (p!=null) result.putIfAbsent(((LocationInternal)p).config().getBag());
+            return result;
+        }
+
+        @Override
+        public ConfigBag getLocalBag() {
+            return configBag;
+        }
+
+        @Override
+        public Maybe<Object> getRaw(ConfigKey<?> key) {
+            if (hasConfig(key, false)) return Maybe.of(getLocalBag().getStringKey(key.getName()));
+            if (getParent() != null && isInherited(key)) return ((LocationInternal)getParent()).config().getRaw(key);
+            return Maybe.absent();
+        }
+
+        @Override
+        public Maybe<Object> getRaw(HasConfigKey<?> key) {
+            return getRaw(key.getConfigKey());
+        }
+
+        @Override
+        public Maybe<Object> getLocalRaw(ConfigKey<?> key) {
+            if (hasConfig(key, false)) return Maybe.of(getLocalBag().getStringKey(key.getName()));
+            return Maybe.absent();
+        }
+
+        @Override
+        public Maybe<Object> getLocalRaw(HasConfigKey<?> key) {
+            return getLocalRaw(key.getConfigKey());
+        }
+
+        @Override
+        public void addToLocalBag(Map<String, ?> vals) {
+            configBag.putAll(vals);
+        }
+
+        @Override
+        public void removeFromLocalBag(String key) {
+            configBag.remove(key);
+        }
+
+        @Override
+        public void refreshInheritedConfig() {
+            // no-op for location
+        }
+        
+        @Override
+        public void refreshInheritedConfigOfChildren() {
+            // no-op for location
+        }
+        
+        private boolean hasConfig(ConfigKey<?> key, boolean includeInherited) {
+            if (includeInherited && isInherited(key)) {
+                return getBag().containsKey(key);
+            } else {
+                return getLocalBag().containsKey(key);
+            }
+        }
+        
+        private boolean isInherited(ConfigKey<?> key) {
+            ConfigInheritance inheritance = key.getInheritance();
+            if (inheritance==null) inheritance = getDefaultInheritance();
+            return inheritance.isInherited(key, getParent(), AbstractLocation.this);
+        }
+
+        private ConfigInheritance getDefaultInheritance() {
+            return ConfigInheritance.ALWAYS;
+        }
+    }
+    
+    @Override
+    public <T> T getConfig(HasConfigKey<T> key) {
+        return config().get(key);
+    }
+
+    @Override
+    public <T> T getConfig(ConfigKey<T> key) {
+        return config().get(key);
+    }
+
+    @Override
+    @Deprecated
+    public boolean hasConfig(ConfigKey<?> key, boolean includeInherited) {
+        return config.hasConfig(key, includeInherited);
+    }
+
+    @Override
+    @Deprecated
+    public Map<String,Object> getAllConfig(boolean includeInherited) {
+        // TODO Have no information about what to include/exclude inheritance wise.
+        // however few things use getAllConfigBag()
+        ConfigBag bag = (includeInherited ? config().getBag() : config().getLocalBag());
+        return bag.getAllConfig();
+    }
+    
+    @Override
+    @Deprecated
+    public ConfigBag getAllConfigBag() {
+        // TODO see comments in EntityConfigMap and on interface methods. 
+        // here ConfigBag is used exclusively so
+        // we have no information about what to include/exclude inheritance wise.
+        // however few things use getAllConfigBag()
+        return config().getBag();
+    }
+    
+    @Override
+    public ConfigBag getLocalConfigBag() {
+        return config().getLocalBag();
+    }
+
+    /** 
+     * @deprecated since 0.7; use {@link #getLocalConfigBag()}
+     * @since 0.6
+     */
+    @Deprecated
+    public ConfigBag getRawLocalConfigBag() {
+        return config().getLocalBag();
+    }
+    
+    @Override
+    @Deprecated
+    public <T> T setConfig(ConfigKey<T> key, T value) {
+        return config().set(key, value);
+    }
+
+    /**
+     * @since 0.6.0 (?) - use getDisplayName
+     * @deprecated since 0.7.0; use {@link #getDisplayName()}
+     */
+    @Deprecated
+    public void setName(String newName) {
+        setDisplayName(newName);
+    }
+
+    public void setDisplayName(String newName) {
+        name.set(newName);
+        displayNameAutoGenerated = false;
+        onChanged();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (! (o instanceof Location)) {
+            return false;
+        }
+
+        Location l = (Location) o;
+        return getId().equals(l.getId());
+    }
+
+    @Override
+    public int hashCode() {
+        return getId().hashCode();
+    }
+
+    @Override
+    public boolean containsLocation(Location potentialDescendent) {
+        Location loc = potentialDescendent;
+        while (loc != null) {
+            if (this == loc) return true;
+            loc = loc.getParent();
+        }
+        return false;
+    }
+
+    protected <T extends Location> T addChild(LocationSpec<T> spec) {
+        T child = getManagementContext().getLocationManager().createLocation(spec);
+        addChild(child);
+        return child;
+    }
+    
+    @SuppressWarnings("deprecation")
+    public void addChild(Location child) {
+        // Previously, setParent delegated to addChildLocation and we sometimes ended up with
+        // duplicate entries here. Instead this now uses a similar scheme to 
+        // AbstractLocation.setParent/addChild (with any weaknesses for distribution that such a 
+        // scheme might have...).
+        // 
+        // We continue to use a list to allow identical-looking locations, but they must be different 
+        // instances.
+        
+        synchronized (children) {
+            for (Location contender : children) {
+                if (contender == child) {
+                    // don't re-add; no-op
+                    return;
+                }
+            }
+
+            children.add(child);
+        }
+        
+        if (isManaged()) {
+            if (!getManagementContext().getLocationManager().isManaged(child)) {
+                Locations.manage(child, getManagementContext());
+            }
+        } else if (getManagementContext() != null) {
+            if (((LocalLocationManager)getManagementContext().getLocationManager()).getLocationEvenIfPreManaged(child.getId()) == null) {
+                ((ManagementContextInternal)getManagementContext()).prePreManage(child);
+            }
+        }
+
+        children.add(child);
+        child.setParent(this);
+        
+        onChanged();
+    }
+    
+    public boolean removeChild(Location child) {
+        boolean removed;
+        synchronized (children) {
+            removed = children.remove(child);
+        }
+        if (removed) {
+            if (child instanceof Closeable) {
+                Streams.closeQuietly((Closeable)child);
+            }
+            child.setParent(null);
+            
+            if (isManaged()) {
+                getManagementContext().getLocationManager().unmanage(child);
+            }
+        }
+        onChanged();
+        return removed;
+    }
+
+    protected void onChanged() {
+        // currently changes simply trigger re-persistence; there is no intermediate listener as we do for EntityChangeListener
+        if (isManaged()) {
+            getManagementContext().getRebindManager().getChangeListener().onChanged(this);
+        }
+    }
+
+    /** Default String representation is simplified name of class, together with selected fields. */
+    @Override
+    public String toString() {
+        return string().toString();
+    }
+    
+    @Override
+    public String toVerboseString() {
+        return toString();
+    }
+
+    /** override this, adding to the returned value, to supply additional fields to include in the toString */
+    protected ToStringHelper string() {
+        return Objects.toStringHelper(getClass()).add("id", getId()).add("name", name);
+    }
+    
+    @Override
+    public HostGeoInfo getHostGeoInfo() { return hostGeoInfo.get(); }
+    
+    public void setHostGeoInfo(HostGeoInfo hostGeoInfo) {
+        if (hostGeoInfo!=null) { 
+            this.hostGeoInfo.set(hostGeoInfo);
+            setConfig(LocationConfigKeys.LATITUDE, hostGeoInfo.latitude); 
+            setConfig(LocationConfigKeys.LONGITUDE, hostGeoInfo.longitude); 
+        } 
+    }
+
+    @Override
+    public RebindSupport<LocationMemento> getRebindSupport() {
+        return new BasicLocationRebindSupport(this);
+    }
+    
+    @Override
+    public boolean hasExtension(Class<?> extensionType) {
+        return extensions.get().containsKey(checkNotNull(extensionType, "extensionType"));
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> T getExtension(Class<T> extensionType) {
+        Object extension = extensions.get().get(checkNotNull(extensionType, "extensionType"));
+        if (extension == null) {
+            throw new IllegalArgumentException("No extension of type "+extensionType+" registered for location "+this);
+        }
+        return (T) extension;
+    }
+    
+    @Override
+    public <T> void addExtension(Class<T> extensionType, T extension) {
+        checkNotNull(extensionType, "extensionType");
+        checkNotNull(extension, "extension");
+        checkArgument(extensionType.isInstance(extension), "extension %s does not implement %s", extension, extensionType);
+        extensions.get().put(extensionType, extension);
+    }
+
+    @Override
+    public Map<String, String> toMetadataRecord() {
+        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
+        if (getDisplayName() != null) builder.put("displayName", getDisplayName());
+        if (getParent() != null && getParent().getDisplayName() != null) {
+            builder.put("parentDisplayName", getParent().getDisplayName());
+        }
+        return builder.build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java
new file mode 100644
index 0000000..766021e
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocationResolver.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationRegistry;
+import org.apache.brooklyn.api.location.LocationResolver;
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.core.location.internal.LocationInternal;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.text.KeyValueParser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Examples of valid specs:
+ *   <ul>
+ *     <li>byon(hosts=myhost)
+ *     <li>byon(hosts=myhost,myhost2)
+ *     <li>byon(hosts="myhost, myhost2")
+ *     <li>byon(hosts=myhost,myhost2, name=abc)
+ *     <li>byon(hosts="myhost, myhost2", name="my location name")
+ *   </ul>
+ * 
+ * @author aled
+ */
+@SuppressWarnings({"unchecked","rawtypes"})
+public abstract class AbstractLocationResolver implements LocationResolver {
+
+    public static final Logger log = LoggerFactory.getLogger(AbstractLocationResolver.class);
+    
+    protected volatile ManagementContext managementContext;
+
+    protected volatile SpecParser specParser;
+
+    protected abstract Class<? extends Location> getLocationType();
+    
+    protected abstract SpecParser getSpecParser();
+    
+    @Override
+    public void init(ManagementContext managementContext) {
+        this.managementContext = checkNotNull(managementContext, "managementContext");
+        this.specParser = getSpecParser();
+    }
+    
+    @Override
+    public boolean accepts(String spec, LocationRegistry registry) {
+        return BasicLocationRegistry.isResolverPrefixForSpec(this, spec, true);
+    }
+
+    @Override
+    public Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry) {
+        ConfigBag config = extractConfig(locationFlags, spec, registry);
+        Map globalProperties = registry.getProperties();
+        String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
+        
+        if (registry != null) {
+            LocationPropertiesFromBrooklynProperties.setLocalTempDir(globalProperties, config);
+        }
+
+        return managementContext.getLocationManager().createLocation(LocationSpec.create(getLocationType())
+            .configure(config.getAllConfig())
+            .configure(LocationConfigUtils.finalAndOriginalSpecs(spec, locationFlags, globalProperties, namedLocation)));
+    }
+
+    protected ConfigBag extractConfig(Map<?,?> locationFlags, String spec, LocationRegistry registry) {
+        Map globalProperties = registry.getProperties();
+        ParsedSpec parsedSpec = specParser.parse(spec);
+        String namedLocation = (String) locationFlags.get(LocationInternal.NAMED_SPEC_NAME.getName());
+        
+        // prefer args map over location flags
+        Map<String, Object> filteredProperties = getFilteredLocationProperties(getPrefix(), namedLocation, globalProperties);
+        ConfigBag flags = ConfigBag.newInstance(parsedSpec.argsMap).putIfAbsent(locationFlags).putIfAbsent(filteredProperties);
+
+        return flags;
+    }
+    
+    protected Map<String, Object> getFilteredLocationProperties(String provider, String namedLocation, Map<String, ?> globalProperties) {
+        return new LocationPropertiesFromBrooklynProperties().getLocationProperties(getPrefix(), namedLocation, globalProperties);
+    }
+    
+    protected static class ParsedSpec {
+        public final String spec;
+        public final List<String> partsList;
+        public final Map<String,String> argsMap;
+        
+        ParsedSpec(String spec, List<String> partsList, Map<String,String> argsMap) {
+            this.spec = spec;
+            this.partsList = ImmutableList.copyOf(partsList);
+            this.argsMap = Collections.unmodifiableMap(MutableMap.copyOf(argsMap));
+        }
+    }
+    
+    /**
+     * Parses a spec, by default of the general form "prefix:parts1:part2(arg1=val1,arg2=val2)"
+     */
+    protected static class SpecParser {
+        
+        protected final String prefix;
+        protected final Pattern pattern;
+        private String exampleUsage;
+        
+        public SpecParser(String prefix) {
+            this.prefix = prefix;
+            pattern = Pattern.compile("("+prefix+"|"+prefix.toLowerCase()+"|"+prefix.toUpperCase()+")" + "(:)?" + "(\\((.*)\\))?$");
+        }
+        
+        public SpecParser(String prefix, Pattern pattern) {
+            this.prefix = prefix;
+            this.pattern = pattern;
+        }
+        
+        public SpecParser setExampleUsage(String exampleUsage) {
+            this.exampleUsage = exampleUsage;
+            return this;
+        }
+
+        protected String getUsage(String spec) {
+            if (exampleUsage == null) {
+                return "Spec should be in the form "+pattern;
+            } else {
+                return "for example, "+exampleUsage;
+            }
+        }
+        
+        protected void checkParsedSpec(ParsedSpec parsedSpec) {
+            // If someone tries "byon:(),byon:()" as a single spec, we get weird key-values!
+            for (String key : parsedSpec.argsMap.keySet()) {
+                if (key.contains(":") || key.contains("{") || key.contains("}") || key.contains("(") || key.contains(")")) {
+                    throw new IllegalArgumentException("Invalid byon spec: "+parsedSpec.spec+" (key="+key+")");
+                }
+            }
+            String name = parsedSpec.argsMap.get("name");
+            if (parsedSpec.argsMap.containsKey("name") && (name == null || name.isEmpty())) {
+                throw new IllegalArgumentException("Invalid location '"+parsedSpec.spec+"'; if name supplied then value must be non-empty");
+            }
+            String displayName = parsedSpec.argsMap.get("displayName");
+            if (parsedSpec.argsMap.containsKey("displayName") && (displayName == null || displayName.isEmpty())) {
+                throw new IllegalArgumentException("Invalid location '"+parsedSpec.spec+"'; if displayName supplied then value must be non-empty");
+            }
+        }
+        
+        public ParsedSpec parse(String spec) {
+            Matcher matcher = pattern.matcher(spec);
+            if (!matcher.matches()) {
+                throw new IllegalArgumentException("Invalid location '"+spec+"'; "+getUsage(spec));
+            }
+            
+            String argsPart = matcher.group(3);
+            if (argsPart != null && argsPart.startsWith("(") && argsPart.endsWith(")")) {
+                // TODO Hacky; hosts("1.1.1.1") returns argsPart=("1.1.1.1")
+                argsPart = argsPart.substring(1, argsPart.length()-1);
+            }
+            Map<String, String> argsMap = KeyValueParser.parseMap(argsPart);
+            ParsedSpec result = new ParsedSpec(spec, ImmutableList.<String>of(), argsMap);
+            checkParsedSpec(result);
+            return result;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java b/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
new file mode 100644
index 0000000..c8e7a6e
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/location/AggregatingMachineProvisioningLocation.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.location;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import java.io.Closeable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.location.MachineLocation;
+import org.apache.brooklyn.api.location.MachineProvisioningLocation;
+import org.apache.brooklyn.api.location.NoMachinesAvailableException;
+import org.apache.brooklyn.util.core.flags.SetFromFlag;
+import org.apache.brooklyn.util.stream.Streams;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Takes a list of other provisioners, and round-robins across them when obtaining a machine.
+ */
+public class AggregatingMachineProvisioningLocation<T extends MachineLocation> extends AbstractLocation 
+        implements MachineProvisioningLocation<T>, Closeable {
+
+    private static final long serialVersionUID = -8818006672883481775L;
+
+    private Object lock;
+    
+    @SetFromFlag
+    protected List<MachineProvisioningLocation<T>> provisioners;
+    
+    @SetFromFlag
+    protected Map<T, MachineProvisioningLocation<T>> inUse;
+
+    protected final AtomicInteger obtainCounter = new AtomicInteger();
+    
+    public AggregatingMachineProvisioningLocation() {
+        this(Maps.newLinkedHashMap());
+    }
+    
+    public AggregatingMachineProvisioningLocation(Map properties) {
+        super(properties);
+
+        if (isLegacyConstruction()) {
+            init();
+        }
+    }
+
+    @Override
+    public void init() {
+        super.init();
+    }
+    
+    @Override
+    public String toVerboseString() {
+        return Objects.toStringHelper(this).omitNullValues()
+                .add("id", getId()).add("name", getDisplayName())
+                .add("provisioners", provisioners)
+                .toString();
+    }
+
+    @Override
+    public AbstractLocation configure(Map<?,?> properties) {
+        if (lock == null) {
+            lock = new Object();
+            provisioners = Lists.<MachineProvisioningLocation<T>>newArrayList();
+            inUse = Maps.<T, MachineProvisioningLocation<T>>newLinkedHashMap();
+        }
+        return super.configure(properties);
+    }
+    
+    @Override
+    public AggregatingMachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void close() {
+        for (MachineProvisioningLocation<?> provisioner : provisioners) {
+            if (provisioner instanceof Closeable) {
+                Streams.closeQuietly((Closeable)provisioner);
+            }
+        }
+    }
+    
+    public T obtain() throws NoMachinesAvailableException {
+        return obtain(Maps.<String,Object>newLinkedHashMap());
+    }
+    
+    @Override
+    public T obtain(Map<?,?> flags) throws NoMachinesAvailableException {
+        checkState(provisioners.size() > 0, "no provisioners!");
+        int index = obtainCounter.getAndIncrement();
+        for (int i = 0; i < provisioners.size(); i++) {
+            MachineProvisioningLocation<T> provisioner = provisioners.get(index++ % provisioners.size());
+            try {
+                T machine = provisioner.obtain(flags);
+                inUse.put(machine, provisioner);
+                return machine;
+            } catch (NoMachinesAvailableException e) {
+                // move on; try next
+            }
+        }
+        throw new NoMachinesAvailableException("No machines available in "+toString());
+    }
+
+    @Override
+    public void release(T machine) {
+        MachineProvisioningLocation<T> provisioner = inUse.remove(machine);
+        if (provisioner != null) {
+            provisioner.release(machine);
+        } else {
+            throw new IllegalStateException("Request to release machine "+machine+", but this machine is not currently allocated");
+        }
+    }
+
+    @Override
+    public Map<String,Object> getProvisioningFlags(Collection<String> tags) {
+        return Maps.<String,Object>newLinkedHashMap();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java b/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java
new file mode 100644
index 0000000..f666268
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/location/BasicHardwareDetails.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.location;
+
+import javax.annotation.concurrent.Immutable;
+
+import com.google.common.base.Objects;
+
+import org.apache.brooklyn.api.location.HardwareDetails;
+
+@Immutable
+public class BasicHardwareDetails implements HardwareDetails {
+
+    private final Integer cpuCount;
+    private final Integer ram;
+
+    public BasicHardwareDetails(Integer cpuCount, Integer ram) {
+        this.cpuCount = cpuCount;
+        this.ram = ram;
+    }
+
+    @Override
+    public Integer getCpuCount() {
+        return cpuCount;
+    }
+
+    @Override
+    public Integer getRam() {
+        return ram;
+    }
+
+    @Override
+    public String toString() {
+        return Objects.toStringHelper(HardwareDetails.class)
+                .omitNullValues()
+                .add("cpuCount", cpuCount)
+                .add("ram", ram)
+                .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/538324e1/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java b/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
new file mode 100644
index 0000000..508a417
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/location/BasicLocationDefinition.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.location.LocationDefinition;
+import org.apache.brooklyn.util.text.Identifiers;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+
+public class BasicLocationDefinition implements LocationDefinition {
+
+    private final String id;
+    private final String name;
+    private final String spec;
+    private final Map<String,Object> config;
+
+    public BasicLocationDefinition(String name, String spec, Map<String,? extends Object> config) {
+        this(Identifiers.makeRandomId(8), name, spec, config);
+    }
+    
+    public BasicLocationDefinition(String id, String name, String spec, Map<String,? extends Object> config) {      
+        this.id = Preconditions.checkNotNull(id);
+        this.name = name;
+        this.spec = Preconditions.checkNotNull(spec);
+        this.config = config==null ? ImmutableMap.<String, Object>of() : ImmutableMap.<String, Object>copyOf(config);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public String getSpec() {
+        return spec;
+    }
+    
+    @Override
+    public Map<String, Object> getConfig() {
+        return config;
+    }
+    
+    @Override
+    public boolean equals(Object o) {
+        if (this==o) return true;
+        if ((o instanceof LocationDefinition) && id.equals(((LocationDefinition)o).getId())) return true;
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return id.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return "LocationDefinition{" +
+                "id='" + getId() + '\'' +
+                ", name='" + getName() + '\'' +
+                ", spec='" + getSpec() + '\'' +
+                ", config=" + getConfig() +
+                '}';
+    }
+}


Mime
View raw message