class HBaseTimelineStorageUtils {

  public static Configuration getTimelineServiceHBaseConf(Configuration conf)
      throws MalformedURLException {
    if (conf == null) {
      throw new NullPointerException();
    }

    Configuration hbaseConf;
    String timelineServiceHBaseConfFileURL =
        conf.get(YarnConfiguration.TIMELINE_SERVICE_HBASE_CONFIGURATION_FILE);
    if (timelineServiceHBaseConfFileURL != null
        && timelineServiceHBaseConfFileURL.length() > 0) {
      LOG.info("Using hbase configuration at " +
          timelineServiceHBaseConfFileURL);
      // create a clone so that we don't mess with out input one
      hbaseConf = new Configuration(conf);
      Configuration plainHBaseConf = new Configuration(false);
      URL hbaseSiteXML = new URL(timelineServiceHBaseConfFileURL);
      plainHBaseConf.addResource(hbaseSiteXML);
      HBaseConfiguration.merge(hbaseConf, plainHBaseConf);
    } else {
      // default to what is on the classpath
      hbaseConf = HBaseConfiguration.create(conf);
    }
    return hbaseConf;
  }

  private  HBaseTimelineStorageUtils();

}