You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/08/20 00:54:04 UTC

[16/36] incubator-brooklyn git commit: Rename o.a.b.sensor.core to o.a.b.core.sensor

Rename o.a.b.sensor.core to o.a.b.core.sensor


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

Branch: refs/heads/master
Commit: 2a78e273dae0caf2e7a3b791f365d7c839a9b20b
Parents: 8dbb0e4
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 19 22:42:32 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Aug 19 22:48:55 2015 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/core/config/ConfigKeys.java |   8 +-
 .../brooklyn/core/effector/AddSensor.java       |   2 +-
 .../brooklyn/core/entity/AbstractEntity.java    |   8 +-
 .../apache/brooklyn/core/entity/Attributes.java |  10 +-
 .../core/entity/BrooklynConfigKeys.java         |   4 +-
 .../apache/brooklyn/core/entity/Entities.java   |   2 +-
 .../brooklyn/core/entity/EntityTasks.java       |   2 +-
 .../brooklyn/core/entity/trait/Changeable.java  |   4 +-
 .../core/location/dynamic/LocationOwner.java    |   4 +-
 .../core/mgmt/persist/XmlMementoSerializer.java |   2 +-
 .../mgmt/rebind/dto/BasicEntityMemento.java     |   2 +-
 .../brooklyn/core/sensor/AttributeMap.java      | 202 +++++
 .../sensor/AttributeSensorAndConfigKey.java     | 147 ++++
 .../core/sensor/BasicAttributeSensor.java       |  62 ++
 .../BasicAttributeSensorAndConfigKey.java       | 114 +++
 .../core/sensor/BasicNotificationSensor.java    |  36 +
 .../brooklyn/core/sensor/BasicSensor.java       | 114 +++
 .../brooklyn/core/sensor/BasicSensorEvent.java  | 112 +++
 .../core/sensor/DependentConfiguration.java     | 823 +++++++++++++++++++
 .../brooklyn/core/sensor/HttpRequestSensor.java |  96 +++
 .../sensor/PortAttributeSensorAndConfigKey.java | 141 ++++
 .../apache/brooklyn/core/sensor/Sensors.java    | 164 ++++
 .../brooklyn/core/sensor/StaticSensor.java      |  72 ++
 ...platedStringAttributeSensorAndConfigKey.java |  66 ++
 .../core/server/entity/BrooklynMetrics.java     |   4 +-
 .../brooklyn/entity/group/AbstractGroup.java    |   2 +-
 .../brooklyn/entity/group/DynamicCluster.java   |   6 +-
 .../brooklyn/entity/group/DynamicFabric.java    |   2 +-
 .../brooklyn/entity/group/DynamicGroup.java     |   2 +-
 .../entity/group/DynamicMultiGroup.java         |   2 +-
 .../brooklyn/entity/stock/DelegateEntity.java   |   4 +-
 .../winrm/AdvertiseWinrmLoginPolicy.java        |   2 +-
 .../brooklyn/sensor/core/AttributeMap.java      | 202 -----
 .../core/AttributeSensorAndConfigKey.java       | 147 ----
 .../sensor/core/BasicAttributeSensor.java       |  62 --
 .../core/BasicAttributeSensorAndConfigKey.java  | 114 ---
 .../sensor/core/BasicNotificationSensor.java    |  36 -
 .../brooklyn/sensor/core/BasicSensor.java       | 114 ---
 .../brooklyn/sensor/core/BasicSensorEvent.java  | 112 ---
 .../sensor/core/DependentConfiguration.java     | 823 -------------------
 .../brooklyn/sensor/core/HttpRequestSensor.java |  96 ---
 .../core/PortAttributeSensorAndConfigKey.java   | 141 ----
 .../apache/brooklyn/sensor/core/Sensors.java    | 164 ----
 .../brooklyn/sensor/core/StaticSensor.java      |  72 --
 ...platedStringAttributeSensorAndConfigKey.java |  66 --
 .../sensor/enricher/AbstractTransformer.java    |   2 +-
 .../AbstractTypeTransformingEnricher.java       |   2 +-
 .../sensor/enricher/AddingEnricher.java         |   2 +-
 .../brooklyn/sensor/enricher/Combiner.java      |   2 +-
 .../apache/brooklyn/sensor/enricher/Joiner.java |   2 +-
 .../sensor/feed/ConfigToAttributes.java         |   4 +-
 .../apache/brooklyn/sensor/feed/FeedConfig.java |   2 +-
 .../windows/WindowsPerformanceCounterFeed.java  |   2 +-
 .../brooklyn/util/core/flags/TypeCoercions.java |   2 +-
 .../util/core/text/TemplateProcessor.java       |   4 +-
 ...apListAndOtherStructuredConfigKeyTest.groovy |   2 +-
 .../brooklyn/core/entity/AttributeMapTest.java  |   4 +-
 .../brooklyn/core/entity/AttributeTest.java     |   2 +-
 .../entity/ConfigEntityInheritanceTest.java     |   4 +-
 .../core/entity/DependentConfigurationTest.java |   2 +-
 .../core/entity/EntitySubscriptionTest.java     |   2 +-
 .../brooklyn/core/entity/EntityTypeTest.java    |   4 +-
 .../brooklyn/core/entity/hello/HelloEntity.java |   4 +-
 .../core/entity/hello/LocalEntitiesTest.java    |   4 +-
 .../core/entity/internal/ConfigMapTest.java     |   2 +-
 .../EntityConfigMapUsageLegacyTest.java         |   2 +-
 .../internal/EntityConfigMapUsageTest.java      |   2 +-
 .../entity/lifecycle/ServiceStateLogicTest.java |   2 +-
 .../core/location/TestPortSupplierLocation.java |   2 +-
 .../access/PortForwardManagerRebindTest.java    |   2 +-
 .../internal/EntityExecutionManagerTest.java    |   2 +-
 .../mgmt/rebind/RebindCatalogEntityTest.java    |   2 +-
 .../core/mgmt/rebind/RebindEnricherTest.java    |   2 +-
 .../core/mgmt/rebind/RebindEntityTest.java      |   8 +-
 .../core/mgmt/rebind/RebindFeedTest.java        |   2 +-
 .../core/policy/basic/PolicyConfigTest.java     |   2 +-
 .../policy/basic/PolicySubscriptionTest.java    |   2 +-
 .../core/sensor/HttpRequestSensorTest.java      |  85 ++
 .../brooklyn/core/sensor/StaticSensorTest.java  |  55 ++
 .../core/test/entity/TestApplication.java       |   2 +-
 .../brooklyn/core/test/entity/TestEntity.java   |   4 +-
 .../brooklyn/entity/group/DynamicGroupTest.java |   2 +-
 .../entity/group/DynamicMultiGroupTest.java     |   2 +-
 .../brooklyn/entity/stock/DataEntityTest.java   |   2 +-
 .../sensor/core/HttpRequestSensorTest.java      |  85 --
 .../brooklyn/sensor/core/StaticSensorTest.java  |  55 --
 ...stomAggregatingEnricherDeprecatedTest.groovy |   2 +-
 .../enricher/CustomAggregatingEnricherTest.java |   2 +-
 .../brooklyn/sensor/enricher/EnrichersTest.java |   2 +-
 ...SensorPropagatingEnricherDeprecatedTest.java |   2 +-
 .../enricher/SensorPropagatingEnricherTest.java |   4 +-
 .../TransformingEnricherDeprecatedTest.groovy   |   2 +-
 .../enricher/TransformingEnricherTest.java      |   2 +-
 .../YamlRollingTimeWindowMeanEnricherTest.java  |   4 +-
 .../YamlTimeWeightedDeltaEnricherTest.java      |   4 +-
 .../sensor/feed/ConfigToAttributesTest.java     |   4 +-
 .../sensor/feed/function/FunctionFeedTest.java  |   2 +-
 .../feed/http/HttpFeedIntegrationTest.java      |   2 +-
 .../brooklyn/sensor/feed/http/HttpFeedTest.java |   2 +-
 .../feed/shell/ShellFeedIntegrationTest.java    |   2 +-
 .../sensor/feed/ssh/SshFeedIntegrationTest.java |   2 +-
 .../WindowsPerformanceCounterFeedLiveTest.java  |   2 +-
 .../WindowsPerformanceCounterFeedTest.java      |   2 +-
 .../brooklyn/util/core/task/TasksTest.java      |   2 +-
 .../util/core/text/TemplateProcessorTest.java   |   2 +-
 .../brooklyn/demo/GlobalWebFabricExample.java   |   2 +-
 .../brooklyn/demo/CumulusRDFApplication.java    |   2 +-
 .../brooklyn/demo/NodeJsTodoApplication.java    |   4 +-
 .../demo/WebClusterDatabaseExample.java         |   6 +-
 .../demo/WebClusterDatabaseExampleApp.java      |   6 +-
 .../demo/WebClusterDatabaseExampleGroovy.groovy |   4 +-
 .../policy/jclouds/os/CreateUserPolicy.java     |   2 +-
 .../policy/autoscaling/AutoScalerPolicy.java    |   2 +-
 .../policy/enricher/HttpLatencyDetector.java    |   2 +-
 .../policy/followthesun/FollowTheSunPool.java   |   2 +-
 .../policy/ha/ConnectionFailureDetector.java    |   2 +-
 .../apache/brooklyn/policy/ha/HASensors.java    |   2 +-
 .../policy/ha/ServiceFailureDetector.java       |   2 +-
 .../brooklyn/policy/ha/ServiceReplacer.java     |   2 +-
 .../brooklyn/policy/ha/ServiceRestarter.java    |   2 +-
 .../policy/ha/SshMachineFailureDetector.java    |   2 +-
 .../loadbalancing/BalanceableContainer.java     |   2 +-
 .../loadbalancing/BalanceableWorkerPool.java    |   2 +-
 .../brooklyn/policy/loadbalancing/Movable.java  |   2 +-
 .../autoscaling/AutoScalerPolicyMetricTest.java |   4 +-
 .../autoscaling/AutoScalerPolicyRebindTest.java |   4 +-
 .../AutoScalerPolicyReconfigurationTest.java    |   2 +-
 .../autoscaling/AutoScalerPolicyTest.java       |   2 +-
 .../policy/enricher/DeltaEnrichersTests.groovy  |   2 +-
 .../enricher/HttpLatencyDetectorTest.java       |   2 +-
 .../policy/enricher/RebindEnricherTest.java     |   2 +-
 .../enricher/RollingMeanEnricherTest.groovy     |   2 +-
 .../RollingTimeWindowMeanEnricherTest.groovy    |   2 +-
 .../enricher/TimeFractionDeltaEnricherTest.java |   4 +-
 .../AbstractLoadBalancingPolicyTest.java        |   2 +-
 .../policy/loadbalancing/MockItemEntity.java    |   2 +-
 .../entity/database/derby/DerbyDatabase.java    |   4 +-
 .../entity/database/derby/DerbySchema.java      |   2 +-
 .../postgresql/PostgreSqlNodeSaltImpl.java      |   2 +-
 .../apache/brooklyn/entity/salt/SaltConfig.java |   2 +-
 .../brooklyn/entity/salt/SaltStackMaster.java   |   4 +-
 .../monitoring/zabbix/ZabbixMonitored.java      |   4 +-
 .../entity/monitoring/zabbix/ZabbixServer.java  |   2 +-
 .../nosql/hazelcast/HazelcastCluster.java       |   4 +-
 .../entity/nosql/hazelcast/HazelcastNode.java   |   6 +-
 .../nosql/infinispan/Infinispan5Server.java     |   4 +-
 .../entity/brooklynnode/BrooklynCluster.java    |   2 +-
 .../brooklynnode/BrooklynEntityMirror.java      |   2 +-
 .../brooklynnode/BrooklynEntityMirrorImpl.java  |   2 +-
 .../entity/brooklynnode/BrooklynNode.java       |  10 +-
 .../entity/java/JmxAttributeSensor.java         |   4 +-
 .../brooklyn/entity/java/UsesJavaMXBeans.java   |   4 +-
 .../apache/brooklyn/entity/java/UsesJmx.java    |   6 +-
 .../brooklyn/entity/java/VanillaJavaApp.java    |   2 +-
 .../entity/machine/MachineAttributes.java       |   2 +-
 .../entity/machine/pool/ServerPool.java         |   2 +-
 .../entity/machine/pool/ServerPoolImpl.java     |   2 +-
 .../AbstractSoftwareProcessWinRmDriver.java     |   2 +-
 .../software/base/AbstractVanillaProcess.java   |   2 +-
 .../entity/software/base/SameServerEntity.java  |   2 +-
 .../entity/software/base/SoftwareProcess.java   |   4 +-
 .../software/base/SoftwareProcessImpl.java      |   2 +-
 .../software/base/VanillaWindowsProcess.java    |   2 +-
 .../brooklyn/sensor/ssh/SshCommandSensor.java   |   2 +-
 .../winrm/WindowsPerformanceCounterSensors.java |   2 +-
 .../entity/brooklynnode/MockBrooklynNode.java   |   2 +-
 .../brooklyn/entity/java/EntityPollingTest.java |   2 +-
 .../entity/java/VanillaJavaAppRebindTest.java   |   2 +-
 .../base/SoftwareProcessEntityLatchTest.java    |   2 +-
 .../base/SoftwareProcessEntityTest.java         |   2 +-
 .../MachineLifecycleEffectorTasksTest.java      |   4 +-
 .../PortAttributeSensorAndConfigKeyTest.java    |   2 +-
 .../test/ssh/SshCommandIntegrationTest.java     |   2 +-
 .../brooklyn/sensor/feed/jmx/JmxFeedTest.java   |   6 +-
 .../sensor/feed/jmx/RebindJmxFeedTest.java      |   2 +-
 .../entity/database/DatastoreMixins.java        |   2 +-
 .../entity/database/crate/CrateNode.java        |   8 +-
 .../entity/database/mariadb/MariaDbNode.java    |   8 +-
 .../entity/database/mysql/MySqlCluster.java     |   4 +-
 .../entity/database/mysql/MySqlClusterImpl.java |   4 +-
 .../entity/database/mysql/MySqlNode.java        |   8 +-
 .../database/postgresql/PostgreSqlNode.java     |   4 +-
 .../postgresql/PostgreSqlSshDriver.java         |   2 +-
 .../entity/database/rubyrep/RubyRepNode.java    |   6 +-
 .../database/rubyrep/RubyRepNodeImpl.java       |   2 +-
 .../entity/messaging/MessageBroker.java         |   2 +-
 .../apache/brooklyn/entity/messaging/Queue.java |   4 +-
 .../apache/brooklyn/entity/messaging/Topic.java |   2 +-
 .../messaging/activemq/ActiveMQBroker.java      |   8 +-
 .../entity/messaging/amqp/AmqpExchange.java     |   2 +-
 .../entity/messaging/amqp/AmqpServer.java       |   4 +-
 .../brooklyn/entity/messaging/kafka/Kafka.java  |   2 +-
 .../entity/messaging/kafka/KafkaBroker.java     |   4 +-
 .../entity/messaging/kafka/KafkaCluster.java    |   4 +-
 .../entity/messaging/kafka/KafkaZooKeeper.java  |   2 +-
 .../entity/messaging/qpid/QpidBroker.java       |   4 +-
 .../entity/messaging/rabbit/RabbitBroker.java   |   6 +-
 .../brooklyn/entity/messaging/storm/Storm.java  |   6 +-
 .../entity/messaging/storm/StormSshDriver.java  |   2 +-
 .../entity/zookeeper/ZooKeeperEnsemble.java     |   4 +-
 .../entity/zookeeper/ZooKeeperNode.java         |   6 +-
 .../storm/StormAbstractCloudLiveTest.java       |   2 +-
 .../entity/monitoring/monit/MonitNode.java      |   6 +-
 .../monitoring/monit/MonitIntegrationTest.java  |   2 +-
 .../entity/network/bind/BindDnsServer.java      |   4 +-
 .../network/bind/PrefixAndIdEnricher.java       |   2 +-
 .../nosql/cassandra/CassandraDatacenter.java    |   4 +-
 .../entity/nosql/cassandra/CassandraNode.java   |   6 +-
 .../nosql/cassandra/CassandraNodeImpl.java      |   4 +-
 .../nosql/cassandra/CassandraNodeSshDriver.java |   2 +-
 .../nosql/couchbase/CouchbaseCluster.java       |   2 +-
 .../nosql/couchbase/CouchbaseClusterImpl.java   |   2 +-
 .../entity/nosql/couchbase/CouchbaseNode.java   |   6 +-
 .../nosql/couchbase/CouchbaseNodeSshDriver.java |   2 +-
 .../nosql/couchbase/CouchbaseSyncGateway.java   |   6 +-
 .../CouchbaseSyncGatewaySshDriver.java          |   2 +-
 .../entity/nosql/couchdb/CouchDBCluster.java    |   4 +-
 .../entity/nosql/couchdb/CouchDBNode.java       |   2 +-
 .../elasticsearch/ElasticSearchCluster.java     |   2 +-
 .../nosql/elasticsearch/ElasticSearchNode.java  |   8 +-
 .../nosql/mongodb/AbstractMongoDBServer.java    |   6 +-
 .../nosql/mongodb/MongoDBClientSshDriver.java   |   2 +-
 .../entity/nosql/mongodb/MongoDBReplicaSet.java |   2 +-
 .../entity/nosql/mongodb/MongoDBServer.java     |   4 +-
 .../sharding/CoLocatedMongoDBRouter.java        |   2 +-
 .../sharding/CoLocatedMongoDBRouterImpl.java    |   2 +-
 .../sharding/MongoDBConfigServerCluster.java    |   2 +-
 .../nosql/mongodb/sharding/MongoDBRouter.java   |   2 +-
 .../mongodb/sharding/MongoDBRouterCluster.java  |   2 +-
 .../sharding/MongoDBShardedDeployment.java      |   2 +-
 .../sharding/MongoDBShardedDeploymentImpl.java  |   2 +-
 .../entity/nosql/redis/RedisClusterImpl.java    |   2 +-
 .../brooklyn/entity/nosql/redis/RedisStore.java |   6 +-
 .../brooklyn/entity/nosql/riak/RiakCluster.java |   2 +-
 .../entity/nosql/riak/RiakClusterImpl.java      |   2 +-
 .../brooklyn/entity/nosql/riak/RiakNode.java    |   6 +-
 .../entity/nosql/riak/RiakNodeImpl.java         |   2 +-
 .../brooklyn/entity/nosql/solr/SolrServer.java  |   4 +-
 .../cassandra/CassandraNodeIntegrationTest.java |   2 +-
 .../entity/osgi/karaf/KarafContainer.java       |   6 +-
 .../entity/dns/AbstractGeoDnsService.java       |   2 +-
 .../dns/geoscaling/GeoscalingDnsService.java    |   2 +-
 .../entity/proxy/AbstractController.java        |   2 +-
 .../brooklyn/entity/proxy/LoadBalancer.java     |   6 +-
 .../entity/proxy/nginx/NginxController.java     |   4 +-
 .../brooklyn/entity/proxy/nginx/UrlMapping.java |   2 +-
 .../webapp/ControlledDynamicWebAppCluster.java  |   4 +-
 .../entity/webapp/DynamicWebAppCluster.java     |   2 +-
 .../entity/webapp/DynamicWebAppFabric.java      |   2 +-
 .../entity/webapp/JavaWebAppService.java        |   2 +-
 .../entity/webapp/WebAppServiceConstants.java   |   6 +-
 .../entity/webapp/WebAppServiceMetrics.java     |   8 +-
 .../entity/webapp/jboss/JBoss6Server.java       |   2 +-
 .../entity/webapp/jboss/JBoss7Server.java       |   8 +-
 .../entity/webapp/jetty/Jetty6Server.java       |   4 +-
 .../entity/webapp/tomcat/Tomcat8Server.java     |   2 +-
 .../entity/webapp/tomcat/TomcatServer.java      |   6 +-
 .../brooklyn/entity/proxy/StubAppServer.java    |   2 +-
 .../nginx/NginxHttpsSslIntegrationTest.java     |   2 +-
 .../app/ClusterWebServerDatabaseSample.java     |   6 +-
 .../spi/dsl/methods/BrooklynDslCommon.java      |   2 +-
 .../brooklyn/spi/dsl/methods/DslComponent.java  |   4 +-
 .../camp/brooklyn/DslAndRebindYamlTest.java     |   2 +-
 .../EnrichersSlightlySimplerYamlTest.java       |   2 +-
 .../camp/brooklyn/EntitiesYamlTest.java         |   2 +-
 .../TestSensorAndEffectorInitializer.java       |   2 +-
 .../brooklyn/VanillaBashNetcatYamlTest.java     |   2 +-
 .../brooklyn/qa/load/SimulatedTheeTierApp.java  |   4 +-
 .../qa/longevity/webcluster/WebClusterApp.java  |   2 +-
 .../rest/resources/ApplicationResource.java     |   2 +-
 .../brooklyn/rest/resources/SensorResource.java |   2 +-
 .../brooklyn/rest/domain/SensorSummaryTest.java |   2 +-
 .../rest/resources/DescendantsTest.java         |   2 +-
 .../rest/resources/SensorResourceTest.java      |   2 +-
 .../testing/mocks/RestMockSimpleEntity.java     |   2 +-
 275 files changed, 2667 insertions(+), 2667 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java b/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
