package brooklyn.policy.ha;

import brooklyn.event.basic.BasicNotificationSensor;

public class HASensors {

    public static final BasicNotificationSensor<FailureDescriptor> ENTITY_FAILED = new BasicNotificationSensor<FailureDescriptor>(
            FailureDescriptor.class, "ha.entityFailed", "Indicates that an entity has failed");
    
    public static final BasicNotificationSensor<FailureDescriptor> ENTITY_RECOVERED = new BasicNotificationSensor<FailureDescriptor>(
            FailureDescriptor.class, "ha.entityRecovered", "Indicates that a previously failed entity has recovered");
    
    // TODO How to make this serializable with the entity reference
    public static class FailureDescriptor {
        private final Object component;
        private final String description;
        
        public FailureDescriptor(Object component, String description) {
            this.component = component;
            this.description = description;
        }
        
        public Object getComponent() {
            return component;
        }
        
        public String getDescription() {
            return description;
        }
    }
}

@@ -76,16 +76,56 @@
 ensor;%0A%0A
+import com.google.common.base.Objects;%0A%0A
 public c
@@ -1178,20 +1178,212 @@
 ;%0A        %7D%0A
+        %0A        @Override%0A        public String toString() %7B%0A            return Objects.toStringHelper(this).add(%22component%22, component).add(%22description%22, description).toString();%0A        %7D%0A
     %7D%0A%7D%0A

add toString