// Path: agathon-manager/src/main/java/com/brighttag/agathon/dao/BackingStoreException.java
// public class BackingStoreException extends Exception {
//   private static final long serialVersionUID = 1L;
// 
//   public BackingStoreException() {
//   }
// 
//   public BackingStoreException(String message) {
//     super(message);
//   }
// 
//   public BackingStoreException(Throwable cause) {
//     super(cause);
//   }
// 
//   public BackingStoreException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
// }
// 
// Path: agathon-manager/src/main/java/com/brighttag/agathon/dao/CassandraRingDao.java
// public interface CassandraRingDao {
// 
//   /**
//    * Returns the set of Cassandra rings.
//    *
//    * @return set of Cassandra rings
//    * @throws BackingStoreException if there was a problem communicating with the backing store.
//    */
//   ImmutableSet<CassandraRing> findAll() throws BackingStoreException;
// 
//   /**
//    * Returns the Cassandra ring with the given {@code name} or {@code null} if not found.
//    *
//    * @param name the Cassandra ring name
//    * @return the Cassandra ring or {@code null} if not found
//    * @throws BackingStoreException if there was a problem communicating with the backing store.
//    */
//   @Nullable CassandraRing findByName(String name) throws BackingStoreException;
// 
//   /**
//    * Saves the Cassandra {@code ring}.
//    *
//    * @param ring the Cassandra ring
//    */
//   void save(CassandraRing ring);
// 
//   /**
//    * Deletes the Cassandra {@code ring}.
//    *
//    * @param ring the Cassandra ring
//    */
//   void delete(CassandraRing ring);
// 
// }
// 
// Path: agathon-manager/src/main/java/com/brighttag/agathon/model/CassandraRing.java
// public class CassandraRing {
// 
//   private final String name;
//   private final ImmutableSet<CassandraInstance> instances;
// 
//   private CassandraRing(@JsonProperty("name") String name,
//       @JsonProperty("instances") Set<CassandraInstance> instances) {
//     this(new Builder()
//         .name(name)
//         .instances(instances));
//   }
// 
//   private CassandraRing(Builder builder) {
//     this.name = builder.name;
//     this.instances = builder.instances.build();
//   }
// 
//   public @NotEmpty String getName() {
//     return name;
//   }
// 
//   public @NotEmpty ImmutableSet<CassandraInstance> getInstances() {
//     return instances;
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(significantAttributes());
//   }
// 
//   @Override
//   public boolean equals(Object obj) {
//     if (obj == null) {
//       return false;
//     } else if (obj == this) {
//       return true;
//     } else if (!getClass().isAssignableFrom(obj.getClass())) {
//       return false;
//     }
//     return Arrays.equals(significantAttributes(), getClass().cast(obj).significantAttributes());
//   }
// 
//   @Override
//   public String toString() {
//     return Objects.toStringHelper(this)
//         .add("name", name)
//         .add("instances", instances)
//         .toString();
//   }
// 
//   Object[] significantAttributes() {
//     return new Object[] { name, instances };
//   }
// 
//   /**
//    * Fluent builder for {@link CassandraRing}s.
//    *
//    * @author codyaray
//    * @since 9/16/2013
//    */
//   public static class Builder {
// 
//     private String name;
//     private final ImmutableSet.Builder<CassandraInstance> instances = ImmutableSet.builder();
// 
//     public Builder instances(Collection<CassandraInstance> instances) {
//       this.instances.addAll(instances);
//       return this;
//     }
// 
//     public Builder name(String name) {
//       this.name = name;
//       return this;
//     }
// 
//     public CassandraRing build() {
//       checkNotNull(name);
//       return new CassandraRing(this);
//     }
// 
//   }
// 
// }


import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.brighttag.agathon.dao.BackingStoreException;
import com.brighttag.agathon.dao.CassandraRingDao;
import com.brighttag.agathon.model.CassandraRing;
  @Override
  public ImmutableSet<CassandraRing> findAll() throws BackingStoreException {
    ImmutableSet.Builder<CassandraRing> ringBuilder = ImmutableSet.builder();
    ZergHosts hosts = ZergHosts.from(zergConnector.getHosts());
    for (String ring : hosts.rings()) {
      ringBuilder.add(buildRingFromHosts(ring, hosts));
    }
    return ringBuilder.build();
  }

  @Override
  public @Nullable CassandraRing findByName(String name) throws BackingStoreException {
    ZergHosts hosts = ZergHosts.from(zergConnector.getHosts());
    if (!hosts.rings().contains(name)) {
      return null;
    }
    return buildRingFromHosts(name, hosts);
  }

  @Override
  public void save(CassandraRing ring) {
    throw new UnsupportedOperationException("Save is not supported for " + getClass().getSimpleName());
  }

  @Override
  public void delete(CassandraRing ring) {
    throw new UnsupportedOperationException("Delete is not supported for " + getClass().getSimpleName());
  }

  private CassandraRing buildRingFromHosts(String ring, ZergHosts hosts) {
// Path: agathon-manager/src/main/java/com/brighttag/agathon/dao/BackingStoreException.java
// public class BackingStoreException extends Exception {
//   private static final long serialVersionUID = 1L;
// 
//   public BackingStoreException() {
//   }
// 
//   public BackingStoreException(String message) {
//     super(message);
//   }
// 
//   public BackingStoreException(Throwable cause) {
//     super(cause);
//   }
// 
//   public BackingStoreException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
// }
// 
// Path: agathon-manager/src/main/java/com/brighttag/agathon/dao/CassandraRingDao.java
// public interface CassandraRingDao {
// 
//   /**
//    * Returns the set of Cassandra rings.
//    *
//    * @return set of Cassandra rings
//    * @throws BackingStoreException if there was a problem communicating with the backing store.
//    */
//   ImmutableSet<CassandraRing> findAll() throws BackingStoreException;
// 
//   /**
//    * Returns the Cassandra ring with the given {@code name} or {@code null} if not found.
//    *
//    * @param name the Cassandra ring name
//    * @return the Cassandra ring or {@code null} if not found
//    * @throws BackingStoreException if there was a problem communicating with the backing store.
//    */
//   @Nullable CassandraRing findByName(String name) throws BackingStoreException;
// 
//   /**
//    * Saves the Cassandra {@code ring}.
//    *
//    * @param ring the Cassandra ring
//    */
//   void save(CassandraRing ring);
// 
//   /**
//    * Deletes the Cassandra {@code ring}.
//    *
//    * @param ring the Cassandra ring
//    */
//   void delete(CassandraRing ring);
// 
// }
// 
// Path: agathon-manager/src/main/java/com/brighttag/agathon/model/CassandraRing.java
// public class CassandraRing {
// 
//   private final String name;
//   private final ImmutableSet<CassandraInstance> instances;
// 
//   private CassandraRing(@JsonProperty("name") String name,
//       @JsonProperty("instances") Set<CassandraInstance> instances) {
//     this(new Builder()
//         .name(name)
//         .instances(instances));
//   }
// 
//   private CassandraRing(Builder builder) {
//     this.name = builder.name;
//     this.instances = builder.instances.build();
//   }
// 
//   public @NotEmpty String getName() {
//     return name;
//   }
// 
//   public @NotEmpty ImmutableSet<CassandraInstance> getInstances() {
//     return instances;
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(significantAttributes());
//   }
// 
//   @Override
//   public boolean equals(Object obj) {
//     if (obj == null) {
//       return false;
//     } else if (obj == this) {
//       return true;
//     } else if (!getClass().isAssignableFrom(obj.getClass())) {
//       return false;
//     }
//     return Arrays.equals(significantAttributes(), getClass().cast(obj).significantAttributes());
//   }
// 
//   @Override
//   public String toString() {
//     return Objects.toStringHelper(this)
//         .add("name", name)
//         .add("instances", instances)
//         .toString();
//   }
// 
//   Object[] significantAttributes() {
//     return new Object[] { name, instances };
//   }
// 
//   /**
//    * Fluent builder for {@link CassandraRing}s.
//    *
//    * @author codyaray
//    * @since 9/16/2013
//    */
//   public static class Builder {
// 
//     private String name;
//     private final ImmutableSet.Builder<CassandraInstance> instances = ImmutableSet.builder();
// 
//     public Builder instances(Collection<CassandraInstance> instances) {
//       this.instances.addAll(instances);
//       return this;
//     }
// 
//     public Builder name(String name) {
//       this.name = name;
//       return this;
//     }
// 
//     public CassandraRing build() {
//       checkNotNull(name);
//       return new CassandraRing(this);
//     }
// 
//   }
// 
// }


// Path: agathon-manager/src/main/java/com/brighttag/agathon/dao/zerg/ZergCassandraRingDao.java
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.brighttag.agathon.dao.BackingStoreException;
import com.brighttag.agathon.dao.CassandraRingDao;
import com.brighttag.agathon.model.CassandraRing;

  @Override
  public ImmutableSet<CassandraRing> findAll() throws BackingStoreException {
    ImmutableSet.Builder<CassandraRing> ringBuilder = ImmutableSet.builder();
    ZergHosts hosts = ZergHosts.from(zergConnector.getHosts());
    for (String ring : hosts.rings()) {
      ringBuilder.add(buildRingFromHosts(ring, hosts));
    }
    return ringBuilder.build();
  }

  @Override
  public @Nullable CassandraRing findByName(String name) throws BackingStoreException {
    ZergHosts hosts = ZergHosts.from(zergConnector.getHosts());
    if (!hosts.rings().contains(name)) {
      return null;
    }
    return buildRingFromHosts(name, hosts);
  }

  @Override
  public void save(CassandraRing ring) {
    throw new UnsupportedOperationException("Save is not supported for " + getClass().getSimpleName());
  }

  @Override
  public void delete(CassandraRing ring) {
    throw new UnsupportedOperationException("Delete is not supported for " + getClass().getSimpleName());
  }

  private CassandraRing buildRingFromHosts(String ring, ZergHosts hosts) {
    return new CassandraRing.Builder()