package org.atlasapi.system;

import java.util.Collection;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.codahale.metrics.MetricRegistry;
import com.google.common.collect.ImmutableList;
import com.metabroadcast.common.health.HealthProbe;
import com.metabroadcast.common.health.probes.DiskSpaceProbe;
import com.metabroadcast.common.health.probes.MemoryInfoProbe;
import com.metabroadcast.common.webapp.health.HealthController;
import com.metabroadcast.common.webapp.health.probes.MetricsProbe;

@Configuration
public class HealthModule {

    private static final MetricRegistry metrics = new MetricRegistry();
    private final ImmutableList<HealthProbe> systemProbes = ImmutableList.of(
            new MemoryInfoProbe(),
            new DiskSpaceProbe()
    );

    private @Autowired Collection<HealthProbe> probes;
    private @Autowired HealthController healthController;

    public @Bean HealthController healthController() {
        return new HealthController(systemProbes);
    }

    public @Bean org.atlasapi.system.HealthController threadController() {
        return new org.atlasapi.system.HealthController(null);
    }

    public @Bean HealthProbe metricsProbe() {
        return new MetricsProbe("Metrics", metrics());
    }

    public @Bean MetricRegistry metrics() {
        return metrics;
    }

    public static MetricRegistry staticMetrics() {
        return metrics;
    }

    @PostConstruct
    public void addProbes() {
        healthController.addProbes(probes);
    }
}
@@ -93,16 +93,60 @@
 truct;%0A%0A
+import org.atlasapi.AtlasPersistenceModule;%0A
 import o
@@ -579,24 +579,101 @@
 yInfoProbe;%0A
+import com.metabroadcast.common.persistence.cassandra.health.CassandraProbe;%0A
 import com.m
@@ -908,16 +908,17 @@
 stry();%0A
+%0A
     priv
@@ -925,162 +925,8 @@
 ate 
-final ImmutableList%3CHealthProbe%3E systemProbes = ImmutableList.of(%0A            new MemoryInfoProbe(),%0A            new DiskSpaceProbe()%0A    );%0A%0A    private 
 @Aut
@@ -1017,19 +1017,84 @@
 hControl
+ler;%0A    private @Autowired AtlasPersistenceModule persistenceModu
 le
-r
 ;%0A%0A    p
@@ -1183,20 +1183,199 @@
 ler(
-systemProbes
+ImmutableList.of(%0A                new MemoryInfoProbe(),%0A                new DiskSpaceProbe(),%0A                new CassandraProbe(persistenceModule.persistenceModule().getSession())%0A        )
 );%0A 
@@ -1712,90 +1712,8 @@
  %7D%0A%0A
-    public static MetricRegistry staticMetrics() %7B%0A        return metrics;%0A    %7D%0A%0A
     
@@ -1808,8 +1808,9 @@
 %0A    %7D%0A%7D
+%0A

Add Cassandra probe to health controller