All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.byu.hbll.box.BoxHealth Maven / Gradle / Ivy

There is a newer version: 2.5.3
Show newest version
package edu.byu.hbll.box;

import java.util.HashMap;
import java.util.Map;

/**
 * A snapshot of the health of the Box system.
 *
 * @author Charles Draper
 */
public class BoxHealth {

  private boolean healthy;
  private Map sourceHealthMap = new HashMap<>();

  /**
   * Creates a new {@link BoxHealth} initialized with the given health information.
   *
   * @param healthy whether or not the overall health of box is good
   * @param sourceHealthMap the health information for all sources keyed by sourceName
   */
  public BoxHealth(boolean healthy, Map sourceHealthMap) {
    this.healthy = healthy;
    this.sourceHealthMap = sourceHealthMap;
  }

  /**
   * Returns whether this box is healthy.
   *
   * @return whether or not the overall health of box is good
   */
  public boolean isHealthy() {
    return healthy;
  }

  /**
   * Returns the health of the given source.
   *
   * @param sourceName the sourceName
   * @return the health for a particular source
   */
  public SourceHealth getSourceHealth(String sourceName) {
    return sourceHealthMap.get(sourceName);
  }

  /**
   * Returns the health information for all sources keyed by sourceName.
   *
   * @return the health information for all sources keyed by sourceName
   */
  public Map getSourceHealthMap() {
    return sourceHealthMap;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy