// Path: breakerbox-azure/src/main/java/com/yammer/breakerbox/azure/core/TableKey.java
// public interface TableKey {
//     String getRowKey();
//     String getPartitionKey();
//     Class<? extends TableServiceEntity> getEntityClass();
//     AzureTableName getTable();
// }
// 
// Path: breakerbox-azure/src/main/java/com/yammer/breakerbox/azure/core/TableType.java
// public abstract class TableType extends TableServiceEntity {
//     protected final AzureTableName azureTableName;
// 
//     protected TableType(AzureTableName azureTableName) {
//         this.azureTableName = checkNotNull(azureTableName, "azureTableName cannot be null");
//     }
// 
//     public AzureTableName getAzureTableName() {
//         return azureTableName;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (!(o instanceof TableType)) return false;
// 
//         TableType that = (TableType) o;
// 
//         if (azureTableName != that.azureTableName) return false;
//         if (partitionKey != null ? !partitionKey.equals(that.partitionKey) : that.partitionKey != null) return false;
//         if (rowKey != null ? !rowKey.equals(that.rowKey) : that.rowKey != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = azureTableName.hashCode();
//         result = 31 * result + (partitionKey != null ? partitionKey.hashCode() : 0);
//         result = 31 * result + (rowKey != null ? rowKey.hashCode() : 0);
//         return result;
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/DependencyId.java
// public class DependencyId implements TenacityPropertyKey {
//     private final String id;
// 
//     private DependencyId(String id) {
//         this.id = id.toUpperCase();
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static DependencyId from(String id) {
//         return new DependencyId(id);
//     }
// 
//     @Override
//     public String name() {
//         return id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final DependencyId other = (DependencyId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/ServiceId.java
// public class ServiceId {
//     private final String id;
// 
//     private ServiceId(String id) {
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static ServiceId from(String id) {
//         return new ServiceId(id);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final ServiceId other = (ServiceId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }


import com.microsoft.azure.storage.table.TableServiceEntity;
import com.yammer.breakerbox.azure.core.AzureTableName;
import com.yammer.breakerbox.azure.core.TableId;
import com.yammer.breakerbox.azure.core.TableKey;
import com.yammer.breakerbox.azure.core.TableType;
import com.yammer.breakerbox.store.DependencyId;
import com.yammer.breakerbox.store.ServiceId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package com.yammer.breakerbox.azure.model;


/**
 * Bean to represent the Service table.
 * Partitioned by service, each service contains a list of service dependency keys.
 * As of 5-SEP-2013, these dependency keys are updated by the continuous polling of services'
 * Tenacity endpoint for DependencyKeys. See TenacityClient for more.
 */
public class ServiceEntity extends TableType implements TableKey {
    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceEntity.class);

    private ServiceEntity(ServiceId serviceId,
                          DependencyId dependencyId) {
        super(TableId.SERVICE);
        this.partitionKey = serviceId.getId();
        this.rowKey = dependencyId.getId();
    }

    public ServiceId getServiceId() {
        return ServiceId.from(getPartitionKey());
    }

    public DependencyId getDependencyId() {
        return DependencyId.from(getRowKey());
    }

    public static ServiceEntity build(ServiceId serviceId,
                                      DependencyId dependencyId) {
        return new ServiceEntity(serviceId, dependencyId);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
// Path: breakerbox-azure/src/main/java/com/yammer/breakerbox/azure/core/TableKey.java
// public interface TableKey {
//     String getRowKey();
//     String getPartitionKey();
//     Class<? extends TableServiceEntity> getEntityClass();
//     AzureTableName getTable();
// }
// 
// Path: breakerbox-azure/src/main/java/com/yammer/breakerbox/azure/core/TableType.java
// public abstract class TableType extends TableServiceEntity {
//     protected final AzureTableName azureTableName;
// 
//     protected TableType(AzureTableName azureTableName) {
//         this.azureTableName = checkNotNull(azureTableName, "azureTableName cannot be null");
//     }
// 
//     public AzureTableName getAzureTableName() {
//         return azureTableName;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (!(o instanceof TableType)) return false;
// 
//         TableType that = (TableType) o;
// 
//         if (azureTableName != that.azureTableName) return false;
//         if (partitionKey != null ? !partitionKey.equals(that.partitionKey) : that.partitionKey != null) return false;
//         if (rowKey != null ? !rowKey.equals(that.rowKey) : that.rowKey != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = azureTableName.hashCode();
//         result = 31 * result + (partitionKey != null ? partitionKey.hashCode() : 0);
//         result = 31 * result + (rowKey != null ? rowKey.hashCode() : 0);
//         return result;
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/DependencyId.java
// public class DependencyId implements TenacityPropertyKey {
//     private final String id;
// 
//     private DependencyId(String id) {
//         this.id = id.toUpperCase();
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static DependencyId from(String id) {
//         return new DependencyId(id);
//     }
// 
//     @Override
//     public String name() {
//         return id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final DependencyId other = (DependencyId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }
// 
// Path: breakerbox-store/src/main/java/com/yammer/breakerbox/store/ServiceId.java
// public class ServiceId {
//     private final String id;
// 
//     private ServiceId(String id) {
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public static ServiceId from(String id) {
//         return new ServiceId(id);
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(id);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null || getClass() != obj.getClass()) {
//             return false;
//         }
//         final ServiceId other = (ServiceId) obj;
//         return Objects.equals(this.id, other.id);
//     }
// 
//     @Override
//     public String toString() {
//         return id;
//     }
// }


// Path: breakerbox-azure/src/main/java/com/yammer/breakerbox/azure/model/ServiceEntity.java
import com.microsoft.azure.storage.table.TableServiceEntity;
import com.yammer.breakerbox.azure.core.AzureTableName;
import com.yammer.breakerbox.azure.core.TableId;
import com.yammer.breakerbox.azure.core.TableKey;
import com.yammer.breakerbox.azure.core.TableType;
import com.yammer.breakerbox.store.DependencyId;
import com.yammer.breakerbox.store.ServiceId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package com.yammer.breakerbox.azure.model;


/**
 * Bean to represent the Service table.
 * Partitioned by service, each service contains a list of service dependency keys.
 * As of 5-SEP-2013, these dependency keys are updated by the continuous polling of services'
 * Tenacity endpoint for DependencyKeys. See TenacityClient for more.
 */
public class ServiceEntity extends TableType implements TableKey {
    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceEntity.class);

    private ServiceEntity(ServiceId serviceId,
                          DependencyId dependencyId) {
        super(TableId.SERVICE);
        this.partitionKey = serviceId.getId();
        this.rowKey = dependencyId.getId();
    }

    public ServiceId getServiceId() {
        return ServiceId.from(getPartitionKey());
    }

    public DependencyId getDependencyId() {
        return DependencyId.from(getRowKey());
    }

    public static ServiceEntity build(ServiceId serviceId,
                                      DependencyId dependencyId) {
        return new ServiceEntity(serviceId, dependencyId);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;