You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/08/14 05:43:23 UTC
[54/54] incubator-brooklyn git commit: [BROOKLYN-162] Move
./api/location to the right package
[BROOKLYN-162] Move ./api/location to the right package
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d32d672a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d32d672a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d32d672a
Branch: refs/heads/master
Commit: d32d672ad66cda00adc92053e262595e6d00ace3
Parents: e2c5705
Author: Hadrian Zbarcea <ha...@apache.org>
Authored: Thu Aug 13 23:18:00 2015 -0400
Committer: Hadrian Zbarcea <ha...@apache.org>
Committed: Thu Aug 13 23:18:00 2015 -0400
----------------------------------------------------------------------
.../org/apache/brooklyn/api/entity/Entity.java | 2 +-
.../api/entity/drivers/EntityDriver.java | 3 +-
.../api/entity/drivers/EntityDriverManager.java | 2 +-
.../api/entity/proxying/EntitySpec.java | 2 +-
.../api/entity/proxying/EntityTypeRegistry.java | 3 +-
.../api/entity/rebind/BrooklynObjectType.java | 3 +-
.../entity/rebind/RebindExceptionHandler.java | 3 +-
.../api/location/AddressableLocation.java | 43 ++++
.../BasicMachineLocationCustomizer.java | 41 ++++
.../brooklyn/api/location/HardwareDetails.java | 40 ++++
.../apache/brooklyn/api/location/Location.java | 146 ++++++++++++
.../api/location/LocationDefinition.java | 42 ++++
.../location/LocationNotAvailableException.java | 35 +++
.../brooklyn/api/location/LocationRegistry.java | 128 +++++++++++
.../brooklyn/api/location/LocationResolver.java | 57 +++++
.../brooklyn/api/location/LocationSpec.java | 229 +++++++++++++++++++
.../brooklyn/api/location/LocationType.java | 32 +++
.../brooklyn/api/location/MachineDetails.java | 34 +++
.../brooklyn/api/location/MachineLocation.java | 46 ++++
.../api/location/MachineLocationCustomizer.java | 42 ++++
.../api/location/MachineManagementMixins.java | 92 ++++++++
.../location/MachineProvisioningLocation.java | 72 ++++++
.../location/NoMachinesAvailableException.java | 35 +++
.../apache/brooklyn/api/location/OsDetails.java | 46 ++++
.../apache/brooklyn/api/location/PortRange.java | 48 ++++
.../brooklyn/api/location/PortSupplier.java | 50 ++++
.../api/location/ProvisioningLocation.java | 44 ++++
.../api/management/AccessController.java | 3 +-
.../api/management/LocationManager.java | 4 +-
.../api/management/ManagementContext.java | 2 +-
.../brooklyn/location/AddressableLocation.java | 43 ----
.../BasicMachineLocationCustomizer.java | 41 ----
.../brooklyn/location/HardwareDetails.java | 40 ----
.../org/apache/brooklyn/location/Location.java | 146 ------------
.../brooklyn/location/LocationDefinition.java | 42 ----
.../location/LocationNotAvailableException.java | 35 ---
.../brooklyn/location/LocationRegistry.java | 128 -----------
.../brooklyn/location/LocationResolver.java | 57 -----
.../apache/brooklyn/location/LocationSpec.java | 229 -------------------
.../apache/brooklyn/location/LocationType.java | 32 ---
.../brooklyn/location/MachineDetails.java | 34 ---
.../brooklyn/location/MachineLocation.java | 46 ----
.../location/MachineLocationCustomizer.java | 42 ----
.../location/MachineManagementMixins.java | 92 --------
.../location/MachineProvisioningLocation.java | 72 ------
.../location/NoMachinesAvailableException.java | 35 ---
.../org/apache/brooklyn/location/OsDetails.java | 46 ----
.../org/apache/brooklyn/location/PortRange.java | 48 ----
.../apache/brooklyn/location/PortSupplier.java | 50 ----
.../brooklyn/location/ProvisioningLocation.java | 44 ----
.../mementos/BrooklynMementoPersister.java | 2 +-
.../main/java/brooklyn/basic/BrooklynTypes.java | 2 +-
.../brooklyn/catalog/CatalogPredicates.java | 4 +-
.../catalog/internal/BasicBrooklynCatalog.java | 6 +-
.../catalog/internal/CatalogClasspathDo.java | 2 +-
.../internal/CatalogLocationItemDto.java | 4 +-
.../entity/basic/AbstractApplication.java | 2 +-
.../brooklyn/entity/basic/AbstractEntity.java | 4 +-
.../brooklyn/entity/basic/BasicStartable.java | 3 +-
.../entity/basic/BasicStartableImpl.java | 2 +-
.../entity/basic/BrooklynConfigKeys.java | 4 +-
.../brooklyn/entity/basic/DataEntityImpl.java | 2 +-
.../entity/basic/EffectorStartableImpl.java | 4 +-
.../java/brooklyn/entity/basic/Entities.java | 6 +-
.../entity/basic/EntityFactoryForLocation.java | 3 +-
.../brooklyn/entity/basic/EntityFunctions.java | 2 +-
.../brooklyn/entity/basic/EntityInternal.java | 2 +-
.../brooklyn/entity/basic/EntityPredicates.java | 2 +-
.../basic/EntityTransientCopyInternal.java | 2 +-
.../java/brooklyn/entity/basic/Lifecycle.java | 3 +-
.../drivers/BasicEntityDriverManager.java | 3 +-
.../drivers/ReflectiveEntityDriverFactory.java | 4 +-
.../drivers/RegistryEntityDriverFactory.java | 3 +-
.../brooklyn/entity/group/DynamicCluster.java | 2 +-
.../entity/group/DynamicClusterImpl.java | 6 +-
.../entity/group/DynamicFabricImpl.java | 2 +-
.../entity/group/DynamicRegionsFabricImpl.java | 2 +-
.../zoneaware/AbstractZoneFailureDetector.java | 2 +-
.../BalancingNodePlacementStrategy.java | 2 +-
.../zoneaware/CombiningZoneFailureDetector.java | 2 +-
.../CriticalCauseZoneFailureDetector.java | 3 +-
.../ProportionalZoneFailureDetector.java | 3 +-
.../proxying/InternalLocationFactory.java | 6 +-
.../entity/rebind/BasicEntityRebindSupport.java | 2 +-
.../rebind/BasicLocationRebindSupport.java | 4 +-
.../rebind/ImmediateDeltaChangeListener.java | 3 +-
.../rebind/PeriodicDeltaChangeListener.java | 2 +-
.../entity/rebind/RebindContextImpl.java | 2 +-
.../rebind/RebindContextLookupContext.java | 2 +-
.../rebind/RebindExceptionHandlerImpl.java | 2 +-
.../brooklyn/entity/rebind/RebindIteration.java | 4 +-
.../java/brooklyn/entity/rebind/TreeUtils.java | 2 +-
.../entity/rebind/dto/MementosGenerators.java | 4 +-
.../persister/BrooklynPersistenceUtils.java | 6 +-
.../rebind/persister/XmlMementoSerializer.java | 2 +-
.../java/brooklyn/entity/trait/Startable.java | 2 +-
.../brooklyn/entity/trait/StartableMethods.java | 2 +-
.../basic/PortAttributeSensorAndConfigKey.java | 10 +-
.../ha/HighAvailabilityManagerImpl.java | 2 +-
.../internal/AbstractManagementContext.java | 4 +-
.../internal/BrooklynGarbageCollector.java | 2 +-
.../management/internal/LocalAccessManager.java | 3 +-
.../internal/LocalLocationManager.java | 8 +-
.../internal/LocalManagementContext.java | 2 +-
.../management/internal/LocalUsageManager.java | 4 +-
.../internal/LocationManagerInternal.java | 3 +-
.../internal/ManagementContextInternal.java | 2 +-
.../internal/NonDeploymentLocationManager.java | 5 +-
.../NonDeploymentManagementContext.java | 4 +-
.../internal/NonDeploymentUsageManager.java | 2 +-
.../management/internal/UsageListener.java | 2 +-
.../management/internal/UsageManager.java | 2 +-
.../java/brooklyn/util/task/ssh/SshTasks.java | 4 +-
.../brooklyn/util/text/TemplateProcessor.java | 2 +-
.../location/access/BrooklynAccessUtils.java | 6 +-
.../location/access/PortForwardManager.java | 4 +-
.../access/PortForwardManagerClient.java | 2 +-
.../location/access/PortForwardManagerImpl.java | 2 +-
.../PortForwardManagerLocationResolver.java | 8 +-
.../brooklyn/location/access/PortMapping.java | 2 +-
.../location/basic/AbstractLocation.java | 6 +-
.../basic/AbstractLocationResolver.java | 10 +-
.../AggregatingMachineProvisioningLocation.java | 7 +-
.../location/basic/BasicHardwareDetails.java | 2 +-
.../location/basic/BasicLocationDefinition.java | 3 +-
.../location/basic/BasicLocationRegistry.java | 10 +-
.../location/basic/BasicMachineDetails.java | 6 +-
.../location/basic/BasicMachineMetadata.java | 3 +-
.../brooklyn/location/basic/BasicOsDetails.java | 3 +-
.../location/basic/ByonLocationResolver.java | 8 +-
.../location/basic/CatalogLocationResolver.java | 8 +-
.../basic/DefinedLocationByIdResolver.java | 8 +-
.../FixedListMachineProvisioningLocation.java | 14 +-
.../location/basic/HostLocationResolver.java | 7 +-
.../basic/LocalhostLocationResolver.java | 7 +-
.../LocalhostMachineProvisioningLocation.java | 10 +-
.../location/basic/LocationDynamicType.java | 5 +-
.../location/basic/LocationInternal.java | 2 +-
.../location/basic/LocationPredicates.java | 3 +-
.../brooklyn/location/basic/Locations.java | 6 +-
.../brooklyn/location/basic/Machines.java | 6 +-
.../brooklyn/location/basic/MultiLocation.java | 10 +-
.../location/basic/MultiLocationResolver.java | 8 +-
.../location/basic/NamedLocationResolver.java | 8 +-
.../brooklyn/location/basic/PortRanges.java | 3 +-
.../basic/RegistryLocationResolver.java | 6 +-
.../basic/SingleMachineLocationResolver.java | 7 +-
.../SingleMachineProvisioningLocation.java | 6 +-
.../location/basic/SshMachineLocation.java | 12 +-
.../location/basic/WinRmMachineLocation.java | 8 +-
.../AbstractAvailabilityZoneExtension.java | 3 +-
...bstractCloudMachineProvisioningLocation.java | 7 +-
.../cloud/AvailabilityZoneExtension.java | 3 +-
.../location/cloud/CloudLocationConfig.java | 4 +-
.../location/cloud/names/CloudMachineNamer.java | 4 +-
.../location/dynamic/DynamicLocation.java | 2 +-
.../location/dynamic/LocationOwner.java | 4 +-
.../brooklyn/location/geo/HostGeoInfo.java | 4 +-
.../brooklyn/location/paas/PaasLocation.java | 2 +-
...pache.brooklyn.api.location.LocationResolver | 27 +++
...rg.apache.brooklyn.location.LocationResolver | 9 -
.../enricher/CustomAggregatingEnricherTest.java | 4 +-
.../brooklyn/entity/EffectorMetadataTest.java | 2 +-
.../java/brooklyn/entity/SetFromFlagTest.java | 4 +-
.../basic/AbstractApplicationLegacyTest.java | 3 +-
.../entity/basic/BasicStartableTest.java | 5 +-
.../brooklyn/entity/basic/DataEntityTest.java | 4 +-
.../brooklyn/entity/basic/EntitiesTest.java | 4 +-
.../entity/basic/EntityFunctionsTest.java | 2 +-
.../entity/basic/EntityLocationsTest.java | 2 +-
.../entity/basic/EntityPredicatesTest.java | 2 +-
.../entity/basic/EntitySuppliersTest.java | 5 +-
.../entity/basic/ServiceStateLogicTest.java | 2 +-
.../ReflectiveEntityDriverFactoryTest.java | 4 +-
.../RegistryEntityDriverFactoryTest.java | 4 +-
.../downloads/BasicDownloadsRegistryTest.java | 4 +-
.../DownloadProducerFromLocalRepoTest.java | 4 +-
.../DownloadProducerFromPropertiesTest.java | 4 +-
.../downloads/DownloadSubstitutersTest.java | 3 +-
.../drivers/downloads/MyEntityDriver.java | 3 +-
.../entity/group/DynamicClusterTest.java | 4 +-
...DynamicClusterWithAvailabilityZonesTest.java | 6 +-
.../entity/group/DynamicFabricTest.java | 4 +-
.../entity/group/DynamicRegionsFabricTest.java | 4 +-
.../java/brooklyn/entity/group/GroupTest.java | 4 +-
.../group/MembershipTrackingPolicyTest.java | 4 +-
.../entity/group/QuarantineGroupTest.java | 3 +-
.../BalancingNodePlacementStrategyTest.java | 6 +-
.../ProportionalZoneFailureDetectorTest.java | 4 +-
.../entity/rebind/RebindEnricherTest.java | 4 +-
.../entity/rebind/RebindEntityTest.java | 6 +-
.../brooklyn/entity/rebind/RebindFeedTest.java | 4 +-
.../rebind/RebindLocalhostLocationTest.java | 3 +-
.../entity/rebind/RebindLocationTest.java | 6 +-
.../entity/rebind/RebindPolicyTest.java | 4 +-
.../rebind/RebindSshMachineLocationTest.java | 3 +-
.../brooklyn/entity/rebind/RebindTestUtils.java | 2 +-
.../rebind/RecordingRebindExceptionHandler.java | 3 +-
.../BrooklynMementoPersisterTestFixture.java | 6 +-
.../persister/XmlMementoSerializerTest.java | 4 +-
.../entity/trait/FailingEntityImpl.java | 2 +-
.../event/feed/function/FunctionFeedTest.java | 4 +-
.../feed/http/HttpFeedIntegrationTest.java | 4 +-
.../brooklyn/event/feed/http/HttpFeedTest.java | 2 +-
.../WindowsPerformanceCounterFeedLiveTest.java | 6 +-
.../WindowsPerformanceCounterFeedTest.java | 4 +-
.../AcmeEntitlementManagerTestFixture.java | 2 +-
.../entitlement/EntityEntitlementTest.java | 2 +-
.../ha/HighAvailabilityManagerInMemoryTest.java | 6 +-
.../HighAvailabilityManagerSplitBrainTest.java | 2 +-
.../brooklyn/management/ha/HotStandbyTest.java | 6 +-
.../brooklyn/management/ha/WarmStandbyTest.java | 2 +-
.../management/internal/AccessManagerTest.java | 6 +-
.../internal/LocalManagementContextTest.java | 2 +-
.../longevity/EntityCleanupLongevityTest.java | 4 +-
.../EntityCleanupLongevityTestFixture.java | 4 +-
.../qa/longevity/EntityCleanupTest.java | 4 +-
.../EntityPersistencePerformanceTest.java | 4 +-
.../test/java/brooklyn/test/HttpService.java | 5 +-
.../brooklyn/util/task/ssh/SshTasksTest.java | 4 +-
.../PortForwardManagerLocationResolverTest.java | 2 +-
.../access/PortForwardManagerRebindTest.java | 6 +-
.../location/access/PortForwardManagerTest.java | 4 +-
.../location/basic/AbstractLocationTest.java | 4 +-
...regatingMachineProvisioningLocationTest.java | 10 +-
.../basic/ByonLocationResolverTest.java | 6 +-
...stMachineProvisioningLocationRebindTest.java | 2 +-
...ixedListMachineProvisioningLocationTest.java | 6 +-
.../basic/HostLocationResolverTest.java | 2 +-
.../basic/LocalhostLocationResolverTest.java | 4 +-
...ocalhostMachineProvisioningLocationTest.java | 10 +-
.../LocalhostProvisioningAndAccessTest.java | 2 +-
.../location/basic/LocationConfigTest.java | 2 +-
.../location/basic/LocationExtensionsTest.java | 4 +-
.../location/basic/LocationManagementTest.java | 2 +-
.../location/basic/LocationPredicatesTest.java | 4 +-
.../location/basic/LocationRegistryTest.java | 4 +-
.../location/basic/MachineDetailsTest.java | 6 +-
.../location/basic/MultiLocationRebindTest.java | 4 +-
.../basic/MultiLocationResolverTest.java | 8 +-
.../location/basic/MultiLocationTest.java | 6 +-
.../brooklyn/location/basic/PortRangesTest.java | 2 +-
.../RecordingMachineLocationCustomizer.java | 4 +-
.../location/basic/SimulatedLocation.java | 17 +-
.../SshMachineLocationReuseIntegrationTest.java | 4 +-
.../location/basic/SshMachineLocationTest.java | 10 +-
.../brooklyn/location/geo/HostGeoInfoTest.java | 2 +-
.../test/entity/BlockingEntityImpl.java | 2 +-
.../test/entity/TestApplicationImpl.java | 4 +-
.../brooklyn/test/entity/TestEntityImpl.java | 2 +-
.../brooklyn/demo/CumulusRDFApplication.java | 4 +-
...lusterDatabaseExampleAppIntegrationTest.java | 2 +-
.../policy/os/AdvertiseWinrmLoginPolicy.java | 4 +-
.../brooklyn/policy/os/CreateUserPolicy.java | 4 +-
.../location/jclouds/BrooklynMachinePool.java | 4 +-
.../jclouds/JcloudsByonLocationResolver.java | 10 +-
.../location/jclouds/JcloudsLocation.java | 12 +-
.../jclouds/JcloudsLocationResolver.java | 8 +-
.../jclouds/JcloudsMachineLocation.java | 3 +-
.../jclouds/JcloudsSshMachineLocation.java | 6 +-
.../zone/AwsAvailabilityZoneExtension.java | 3 +-
...pache.brooklyn.api.location.LocationResolver | 20 ++
...rg.apache.brooklyn.location.LocationResolver | 2 -
.../os/AdvertiseWinrmLoginPolicyTest.java | 3 +-
.../policy/os/CreateUserPolicyLiveTest.java | 8 +-
.../policy/os/CreateUserPolicyTest.java | 4 +-
.../jclouds/BailOutJcloudsLocation.java | 2 +-
.../jclouds/JcloudsAddressesLiveTest.java | 2 +-
.../jclouds/JcloudsLocationMetadataTest.java | 4 +-
.../location/jclouds/JcloudsLocationTest.java | 10 +-
.../location/jclouds/JcloudsLoginLiveTest.java | 4 +-
.../location/jclouds/LiveTestEntity.java | 7 +-
.../jclouds/RebindJcloudsLocationLiveTest.java | 2 +-
...loudsLocationUserLoginAndConfigLiveTest.java | 2 +-
...hineProvisioningLocationJcloudsLiveTest.java | 3 +-
.../provider/AbstractJcloudsLocationTest.java | 4 +-
.../zone/AwsAvailabilityZoneExtensionTest.java | 4 +-
parent/pom.xml | 1 -
.../followthesun/DefaultFollowTheSunModel.java | 3 +-
.../policy/followthesun/FollowTheSunModel.java | 2 +-
.../followthesun/FollowTheSunParameters.java | 3 +-
.../policy/followthesun/FollowTheSunPolicy.java | 4 +-
.../followthesun/FollowTheSunStrategy.java | 2 +-
.../loadbalancing/BalanceablePoolModel.java | 2 +-
.../policy/loadbalancing/BalancingStrategy.java | 3 +-
.../DefaultBalanceablePoolModel.java | 3 +-
.../loadbalancing/LocationConstraint.java | 2 +-
.../autoscaling/AutoScalerPolicyRebindTest.java | 4 +-
.../AbstractFollowTheSunPolicyTest.java | 6 +-
.../followthesun/FollowTheSunModelTest.java | 4 +-
.../FollowTheSunPolicySoakTest.java | 4 +-
.../followthesun/FollowTheSunPolicyTest.java | 4 +-
.../brooklyn/policy/ha/HaPolicyRebindTest.java | 6 +-
.../brooklyn/policy/ha/ServiceReplacerTest.java | 6 +-
.../loadbalancing/MockContainerEntityImpl.java | 2 +-
.../basic/AbstractSoftwareProcessDriver.java | 2 +-
.../SameServerDriverLifecycleEffectorTasks.java | 8 +-
.../brooklyn/entity/basic/SameServerEntity.java | 2 +-
.../entity/basic/SameServerEntityImpl.java | 2 +-
.../brooklyn/entity/basic/SoftwareProcess.java | 2 +-
...wareProcessDriverLifecycleEffectorTasks.java | 4 +-
.../entity/basic/SoftwareProcessImpl.java | 10 +-
.../entity/chef/ChefLifecycleEffectorTasks.java | 4 +-
.../main/java/brooklyn/entity/java/UsesJmx.java | 4 +-
.../java/brooklyn/entity/pool/ServerPool.java | 5 +-
.../brooklyn/entity/pool/ServerPoolImpl.java | 10 +-
.../entity/pool/ServerPoolLocation.java | 8 +-
.../entity/pool/ServerPoolLocationResolver.java | 9 +-
.../software/MachineLifecycleEffectorTasks.java | 14 +-
.../software/ProvidesProvisioningFlags.java | 3 +-
.../entity/software/SshEffectorTasks.java | 4 +-
...pache.brooklyn.api.location.LocationResolver | 19 ++
...rg.apache.brooklyn.location.LocationResolver | 1 -
.../brooklyn/entity/AbstractEc2LiveTest.java | 4 +-
.../entity/AbstractGoogleComputeLiveTest.java | 2 +-
.../entity/AbstractSoftlayerLiveTest.java | 2 +-
.../entity/basic/SameServerEntityTest.java | 3 +-
.../basic/SoftwareProcessEntityLatchTest.java | 4 +-
.../basic/SoftwareProcessEntityRebindTest.java | 8 +-
.../entity/basic/SoftwareProcessEntityTest.java | 8 +-
...SoftwareProcessSshDriverIntegrationTest.java | 4 +-
.../basic/SoftwareProcessSubclassTest.java | 2 +-
...ftwareProcessAndChildrenIntegrationTest.java | 2 +-
.../basic/lifecycle/NaiveScriptRunnerTest.java | 4 +-
.../basic/lifecycle/ScriptHelperTest.java | 4 +-
.../entity/brooklynnode/BrooklynNodeTest.java | 4 +-
.../entity/brooklynnode/MockBrooklynNode.java | 2 +-
.../brooklynnode/SameBrooklynNodeImpl.java | 3 +-
.../entity/chef/ChefLiveTestSupport.java | 6 +-
.../AbstractChefToyMySqlEntityLiveTest.java | 3 +-
.../brooklyn/entity/driver/MockSshDriver.java | 3 +-
...rWithAvailabilityZonesMultiLocationTest.java | 10 +-
.../brooklyn/entity/java/EntityPollingTest.java | 4 +-
.../java/brooklyn/entity/java/JavaOptsTest.java | 6 +-
...SoftwareProcessSshDriverIntegrationTest.java | 6 +-
.../machine/MachineEntityEc2LiveTest.java | 2 +-
.../entity/pool/AbstractServerPoolTest.java | 8 +-
.../entity/pool/ServerPoolLiveTest.java | 2 +-
.../pool/ServerPoolLocationResolverTest.java | 6 +-
.../brooklyn/entity/pool/ServerPoolTest.java | 3 +-
.../entity/software/AbstractDockerLiveTest.java | 2 +-
.../entity/software/SoftwareEffectorTest.java | 4 +-
.../entity/software/SshEffectorTasksTest.java | 4 +-
.../software/http/HttpRequestSensorTest.java | 2 +-
.../mysql/AbstractToyMySqlEntityTest.java | 6 +-
.../mysql/DynamicToyMySqlEntityBuilder.java | 6 +-
.../software/ssh/SshCommandIntegrationTest.java | 4 +-
.../PortAttributeSensorAndConfigKeyTest.java | 3 +-
.../event/feed/jmx/RebindJmxFeedTest.java | 4 +-
.../usage/ApplicationUsageTrackingTest.java | 2 +-
.../usage/LocationUsageTrackingTest.java | 8 +-
.../management/usage/UsageListenerTest.java | 4 +-
.../basic/MachineDetailsEc2LiveTest.java | 6 +-
.../MachineDetailsGoogleComputeLiveTest.java | 6 +-
.../basic/WinRmMachineLocationTest.java | 2 +-
.../database/mariadb/MariaDbSshDriver.java | 4 +-
.../entity/database/mysql/MySqlClusterImpl.java | 2 +-
.../entity/database/mysql/MySqlSshDriver.java | 4 +-
.../postgresql/PostgreSqlSshDriver.java | 4 +-
.../database/mariadb/MariaDbLiveEc2Test.java | 3 +-
.../database/mysql/MySqlClusterLiveEc2Test.java | 3 +-
.../mysql/MySqlClusterLiveSoftlayerTest.java | 3 +-
.../database/mysql/MySqlClusterTestHelper.java | 2 +-
.../entity/database/mysql/MySqlLiveEc2Test.java | 2 +-
.../entity/database/mysql/MySqlLiveGceTest.java | 2 +-
.../database/mysql/MysqlDockerLiveTest.java | 2 +-
.../postgresql/PostgreSqDockerLiveTest.java | 2 +-
.../database/postgresql/PostgreSqlChefTest.java | 4 +-
.../postgresql/PostgreSqlEc2LiveTest.java | 2 +-
.../postgresql/PostgreSqlGceLiveTest.java | 2 +-
.../database/rubyrep/RubyRepEc2LiveTest.java | 3 +-
.../rubyrep/RubyRepIntegrationTest.java | 4 +-
.../rubyrep/RubyRepRackspaceLiveTest.java | 4 +-
.../messaging/kafka/KafkaClusterImpl.java | 2 +-
.../entity/zookeeper/ZooKeeperEnsembleImpl.java | 2 +-
.../messaging/activemq/ActiveMQEc2LiveTest.java | 2 +-
.../activemq/ActiveMQGoogleComputeLiveTest.java | 2 +-
.../activemq/ActiveMQIntegrationTest.java | 2 +-
.../messaging/kafka/KafkaIntegrationTest.java | 6 +-
.../entity/messaging/kafka/KafkaLiveTest.java | 2 +-
.../entity/messaging/qpid/QpidEc2LiveTest.java | 2 +-
.../messaging/qpid/QpidIntegrationTest.java | 2 +-
.../messaging/rabbit/RabbitEc2LiveTest.java | 2 +-
.../messaging/rabbit/RabbitIntegrationTest.java | 3 +-
.../storm/StormAbstractCloudLiveTest.java | 2 +-
.../messaging/storm/StormEc2LiveTest.java | 2 +-
.../zookeeper/ZooKeeperEc2LiveTest.java | 2 +-
.../zookeeper/ZooKeeperEnsembleLiveTest.java | 2 +-
.../entity/monitoring/monit/MonitNodeImpl.java | 4 +-
.../entity/monitoring/monit/MonitSshDriver.java | 4 +-
.../monitoring/monit/MonitIntegrationTest.java | 4 +-
.../network/bind/BindDnsServerByonLiveTest.java | 4 +-
.../network/bind/BindDnsServerEc2LiveTest.java | 3 +-
.../network/bind/BindDnsServerLiveTest.java | 2 +-
.../bind/BindDnsServerSoftlayerLiveTest.java | 3 +-
.../cassandra/CassandraDatacenterImpl.java | 4 +-
.../entity/nosql/cassandra/CassandraFabric.java | 2 +-
.../nosql/cassandra/CassandraFabricImpl.java | 2 +-
.../nosql/cassandra/CassandraNodeImpl.java | 6 +-
.../nosql/cassandra/CassandraNodeSshDriver.java | 4 +-
.../nosql/couchbase/CouchbaseNodeImpl.java | 4 +-
.../nosql/couchbase/CouchbaseNodeSshDriver.java | 4 +-
.../CouchbaseSyncGatewaySshDriver.java | 4 +-
.../nosql/couchdb/CouchDBNodeSshDriver.java | 4 +-
.../nosql/mongodb/AbstractMongoDBSshDriver.java | 4 +-
.../nosql/mongodb/MongoDBReplicaSetImpl.java | 2 +-
.../sharding/CoLocatedMongoDBRouterImpl.java | 2 +-
.../MongoDBConfigServerClusterImpl.java | 2 +-
.../sharding/MongoDBRouterClusterImpl.java | 2 +-
.../sharding/MongoDBShardClusterImpl.java | 2 +-
.../sharding/MongoDBShardedDeploymentImpl.java | 2 +-
.../entity/nosql/redis/RedisClusterImpl.java | 2 +-
.../entity/nosql/redis/RedisStoreImpl.java | 5 +-
.../entity/nosql/redis/RedisStoreSshDriver.java | 4 +-
.../entity/nosql/riak/RiakNodeImpl.java | 4 +-
.../entity/nosql/riak/RiakNodeSshDriver.java | 5 +-
.../entity/nosql/solr/SolrServerSshDriver.java | 5 +-
.../cassandra/AbstractCassandraNodeTest.java | 3 +-
.../CassandraDatacenterIntegrationTest.java | 2 +-
.../cassandra/CassandraDatacenterLiveTest.java | 2 +-
.../cassandra/CassandraDatacenterTest.java | 4 +-
.../nosql/cassandra/CassandraFabricTest.java | 6 +-
.../cassandra/CassandraNodeEc2LiveTest.java | 2 +-
.../CouchbaseSyncGatewayEc2LiveTest.java | 2 +-
.../nosql/couchdb/AbstractCouchDBNodeTest.java | 4 +-
.../nosql/couchdb/CouchDBClusterLiveTest.java | 2 +-
.../nosql/couchdb/CouchDBNodeEc2LiveTest.java | 2 +-
.../ElasticSearchClusterIntegrationTest.java | 2 +-
.../ElasticSearchNodeIntegrationTest.java | 4 +-
.../nosql/mongodb/MongoDBEc2LiveTest.java | 2 +-
.../mongodb/MongoDBReplicaSetEc2LiveTest.java | 2 +-
.../nosql/mongodb/MongoDBSoftLayerLiveTest.java | 2 +-
.../MongoDBShardedDeploymentEc2LiveTest.java | 2 +-
.../redis/RedisClusterIntegrationTest.java | 4 +-
.../entity/nosql/redis/RedisEc2LiveTest.java | 2 +-
.../nosql/redis/RedisIntegrationTest.java | 4 +-
.../nosql/riak/RiakClusterEc2LiveTest.java | 2 +-
.../entity/nosql/riak/RiakNodeEc2LiveTest.java | 2 +-
.../riak/RiakNodeGoogleComputeLiveTest.java | 2 +-
.../nosql/riak/RiakNodeSoftlayerLiveTest.java | 2 +-
.../nosql/solr/AbstractSolrServerTest.java | 3 +-
.../nosql/solr/SolrServerEc2LiveTest.java | 2 +-
.../osgi/karaf/KarafContainerEc2LiveTest.java | 2 +-
.../entity/osgi/karaf/KarafContainerTest.java | 4 +-
.../AbstractNonProvisionedControllerImpl.java | 2 +-
.../entity/proxy/nginx/NginxSshDriver.java | 6 +-
.../ControlledDynamicWebAppClusterImpl.java | 2 +-
.../entity/webapp/ElasticJavaWebAppService.java | 4 +-
.../webapp/nodejs/NodeJsWebAppService.java | 4 +-
.../entity/dns/AbstractGeoDnsServiceTest.java | 10 +-
.../geoscaling/GeoscalingIntegrationTest.java | 4 +-
.../entity/proxy/AbstractControllerTest.java | 12 +-
.../brooklyn/entity/proxy/StubAppServer.java | 8 +-
.../brooklyn/entity/proxy/UrlMappingTest.java | 4 +-
.../nginx/NginxClusterIntegrationTest.java | 4 +-
.../entity/proxy/nginx/NginxEc2LiveTest.java | 2 +-
.../nginx/NginxHttpsSslIntegrationTest.java | 4 +-
.../proxy/nginx/NginxIntegrationTest.java | 2 +-
.../proxy/nginx/NginxRebindIntegrationTest.java | 4 +-
.../nginx/NginxRebindWithHaIntegrationTest.java | 4 +-
.../proxy/nginx/NginxWebClusterEc2LiveTest.java | 6 +-
.../AbstractWebAppFixtureIntegrationTest.java | 4 +-
.../webapp/TomcatAutoScalerPolicyTest.java | 4 +-
.../webapp/WebAppConcurrentDeployTest.java | 6 +-
.../webapp/WebAppLiveIntegrationTest.groovy | 2 +-
.../jboss/JBoss6ServerAwsEc2LiveTest.java | 2 +-
.../jboss/JBoss7ServerAwsEc2LiveTest.java | 2 +-
.../jboss/JBoss7ServerDockerLiveTest.java | 2 +-
.../Jboss7ServerGoogleComputeLiveTest.java | 2 +-
.../webapp/nodejs/NodeJsWebAppEc2LiveTest.java | 2 +-
.../NodeJsWebAppFixtureIntegrationTest.java | 4 +-
.../NodeJsWebAppSimpleIntegrationTest.java | 4 +-
.../nodejs/NodeJsWebAppSoftlayerLiveTest.java | 2 +-
.../webapp/tomcat/Tomcat8ServerEc2LiveTest.java | 2 +-
.../tomcat/Tomcat8ServerSoftlayerLiveTest.java | 2 +-
.../webapp/tomcat/TomcatServerEc2LiveTest.java | 2 +-
.../tomcat/TomcatServerSoftlayerLiveTest.java | 2 +-
.../test/entity/TestJavaWebAppEntity.java | 2 +-
.../BrooklynComponentTemplateResolver.java | 2 +-
.../creation/BrooklynYamlLocationResolver.java | 4 +-
.../camp/brooklyn/ByonLocationsYamlTest.java | 4 +-
.../brooklyn/EmptySoftwareProcessYamlTest.java | 4 +-
.../camp/brooklyn/EntitiesYamlTest.java | 2 +-
.../camp/brooklyn/LocationsYamlTest.java | 6 +-
.../brooklyn/TestEntityWithInitConfigImpl.java | 2 +-
.../CatalogOsgiVersionMoreEntityTest.java | 2 +-
.../catalog/CatalogYamlLocationTest.java | 8 +-
.../org/apache/brooklyn/cli/CloudExplorer.java | 6 +-
.../org/apache/brooklyn/cli/ItemLister.java | 4 +-
.../brooklyn/cli/lister/ItemDescriptors.java | 2 +-
.../java/org/apache/brooklyn/cli/CliTest.java | 4 +-
.../brooklyn/launcher/BrooklynLauncher.java | 8 +-
.../brooklyn/launcher/BrooklynWebServer.java | 4 +-
.../brooklynnode/BrooklynNodeRestTest.java | 2 +-
.../BrooklynLauncherRebindTestFixture.java | 2 +-
.../brooklyn/launcher/BrooklynLauncherTest.java | 4 +-
.../SoftlayerObtainPrivateLiveTest.java | 4 +-
.../org/apache/brooklyn/qa/load/LoadTest.java | 2 +-
.../apache/brooklyn/rest/BrooklynWebConfig.java | 3 +-
.../rest/resources/ApplicationResource.java | 2 +-
.../rest/resources/CatalogResource.java | 4 +-
.../brooklyn/rest/resources/EntityResource.java | 2 +-
.../rest/resources/LocationResource.java | 6 +-
.../rest/transform/ApplicationTransformer.java | 2 +-
.../rest/transform/CatalogTransformer.java | 4 +-
.../rest/transform/LocationTransformer.java | 6 +-
.../rest/util/BrooklynRestResourceUtils.java | 4 +-
.../brooklyn/rest/util/EntityLocationUtils.java | 3 +-
.../rest/util/json/BidiSerialization.java | 3 +-
.../rest/resources/LocationResourceTest.java | 3 +-
.../rest/resources/ScriptResourceTest.java | 2 +-
.../rest/resources/UsageResourceTest.java | 9 +-
.../rest/testing/BrooklynRestApiTest.java | 4 +-
.../rest/util/EntityLocationUtilsTest.java | 4 +-
514 files changed, 2456 insertions(+), 2054 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
index 844996a..0918d14 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
@@ -26,6 +26,7 @@ import javax.annotation.Nullable;
import org.apache.brooklyn.api.basic.BrooklynObject;
import org.apache.brooklyn.api.entity.proxying.EntitySpec;
import org.apache.brooklyn.api.event.AttributeSensor;
+import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.api.management.Task;
import org.apache.brooklyn.policy.Enricher;
import org.apache.brooklyn.policy.EnricherSpec;
@@ -34,7 +35,6 @@ import org.apache.brooklyn.policy.PolicySpec;
import brooklyn.config.ConfigKey;
import brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.location.Location;
import brooklyn.util.guava.Maybe;
/**
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
index 7ba0966..6a5ebd2 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriver.java
@@ -19,8 +19,7 @@
package org.apache.brooklyn.api.entity.drivers;
import org.apache.brooklyn.api.entity.basic.EntityLocal;
-
-import org.apache.brooklyn.location.Location;
+import org.apache.brooklyn.api.location.Location;
import com.google.common.annotations.Beta;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
index fe7134b..b2ad37e 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/drivers/EntityDriverManager.java
@@ -18,7 +18,7 @@
*/
package org.apache.brooklyn.api.entity.drivers;
-import org.apache.brooklyn.location.Location;
+import org.apache.brooklyn.api.location.Location;
/**
* Responsible for creating a driver for a given entity/location. Also used for customizing which
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntitySpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntitySpec.java b/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntitySpec.java
index 5af103a..7a0d351 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntitySpec.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntitySpec.java
@@ -30,6 +30,7 @@ import javax.annotation.Nullable;
import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.Group;
+import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.api.management.Task;
import org.apache.brooklyn.policy.Enricher;
import org.apache.brooklyn.policy.EnricherSpec;
@@ -40,7 +41,6 @@ import org.slf4j.LoggerFactory;
import brooklyn.config.ConfigKey;
import brooklyn.config.ConfigKey.HasConfigKey;
-import org.apache.brooklyn.location.Location;
import brooklyn.util.collections.MutableList;
import com.google.common.base.Supplier;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntityTypeRegistry.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntityTypeRegistry.java b/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntityTypeRegistry.java
index 5b55a54..76f5c54 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntityTypeRegistry.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/proxying/EntityTypeRegistry.java
@@ -21,8 +21,7 @@ package org.apache.brooklyn.api.entity.proxying;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;
import org.apache.brooklyn.api.entity.drivers.EntityDriver;
-
-import org.apache.brooklyn.location.Location;
+import org.apache.brooklyn.api.location.Location;
/**
* A registry of the entity implementations to be used when creating an entity of a given type.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/BrooklynObjectType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/BrooklynObjectType.java b/api/src/main/java/org/apache/brooklyn/api/entity/rebind/BrooklynObjectType.java
index 74f10ff..b4a120e 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/BrooklynObjectType.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/rebind/BrooklynObjectType.java
@@ -22,11 +22,10 @@ import org.apache.brooklyn.api.basic.BrooklynObject;
import org.apache.brooklyn.api.catalog.CatalogItem;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.Feed;
+import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.policy.Enricher;
import org.apache.brooklyn.policy.Policy;
-import org.apache.brooklyn.location.Location;
-
import com.google.common.annotations.Beta;
import com.google.common.base.CaseFormat;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/RebindExceptionHandler.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/RebindExceptionHandler.java b/api/src/main/java/org/apache/brooklyn/api/entity/rebind/RebindExceptionHandler.java
index 4b613c3..24e5997 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/rebind/RebindExceptionHandler.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/rebind/RebindExceptionHandler.java
@@ -25,11 +25,10 @@ import org.apache.brooklyn.api.catalog.CatalogItem;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.Feed;
import org.apache.brooklyn.api.entity.basic.EntityLocal;
+import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.policy.Enricher;
import org.apache.brooklyn.policy.Policy;
-import org.apache.brooklyn.location.Location;
-
import com.google.common.annotations.Beta;
/**
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
new file mode 100644
index 0000000..31c3b29
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/AddressableLocation.java
@@ -0,0 +1,43 @@
+/*
+ * 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.api.location;
+
+import java.net.InetAddress;
+
+/** A location that has an IP address.
+ * <p>
+ * This IP address may be a machine (usually the MachineLocation sub-interface),
+ * or often an entry point for a service.
+ */
+public interface AddressableLocation extends Location {
+
+ /**
+ * Return the single most appropriate address for this location.
+ * (An implementation or sub-interface definition may supply more information
+ * on the precise semantics of the address.)
+ *
+ * Should not return null, but in some "special cases" (e.g. CloudFoundryLocation it
+ * may return null if the location is not configured correctly). Users should expect
+ * a non-null result and treat null as a programming error or misconfiguration.
+ * Implementors of this interface should strive to not return null (and then we'll
+ * remove this caveat from the javadoc!).
+ */
+ InetAddress getAddress();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
new file mode 100644
index 0000000..99d4fee
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/BasicMachineLocationCustomizer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.api.location;
+
+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 MachineLocationCustomizer} is marked {@link Beta}.
+ */
+@Beta
+public class BasicMachineLocationCustomizer implements MachineLocationCustomizer {
+
+ @Override
+ public void customize(MachineLocation machine) {
+ // no-op
+ }
+
+ @Override
+ public void preRelease(MachineLocation machine) {
+ // no-op
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
new file mode 100644
index 0000000..7e4cc49
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/HardwareDetails.java
@@ -0,0 +1,40 @@
+/*
+ * 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.api.location;
+
+import javax.annotation.Nullable;
+
+/**
+ * @since 0.7.0
+ */
+public interface HardwareDetails {
+
+ /**
+ * The number of CPUs on the machine
+ */
+ @Nullable
+ Integer getCpuCount();
+
+ /**
+ * Amount of RAM in megabytes
+ */
+ @Nullable
+ Integer getRam();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/Location.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/Location.java b/api/src/main/java/org/apache/brooklyn/api/location/Location.java
new file mode 100644
index 0000000..0d05556
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/Location.java
@@ -0,0 +1,146 @@
+/*
+ * 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.api.location;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.brooklyn.api.basic.BrooklynObject;
+
+import brooklyn.config.ConfigKey;
+import brooklyn.config.ConfigKey.HasConfigKey;
+
+/**
+ * A location that an entity can be in. Examples of locations include a single machine
+ * or a pool of machines, or a region within a given cloud.
+ *
+ * See {@link brooklyn.entity.trait.Startable#start(Collection)}.
+ *
+ * Locations may not be {@link Serializable} in subsequent releases!
+ */
+public interface Location extends Serializable, BrooklynObject {
+
+ /**
+ * A unique id for this location.
+ */
+ @Override
+ String getId();
+
+ /**
+ * Get the name assigned to this location.
+ *
+ * @return the name assigned to the location.
+ * @since 0.6 (previously getName())
+ */
+ @Override
+ String getDisplayName();
+
+ /**
+ * Get the 'parent' of this location. Locations are organized into a tree hierarchy, and this method will return a reference
+ * to the parent of this location, or {@code null} if this location is the tree root.
+ *
+ * @return a reference to the parent of this location, or {@code null} if this location is the tree root.
+ * @since 0.6 (previously getParentLocation())
+ */
+ Location getParent();
+
+ /**
+ * Get the 'children' of this location. Locations are organized into a tree hierarchy, and this method will return a
+ * collection containing the children of this location. This collection is an unmodifiable view of the data.
+ *
+ * @return a collection containing the children of this location.
+ * @since 0.6 (previously getChildLocations())
+ */
+ Collection<Location> getChildren();
+
+ /**
+ * Set the 'parent' of this location. If this location was previously a child of a different location, it is removed from
+ * the other location first. It is valid to pass in {@code null} to indicate that the location should be disconnected
+ * from its parent.
+ *
+ * Adds this location as a child of the new parent (see {@code getChildLocations()}).
+ *
+ * @param newParent the new parent location object, or {@code null} to clear the parent reference.
+ * @since 0.6 (previously setParentLocation(Location))
+ */
+ void setParent(Location newParent);
+
+ /**
+ * @return meta-data about the location (usually a long line, or a small number of lines).
+ *
+ * @since 0.6
+ */
+ String toVerboseString();
+
+ /**
+ * Answers true if this location equals or is an ancestor of the given location.
+ */
+ boolean containsLocation(Location potentialDescendent);
+
+ /**
+ * Returns configuration set at this location or inherited or default.
+ *
+ * Convenience method for {@code config().get(key)}
+ */
+ <T> T getConfig(ConfigKey<T> key);
+
+ /**
+ * Convenience method for {@code config().get(key)}
+ *
+ * @see {@link #getConfig(ConfigKey)}
+ */
+ <T> T getConfig(HasConfigKey<T> key);
+
+ /**
+ * True iff the indication config key is set, either inherited (second argument true) or locally-only (second argument false).
+ *
+ * @deprecated since 0.7.0; use {@link #config()}, such as {@code ((LocationInternal)location).config().getRaw(key).isPresent()}
+ */
+ @Deprecated
+ boolean hasConfig(ConfigKey<?> key, boolean includeInherited);
+
+ /**
+ * Returns all config set, either inherited (argument true) or locally-only (argument false).
+ *
+ * @deprecated since 0.7.0; use {@link #config()}, such as {@code policy.config().getBag()}
+ */
+ @Deprecated
+ public Map<String,Object> getAllConfig(boolean includeInherited);
+
+ /**
+ * Whether this location has support for the given extension type.
+ * See additional comments in {@link #getExtension(Class)}.
+ *
+ * @throws NullPointerException if extensionType is null
+ */
+ boolean hasExtension(Class<?> extensionType);
+
+ /**
+ * Returns an extension of the given type. Note that the type must be an exact match for
+ * how the extension was registered (e.g. {@code getExtension(Object.class)} will not match
+ * anything, even though registered extension extend {@link Object}.
+ * <p>
+ * This will not look at extensions of {@link #getParent()}.
+ *
+ * @throws IllegalArgumentException if this location does not support the given extension type
+ * @throws NullPointerException if extensionType is null
+ */
+ <T> T getExtension(Class<T> extensionType);
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
new file mode 100644
index 0000000..000d883
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationDefinition.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.management.ManagementContext;
+
+/**
+ * Defines a location, where the {@link #getSpec()} is like a serialized representation
+ * of the location so that Brooklyn can create a corresponding location.
+ *
+ * Examples include a complete description (e.g. giving a list of machines in a pool), or
+ * a name that matches a named location defined in the brooklyn poperties.
+ *
+ * Users are not expected to implement this, or to use the interface directly. See
+ * {@link LocationRegistry#resolve(String)} and {@link ManagementContext#getLocationRegistry()}.
+ */
+public interface LocationDefinition {
+
+ public String getId();
+ public String getName();
+ public String getSpec();
+ public Map<String,Object> getConfig();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
new file mode 100644
index 0000000..de1c09d
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationNotAvailableException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.api.location;
+
+
+/**
+ * Indicates that a {@link ProvisioningLocation} is not able to provision a requested location
+ */
+public class LocationNotAvailableException extends Exception {
+ private static final long serialVersionUID = 1079817235289265761L;
+
+ public LocationNotAvailableException(String s) {
+ super(s);
+ }
+
+ public LocationNotAvailableException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
new file mode 100644
index 0000000..b3c3e5a
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationRegistry.java
@@ -0,0 +1,128 @@
+/*
+ * 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.api.location;
+
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.annotation.Nullable;
+
+import brooklyn.util.guava.Maybe;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * The registry of the sorts of locations that brooklyn knows about. Given a
+ * {@LocationDefinition} or a {@link String} representation of a spec, this can
+ * be used to create a {@link Location} instance.
+ */
+@SuppressWarnings("rawtypes")
+public interface LocationRegistry {
+
+ /** map of ID (possibly randomly generated) to the definition (spec, name, id, and props;
+ * where spec is the spec as defined, for instance possibly another named:xxx location) */
+ public Map<String,LocationDefinition> getDefinedLocations();
+
+ /** returns a LocationDefinition given its ID (usually a random string), or null if none */
+ public LocationDefinition getDefinedLocationById(String id);
+
+ /** returns a LocationDefinition given its name (e.g. for named locations, supply the bit after the "named:" prefix),
+ * or null if none */
+ public LocationDefinition getDefinedLocationByName(String name);
+
+ /** adds or updates the given defined location */
+ public void updateDefinedLocation(LocationDefinition l);
+
+ /** removes the defined location from the registry (applications running there are unaffected) */
+ public void removeDefinedLocation(String id);
+
+ /** Returns a fully populated (config etc) location from the given definition, with optional add'l flags.
+ * the location will be managed by default, unless the manage parameter is false,
+ * or the manage parameter is null and the CREATE_UNMANAGED flag is set.
+ * <p>
+ * The manage parameter is {@link Boolean} so that null can be used to say rely on anything in the flags.
+ *
+ * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
+ @Beta
+ public Maybe<Location> resolve(LocationDefinition ld, Boolean manage, Map locationFlags);
+
+ /** As {@link #resolve(LocationDefinition, Boolean, Map), with the location managed, and no additional flags,
+ * unwrapping the result (throwing if not resolvable) */
+ public Location resolve(LocationDefinition l);
+
+ /** Returns a location created from the given spec, which might correspond to a definition, or created on-the-fly.
+ * Optional flags can be passed through to underlying the location.
+ * @since 0.7.0, but beta and likely to change as the semantics of this class are tuned */
+ @Beta
+ public Maybe<Location> resolve(String spec, Boolean manage, Map locationFlags);
+
+ /** efficiently returns for inspection only a fully populated (config etc) location from the given definition;
+ * the value might be unmanaged so it is not meant for any use other than inspection,
+ * but callers should prefer this when they don't wish to create a new location which will be managed in perpetuity!
+ *
+ * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
+ @Deprecated
+ public Location resolveForPeeking(LocationDefinition l);
+
+ /** returns fully populated (config etc) location from the given definition, with overrides;
+ * @deprecated since 0.7.0, use {@link #resolve(LocationDefinition, Boolean, Map)} */
+ @Deprecated
+ public Location resolve(LocationDefinition l, Map<?,?> locationFlags);
+
+ /** See {@link #resolve(String, Boolean, Map)}; asks for the location to be managed, and supplies no additional flags,
+ * and unwraps the result (throwing if the spec cannot be resolve) */
+ public Location resolve(String spec);
+
+ /** Returns true/false depending whether spec seems like a valid location,
+ * that is it has a chance of being resolved (depending on the spec) but NOT guaranteed,
+ * as it is not passed to the spec;
+ * see {@link #resolve(String, Boolean, Map)} which has stronger guarantees
+ * @deprecated since 0.7.0, not really needed, and semantics are weak; use {@link #resolve(String, Boolean, Map)} */
+ @Deprecated
+ public boolean canMaybeResolve(String spec);
+
+ /** As {@link #resolve(String, Boolean, Map)}, but unwrapped
+ * @throws NoSuchElementException if the spec cannot be resolved */
+ public Location resolve(String spec, @Nullable Map locationFlags);
+
+ /** as {@link #resolve(String)} but returning null (never throwing)
+ * @deprecated since 0.7.0 use {@link #resolve(String, Boolean, Map)} */
+ @Deprecated
+ public Location resolveIfPossible(String spec);
+
+ /**
+ * As {@link #resolve(String)} but takes collections (of strings or locations)
+ * <p>
+ * Expects a collection of elements being individual location spec strings or locations,
+ * and returns a list of resolved (newly created and managed) locations.
+ * <p>
+ * From 0.7.0 this no longer flattens lists (nested lists are disallowed)
+ * or parses comma-separated elements (they are resolved as-is)
+ */
+ public List<Location> resolve(Iterable<?> spec);
+
+ /** Takes a string, interpreted as a comma-separated (or JSON style, when you need internal double quotes or commas) list;
+ * or a list, passed to {@link #resolve(Iterable)}; or null/empty (empty list),
+ * and returns a list of resolved (created and managed) locations */
+ public List<Location> resolveList(Object specList);
+
+ public Map getProperties();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
new file mode 100644
index 0000000..0da6175
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationResolver.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.management.ManagementContext;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provides a way of creating location instances of a particular type.
+ */
+public interface LocationResolver {
+
+ void init(ManagementContext managementContext);
+
+ /** the prefix that this resolver will attend to */
+ String getPrefix();
+
+ /** whether the spec is something which should be passed to this resolver */
+ boolean accepts(String spec, LocationRegistry registry);
+
+ /**
+ * Similar to {@link #newLocationFromString(Map, String)}
+ * but passing in a reference to the registry itself (from which the base properties are discovered)
+ * and including flags (e.g. user, key, cloud credential) which are known to be for this location.
+ * <p>
+ * introduced to support locations which refer to other locations, e.g. NamedLocationResolver
+ **/
+ @SuppressWarnings("rawtypes")
+ Location newLocationFromString(Map locationFlags, String spec, LocationRegistry registry);
+
+ /** @since 0.7.0 exploring this as a mechanism to disable locations */
+ @Beta
+ public interface EnableableLocationResolver extends LocationResolver {
+ /** whether the location is enabled */
+ boolean isEnabled();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
new file mode 100644
index 0000000..8164ab0
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationSpec.java
@@ -0,0 +1,229 @@
+/*
+ * 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.api.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.management.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.config.ConfigKey;
+import brooklyn.config.ConfigKey.HasConfigKey;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Gives details of a location to be created. It describes the location's configuration, and is
+ * reusable to create multiple locations with the same configuration.
+ *
+ * To create a LocationSpec, it is strongly encouraged to use {@code create(...)} methods.
+ *
+ * @param <T> The type of location to be created
+ *
+ * @author aled
+ */
+public class LocationSpec<T extends Location> extends AbstractBrooklynObjectSpec<T,LocationSpec<T>> {
+
+ // TODO Would like to add `configure(ConfigBag)`, but `ConfigBag` is in core rather than api
+
+ private static final Logger log = LoggerFactory.getLogger(LocationSpec.class);
+
+ private final static long serialVersionUID = 1L;
+
+ /**
+ * Creates a new {@link LocationSpec} instance for a location of the given type. The returned
+ * {@link LocationSpec} can then be customized.
+ *
+ * @param type A {@link Location} class
+ */
+ public static <T extends Location> LocationSpec<T> create(Class<T> type) {
+ return new LocationSpec<T>(type);
+ }
+
+ /**
+ * Creates a new {@link LocationSpec} instance with the given config, for a location of the given type.
+ *
+ * This is primarily for groovy code; equivalent to {@code LocationSpec.create(type).configure(config)}.
+ *
+ * @param config The spec's configuration (see {@link LocationSpec#configure(Map)}).
+ * @param type A {@link Location} class
+ */
+ public static <T extends Location> LocationSpec<T> create(Map<?,?> config, Class<T> type) {
+ return LocationSpec.create(type).configure(config);
+ }
+
+ /**
+ * Copies entity spec so its configuration can be overridden without modifying the
+ * original entity spec.
+ */
+ public static <T extends Location> LocationSpec<T> create(LocationSpec<T> spec) {
+ // need this to get LocationSpec<T> rather than LocationSpec<? extends T>
+ @SuppressWarnings("unchecked")
+ Class<T> exactType = (Class<T>)spec.getType();
+
+ LocationSpec<T> result = create(exactType)
+ .displayName(spec.getDisplayName())
+ .tags(spec.getTags())
+ .configure(spec.getConfig())
+ .configure(spec.getFlags())
+ .catalogItemId(spec.getCatalogItemId())
+ .extensions(spec.getExtensions());
+
+ if (spec.getParent() != null) result.parent(spec.getParent());
+
+ return (LocationSpec<T>) result;
+ }
+
+ private String id;
+ private Location parent;
+ private final Map<String, Object> flags = Maps.newLinkedHashMap();
+ private final Map<ConfigKey<?>, Object> config = Maps.newLinkedHashMap();
+ private final Map<Class<?>, Object> extensions = Maps.newLinkedHashMap();
+
+ protected LocationSpec(Class<T> type) {
+ super(type);
+ }
+
+ protected void checkValidType(Class<? extends T> type) {
+ checkIsImplementation(type, Location.class);
+ checkIsNewStyleImplementation(type);
+ }
+
+ /**
+ * @deprecated since 0.7.0; instead let the management context pick a random+unique id
+ */
+ @Deprecated
+ public LocationSpec<T> id(String val) {
+ id = val;
+ return this;
+ }
+
+ public LocationSpec<T> parent(Location val) {
+ parent = checkNotNull(val, "parent");
+ return this;
+ }
+
+ public LocationSpec<T> configure(Map<?,?> val) {
+ for (Map.Entry<?, ?> entry: val.entrySet()) {
+ if (entry.getKey()==null) throw new NullPointerException("Null key not permitted");
+ if (entry.getKey() instanceof CharSequence)
+ flags.put(entry.getKey().toString(), entry.getValue());
+ else if (entry.getKey() instanceof ConfigKey<?>)
+ config.put((ConfigKey<?>)entry.getKey(), entry.getValue());
+ else if (entry.getKey() instanceof HasConfigKey<?>)
+ config.put(((HasConfigKey<?>)entry.getKey()).getConfigKey(), entry.getValue());
+ else {
+ log.warn("Spec "+this+" ignoring unknown config key "+entry.getKey());
+ }
+ }
+ return this;
+ }
+
+ public LocationSpec<T> configure(CharSequence key, Object val) {
+ flags.put(checkNotNull(key, "key").toString(), val);
+ return this;
+ }
+
+ public <V> LocationSpec<T> configure(ConfigKey<V> key, V val) {
+ config.put(checkNotNull(key, "key"), val);
+ return this;
+ }
+
+ public <V> LocationSpec<T> configureIfNotNull(ConfigKey<V> key, V val) {
+ return (val != null) ? configure(key, val) : this;
+ }
+
+ public <V> LocationSpec<T> configure(ConfigKey<V> key, Task<? extends V> val) {
+ config.put(checkNotNull(key, "key"), val);
+ return this;
+ }
+
+ public <V> LocationSpec<T> configure(HasConfigKey<V> key, V val) {
+ config.put(checkNotNull(key, "key").getConfigKey(), val);
+ return this;
+ }
+
+ public <V> LocationSpec<T> configure(HasConfigKey<V> key, Task<? extends V> val) {
+ config.put(checkNotNull(key, "key").getConfigKey(), val);
+ return this;
+ }
+
+ public <V> LocationSpec<T> removeConfig(ConfigKey<V> key) {
+ config.remove( checkNotNull(key, "key") );
+ return this;
+ }
+
+ public <E> LocationSpec<T> extension(Class<E> extensionType, E extension) {
+ extensions.put(checkNotNull(extensionType, "extensionType"), checkNotNull(extension, "extension"));
+ return this;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public <E> LocationSpec<T> extensions(Map<Class<?>, ?> extensions) {
+ for (Map.Entry<Class<?>, ?> entry : extensions.entrySet()) {
+ extension((Class)entry.getKey(), entry.getValue());
+ }
+ return this;
+ }
+
+ /**
+ * @return The id of the location to be created, or null if brooklyn can auto-generate an id
+ *
+ * @deprecated since 0.7.0; instead let the management context pick a random+unique id
+ */
+ @Deprecated
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return The location's parent
+ */
+ public Location getParent() {
+ return parent;
+ }
+
+ /**
+ * @return Read-only construction flags
+ * @see SetFromFlag declarations on the location type
+ */
+ public Map<String, ?> getFlags() {
+ return Collections.unmodifiableMap(flags);
+ }
+
+ /**
+ * @return Read-only configuration values
+ */
+ public Map<ConfigKey<?>, Object> getConfig() {
+ return Collections.unmodifiableMap(config);
+ }
+
+ /**
+ * @return Read-only extension values
+ */
+ public Map<Class<?>, Object> getExtensions() {
+ return Collections.unmodifiableMap(extensions);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java b/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
new file mode 100644
index 0000000..dd895e3
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/LocationType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.api.location;
+
+import org.apache.brooklyn.api.basic.BrooklynType;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Gives type information for a {@link Location}. It is immutable.
+
+ * @since 0.7.0
+ */
+@Beta
+public interface LocationType extends BrooklynType {
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
new file mode 100644
index 0000000..ae8b1c2
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineDetails.java
@@ -0,0 +1,34 @@
+/*
+ * 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.api.location;
+
+import javax.annotation.Nonnull;
+
+/**
+ * @since 0.7.0
+ */
+public interface MachineDetails {
+
+ @Nonnull
+ HardwareDetails getHardwareDetails();
+
+ @Nonnull
+ OsDetails getOsDetails();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
new file mode 100644
index 0000000..44c8e23
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocation.java
@@ -0,0 +1,46 @@
+/*
+ * 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.api.location;
+
+import java.net.InetAddress;
+
+import brooklyn.util.net.HasNetworkAddresses;
+
+/**
+ * A location that is a machine.
+ *
+ * This interface marks a {@link Location} being a network node with an IP address,
+ * and supports appropriate operations on the node.
+ */
+public interface MachineLocation extends AddressableLocation, HasNetworkAddresses {
+ /**
+ * @return the machine's network address.
+ */
+ InetAddress getAddress();
+
+ /** @deprecated since 0.7.0. Use getMachineDetails().getOsDetails() instead. */
+ @Deprecated
+ OsDetails getOsDetails();
+
+ /*
+ * @return hardware and operating system-specific details for the machine.
+ */
+ MachineDetails getMachineDetails();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
new file mode 100644
index 0000000..a9b4e2e
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineLocationCustomizer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.location;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Customization hooks to allow apps to perform specific customisation of obtained machines.
+ * <p>
+ * Users are strongly encouraged to sub-class {@link BasicMachineLocationCustomizer}, to give
+ * some protection against this {@link Beta} API changing in future releases.
+ */
+@Beta
+public interface MachineLocationCustomizer {
+
+ /**
+ * Override to configure the given machine once it has been created (prior to any use).
+ */
+ void customize(MachineLocation machine);
+
+ /**
+ * Override to handle machine-related cleanup prior to {@link MachineProvisioningLocation}
+ * releasing the machine.
+ */
+ void preRelease(MachineLocation machine);
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
new file mode 100644
index 0000000..b91aeb8
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineManagementMixins.java
@@ -0,0 +1,92 @@
+/*
+ * 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.api.location;
+
+import java.util.Map;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Defines mixins for interesting locations.
+ */
+public class MachineManagementMixins {
+
+ public interface RichMachineProvisioningLocation<T extends MachineLocation> extends
+ MachineProvisioningLocation<T>, ListsMachines, GivesMachineMetadata, KillsMachines {}
+
+ public interface ListsMachines {
+ /**
+ * @return A map of machine ID to metadata record for all machines known in a given cloud location.
+ */
+ Map<String,MachineMetadata> listMachines();
+ }
+
+ public interface GivesMachineMetadata {
+ /**
+ * @return the {@link MachineMetadata} for a given (brooklyn) machine location instance,
+ * or null if not matched.
+ */
+ MachineMetadata getMachineMetadata(MachineLocation location);
+ }
+
+ public interface KillsMachines {
+ /** Kills the indicated machine; throws if not recognised or possible */
+ void killMachine(MachineLocation machine);
+
+ /** Kills the machine indicated by the given (server-side) machine id;
+ * note, the ID is the _cloud-service_ ID,
+ * that is, pass in getMetadata(machineLocation).getId() not the machineLocation.getId() */
+ void killMachine(String cloudServiceId);
+ }
+
+ /** very lightweight machine record */
+ public interface MachineMetadata {
+ /** The cloud service ID -- distinct from any Brooklyn {@link Location#getId()} */
+ String getId();
+ String getName();
+ String getPrimaryIp();
+ Boolean isRunning();
+ /** original metadata object, if available; e.g. ComputeMetadata when using jclouds */
+ Object getOriginalMetadata();
+ }
+
+ /**
+ * Implement to indicate that a location can suspend and resume machines.
+ */
+ @Beta
+ public interface SuspendResumeLocation extends SuspendsMachines, ResumesMachines {};
+
+
+ @Beta
+ public interface SuspendsMachines {
+ /**
+ * Suspend the indicated machine.
+ */
+ void suspendMachine(MachineLocation location);
+ }
+
+ @Beta
+ public interface ResumesMachines {
+ /**
+ * Resume the indicated machine.
+ */
+ void resumeMachine(MachineLocation location);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d32d672a/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java b/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
new file mode 100644
index 0000000..1fcf785
--- /dev/null
+++ b/api/src/main/java/org/apache/brooklyn/api/location/MachineProvisioningLocation.java
@@ -0,0 +1,72 @@
+/*
+ * 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.api.location;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * A location that is able to provision new machines within its location.
+ *
+ * This interface extends {@link Location} to add the ability to provision {@link MachineLocation}s in this location.
+ */
+public interface MachineProvisioningLocation<T extends MachineLocation> extends ProvisioningLocation<T> {
+ /**
+ * Obtain a machine in this location.
+ *
+ * @param flags Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers).
+ * "callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel)
+ * @return a machine that is a child of this location.
+ * @throws NoMachinesAvailableException if there are no machines available in this location (or impls may return null, but that is discouraged)
+ */
+ @Override
+ T obtain(Map<?,?> flags) throws NoMachinesAvailableException;
+
+ /**
+ * Creates a new location of the same type, but with additional creation instructions in the form of flags,
+ * e.g. for specifying subnets, security groups, etc
+ * <p>
+ * Implementers who wish to subclass this provisioning location for additional functionality
+ * in a specific cloud can use the relevant implementation of this method as a guide.
+ */
+ MachineProvisioningLocation<T> newSubLocation(Map<?,?> newFlags);
+
+ /**
+ * Release a previously-obtained machine.
+ *
+ * @param machine a {@link MachineLocation} previously obtained from a call to {@link #obtain()}
+ * @throws IllegalStateException if the machine did not come from a call to {@link #obtain()} or it has already been released.
+ */
+ @Override
+ void release(T machine);
+
+ /**
+ * Gets flags, suitable as an argument to {@link #obtain(Map)}. The tags provided give
+ * hints about the machine required. The provisioning-location could be configured to
+ * understand those tags.
+ *
+ * For example, an AWS-location could be configured to understand that a particular entity
+ * type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the
+ * required image id.
+ *
+ * @param tags
+ * @return
+ */
+ Map<String,Object> getProvisioningFlags(Collection<String> tags);
+}