private static ServiceAnnouncement getPrestoAnnouncement(Set<ServiceAnnouncement> announcements) {
   for (ServiceAnnouncement announcement : announcements) {
     if (announcement.getType().equals("presto")) {
       return announcement;
     }
   }
   throw new RuntimeException("Presto announcement not found: " + announcements);
 }
  private static void updateDatasourcesAnnouncement(Announcer announcer, String connectorId) {
    //
    // This code was copied from PrestoServer, and is a hack that should be removed when the data
    // source property is removed
    //

    // get existing announcement
    ServiceAnnouncement announcement = getPrestoAnnouncement(announcer.getServiceAnnouncements());

    // update datasources property
    Map<String, String> properties = new LinkedHashMap<>(announcement.getProperties());
    String property = nullToEmpty(properties.get("datasources"));
    Set<String> datasources =
        new LinkedHashSet<>(
            Splitter.on(',').trimResults().omitEmptyStrings().splitToList(property));
    datasources.add(connectorId);
    properties.put("datasources", Joiner.on(',').join(datasources));

    // update announcement
    announcer.removeServiceAnnouncement(announcement.getId());
    announcer.addServiceAnnouncement(
        serviceAnnouncement(announcement.getType()).addProperties(properties).build());
    announcer.forceAnnounce();
  }