index 167e208..df03c29 100644
--- a/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
+++ b/core/src/main/java/org/apache/brooklyn/core/config/ConfigKeys.java
@@ -24,10 +24,10 @@ import javax.annotation.Nonnull;
 
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.BasicConfigKey.BasicConfigKeyOverwriting;
-import org.apache.brooklyn.sensor.core.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.TemplatedStringAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.TemplatedStringAttributeSensorAndConfigKey;
 import org.apache.brooklyn.util.core.config.ConfigBag;
 import org.apache.brooklyn.util.text.Strings;
 import org.apache.brooklyn.util.time.Duration;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java b/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
index 3c08831..d35068f 100644
--- a/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
+++ b/core/src/main/java/org/apache/brooklyn/core/effector/AddSensor.java
@@ -26,7 +26,7 @@ import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.core.config.ConfigBag;
 import org.apache.brooklyn.util.guava.Maybe;
 import org.apache.brooklyn.util.javalang.Boxing;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/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 ea6bda7..994961c 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
@@ -77,10 +77,10 @@ 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.core.policy.AbstractPolicy;
-import org.apache.brooklyn.sensor.core.AttributeMap;
-import org.apache.brooklyn.sensor.core.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.BasicNotificationSensor;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.AttributeMap;
+import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.sensor.enricher.AbstractEnricher;
 import org.apache.brooklyn.sensor.feed.AbstractFeed;
 import org.apache.brooklyn.sensor.feed.ConfigToAttributes;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java b/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
