brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [03/13] incubator-brooklyn git commit: Use entity.sensors().* etc, instead of deprecated methods
Date Wed, 07 Oct 2015 09:31:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidDestinationImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidDestinationImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidDestinationImpl.java
index 155e43a..d475c5e 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidDestinationImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidDestinationImpl.java
@@ -61,7 +61,7 @@ public abstract class QpidDestinationImpl extends JMSDestinationImpl implements
         // But tricky for if brooklyn were distributed
         try {
             if (virtualHost == null) virtualHost = getConfig(QpidBroker.VIRTUAL_HOST_NAME);
-            setAttribute(QpidBroker.VIRTUAL_HOST_NAME, virtualHost);
+            sensors().set(QpidBroker.VIRTUAL_HOST_NAME, virtualHost);
             virtualHostManager = new ObjectName(format("org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=\"%s\"", virtualHost));
             jmxHelper = new JmxHelper((EntityLocal)getParent());
         } catch (MalformedObjectNameException e) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidQueueImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidQueueImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidQueueImpl.java
index e9d6b95..6362c54 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidQueueImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidQueueImpl.java
@@ -35,7 +35,7 @@ public class QpidQueueImpl extends QpidDestinationImpl implements QpidQueue {
     @Override
     public void onManagementStarting() {
         super.onManagementStarting();
-        setAttribute(QUEUE_NAME, getName());
+        sensors().set(QUEUE_NAME, getName());
         try {
             exchange = new ObjectName(format("org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=\"%s\",name=\"%s\",ExchangeType=direct", virtualHost, getExchangeName()));
         } catch (MalformedObjectNameException e) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidTopicImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidTopicImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidTopicImpl.java
index 02454fe..39b0667 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidTopicImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/qpid/QpidTopicImpl.java
@@ -34,7 +34,7 @@ public class QpidTopicImpl extends QpidDestinationImpl implements QpidTopic {
     @Override
     public void onManagementStarting() {
         super.onManagementStarting();
-        setAttribute(TOPIC_NAME, getName());
+        sensors().set(TOPIC_NAME, getName());
         try {
             String virtualHost = getParent().getVirtualHost();
             exchange = new ObjectName(format("org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=\"%s\",name=\"%s\",ExchangeType=topic", virtualHost, getExchangeName()));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java
index f4026bd..1227365 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java
@@ -71,7 +71,7 @@ public class RabbitBrokerImpl extends SoftwareProcessImpl implements RabbitBroke
 
     public void setBrokerUrl() {
         String urlFormat = "amqp://guest:guest@%s:%d/%s";
-        setAttribute(BROKER_URL, format(urlFormat, getAttribute(HOSTNAME), getAttribute(AMQP_PORT), getAttribute(VIRTUAL_HOST_NAME)));
+        sensors().set(BROKER_URL, format(urlFormat, getAttribute(HOSTNAME), getAttribute(AMQP_PORT), getAttribute(VIRTUAL_HOST_NAME)));
     }
 
     public RabbitQueue createQueue(Map properties) {
@@ -95,7 +95,7 @@ public class RabbitBrokerImpl extends SoftwareProcessImpl implements RabbitBroke
         setBrokerUrl();
 
         if (getEnableManagementPlugin()) {
-            setAttribute(MANAGEMENT_URL, format("http://%s:%s/", getAttribute(HOSTNAME), getAttribute(MANAGEMENT_PORT)));
+            sensors().set(MANAGEMENT_URL, format("http://%s:%s/", getAttribute(HOSTNAME), getAttribute(MANAGEMENT_PORT)));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitDestination.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitDestination.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitDestination.java
index 768c36c..2756bf9 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitDestination.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitDestination.java
@@ -47,7 +47,7 @@ public abstract class RabbitDestination extends AbstractEntity implements AmqpEx
         
         exchange = (getConfig(EXCHANGE_NAME) != null) ? getConfig(EXCHANGE_NAME) : getDefaultExchangeName();
         virtualHost = getConfig(RabbitBroker.VIRTUAL_HOST_NAME);
-        setAttribute(RabbitBroker.VIRTUAL_HOST_NAME, virtualHost);
+        sensors().set(RabbitBroker.VIRTUAL_HOST_NAME, virtualHost);
         
         machine = (SshMachineLocation) Iterables.find(getParent().getLocations(), Predicates.instanceOf(SshMachineLocation.class));
         shellEnvironment = getParent().getShellEnvironment();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitQueue.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitQueue.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitQueue.java
index 037085b..03b3d68 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitQueue.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/rabbit/RabbitQueue.java
@@ -39,7 +39,7 @@ public class RabbitQueue extends RabbitDestination implements Queue {
 
     @Override
     public void create() {
-        setAttribute(QUEUE_NAME, getName());
+        sensors().set(QUEUE_NAME, getName());
         super.create();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormDeploymentImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormDeploymentImpl.java
index 61d6a4e..7b26ed9 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormDeploymentImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormDeploymentImpl.java
@@ -49,12 +49,12 @@ public class StormDeploymentImpl extends BasicStartableImpl implements StormDepl
             ZooKeeperEnsemble.class).configure(
                 ZooKeeperEnsemble.INITIAL_SIZE, getConfig(ZOOKEEPERS_COUNT)));
         
-        setConfig(Storm.ZOOKEEPER_ENSEMBLE, zooKeeperEnsemble);
+        config().set(Storm.ZOOKEEPER_ENSEMBLE, zooKeeperEnsemble);
         
         Storm nimbus = addChild(EntitySpec.create(Storm.class).configure(ROLE, NIMBUS));
         
-        setConfig(Storm.NIMBUS_ENTITY, nimbus);
-        setConfig(Storm.START_MUTEX, new Object());
+        config().set(Storm.NIMBUS_ENTITY, nimbus);
+        config().set(Storm.START_MUTEX, new Object());
         
         addChild(EntitySpec.create(DynamicCluster.class)
             .configure(DynamicCluster.MEMBER_SPEC, 
@@ -64,11 +64,11 @@ public class StormDeploymentImpl extends BasicStartableImpl implements StormDepl
         
         Storm ui = addChild(EntitySpec.create(Storm.class).configure(ROLE, UI));
         
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .propagating(Storm.STORM_UI_URL)
                 .from(ui)
                 .build());
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .propagating(Attributes.HOSTNAME)
                 .from(nimbus)
                 .build());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormImpl.java
index a1fc3d8..71f145c 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/messaging/storm/StormImpl.java
@@ -72,7 +72,7 @@ public class StormImpl extends SoftwareProcessImpl implements Storm {
         Time.sleep(Duration.TEN_SECONDS);
 
         if (getRole() == Role.UI) {
-            setAttribute(STORM_UI_URL, "http://"+getAttribute(Attributes.HOSTNAME)+":"+getAttribute(UI_PORT)+"/");
+            sensors().set(STORM_UI_URL, "http://"+getAttribute(Attributes.HOSTNAME)+":"+getAttribute(UI_PORT)+"/");
         }
 
         if (((JavaSoftwareProcessDriver)getDriver()).isJmxEnabled()) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/messaging/src/main/java/org/apache/brooklyn/entity/zookeeper/ZooKeeperEnsembleImpl.java
----------------------------------------------------------------------
diff --git a/software/messaging/src/main/java/org/apache/brooklyn/entity/zookeeper/ZooKeeperEnsembleImpl.java b/software/messaging/src/main/java/org/apache/brooklyn/entity/zookeeper/ZooKeeperEnsembleImpl.java
index ee917a6..c2c3e3f 100644
--- a/software/messaging/src/main/java/org/apache/brooklyn/entity/zookeeper/ZooKeeperEnsembleImpl.java
+++ b/software/messaging/src/main/java/org/apache/brooklyn/entity/zookeeper/ZooKeeperEnsembleImpl.java
@@ -62,7 +62,7 @@ public class ZooKeeperEnsembleImpl extends DynamicClusterImpl implements ZooKeep
         log.info("Initializing the ZooKeeper Ensemble");
         super.init();
 
-        policy = addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policy = policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Members tracker")
                 .configure("group", this));
     }
@@ -75,7 +75,7 @@ public class ZooKeeperEnsembleImpl extends DynamicClusterImpl implements ZooKeep
         @Override
         protected void onEntityAdded(Entity member) {
             if (member.getAttribute(ZooKeeperNode.MY_ID) == null) {
-                ((EntityInternal) member).setAttribute(ZooKeeperNode.MY_ID, myId.incrementAndGet());
+                ((EntityInternal) member).sensors().set(ZooKeeperNode.MY_ID, myId.incrementAndGet());
             }
         }
 
@@ -98,7 +98,7 @@ public class ZooKeeperEnsembleImpl extends DynamicClusterImpl implements ZooKeep
         for (Entity zookeeper : getMembers()) {
             zookeeperServers.add(zookeeper.getAttribute(Attributes.HOSTNAME));
         }
-        setAttribute(ZOOKEEPER_SERVERS, zookeeperServers);
+        sensors().set(ZOOKEEPER_SERVERS, zookeeperServers);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/monitoring/src/main/java/org/apache/brooklyn/entity/monitoring/monit/MonitNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/monitoring/src/main/java/org/apache/brooklyn/entity/monitoring/monit/MonitNodeImpl.java b/software/monitoring/src/main/java/org/apache/brooklyn/entity/monitoring/monit/MonitNodeImpl.java
index 5af6dff..2702994 100644
--- a/software/monitoring/src/main/java/org/apache/brooklyn/entity/monitoring/monit/MonitNodeImpl.java
+++ b/software/monitoring/src/main/java/org/apache/brooklyn/entity/monitoring/monit/MonitNodeImpl.java
@@ -99,7 +99,7 @@ public class MonitNodeImpl extends SoftwareProcessImpl implements MonitNode {
                 .build();
         } else {
             LOG.warn("Location(s) {} not an ssh-machine location, so not polling for status; setting serviceUp immediately", getLocations());
-            setAttribute(SERVICE_UP, true);
+            sensors().set(SERVICE_UP, true);
         }
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java
----------------------------------------------------------------------
diff --git a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java
index 114acea..120486a 100644
--- a/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java
+++ b/software/network/src/main/java/org/apache/brooklyn/entity/network/bind/BindDnsServerImpl.java
@@ -106,13 +106,13 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer
         checkNotNull(getConfig(HOSTNAME_SENSOR), "%s requires value for %s", getClass().getName(), HOSTNAME_SENSOR);
         DynamicGroup entities = addChild(EntitySpec.create(DynamicGroup.class)
                 .configure(DynamicGroup.ENTITY_FILTER, getEntityFilter()));
-        setAttribute(ENTITIES, entities);
-        setAttribute(A_RECORDS, ImmutableMap.<String, String>of());
-        setAttribute(CNAME_RECORDS, ImmutableMultimap.<String, String>of());
-        setAttribute(PTR_RECORDS, ImmutableMap.<String, String>of());
-        setAttribute(ADDRESS_MAPPINGS, ImmutableMultimap.<String, String>of());
+        sensors().set(ENTITIES, entities);
+        sensors().set(A_RECORDS, ImmutableMap.<String, String>of());
+        sensors().set(CNAME_RECORDS, ImmutableMultimap.<String, String>of());
+        sensors().set(PTR_RECORDS, ImmutableMap.<String, String>of());
+        sensors().set(ADDRESS_MAPPINGS, ImmutableMultimap.<String, String>of());
         synchronized (serialMutex) {
-            setAttribute(SERIAL, System.currentTimeMillis());
+            sensors().set(SERIAL, System.currentTimeMillis());
         }
     }
 
@@ -156,12 +156,12 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer
     protected void preStart() {
         String reverse = getConfig(REVERSE_LOOKUP_NETWORK);
         if (Strings.isBlank(reverse)) reverse = getAttribute(ADDRESS);
-        setAttribute(REVERSE_LOOKUP_CIDR, new Cidr(reverse + "/24"));
+        sensors().set(REVERSE_LOOKUP_CIDR, new Cidr(reverse + "/24"));
         String reverseLookupDomain = Joiner.on('.').join(Iterables.skip(Lists.reverse(Lists.newArrayList(
                 Splitter.on('.').split(reverse))), 1)) + ".in-addr.arpa";
-        setAttribute(REVERSE_LOOKUP_DOMAIN, reverseLookupDomain);
+        sensors().set(REVERSE_LOOKUP_DOMAIN, reverseLookupDomain);
 
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Address tracker")
                 .configure(AbstractMembershipTrackingPolicy.SENSORS_TO_TRACK, ImmutableSet.<Sensor<?>>of(getConfig(HOSTNAME_SENSOR)))
                 .configure(AbstractMembershipTrackingPolicy.GROUP, getEntities()));
@@ -244,10 +244,10 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer
                     aRecordToCnames.put(ipToARecord.get(address), domainName);
                 }
             }
-            setAttribute(A_RECORDS, ImmutableMap.copyOf(ipToARecord.inverse()));
-            setAttribute(PTR_RECORDS, ImmutableMap.copyOf(octetToName));
-            setAttribute(CNAME_RECORDS, Multimaps.unmodifiableMultimap(aRecordToCnames));
-            setAttribute(ADDRESS_MAPPINGS, Multimaps.unmodifiableMultimap(ipToAllNames));
+            sensors().set(A_RECORDS, ImmutableMap.copyOf(ipToARecord.inverse()));
+            sensors().set(PTR_RECORDS, ImmutableMap.copyOf(octetToName));
+            sensors().set(CNAME_RECORDS, Multimaps.unmodifiableMultimap(aRecordToCnames));
+            sensors().set(ADDRESS_MAPPINGS, Multimaps.unmodifiableMultimap(ipToAllNames));
 
             // Update Bind configuration files and restart the service
             getDriver().updateBindConfiguration();
@@ -303,7 +303,7 @@ public class BindDnsServerImpl extends SoftwareProcessImpl implements BindDnsSer
     public long getSerial() {
         synchronized (serialMutex) {
             long next = getAttribute(SERIAL) + 1;
-            setAttribute(SERIAL, next);
+            sensors().set(SERIAL, next);
             return next;
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
index 2f68059..a0c67e0 100644
--- a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
+++ b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
@@ -128,7 +128,7 @@ public class BindDnsServerIntegrationTest extends RebindTestFixture<TestApplicat
         cluster.resize(1);
         assertDnsEntityEventuallyHasActiveMembers(1);
         EntityLocal e = (EntityLocal) Iterables.getOnlyElement(cluster.getMembers());
-        e.setAttribute(PrefixAndIdEnricher.SENSOR, " _-pretend.hostname.10.0.0.7.my-cloud.com");
+        e.sensors().set(PrefixAndIdEnricher.SENSOR, " _-pretend.hostname.10.0.0.7.my-cloud.com");
         EntityTestUtils.assertAttributeEqualsEventually(dns, BindDnsServer.A_RECORDS,
                 ImmutableMap.of("pretend-hostname-10-0-0-7-my-cloud-com", e.getAttribute(Attributes.ADDRESS)));
     }
@@ -139,7 +139,7 @@ public class BindDnsServerIntegrationTest extends RebindTestFixture<TestApplicat
         cluster.resize(1);
         assertDnsEntityEventuallyHasActiveMembers(1);
         EntityLocal e = (EntityLocal) Iterables.getOnlyElement(cluster.getMembers());
-        e.setAttribute(PrefixAndIdEnricher.SENSOR, Strings.repeat("a", 171));
+        e.sensors().set(PrefixAndIdEnricher.SENSOR, Strings.repeat("a", 171));
         EntityTestUtils.assertAttributeEqualsEventually(dns, BindDnsServer.A_RECORDS,
                 ImmutableMap.of(Strings.repeat("a", 63), e.getAttribute(Attributes.ADDRESS)));
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
----------------------------------------------------------------------
diff --git a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
index 9c75ace..cf03530 100644
--- a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
+++ b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
@@ -46,10 +46,10 @@ public class PrefixAndIdEnricher extends AbstractEnricher {
     @Override
     public void setEntity(final EntityLocal entity) {
         super.setEntity(entity);
-        subscribe(entity, getConfig(MONITOR), new SensorEventListener<Object>() {
+        subscriptions().subscribe(entity, getConfig(MONITOR), new SensorEventListener<Object>() {
             @Override
             public void onEvent(SensorEvent<Object> event) {
-                entity.setAttribute(SENSOR, getConfig(PREFIX) + entity.getId());
+                entity.sensors().set(SENSOR, getConfig(PREFIX) + entity.getId());
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenterImpl.java
index e17d530..79003c2 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenterImpl.java
@@ -157,24 +157,24 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
          * subscribe to hostname, and keep an accurate set of current seeds in a sensor;
          * then at nodes we set the initial seeds to be the current seeds when ready (non-empty)
          */
-        subscribeToMembers(this, Attributes.HOSTNAME, new SensorEventListener<String>() {
+        subscriptions().subscribeToMembers(this, Attributes.HOSTNAME, new SensorEventListener<String>() {
             @Override
             public void onEvent(SensorEvent<String> event) {
                 seedTracker.onHostnameChanged(event.getSource(), event.getValue());
             }
         });
-        subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
+        subscriptions().subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
             @Override public void onEvent(SensorEvent<Entity> event) {
                 seedTracker.onMemberRemoved(event.getValue());
             }
         });
-        subscribeToMembers(this, Attributes.SERVICE_UP, new SensorEventListener<Boolean>() {
+        subscriptions().subscribeToMembers(this, Attributes.SERVICE_UP, new SensorEventListener<Boolean>() {
             @Override
             public void onEvent(SensorEvent<Boolean> event) {
                 seedTracker.onServiceUpChanged(event.getSource(), event.getValue());
             }
         });
-        subscribeToMembers(this, Attributes.SERVICE_STATE_ACTUAL, new SensorEventListener<Lifecycle>() {
+        subscriptions().subscribeToMembers(this, Attributes.SERVICE_STATE_ACTUAL, new SensorEventListener<Lifecycle>() {
             @Override
             public void onEvent(SensorEvent<Lifecycle> event) {
                 // trigger a recomputation also when lifecycle state changes, 
@@ -185,7 +185,7 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
         });
         
         // Track the datacenters for this cluster
-        subscribeToMembers(this, CassandraNode.DATACENTER_NAME, new SensorEventListener<String>() {
+        subscriptions().subscribeToMembers(this, CassandraNode.DATACENTER_NAME, new SensorEventListener<String>() {
             @Override
             public void onEvent(SensorEvent<String> event) {
                 Entity member = event.getSource();
@@ -211,7 +211,7 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
                 return Optional.absent();
             }
         });
-        subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
+        subscriptions().subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
             @Override public void onEvent(SensorEvent<Entity> event) {
                 Entity entity = event.getSource();
                 Multimap<String, Entity> datacenterUsage = getAttribute(DATACENTER_USAGE);
@@ -370,7 +370,7 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
     protected void connectSensors() {
         connectEnrichers();
         
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Cassandra Cluster Tracker")
                 .configure("sensorsToTrack", ImmutableSet.of(Attributes.SERVICE_UP, Attributes.HOSTNAME, CassandraNode.THRIFT_PORT))
                 .configure("group", this));
@@ -417,7 +417,7 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
         for (List<? extends AttributeSensor<? extends Number>> es : summingEnricherSetup) {
             AttributeSensor<? extends Number> t = es.get(0);
             AttributeSensor<? extends Number> total = es.get(1);
-            addEnricher(Enrichers.builder()
+            enrichers().add(Enrichers.builder()
                     .aggregating(t)
                     .publishing(total)
                     .fromMembers()
@@ -430,7 +430,7 @@ public class CassandraDatacenterImpl extends DynamicClusterImpl implements Cassa
         for (List<? extends AttributeSensor<? extends Number>> es : averagingEnricherSetup) {
             AttributeSensor<Number> t = (AttributeSensor<Number>) es.get(0);
             AttributeSensor<Double> average = (AttributeSensor<Double>) es.get(1);
-            addEnricher(Enrichers.builder()
+            enrichers().add(Enrichers.builder()
                     .aggregating(t)
                     .publishing(average)
                     .fromMembers()

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraFabricImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraFabricImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraFabricImpl.java
index 682d352..5aa108d 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraFabricImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraFabricImpl.java
@@ -208,12 +208,12 @@ public class CassandraFabricImpl extends DynamicFabricImpl implements CassandraF
             config().set(CassandraDatacenter.SEED_SUPPLIER, getSeedSupplier());
         
         // track members
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Cassandra Fabric Tracker")
                 .configure("group", this));
 
         // Track first node's startup
-        subscribeToMembers(this, CassandraDatacenter.FIRST_NODE_STARTED_TIME_UTC, new SensorEventListener<Long>() {
+        subscriptions().subscribeToMembers(this, CassandraDatacenter.FIRST_NODE_STARTED_TIME_UTC, new SensorEventListener<Long>() {
             @Override
             public void onEvent(SensorEvent<Long> event) {
                 Long oldval = getAttribute(CassandraDatacenter.FIRST_NODE_STARTED_TIME_UTC);
@@ -228,7 +228,7 @@ public class CassandraFabricImpl extends DynamicFabricImpl implements CassandraF
         });
         
         // Track the datacenters for this cluster
-        subscribeToMembers(this, CassandraDatacenter.DATACENTER_USAGE, new SensorEventListener<Multimap<String,Entity>>() {
+        subscriptions().subscribeToMembers(this, CassandraDatacenter.DATACENTER_USAGE, new SensorEventListener<Multimap<String,Entity>>() {
             @Override
             public void onEvent(SensorEvent<Multimap<String,Entity>> event) {
                 Multimap<String, Entity> usage = calculateDatacenterUsage();
@@ -236,7 +236,7 @@ public class CassandraFabricImpl extends DynamicFabricImpl implements CassandraF
                 sensors().set(DATACENTERS, usage.keySet());
             }
         });
-        subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
+        subscriptions().subscribe(this, DynamicGroup.MEMBER_REMOVED, new SensorEventListener<Entity>() {
             @Override public void onEvent(SensorEvent<Entity> event) {
                 Multimap<String, Entity> usage = calculateDatacenterUsage();
                 sensors().set(DATACENTER_USAGE, usage);
@@ -342,7 +342,7 @@ public class CassandraFabricImpl extends DynamicFabricImpl implements CassandraF
     protected void connectEnrichers() {
         // TODO Aggregate across sub-clusters
 
-        subscribeToMembers(this, SERVICE_UP, new SensorEventListener<Boolean>() {
+        subscriptions().subscribeToMembers(this, SERVICE_UP, new SensorEventListener<Boolean>() {
             @Override public void onEvent(SensorEvent<Boolean> event) {
                 sensors().set(SERVICE_UP, calculateServiceUp());
             }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
index 1c6742b..e08c99a 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraNodeImpl.java
@@ -517,25 +517,25 @@ public class CassandraNodeImpl extends SoftwareProcessImpl implements CassandraN
     protected void connectEnrichers(Duration windowPeriod) {
         JavaAppUtils.connectJavaAppServerPolicies(this);
 
-        addEnricher(TimeWeightedDeltaEnricher.<Long>getPerSecondDeltaEnricher(this, READ_COMPLETED, READS_PER_SECOND_LAST));
-        addEnricher(TimeWeightedDeltaEnricher.<Long>getPerSecondDeltaEnricher(this, WRITE_COMPLETED, WRITES_PER_SECOND_LAST));
+        enrichers().add(TimeWeightedDeltaEnricher.<Long>getPerSecondDeltaEnricher(this, READ_COMPLETED, READS_PER_SECOND_LAST));
+        enrichers().add(TimeWeightedDeltaEnricher.<Long>getPerSecondDeltaEnricher(this, WRITE_COMPLETED, WRITES_PER_SECOND_LAST));
         
         if (windowPeriod!=null) {
-            addEnricher(new RollingTimeWindowMeanEnricher<Long>(this, THRIFT_PORT_LATENCY, 
+            enrichers().add(new RollingTimeWindowMeanEnricher<Long>(this, THRIFT_PORT_LATENCY, 
                     THRIFT_PORT_LATENCY_IN_WINDOW, windowPeriod));
-            addEnricher(new RollingTimeWindowMeanEnricher<Double>(this, READS_PER_SECOND_LAST, 
+            enrichers().add(new RollingTimeWindowMeanEnricher<Double>(this, READS_PER_SECOND_LAST, 
                     READS_PER_SECOND_IN_WINDOW, windowPeriod));
-            addEnricher(new RollingTimeWindowMeanEnricher<Double>(this, WRITES_PER_SECOND_LAST, 
+            enrichers().add(new RollingTimeWindowMeanEnricher<Double>(this, WRITES_PER_SECOND_LAST, 
                     WRITES_PER_SECOND_IN_WINDOW, windowPeriod));
         }
         
         // service-up checks
-        addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
+        enrichers().add(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
                 .from(THRIFT_PORT_LATENCY)
                 .computing(Functionals.ifEquals(-1L).value("Thrift latency polling failed") )
                 .build());
         
-        addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
+        enrichers().add(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
                 .from(SERVICE_UP_JMX)
                 .computing(Functionals.ifEquals(false).value("JMX reports not up") )
                 .build());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
index eaa7b7a..6e39f7d 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseClusterImpl.java
@@ -119,13 +119,13 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
         log.info("Initializing the Couchbase cluster...");
         super.init();
         
-        addEnricher(
+        enrichers().add(
             Enrichers.builder()
                 .transforming(COUCHBASE_CLUSTER_UP_NODES)
                 .from(this)
                 .publishing(COUCHBASE_CLUSTER_UP_NODE_ADDRESSES)
                 .computing(new ListOfHostAndPort()).build() );
-        addEnricher(
+        enrichers().add(
             Enrichers.builder()
                 .transforming(COUCHBASE_CLUSTER_UP_NODE_ADDRESSES)
                 .from(this)
@@ -163,14 +163,14 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
             addAveragingMemberEnricher(nodeSensor, enricherSetup.get(nodeSensor));
         }
         
-        addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
+        enrichers().add(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS)
             .from(IS_CLUSTER_INITIALIZED).computing(
                 IfFunctions.ifNotEquals(true).value("The cluster is not yet completely initialized")
                     .defaultValue(null).build()).build() );
     }
     
     private void addAveragingMemberEnricher(AttributeSensor<? extends Number> fromSensor, AttributeSensor<? extends Number> toSensor) {
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
             .aggregating(fromSensor)
             .publishing(toSensor)
             .fromMembers()
@@ -180,7 +180,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
     }
 
     private void addSummingMemberEnricher(AttributeSensor<? extends Number> source) {
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
             .aggregating(source)
             .publishing(source)
             .fromMembers()
@@ -191,13 +191,13 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
 
     @Override
     protected void doStart() {
-        setAttribute(IS_CLUSTER_INITIALIZED, false);
+        sensors().set(IS_CLUSTER_INITIALIZED, false);
         
         super.doStart();
 
         connectSensors();
         
-        setAttribute(BUCKET_CREATION_IN_PROGRESS, false);
+        sensors().set(BUCKET_CREATION_IN_PROGRESS, false);
 
         //start timeout before adding the servers
         Tasks.setBlockingDetails("Pausing while Couchbase stabilizes");
@@ -210,8 +210,8 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
             
             //TODO: select a new primary node if this one fails
             Entity primaryNode = upNodes.get().iterator().next();
-            ((EntityInternal) primaryNode).setAttribute(CouchbaseNode.IS_PRIMARY_NODE, true);
-            setAttribute(COUCHBASE_PRIMARY_NODE, primaryNode);
+            ((EntityInternal) primaryNode).sensors().set(CouchbaseNode.IS_PRIMARY_NODE, true);
+            sensors().set(COUCHBASE_PRIMARY_NODE, primaryNode);
 
             Set<Entity> serversToAdd = MutableSet.<Entity>copyOf(getUpNodes());
 
@@ -233,7 +233,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                     log.warn(this+" is not quorate; will likely fail later, but proceeding for now");
                 }
                 for (Entity server: serversToAdd) {
-                    ((EntityInternal) server).setAttribute(CouchbaseNode.IS_IN_CLUSTER, true);
+                    ((EntityInternal) server).sensors().set(CouchbaseNode.IS_IN_CLUSTER, true);
                 }
             }
                 
@@ -264,7 +264,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                 }
             }
 
-            setAttribute(IS_CLUSTER_INITIALIZED, true);
+            sensors().set(IS_CLUSTER_INITIALIZED, true);
             
         } else {
             throw new IllegalStateException("No up nodes available after starting");
@@ -280,7 +280,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
     }
 
     protected void connectSensors() {
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Controller targets tracker")
                 .configure("group", this));
     }
@@ -324,7 +324,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                     if (!upNodes.get().contains(member)) {
                         Set<Entity> newNodes = Sets.newHashSet(getUpNodes());
                         newNodes.add(member);
-                        setAttribute(COUCHBASE_CLUSTER_UP_NODES, newNodes);
+                        sensors().set(COUCHBASE_CLUSTER_UP_NODES, newNodes);
 
                         //add to set of servers to be added.
                         if (isClusterInitialized()) {
@@ -334,7 +334,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                 } else {
                     Set<Entity> newNodes = Sets.newHashSet();
                     newNodes.add(member);
-                    setAttribute(COUCHBASE_CLUSTER_UP_NODES, newNodes);
+                    sensors().set(COUCHBASE_CLUSTER_UP_NODES, newNodes);
 
                     if (isClusterInitialized()) {
                         addServer(member);
@@ -344,7 +344,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                 Set<Entity> upNodes = getUpNodes();
                 if (upNodes != null && upNodes.contains(member)) {
                     upNodes.remove(member);
-                    setAttribute(COUCHBASE_CLUSTER_UP_NODES, upNodes);
+                    sensors().set(COUCHBASE_CLUSTER_UP_NODES, upNodes);
                     log.info("Removing couchbase node {}: {}; from cluster", new Object[]{this, member});
                 }
             }
@@ -398,7 +398,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
 
     @Override
     protected void initEnrichers() {
-        addEnricher(Enrichers.builder().updatingMap(ServiceStateLogic.SERVICE_NOT_UP_INDICATORS)
+        enrichers().add(Enrichers.builder().updatingMap(ServiceStateLogic.SERVICE_NOT_UP_INDICATORS)
             .from(COUCHBASE_CLUSTER_UP_NODES)
             .computing(new Function<Set<Entity>, Object>() {
                 @Override
@@ -479,7 +479,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                 Entities.invokeEffectorWithArgs(this, getPrimaryNode(), CouchbaseNode.SERVER_ADD, webAdmin.toString(), username, password).getUnchecked();
             }
             //FIXME check feedback of whether the server was added.
-            ((EntityInternal) serverToAdd).setAttribute(CouchbaseNode.IS_IN_CLUSTER, true);
+            ((EntityInternal) serverToAdd).sensors().set(CouchbaseNode.IS_IN_CLUSTER, true);
         }
     }
 
@@ -533,7 +533,7 @@ public class CouchbaseClusterImpl extends DynamicClusterImpl implements Couchbas
                         if (CouchbaseClusterImpl.this.resetBucketCreation.get() != null) {
                             CouchbaseClusterImpl.this.resetBucketCreation.get().stop();
                         }
-                        setAttribute(CouchbaseCluster.BUCKET_CREATION_IN_PROGRESS, true);
+                        sensors().set(CouchbaseCluster.BUCKET_CREATION_IN_PROGRESS, true);
                         HostAndPort hostAndPort = BrooklynAccessUtils.getBrooklynAccessibleAddress(primaryNode, primaryNode.getAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT));
 
                         CouchbaseClusterImpl.this.resetBucketCreation.set(HttpFeed.builder()

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
index 74deb3e..d227a4a 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeImpl.java
@@ -86,14 +86,14 @@ public class CouchbaseNodeImpl extends SoftwareProcessImpl implements CouchbaseN
     public void init() {
         super.init();
 
-        subscribe(this, Attributes.SERVICE_UP, new SensorEventListener<Boolean>() {
+        subscriptions().subscribe(this, Attributes.SERVICE_UP, new SensorEventListener<Boolean>() {
             @Override
             public void onEvent(SensorEvent<Boolean> booleanSensorEvent) {
                 if (Boolean.TRUE.equals(booleanSensorEvent.getValue())) {
                     Integer webPort = getAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT);
                     Preconditions.checkNotNull(webPort, CouchbaseNode.COUCHBASE_WEB_ADMIN_PORT+" not set for %s; is an acceptable port available?", this);
                     String hostAndPort = BrooklynAccessUtils.getBrooklynAccessibleAddress(CouchbaseNodeImpl.this, webPort).toString();
-                    setAttribute(CouchbaseNode.COUCHBASE_WEB_ADMIN_URL, URI.create(format("http://%s", hostAndPort)));
+                    sensors().set(CouchbaseNode.COUCHBASE_WEB_ADMIN_URL, URI.create(format("http://%s", hostAndPort)));
                 }
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
index 3774ddb..fe2c788 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
@@ -333,7 +333,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver imp
 
     @Override
     public void rebalance() {
-        entity.setAttribute(CouchbaseNode.REBALANCE_STATUS, "explicitly started");
+        entity.sensors().set(CouchbaseNode.REBALANCE_STATUS, "explicitly started");
         newScript("rebalance")
                 .body.append(
                 couchbaseCli("rebalance") + getCouchbaseHostnameAndCredentials())
@@ -358,7 +358,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver imp
                        }
                 ).run();
 
-        entity.setAttribute(CouchbaseNode.REBALANCE_STATUS, "waiting for completion");
+        entity.sensors().set(CouchbaseNode.REBALANCE_STATUS, "waiting for completion");
         // Wait until the Couchbase node finishes the re-balancing
         Task<Boolean> reBalance = TaskBuilder.<Boolean>builder()
                 .displayName("Waiting until node is rebalancing")
@@ -387,18 +387,18 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver imp
                 .orSubmitAndBlock()
                 .andWaitForSuccess();
         if (completed) {
-            entity.setAttribute(CouchbaseNode.REBALANCE_STATUS, "completed");
+            entity.sensors().set(CouchbaseNode.REBALANCE_STATUS, "completed");
             ServiceStateLogic.ServiceNotUpLogic.clearNotUpIndicator(getEntity(), "rebalancing");
             log.info("Rebalanced cluster via primary node {}", getEntity());
         } else {
-            entity.setAttribute(CouchbaseNode.REBALANCE_STATUS, "timed out");
+            entity.sensors().set(CouchbaseNode.REBALANCE_STATUS, "timed out");
             ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(getEntity(), "rebalancing", "rebalance did not complete within time limit");
             log.warn("Timeout rebalancing cluster via primary node {}", getEntity());
         }
     }
 
     private Iterable<HostAndPort> getNodesHostAndPort() {
-        Group group = Iterables.getFirst(getEntity().getGroups(), null);
+        Group group = Iterables.getFirst(getEntity().groups(), null);
         if (group == null) return Lists.newArrayList();
         return Iterables.transform(group.getAttribute(CouchbaseCluster.COUCHBASE_CLUSTER_UP_NODES),
                 new Function<Entity, HostAndPort>() {
@@ -447,7 +447,7 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver imp
                 " --server-add-password=" + BashStringEscapes.wrapBash(password))
                 .failOnNonZeroResultCode()
                 .execute();
-        entity.setAttribute(CouchbaseNode.REBALANCE_STATUS, "triggered as part of server-add");
+        entity.sensors().set(CouchbaseNode.REBALANCE_STATUS, "triggered as part of server-add");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayImpl.java
index c2e0395..0b42c76 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayImpl.java
@@ -51,7 +51,7 @@ public class CouchbaseSyncGatewayImpl extends SoftwareProcessImpl implements Cou
         String managementUri = String.format("http://%s:%s",
                 hp.getHostText(), hp.getPort());
 
-        setAttribute(MANAGEMENT_URL, managementUri);
+        sensors().set(MANAGEMENT_URL, managementUri);
 
         httpFeed = HttpFeed.builder()
                 .entity(this)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeImpl.java
index 06078f8..14867de 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeImpl.java
@@ -102,7 +102,7 @@ public class CouchDBNodeImpl extends SoftwareProcessImpl implements CouchDBNode
     protected void postStop() {
         super.postStop();
         // zero our workrate derived workrates.
-        setAttribute(REQUESTS_PER_SECOND_LAST, 0D);
-        setAttribute(REQUESTS_PER_SECOND_IN_WINDOW, 0D);
+        sensors().set(REQUESTS_PER_SECOND_LAST, 0D);
+        sensors().set(REQUESTS_PER_SECOND_IN_WINDOW, 0D);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeSshDriver.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeSshDriver.java
index 09184b4..60c1f84 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeSshDriver.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/couchdb/CouchDBNodeSshDriver.java
@@ -48,7 +48,7 @@ public class CouchDBNodeSshDriver extends AbstractSoftwareProcessSshDriver imple
     public CouchDBNodeSshDriver(CouchDBNodeImpl entity, SshMachineLocation machine) {
         super(entity, machine);
 
-        entity.setAttribute(Attributes.LOG_FILE_LOCATION, getLogFileLocation());
+        entity.sensors().set(Attributes.LOG_FILE_LOCATION, getLogFileLocation());
     }
 
     public String getLogFileLocation() { return Os.mergePathsUnix(getRunDir(), "couchdb.log"); }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/elasticsearch/ElasticSearchNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/elasticsearch/ElasticSearchNodeSshDriver.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/elasticsearch/ElasticSearchNodeSshDriver.java
index ccd84a0..6e35e8b 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/elasticsearch/ElasticSearchNodeSshDriver.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/elasticsearch/ElasticSearchNodeSshDriver.java
@@ -81,7 +81,7 @@ public class ElasticSearchNodeSshDriver extends AbstractSoftwareProcessSshDriver
     @Override
     public void launch() {
         String pidFile = getRunDir() + "/" + AbstractSoftwareProcessSshDriver.PID_FILENAME;
-        entity.setAttribute(ElasticSearchNode.PID_FILE, pidFile);
+        entity.sensors().set(ElasticSearchNode.PID_FILE, pidFile);
         StringBuilder commandBuilder = new StringBuilder()
             .append(String.format("%s/bin/elasticsearch -d -p %s", getExpandedInstallDir(), pidFile));
         if (entity.getConfig(ElasticSearchNode.TEMPLATE_CONFIGURATION_URL) != null) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBClientImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBClientImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBClientImpl.java
index 7eeed49..419c09e 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBClientImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBClientImpl.java
@@ -26,7 +26,7 @@ public class MongoDBClientImpl extends SoftwareProcessImpl implements MongoDBCli
     @Override
     protected void connectSensors() {
         super.connectSensors();
-        setAttribute(Startable.SERVICE_UP, true);
+        sensors().set(Startable.SERVICE_UP, true);
     }
 
     @SuppressWarnings("rawtypes")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBReplicaSetImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBReplicaSetImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBReplicaSetImpl.java
index 2c95d02..bb29c8b 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBReplicaSetImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBReplicaSetImpl.java
@@ -137,7 +137,7 @@ public class MongoDBReplicaSetImpl extends DynamicClusterImpl implements MongoDB
     
     @Override
     public void init() {
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .aggregating(MongoDBAuthenticationMixins.ROOT_USERNAME)
                 .publishing(MongoDBAuthenticationMixins.ROOT_USERNAME)
                 .fromMembers()
@@ -345,12 +345,12 @@ public class MongoDBReplicaSetImpl extends DynamicClusterImpl implements MongoDB
     public void start(Collection<? extends Location> locations) {
         // Promises that all the cluster's members have SERVICE_UP true on returning.
         super.start(locations);
-        policy = addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policy = policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName(getName() + " membership tracker")
                 .configure("group", this));
 
         for (AttributeSensor<Long> sensor: SENSORS_TO_SUM)
-            addEnricher(Enrichers.builder()
+            enrichers().add(Enrichers.builder()
                     .aggregating(sensor)
                     .publishing(sensor)
                     .fromMembers()
@@ -361,7 +361,7 @@ public class MongoDBReplicaSetImpl extends DynamicClusterImpl implements MongoDB
         
         // FIXME would it be simpler to have a *subscription* on four or five sensors on allMembers, including SERVICE_UP
         // (which we currently don't check), rather than an enricher, and call to an "update" method?
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .aggregating(MongoDBServer.REPLICA_SET_PRIMARY_ENDPOINT)
                 .publishing(MongoDBServer.REPLICA_SET_PRIMARY_ENDPOINT)
                 .fromMembers()
@@ -380,7 +380,7 @@ public class MongoDBReplicaSetImpl extends DynamicClusterImpl implements MongoDB
                         }})
                 .build());
 
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .aggregating(MongoDBServer.MONGO_SERVER_ENDPOINT)
                 .publishing(REPLICA_SET_ENDPOINTS)
                 .fromMembers()
@@ -398,13 +398,13 @@ public class MongoDBReplicaSetImpl extends DynamicClusterImpl implements MongoDB
                         }})
                 .build());
         
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .transforming(REPLICA_SET_ENDPOINTS)
                 .publishing(DATASTORE_URL)
                 .computing(new EndpointsToDatastoreUrlMapper(this))
                 .build());
 
-        subscribeToMembers(this, MongoDBServer.IS_PRIMARY_FOR_REPLICA_SET, new SensorEventListener<Boolean>() {
+        subscriptions().subscribeToMembers(this, MongoDBServer.IS_PRIMARY_FOR_REPLICA_SET, new SensorEventListener<Boolean>() {
             @Override public void onEvent(SensorEvent<Boolean> event) {
                 if (Boolean.TRUE == event.getValue())
                     sensors().set(PRIMARY_ENTITY, (MongoDBServer)event.getSource());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
index 040199b..2469046 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
@@ -122,7 +122,7 @@ public class MongoDBServerImpl extends SoftwareProcessImpl implements MongoDBSer
         }
 
         // Take interesting details from STATUS.
-        subscribe(this, STATUS_BSON, new SensorEventListener<BasicBSONObject>() {
+        subscriptions().subscribe(this, STATUS_BSON, new SensorEventListener<BasicBSONObject>() {
                 @Override public void onEvent(SensorEvent<BasicBSONObject> event) {
                     BasicBSONObject map = event.getValue();
                     if (map != null && !map.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
index f96b517..9648f47 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
@@ -63,7 +63,7 @@ public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl implements
         router.sensors().set(MongoDBAuthenticationMixins.ROOT_PASSWORD, router.config().get(MongoDBAuthenticationMixins.ROOT_PASSWORD));
         router.sensors().set(MongoDBAuthenticationMixins.ROOT_USERNAME, router.config().get(MongoDBAuthenticationMixins.ROOT_USERNAME));
         router.sensors().set(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE, router.config().get(MongoDBAuthenticationMixins.AUTHENTICATION_DATABASE));
-        addEnricher(Enrichers.builder().propagating(MongoDBRouter.PORT).from(router).build());
+        enrichers().add(Enrichers.builder().propagating(MongoDBRouter.PORT).from(router).build());
         
         super.doStart(locations);
         sensors().set(Startable.SERVICE_UP, true);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
index a93ad74..48b501c 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBRouterClusterImpl.java
@@ -39,7 +39,7 @@ public class MongoDBRouterClusterImpl extends DynamicClusterImpl implements Mong
     @Override
     public void init() {
         super.init();
-        subscribeToChildren(this, MongoDBRouter.RUNNING, new SensorEventListener<Boolean>() {
+        subscriptions().subscribeToChildren(this, MongoDBRouter.RUNNING, new SensorEventListener<Boolean>() {
             @Override public void onEvent(SensorEvent<Boolean> event) {
                 setAnyRouter();
             }
@@ -49,7 +49,7 @@ public class MongoDBRouterClusterImpl extends DynamicClusterImpl implements Mong
     @Override
     public void start(Collection<? extends Location> locations) {
         super.start(locations);
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Router cluster membership tracker")
                 .configure("group", this));
     }
@@ -67,10 +67,10 @@ public class MongoDBRouterClusterImpl extends DynamicClusterImpl implements Mong
     }
     
     protected void setAnyRouter() {
-        setAttribute(MongoDBRouterCluster.ANY_ROUTER, Iterables.tryFind(getRouters(), 
+        sensors().set(MongoDBRouterCluster.ANY_ROUTER, Iterables.tryFind(getRouters(), 
                 EntityPredicates.attributeEqualTo(Startable.SERVICE_UP, true)).orNull());
 
-        setAttribute(
+        sensors().set(
                 MongoDBRouterCluster.ANY_RUNNING_ROUTER, 
                 Iterables.tryFind(getRouters(), EntityPredicates.attributeEqualTo(MongoDBRouter.RUNNING, true))
                 .orNull());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardClusterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardClusterImpl.java
index 5f008ea..e0c0f35 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardClusterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardClusterImpl.java
@@ -74,7 +74,7 @@ public class MongoDBShardClusterImpl extends DynamicClusterImpl implements Mongo
 
     @Override
     public void start(Collection<? extends Location> locations) {
-        subscribeToMembers(this, Startable.SERVICE_UP, new SensorEventListener<Boolean>() {
+        subscriptions().subscribeToMembers(this, Startable.SERVICE_UP, new SensorEventListener<Boolean>() {
             public void onEvent(SensorEvent<Boolean> event) {
                 addShards();
             }
@@ -83,7 +83,7 @@ public class MongoDBShardClusterImpl extends DynamicClusterImpl implements Mongo
         super.start(locations);
         
         MongoDBRouterCluster routers = getParent().getAttribute(MongoDBShardedDeployment.ROUTER_CLUSTER);
-        subscribe(routers, MongoDBRouterCluster.ANY_RUNNING_ROUTER, new SensorEventListener<MongoDBRouter>() {
+        subscriptions().subscribe(routers, MongoDBRouterCluster.ANY_RUNNING_ROUTER, new SensorEventListener<MongoDBRouter>() {
             public void onEvent(SensorEvent<MongoDBRouter> event) {
                 if (event.getValue() != null)
                     addShards();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardedDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardedDeploymentImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardedDeploymentImpl.java
index 5cc217a..05ab66c 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardedDeploymentImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/mongodb/sharding/MongoDBShardedDeploymentImpl.java
@@ -74,7 +74,7 @@ public class MongoDBShardedDeploymentImpl extends AbstractEntity implements Mong
         MongoDBAuthenticationUtils.setAuthenticationConfig(shardClusterSpec, this);
         sensors().set(SHARD_CLUSTER, addChild(shardClusterSpec));
 
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .propagating(MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES)
                 .from(getAttribute(CONFIG_SERVER_CLUSTER))
                 .build());
@@ -97,7 +97,7 @@ public class MongoDBShardedDeploymentImpl extends AbstractEntity implements Mong
                     .get();
 
             if (getConfigRaw(MongoDBShardedDeployment.CO_LOCATED_ROUTER_GROUP, true).isPresent()) {
-                addPolicy(PolicySpec.create(ColocatedRouterTrackingPolicy.class)
+                policies().add(PolicySpec.create(ColocatedRouterTrackingPolicy.class)
                         .displayName("Co-located router tracker")
                         .configure("group", getConfig(MongoDBShardedDeployment.CO_LOCATED_ROUTER_GROUP)));
             }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/redis/RedisClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/redis/RedisClusterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/redis/RedisClusterImpl.java
index 7e71b29..8d847e7 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/redis/RedisClusterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/redis/RedisClusterImpl.java
@@ -75,7 +75,7 @@ public class RedisClusterImpl extends AbstractEntity implements RedisCluster {
                 .configure(SoftwareProcess.CUSTOMIZE_LATCH, DependentConfiguration.attributeWhenReady(master, Attributes.SERVICE_UP))));
         sensors().set(SLAVES, slaves);
 
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
                 .propagating(RedisStore.HOSTNAME, RedisStore.ADDRESS, RedisStore.SUBNET_HOSTNAME, RedisStore.SUBNET_ADDRESS, RedisStore.REDIS_PORT)
                 .from(master)
                 .build());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakClusterImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakClusterImpl.java
index 5002402..8272815 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakClusterImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakClusterImpl.java
@@ -68,7 +68,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
     public void init() {
         super.init();
         log.info("Initializing the riak cluster...");
-        setAttribute(IS_CLUSTER_INIT, false);
+        sensors().set(IS_CLUSTER_INIT, false);
     }
 
     @Override
@@ -91,7 +91,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                 EntityPredicates.attributeEqualTo(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, true),
                 EntityPredicates.attributeEqualTo(RiakNode.SERVICE_UP, true)));
         if (anyNode.isPresent()) {
-            setAttribute(IS_CLUSTER_INIT, true);
+            sensors().set(IS_CLUSTER_INIT, true);
         } else {
             log.warn("No Riak Nodes are found on the cluster: {}. Initialization Failed", getId());
             ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE);
@@ -105,7 +105,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
     }
 
     protected void connectSensors() {
-        addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("Controller targets tracker")
                 .configure("sensorsToTrack", ImmutableSet.of(RiakNode.SERVICE_UP))
                 .configure("group", this));
@@ -120,7 +120,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                     } })
                  .fromMembers()
                  .build();
-        addEnricher(first);
+        enrichers().add(first);
         
         Map<? extends AttributeSensor<? extends Number>, ? extends AttributeSensor<? extends Number>> enricherSetup = 
             ImmutableMap.<AttributeSensor<? extends Number>, AttributeSensor<? extends Number>>builder()
@@ -136,7 +136,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
     }
 
     private void addAveragingMemberEnricher(AttributeSensor<? extends Number> fromSensor, AttributeSensor<? extends Number> toSensor) {
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
             .aggregating(fromSensor)
             .publishing(toSensor)
             .fromMembers()
@@ -146,7 +146,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
     }
 
     private void addSummingMemberEnricher(AttributeSensor<? extends Number> source) {
-        addEnricher(Enrichers.builder()
+        enrichers().add(Enrichers.builder()
             .aggregating(source)
             .publishing(source)
             .fromMembers()
@@ -173,12 +173,12 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                 // flag a first node to be the first node in the riak cluster.
                 Boolean firstNode = getAttribute(IS_FIRST_NODE_SET);
                 if (!Boolean.TRUE.equals(firstNode)) {
-                    setAttribute(IS_FIRST_NODE_SET, Boolean.TRUE);
+                    sensors().set(IS_FIRST_NODE_SET, Boolean.TRUE);
 
                     nodes.put(member, riakName);
-                    setAttribute(RIAK_CLUSTER_NODES, nodes);
+                    sensors().set(RIAK_CLUSTER_NODES, nodes);
 
-                    ((EntityInternal) member).setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE);
+                    ((EntityInternal) member).sensors().set(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE);
 
                     log.info("Added initial Riak node {}: {}; {} to new cluster", new Object[] { this, member, getRiakName(member) });
                 } else {
@@ -192,7 +192,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                             String anyNodeName = anyNodeInCluster.get().getAttribute(RiakNode.RIAK_NODE_NAME);
                             Entities.invokeEffectorWithArgs(this, member, RiakNode.JOIN_RIAK_CLUSTER, anyNodeName).blockUntilEnded();
                             nodes.put(member, riakName);
-                            setAttribute(RIAK_CLUSTER_NODES, nodes);
+                            sensors().set(RIAK_CLUSTER_NODES, nodes);
                             log.info("Added Riak node {}: {}; {} to cluster", new Object[] { this, member, getRiakName(member) });
                         }
                     } else {
@@ -211,7 +211,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                         Entities.invokeEffectorWithArgs(this, anyNodeInCluster.get(), RiakNode.REMOVE_FROM_CLUSTER, getRiakName(member)).blockUntilEnded();
                     }
                     nodes.remove(member);
-                    setAttribute(RIAK_CLUSTER_NODES, nodes);
+                    sensors().set(RIAK_CLUSTER_NODES, nodes);
                     log.info("Removed Riak node {}: {}; {} from cluster", new Object[]{ this, member, getRiakName(member) });
                 }
             }
@@ -232,8 +232,8 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster {
                 addressesPbPort.add(riakNode.getAttribute(Attributes.SUBNET_HOSTNAME) + ":" + riakNode.getAttribute(RiakNode.RIAK_PB_PORT));
             }
         }
-        setAttribute(RiakCluster.NODE_LIST, Joiner.on(",").join(addresses));
-        setAttribute(RiakCluster.NODE_LIST_PB_PORT, Joiner.on(",").join(addressesPbPort));
+        sensors().set(RiakCluster.NODE_LIST, Joiner.on(",").join(addresses));
+        sensors().set(RiakCluster.NODE_LIST_PB_PORT, Joiner.on(",").join(addressesPbPort));
     }
 
     protected boolean belongsInServerPool(Entity member) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeImpl.java
index 08773c8..995c469 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeImpl.java
@@ -184,8 +184,8 @@ public class RiakNodeImpl extends SoftwareProcessImpl implements RiakNode {
 
         httpFeed = httpFeedBuilder.build();
 
-        addEnricher(Enrichers.builder().combining(NODE_GETS, NODE_PUTS).computingSum().publishing(NODE_OPS).build());
-        addEnricher(Enrichers.builder().combining(NODE_GETS_TOTAL, NODE_PUTS_TOTAL).computingSum().publishing(NODE_OPS_TOTAL).build());
+        enrichers().add(Enrichers.builder().combining(NODE_GETS, NODE_PUTS).computingSum().publishing(NODE_OPS).build());
+        enrichers().add(Enrichers.builder().combining(NODE_GETS_TOTAL, NODE_PUTS_TOTAL).computingSum().publishing(NODE_OPS_TOTAL).build());
         WebAppServiceMethods.connectWebAppServerPolicies(this);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index f4fda89..9ec9fb8 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -100,9 +100,9 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
         // Set package install attribute
         OsDetails osDetails = getMachine().getMachineDetails().getOsDetails();
         if (osDetails.isLinux()) {
-            entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL, true);
+            entity.sensors().set(RiakNode.RIAK_PACKAGE_INSTALL, true);
         } else if (osDetails.isMac()) {
-            entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL, false);
+            entity.sensors().set(RiakNode.RIAK_PACKAGE_INSTALL, false);
         }
     }
 
@@ -309,7 +309,7 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
         }
 
         //set the riak node name
-        entity.setAttribute(RiakNode.RIAK_NODE_NAME, format("riak@%s", getSubnetHostname()));
+        entity.sensors().set(RiakNode.RIAK_NODE_NAME, format("riak@%s", getSubnetHostname()));
     }
 
     @Override
@@ -335,7 +335,7 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
         launchScript.failOnNonZeroResultCode().execute();
 
         String mainUri = String.format("http://%s:%s/admin", entity.getAttribute(Attributes.HOSTNAME), entity.getAttribute(RiakNode.RIAK_WEB_PORT));
-        entity.setAttribute(Attributes.MAIN_URI, URI.create(mainUri));
+        entity.sensors().set(Attributes.MAIN_URI, URI.create(mainUri));
     }
 
     @Override
@@ -410,7 +410,7 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
 
                 joinClusterScript.execute();
 
-                entity.setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE);
+                entity.sensors().set(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE);
             } else {
                 log.warn("entity {}: is already in the riak cluster", entity.getId());
             }
@@ -432,7 +432,7 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
 
             leaveClusterScript.execute();
 
-            entity.setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.FALSE);
+            entity.sensors().set(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.FALSE);
         } else {
             log.warn("entity {}: has already left the riak cluster", entity.getId());
         }
@@ -578,7 +578,7 @@ public class RiakNodeSshDriver extends JavaSoftwareProcessSshDriver implements R
         boolean riakOnPath = newScript("riakOnPath")
                 .body.append("which riak")
                 .execute() == 0;
-        entity.setAttribute(RiakNode.RIAK_ON_PATH, riakOnPath);
+        entity.sensors().set(RiakNode.RIAK_ON_PATH, riakOnPath);
     }
 
     private String getRiakName() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/solr/SolrServerImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/solr/SolrServerImpl.java b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/solr/SolrServerImpl.java
index 3ee54fe..98fa91e 100644
--- a/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/solr/SolrServerImpl.java
+++ b/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/solr/SolrServerImpl.java
@@ -55,7 +55,7 @@ public class SolrServerImpl extends SoftwareProcessImpl implements SolrServer {
         HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, getSolrPort());
 
         String solrUri = String.format("http://%s:%d/solr", hp.getHostText(), hp.getPort());
-        setAttribute(Attributes.MAIN_URI, URI.create(solrUri));
+        sensors().set(Attributes.MAIN_URI, URI.create(solrUri));
 
         httpFeed = HttpFeed.builder()
                 .entity(this)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/osgi/src/main/java/org/apache/brooklyn/entity/osgi/karaf/KarafContainerImpl.java
----------------------------------------------------------------------
diff --git a/software/osgi/src/main/java/org/apache/brooklyn/entity/osgi/karaf/KarafContainerImpl.java b/software/osgi/src/main/java/org/apache/brooklyn/entity/osgi/karaf/KarafContainerImpl.java
index 7051b86..92e5b2f 100644
--- a/software/osgi/src/main/java/org/apache/brooklyn/entity/osgi/karaf/KarafContainerImpl.java
+++ b/software/osgi/src/main/java/org/apache/brooklyn/entity/osgi/karaf/KarafContainerImpl.java
@@ -111,7 +111,7 @@ public class KarafContainerImpl extends SoftwareProcessImpl implements KarafCont
         //FIXME should have a better way of setting config -- firstly, not here!
         //preferred style is to have config auto-applied to attributes, and have default values in their definition, not here
         //use of "properties.{user,password}" is non-standard; is that requried? use default jmxUser, jmxPassword flags?
-        setAttribute(JMX_CONTEXT, String.format("karaf-%s", getConfig(KARAF_NAME.getConfigKey())));
+        sensors().set(JMX_CONTEXT, String.format("karaf-%s", getConfig(KARAF_NAME.getConfigKey())));
         
         ConfigToAttributes.apply(this);
 
@@ -135,7 +135,7 @@ public class KarafContainerImpl extends SoftwareProcessImpl implements KarafCont
                                     // If MBean is unreachable, then mark as service-down
                                     if (Boolean.TRUE.equals(getAttribute(SERVICE_UP))) {
                                         LOG.debug("Entity "+this+" is not reachable on JMX");
-                                        setAttribute(SERVICE_UP, false);
+                                        sensors().set(SERVICE_UP, false);
                                     }
                                     return null;
                                 }}))
@@ -144,21 +144,21 @@ public class KarafContainerImpl extends SoftwareProcessImpl implements KarafCont
         
         
         // INSTANCES aggregates data for the other sensors.
-        subscribe(this, KARAF_INSTANCES, new SensorEventListener<Map>() {
+        subscriptions().subscribe(this, KARAF_INSTANCES, new SensorEventListener<Map>() {
                 @Override public void onEvent(SensorEvent<Map> event) {
-                    Map map = event.getValue();
+                    Map<?,?> map = event.getValue();
                     if (map == null) return;
                     
-                    setAttribute(SERVICE_UP, "Started".equals(map.get("State")));
-                    setAttribute(KARAF_ROOT, (Boolean) map.get("Is Root"));
-                    setAttribute(KARAF_JAVA_OPTS, (String) map.get("JavaOpts"));
-                    setAttribute(KARAF_INSTALL_LOCATION, (String) map.get("Location"));
-                    setAttribute(KARAF_NAME, (String) map.get("Name"));
-                    setAttribute(KARAF_PID, (Integer) map.get("Pid"));
-                    setAttribute(KARAF_SSH_PORT, (Integer) map.get("Ssh Port"));
-                    setAttribute(KARAF_RMI_REGISTRY_PORT, (Integer) map.get("RMI Registry Port"));
-                    setAttribute(KARAF_RMI_SERVER_PORT, (Integer) map.get("RMI Server Port"));
-                    setAttribute(KARAF_STATE, (String) map.get("State"));
+                    sensors().set(SERVICE_UP, "Started".equals(map.get("State")));
+                    sensors().set(KARAF_ROOT, (Boolean) map.get("Is Root"));
+                    sensors().set(KARAF_JAVA_OPTS, (String) map.get("JavaOpts"));
+                    sensors().set(KARAF_INSTALL_LOCATION, (String) map.get("Location"));
+                    sensors().set(KARAF_NAME, (String) map.get("Name"));
+                    sensors().set(KARAF_PID, (Integer) map.get("Pid"));
+                    sensors().set(KARAF_SSH_PORT, (Integer) map.get("Ssh Port"));
+                    sensors().set(KARAF_RMI_REGISTRY_PORT, (Integer) map.get("RMI Registry Port"));
+                    sensors().set(KARAF_RMI_SERVER_PORT, (Integer) map.get("RMI Server Port"));
+                    sensors().set(KARAF_STATE, (String) map.get("State"));
                 }});
         
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceImpl.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceImpl.java
index 8271e79..729351a 100644
--- a/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceImpl.java
+++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/AbstractGeoDnsServiceImpl.java
@@ -106,7 +106,7 @@ public abstract class AbstractGeoDnsServiceImpl extends AbstractEntity implement
         
     @Override
     public void setServiceState(Lifecycle state) {
-        setAttribute(HOSTNAME, getHostname());
+        sensors().set(HOSTNAME, getHostname());
         ServiceStateLogic.setExpectedState(this, state);
         if (state==Lifecycle.RUNNING)
             ServiceNotUpLogic.clearNotUpIndicator(this, SERVICE_STATE_ACTUAL);
@@ -130,7 +130,7 @@ public abstract class AbstractGeoDnsServiceImpl extends AbstractEntity implement
         }
         endTracker();
         log.debug("Initializing tracker for "+this+", following "+targetEntityProvider);
-        tracker = addPolicy(PolicySpec.create(MemberTrackingPolicy.class)
+        tracker = policies().add(PolicySpec.create(MemberTrackingPolicy.class)
                 .displayName("GeoDNS targets tracker")
                 .configure("sensorsToTrack", ImmutableSet.of(HOSTNAME, ADDRESS, Attributes.MAIN_URI, WebAppService.ROOT_URL))
                 .configure("group", targetEntityProvider));
@@ -139,7 +139,7 @@ public abstract class AbstractGeoDnsServiceImpl extends AbstractEntity implement
     
     protected synchronized void endTracker() {
         if (tracker == null || targetEntityProvider==null) return;
-        removePolicy(tracker);
+        policies().remove(tracker);
         tracker = null;
     }
     
@@ -298,7 +298,7 @@ public abstract class AbstractGeoDnsServiceImpl extends AbstractEntity implement
         reconfigureService(new LinkedHashSet<HostGeoInfo>(m.values()));
         
         if (log.isDebugEnabled()) log.debug("Targets being set as "+entityIdToAddress);
-        setAttribute(TARGETS, entityIdToAddress);
+        sensors().set(TARGETS, entityIdToAddress);
     }
     
     protected String inferHostname(Entity entity) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4d08310c/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
index 710ca89..3e88805 100644
--- a/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
+++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java
@@ -61,7 +61,7 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl implemen
         super.init();
         
         // defaulting to randomized subdomains makes deploying multiple applications easier
-        if (getConfig(RANDOMIZE_SUBDOMAIN_NAME)==null) setConfig(RANDOMIZE_SUBDOMAIN_NAME, true); 
+        if (getConfig(RANDOMIZE_SUBDOMAIN_NAME)==null) config().set(RANDOMIZE_SUBDOMAIN_NAME, true); 
         
         Boolean trustAll = getConfig(SSL_TRUST_ALL);
         if (Boolean.TRUE.equals(trustAll)) {
@@ -109,9 +109,9 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl implemen
         
         String fullDomain = smartSubdomainName+"."+primaryDomainName;
         log.info("GeoScaling service will configure redirection for '"+fullDomain+"' domain");
-        setAttribute(GEOSCALING_ACCOUNT, username);
-        setAttribute(MANAGED_DOMAIN, fullDomain);
-        setAttribute(HOSTNAME, getHostname());
+        sensors().set(GEOSCALING_ACCOUNT, username);
+        sensors().set(MANAGED_DOMAIN, fullDomain);
+        sensors().set(HOSTNAME, getHostname());
         
         isConfigured = true;
         
@@ -177,14 +177,14 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl implemen
             smartSubdomain.configure(PROVIDE_CITY_INFO, script);
             if (targetHosts.isEmpty()) {
                 setServiceState(Lifecycle.CREATED);
-                setAttribute(ROOT_URL, null);
-                setAttribute(MAIN_URI, null);
+                sensors().set(ROOT_URL, null);
+                sensors().set(MAIN_URI, null);
             } else {
                 setServiceState(Lifecycle.RUNNING);
                 String domain = getAttribute(MANAGED_DOMAIN);
                 if (!Strings.isEmpty(domain)) {
-                    setAttribute(ROOT_URL, "http://"+domain+"/");
-                    setAttribute(MAIN_URI, URI.create("http://"+domain+"/"));
+                    sensors().set(ROOT_URL, "http://"+domain+"/");
+                    sensors().set(MAIN_URI, URI.create("http://"+domain+"/"));
                 }
             }
         } else {



Mime
View raw message