class GraphiteValidator {

  public ValidatedGraphite validate(Graphite graphite) {
    if (graphite == null) {
      graphite = new Graphite();
    }

    Graphite validated = loader.load(graphite.getConfig());

    if (graphite.getHost() != null) {
      validated.setHost(graphite.getHost());
    }
    if (graphite.getPrefix() != null) {
      validated.setPrefix(graphite.getPrefix());
    }
    if (graphite.getNamespace() != null) {
      validated.setNamespace(graphite.getNamespace());
    }
    validated.init();

    if (validated.isEnabled()) {
      if (validated.getHost() == null || validated.getPrefix() == null || validated.getNamespace() == null) {
        throw new CircusTrainException(
            String.format("Missing graphite configuration property: host[%s],  prefix[%s], namespace[%s]",
                validated.getHost(), validated.getPrefix(), validated.getNamespace()));
      }
    }

    return new ValidatedGraphite(validated);
  }

  public  GraphiteValidator(Configuration conf);
    GraphiteValidator(GraphiteLoader loader);

}