index e585e5d..80ed765 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java
@@ -27,11 +27,11 @@ import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.api.sensor.Sensor;
 import org.apache.brooklyn.core.config.render.RendererHints;
 import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
-import org.apache.brooklyn.sensor.core.BasicAttributeSensor;
-import org.apache.brooklyn.sensor.core.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.BasicNotificationSensor;
-import org.apache.brooklyn.sensor.core.PortAttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
+import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.net.UserAndHostAndPort;
 
 import com.google.common.annotations.Beta;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java b/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
index 716f934..cedccb8 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java
@@ -27,9 +27,9 @@ import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.TemplatedStringAttributeSensorAndConfigKey;
 import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.sensor.core.AttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.TemplatedStringAttributeSensorAndConfigKey;
 import org.apache.brooklyn.util.core.internal.ssh.ShellTool;
 import org.apache.brooklyn.util.core.internal.ssh.SshTool;
 import org.apache.brooklyn.util.time.Duration;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/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 ca561e1..c1a77ad 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
@@ -77,7 +77,7 @@ import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 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.sensor.core.DependentConfiguration;
+import org.apache.brooklyn.core.sensor.DependentConfiguration;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.ResourceUtils;
 import org.apache.brooklyn.util.core.config.ConfigBag;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
index ba2992f..c4f383d 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityTasks.java
@@ -21,7 +21,7 @@ package org.apache.brooklyn.core.entity;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.mgmt.Task;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.sensor.core.DependentConfiguration;
+import org.apache.brooklyn.core.sensor.DependentConfiguration;
 import org.apache.brooklyn.util.collections.CollectionFunctionals;
 import org.apache.brooklyn.util.time.Duration;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java b/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
