예제 #1
0
  private void exportContentDeliveryNetworks(File baseDir) throws IOException {
    List<Cdn> cdns = cdnCurator.list();
    if (cdns == null || cdns.isEmpty()) {
      return;
    }

    File cdnDir = new File(baseDir.getCanonicalPath(), "content_delivery_network");
    cdnDir.mkdir();

    FileWriter writer = null;
    for (Cdn cdn : cdns) {
      if (log.isDebugEnabled()) {
        log.debug("Exporting Content Delivery Network" + cdn.getName());
      }
      try {
        File file = new File(cdnDir.getCanonicalPath(), cdn.getLabel() + ".json");
        writer = new FileWriter(file);
        cdnExporter.export(mapper, writer, cdn);
      } finally {
        if (writer != null) {
          writer.close();
        }
      }
    }
  }
예제 #2
0
 /**
  * Retrieves a list of CDN's
  *
  * <p>
  *
  * <pre>
  * {
  *   "id" : "database_id",
  *   "label" : "the-cdn",
  *   "name" : "The CDN",
  *   "url" : "https://location.cdn.redhat.com",
  *   "certificate" : {
  *     "key" : "",
  *     "cert" : "",
  *     "id" : "",
  *     "serial" : "serial number",
  *     "created" : [date],
  *     "updated" : [date]
  *   },
  *   "created" : [date],
  *   "updated" : [date]
  * }
  * </pre>
  *
  * @return a list of Cdn objects
  * @httpcode 200
  */
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public List<Cdn> getContentDeliveryNetworks() {
   return curator.list();
 }