index d8fec0e..388eb17 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/trait/Changeable.java
@@ -20,8 +20,8 @@ package org.apache.brooklyn.core.entity.trait;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.sensor.core.BasicNotificationSensor;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.BasicNotificationSensor;
+import org.apache.brooklyn.core.sensor.Sensors;
 
 /**
  * A collection of entities that can change.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java b/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
index 1d4d4c1..718b97e 100644
--- a/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
+++ b/core/src/main/java/org/apache/brooklyn/core/location/dynamic/LocationOwner.java
@@ -26,8 +26,8 @@ import org.apache.brooklyn.api.location.LocationDefinition;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.sensor.core.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.core.flags.SetFromFlag;
 
 import com.google.common.annotations.Beta;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
index e1d704b..b232ce4 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
@@ -59,7 +59,7 @@ import org.apache.brooklyn.core.mgmt.rebind.dto.BasicFeedMemento;
 import org.apache.brooklyn.core.mgmt.rebind.dto.BasicLocationMemento;
 import org.apache.brooklyn.core.mgmt.rebind.dto.BasicPolicyMemento;
 import org.apache.brooklyn.core.mgmt.rebind.dto.MutableBrooklynMemento;
-import org.apache.brooklyn.sensor.core.BasicAttributeSensor;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
 import org.apache.brooklyn.util.core.xstream.XmlSerializer;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.text.Strings;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java
index 7da8441..7418813 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java
@@ -39,7 +39,7 @@ import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.core.entity.AbstractEntity;
 import org.apache.brooklyn.core.objs.BrooklynTypes;
-import org.apache.brooklyn.sensor.core.Sensors;
+import org.apache.brooklyn.core.sensor.Sensors;
 
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.collect.Lists;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeMap.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeMap.java b/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeMap.java
new file mode 100644
index 0000000..b584f24
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeMap.java
@@ -0,0 +1,202 @@
+/*
+ * 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.sensor;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.core.BrooklynLogging;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * A {@link Map} of {@link Entity} attribute values.
+ */
+public final class AttributeMap implements Serializable {
+
+    private static final long serialVersionUID = -6834883734250888344L;
+
+    static final Logger log = LoggerFactory.getLogger(AttributeMap.class);
+
+    private static enum Marker {
+        NULL;
+    }
+    
+    private final AbstractEntity entity;
+
+    // Assumed to be something like a ConcurrentMap passed in.
+    private final Map<Collection<String>, Object> values;
+
+    /**
+     * Creates a new AttributeMap.
+     *
+     * @param entity the EntityLocal this AttributeMap belongs to.
+     * @throws IllegalArgumentException if entity is null
+     */
+    public AttributeMap(AbstractEntity entity, Map<Collection<String>, Object> storage) {
+        this.entity = checkNotNull(entity, "entity must be specified");
+        this.values = checkNotNull(storage, "storage map must not be null");
+    }
+
+    public Map<Collection<String>, Object> asRawMap() {
+        return ImmutableMap.copyOf(values);
+    }
+
+    public Map<String, Object> asMap() {
+        Map<String, Object> result = Maps.newLinkedHashMap();
+        for (Map.Entry<Collection<String>, Object> entry : values.entrySet()) {
+            String sensorName = Joiner.on('.').join(entry.getKey());
+            Object val = (isNull(entry.getValue())) ? null : entry.getValue();
+            result.put(sensorName, val);
+        }
+        return result;
+    }
+    
+    /**
+     * Updates the value.
+     *
+     * @param path the path to the value.
+     * @param newValue the new value
+     * @return the old value.
+     * @throws IllegalArgumentException if path is null or empty
+     */
+    // TODO path must be ordered(and legal to contain duplicates like "a.b.a"; list would be better
+    public <T> T update(Collection<String> path, T newValue) {
+        checkPath(path);
+
+        if (newValue == null) {
+            newValue = typedNull();
+        }
+
+        if (log.isTraceEnabled()) {
+            log.trace("setting sensor {}={} for {}", new Object[] {path, newValue, entity});
+        }
+
+        @SuppressWarnings("unchecked")
+        T oldValue = (T) values.put(path, newValue);
+        return (isNull(oldValue)) ? null : oldValue;
+    }
+
+    private void checkPath(Collection<String> path) {
+        Preconditions.checkNotNull(path, "path can't be null");
+        Preconditions.checkArgument(!path.isEmpty(), "path can't be empty");
+    }
+
+    public <T> T update(AttributeSensor<T> attribute, T newValue) {
+        T oldValue = updateWithoutPublishing(attribute, newValue);
+        entity.emitInternal(attribute, newValue);
+        return oldValue;
+    }
+    
+    public <T> T updateWithoutPublishing(AttributeSensor<T> attribute, T newValue) {
+        if (log.isTraceEnabled()) {
+            Object oldValue = getValue(attribute);
+            if (!Objects.equal(oldValue, newValue != null)) {
+                log.trace("setting attribute {} to {} (was {}) on {}", new Object[] {attribute.getName(), newValue, oldValue, entity});
+            } else {
+                log.trace("setting attribute {} to {} (unchanged) on {}", new Object[] {attribute.getName(), newValue, this});
+            }
+        }
+
+        T oldValue = (T) update(attribute.getNameParts(), newValue);
+        
+        return (isNull(oldValue)) ? null : oldValue;
+    }
+
+    /**
+     * Where atomicity is desired, the methods in this class synchronize on the {@link #values} map.
+     */
+    public <T> T modify(AttributeSensor<T> attribute, Function<? super T, Maybe<T>> modifier) {
+        synchronized (values) {
+            T oldValue = getValue(attribute);
+            Maybe<? extends T> newValue = modifier.apply(oldValue);
+
+            if (newValue.isPresent()) {
+                if (log.isTraceEnabled()) log.trace("modified attribute {} to {} (was {}) on {}", new Object[] {attribute.getName(), newValue, oldValue, entity});
+                return update(attribute, newValue.get());
+            } else {
+                if (log.isTraceEnabled()) log.trace("modified attribute {} unchanged; not emitting on {}", new Object[] {attribute.getName(), newValue, this});
+                return oldValue;
+            }
+        }
+    }
+
+    public void remove(AttributeSensor<?> attribute) {
+        BrooklynLogging.log(log, BrooklynLogging.levelDebugOrTraceIfReadOnly(entity),
+            "removing attribute {} on {}", attribute.getName(), entity);
+
+        remove(attribute.getNameParts());
+    }
+
+    // TODO path must be ordered(and legal to contain duplicates like "a.b.a"; list would be better
+    public void remove(Collection<String> path) {
+        checkPath(path);
+
+        if (log.isTraceEnabled()) {
+            log.trace("removing sensor {} for {}", new Object[] {path, entity});
+        }
+
+        values.remove(path);
+    }
+
+    /**
+     * Gets the value
+     *
+     * @param path the path of the value to get
+     * @return the value
+     * @throws IllegalArgumentException path is null or empty.
+     */
+    public Object getValue(Collection<String> path) {
+        // TODO previously this would return a map of the sub-tree if the path matched a prefix of a group of sensors, 
+        // or the leaf value if only one value. Arguably that is not required - what is/was the use-case?
+        // 
+        checkPath(path);
+        Object result = values.get(path);
+        return (isNull(result)) ? null : result;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T getValue(AttributeSensor<T> sensor) {
+        return (T) TypeCoercions.coerce(getValue(sensor.getNameParts()), sensor.getType());
+    }
+
+    @SuppressWarnings("unchecked")
+    private <T> T typedNull() {
+        return (T) Marker.NULL;
+    }
+    
+    private boolean isNull(Object t) {
+        return t == Marker.NULL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeSensorAndConfigKey.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeSensorAndConfigKey.java b/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeSensorAndConfigKey.java
new file mode 100644
index 0000000..940d949
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/AttributeSensorAndConfigKey.java
@@ -0,0 +1,147 @@
+/*
+ * 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.sensor;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.BasicConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.AbstractEntity;
+import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
+import org.apache.brooklyn.sensor.feed.ConfigToAttributes;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.reflect.TypeToken;
+
+/**
+* A {@link Sensor} describing an attribute that can be configured with inputs that are used to derive the final value.
+* <p>
+* The {@link ConfigKey} will have the same name and description as the sensor but not necessarily the same type.
+* Conversion to set the sensor value from the config key must be supplied in a subclass.
+* <p>
+* {@link ConfigToAttributes#apply(EntityLocal, AttributeSensorAndConfigKey)} is useful to set the attribute from the sensor.
+*/
+public abstract class AttributeSensorAndConfigKey<ConfigType,SensorType> extends BasicAttributeSensor<SensorType> 
+        implements ConfigKey.HasConfigKey<ConfigType> {
+    private static final long serialVersionUID = -3103809215973264600L;
+    private static final Logger log = LoggerFactory.getLogger(AttributeSensorAndConfigKey.class);
+
+    private ConfigKey<ConfigType> configKey;
+
+    public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name) {
+        this(configType, sensorType, name, name, null);
+    }
+    
+    public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description) {
+        this(TypeToken.of(configType), TypeToken.of(sensorType), name, description, null);
+    }
+    
+    public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) {
+        this(TypeToken.of(configType), TypeToken.of(sensorType), name, description, defaultValue);
+    }
+
+    public AttributeSensorAndConfigKey(TypeToken<ConfigType> configType, TypeToken<SensorType> sensorType, String name) {
+        this(configType, sensorType, name, null);
+    }
+
+    public AttributeSensorAndConfigKey(TypeToken<ConfigType> configType, TypeToken<SensorType> sensorType, String name, String description) {
+        this(configType, sensorType, name, description, null);
+    }
+
+    public AttributeSensorAndConfigKey(TypeToken<ConfigType> configType, TypeToken<SensorType> sensorType, String name, String description, Object defaultValue) {
+        super(sensorType, name, description);
+        ConfigType defaultValueTyped;
+        try {
+            defaultValueTyped = TypeCoercions.coerce(defaultValue, configType);
+        } catch (Exception e) {
+            log.warn("Invalid default value '"+defaultValue+"' for "+name+" (rethrowing: "+e, e);
+            throw Exceptions.propagate(e);
+        }
+        configKey = new BasicConfigKey<ConfigType>(configType, name, description, defaultValueTyped);
+    }
+
+    public AttributeSensorAndConfigKey(AttributeSensorAndConfigKey<ConfigType,SensorType> orig, ConfigType defaultValue) {
+        super(orig.getTypeToken(), orig.getName(), orig.getDescription());
+        configKey = ConfigKeys.newConfigKeyWithDefault(orig.configKey, 
+                TypeCoercions.coerce(defaultValue, orig.configKey.getTypeToken()));
+    }
+
+    public ConfigKey<ConfigType> getConfigKey() { return configKey; }
+    
+    /** returns the sensor value for this attribute on the given entity, if present,
+     * otherwise works out what the sensor value should be based on the config key's value
+     * <p>
+     * calls to this may allocate resources (e.g. ports) so should be called only once and 
+     * then (if non-null) assigned as the sensor's value
+     * <p>
+     * <b>(for this reason this method should generally not be invoked by callers except in tests and by the framework,
+     * and similarly should not be overridden; implement {@link #convertConfigToSensor(Object, Entity)} instead for single-execution calls.
+     * the framework calls this from {@link AbstractEntity#setAttribute(AttributeSensorAndConfigKey)} 
+     * typically via {@link ConfigToAttributes#apply(EntityLocal)} e.g. from SoftwareProcessImpl.preStart().)
+     * </b> 
+     */
+    public SensorType getAsSensorValue(Entity e) {
+        SensorType sensorValue = e.getAttribute(this);
+        if (sensorValue!=null) return sensorValue;
+        
+        ConfigType v = ((EntityLocal)e).getConfig(this);
+        try {
+            return convertConfigToSensor(v, e);
+        } catch (Throwable t) {
+            throw new IllegalArgumentException("Cannot convert config value "+v+" for sensor "+this+": "+t, t);
+        }
+    }
+
+    /**
+     * @see {@link #getAsSensorValue(Entity)}
+     * 
+     * Differs in that the config value is converted based on just the management context, rather
+     * than for a specific entity. For example, useful if using {@link BrooklynConfigKeys} in BrooklynWebServer.
+     * </b> 
+     */
+    public SensorType getAsSensorValue(ManagementContext managementContext) {
+        ConfigType v = managementContext.getConfig().getConfig(this);
+        try {
+            return convertConfigToSensor(v, managementContext);
+        } catch (Throwable t) {
+            throw new IllegalArgumentException("Cannot convert config value "+v+" for sensor "+this+": "+t, t);
+        }
+    }
+
+    /** converts the given ConfigType value to the corresponding SensorType value, 
+     * with respect to the given entity
+     * <p>
+     * this is invoked after checks whether the entity already has a value for the sensor,
+     * and the entity-specific config value is passed for convenience if set, 
+     * otherwise the config key default value is passed for convenience
+     * <p>
+     * this message should be allowed to return null if the conversion cannot be completed at this time */
+    protected abstract SensorType convertConfigToSensor(ConfigType value, Entity entity);
+
+    /**
+     * @see {@link #convertConfigToSensor(Object, Entity)}
+     */
+    protected abstract SensorType convertConfigToSensor(ConfigType value, ManagementContext entity);
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensor.java
new file mode 100644
index 0000000..978e4a4
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensor.java
@@ -0,0 +1,62 @@
+/*
+ * 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.sensor;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+
+import com.google.common.reflect.TypeToken;
+
+/**
+ * A {@link Sensor} describing an attribute change.
+ */
+public class BasicAttributeSensor<T> extends BasicSensor<T> implements AttributeSensor<T> {
+    private static final long serialVersionUID = -2493209215974820300L;
+    
+    private final SensorPersistenceMode persistence;
+
+    public BasicAttributeSensor(Class<T> type, String name) {
+        this(type, name, name);
+    }
+    
+    public BasicAttributeSensor(Class<T> type, String name, String description) {
+        this(TypeToken.of(type), name, description);
+    }
+    
+    public BasicAttributeSensor(TypeToken<T> typeToken, String name) {
+        this(typeToken, name, name);
+    }
+    
+    public BasicAttributeSensor(TypeToken<T> typeToken, String name, String description) {
+        this(typeToken, name, description, SensorPersistenceMode.REQUIRED);
+    }
+    
+    public BasicAttributeSensor(TypeToken<T> typeToken, String name, String description, SensorPersistenceMode persistence) {
+        super(typeToken, name, description);
+        this.persistence = checkNotNull(persistence, "persistence");
+    }
+
+    @Override
+    public SensorPersistenceMode getPersistenceMode() {
+        // persistence could be null if deserializing state written by an old version; in which case default to 'required'
+        return (persistence != null) ? persistence : SensorPersistenceMode.REQUIRED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensorAndConfigKey.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensorAndConfigKey.java b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensorAndConfigKey.java
new file mode 100644
index 0000000..7c86112
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicAttributeSensorAndConfigKey.java
@@ -0,0 +1,114 @@
+/*
+ * 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.sensor;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.config.ConfigKey;
+
+import com.google.common.reflect.TypeToken;
+
+/**
+ * A {@link Sensor} describing an attribute that can be configured with a default value.
+ *
+ * The {@link ConfigKey} has the same type, name and description as the sensor,
+ * and is typically used to populate the sensor's value at runtime.
+ */
+public class BasicAttributeSensorAndConfigKey<T> extends AttributeSensorAndConfigKey<T,T> {
+    
+    private static final long serialVersionUID = -2204916730008559688L;
+
+    public BasicAttributeSensorAndConfigKey(Class<T> type, String name) {
+        this(type, name, name, null);
+    }
+    public BasicAttributeSensorAndConfigKey(Class<T> type, String name, String description) {
+        this(type, name, description, null);
+    }
+    public BasicAttributeSensorAndConfigKey(Class<T> type, String name, String description, T defaultValue) {
+        super(type, type, name, description, defaultValue);
+    }
+
+    public BasicAttributeSensorAndConfigKey(TypeToken<T> type, String name) {
+        super(type, type, name);
+    }
+
+    public BasicAttributeSensorAndConfigKey(TypeToken<T> type, String name, String description) {
+        super(type, type, name, description);
+    }
+
+    public BasicAttributeSensorAndConfigKey(TypeToken<T> type, String name, String description, Object defaultValue) {
+        super(type, type, name, description, defaultValue);
+    }
+
+    public BasicAttributeSensorAndConfigKey(AttributeSensorAndConfigKey<T,T> orig, T defaultValue) {
+        super(orig, defaultValue);
+    }
+    
+    @Override
+    protected T convertConfigToSensor(T value, Entity entity) { return value; }
+
+    @Override
+    protected T convertConfigToSensor(T value, ManagementContext managementContext) { return value; }
+    
+    public static class StringAttributeSensorAndConfigKey extends BasicAttributeSensorAndConfigKey<String> {
+
+        private static final long serialVersionUID = 810512615528081865L;
+
+        public StringAttributeSensorAndConfigKey(AttributeSensorAndConfigKey<String,String> orig, String defaultValue) {
+            super(orig, defaultValue);
+        }
+
+        public StringAttributeSensorAndConfigKey(String name, String description, String defaultValue) {
+            super(String.class, name, description, defaultValue);
+        }
+
+        public StringAttributeSensorAndConfigKey(String name, String description) {
+            super(String.class, name, description);
+        }
+
+        public StringAttributeSensorAndConfigKey(String name) {
+            super(String.class, name);
+        }
+        
+    }
+    
+    public static class IntegerAttributeSensorAndConfigKey extends BasicAttributeSensorAndConfigKey<Integer> {
+
+        private static final long serialVersionUID = 7159564523829723929L;
+
+        public IntegerAttributeSensorAndConfigKey(AttributeSensorAndConfigKey<Integer,Integer> orig, Integer defaultValue) {
+            super(orig, defaultValue);
+        }
+
+        public IntegerAttributeSensorAndConfigKey(String name, String description, Integer defaultValue) {
+            super(Integer.class, name, description, defaultValue);
+        }
+
+        public IntegerAttributeSensorAndConfigKey(String name, String description) {
+            super(Integer.class, name, description);
+        }
+
+        public IntegerAttributeSensorAndConfigKey(String name) {
+            super(Integer.class, name);
+        }
+        
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/BasicNotificationSensor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/BasicNotificationSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicNotificationSensor.java
new file mode 100644
index 0000000..d3a11cf
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicNotificationSensor.java
@@ -0,0 +1,36 @@
+/*
+ * 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.sensor;
+
+import org.apache.brooklyn.api.sensor.Sensor;
+
+/**
+ * A {@link Sensor} used to notify subscribers about events.
+ */
+public class BasicNotificationSensor<T> extends BasicSensor<T> {
+    private static final long serialVersionUID = -7670909215973264600L;
+
+    public BasicNotificationSensor(Class<T> type, String name) {
+        this(type, name, name);
+    }
+    
+    public BasicNotificationSensor(Class<T> type, String name, String description) {
+        super(type, name, description);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensor.java
new file mode 100644
index 0000000..efb610f
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensor.java
@@ -0,0 +1,114 @@
+/*
+ * 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.sensor;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.util.guava.TypeTokens;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Parent for all {@link Sensor}s.
+ */
+public class BasicSensor<T> implements Sensor<T> {
+    private static final long serialVersionUID = -3762018534086101323L;
+    
+    private static final Splitter dots = Splitter.on('.');
+
+    private TypeToken<T> typeToken;
+    private Class<? super T> type;
+    private String name;
+    private String description;
+    private transient List<String> nameParts;
+    
+    // FIXME In groovy, fields were `public final` with a default constructor; do we need the gson?
+    public BasicSensor() { /* for gson */ }
+
+    /** name is typically a dot-separated identifier; description is optional */
+    public BasicSensor(Class<T> type, String name) {
+        this(type, name, name);
+    }
+    
+    public BasicSensor(Class<T> type, String name, String description) {
+        this(TypeToken.of(type), name, description);
+    }
+    
+    public BasicSensor(TypeToken<T> typeToken, String name, String description) {
+        this.typeToken = TypeTokens.getTypeTokenIfNotRaw(checkNotNull(typeToken, "typeToken"));
+        this.type = TypeTokens.getRawTypeIfRaw(typeToken);
+        this.name = checkNotNull(name, "name");
+        this.description = description;
+    }
+
+    /** @see Sensor#getTypeToken() */
+    public TypeToken<T> getTypeToken() { return TypeTokens.getTypeToken(typeToken, type); }
+    
+    /** @see Sensor#getType() */
+    public Class<? super T> getType() { return TypeTokens.getRawType(typeToken, type); }
+ 
+    /** @see Sensor#getTypeName() */
+    public String getTypeName() { 
+        return getType().getName();
+    }
+ 
+    /** @see Sensor#getName() */
+    public String getName() { return name; }
+ 
+    /** @see Sensor#getNameParts() */
+    public synchronized List<String> getNameParts() {
+        if (nameParts==null) nameParts = ImmutableList.copyOf(dots.split(name));
+        return nameParts; 
+    }
+ 
+    /** @see Sensor#getDescription() */
+    public String getDescription() { return description; }
+    
+    /** @see Sensor#newEvent(Entity, Object) */
+    public SensorEvent<T> newEvent(Entity producer, T value) {
+        return new BasicSensorEvent<T>(this, producer, value);
+    }
+    
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(getTypeName(), name, description);
+    }
+ 
+    @Override
+    public boolean equals(Object other) {
+        if (this==other) return true;
+        if (!(other instanceof BasicSensor)) return false;
+        BasicSensor<?> o = (BasicSensor<?>) other;
+        
+        return Objects.equal(getTypeName(), o.getTypeName()) && Objects.equal(name, o.name) && Objects.equal(description, o.description);
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("Sensor: %s (%s)", name, getTypeName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2a78e273/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensorEvent.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensorEvent.java b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensorEvent.java
new file mode 100644
index 0000000..44453fc
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/BasicSensorEvent.java
@@ -0,0 +1,112 @@
+/*
+ * 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.sensor;
+
+import java.util.ConcurrentModificationException;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Objects;
+
+/**
+ * A {@link SensorEvent} containing data from a {@link Sensor} generated by an {@link Entity}.
+ */
+public class BasicSensorEvent<T> implements SensorEvent<T> {
+    
+    private static final Logger log = LoggerFactory.getLogger(BasicSensorEvent.class);
+    
+    private final Sensor<T> sensor;
+    private final Entity source;
+    private final T value;
+    private final long timestamp;
+    
+    public T getValue() { return value; }
+
+    public Sensor<T> getSensor() { return sensor; }
+
+    public Entity getSource() { return source; }
+
+    public long getTimestamp() { return timestamp; }
+
+    /** arguments should not be null (except in certain limited testing situations) */
+    public BasicSensorEvent(Sensor<T> sensor, Entity source, T value) {
+        this(sensor, source, value, System.currentTimeMillis());
+    }
+    
+    public BasicSensorEvent(Sensor<T> sensor, Entity source, T value, long timestamp) {
+        this.sensor = sensor;
+        this.source = source;
+        this.value = value;
+        this.timestamp = timestamp;
+    }
+    
+    public static <T> SensorEvent<T> of(Sensor<T> sensor, Entity source, T value, long timestamp) {
+        return new BasicSensorEvent<T>(sensor, source, value, timestamp);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> SensorEvent<T> ofUnchecked(Sensor<T> sensor, Entity source, Object value, long timestamp) {
+        return new BasicSensorEvent<T>(sensor, source, (T)value, timestamp);
+    }
+
+    public static <T> SensorEvent<T> of(Sensor<T> sensor, Entity source, T value) {
+        return new BasicSensorEvent<T>(sensor, source, value);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> SensorEvent<T> ofUnchecked(Sensor<T> sensor, Entity source, Object value) {
+        return new BasicSensorEvent<T>(sensor, source, (T)value);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(sensor, source, value);
+    }   
+
+    /**
+     * Any SensorEvents are equal if their sensor, source and value are equal.
+     * Ignore timestamp for ease of use in unit tests.   
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof SensorEvent)) return false;
+        SensorEvent<?> other = (SensorEvent<?>) o;
+        return Objects.equal(sensor, other.getSensor()) && Objects.equal(source, other.getSource()) &&
+                Objects.equal(value, other.getValue());
+    }
+    
+    @Override
+    public String toString() {
+        try {
+            return source+"."+sensor+"="+value+" @ "+timestamp;
+        } catch (ConcurrentModificationException e) {
+            // TODO occasional CME observed on shutdown, wrt map, e.g. in UrlMappingTest
+            // transformations should set a copy of the map; see e.g. in ServiceStateLogic.updateMapSensor
+            String result = getClass()+":"+source+"."+sensor+"@"+timestamp;
+            log.warn("Error creating string for " + result + " (ignoring): " + e);
+            if (log.isDebugEnabled())
+                log.debug("Trace for error creating string for " + result + " (ignoring): " + e, e);
+            return result;
+        }
+    }
+}