Example #1
0
  /**
   * Removes all trust bundle from a domain.
   *
   * @param domainName The name of the domain to remove trust bundle from.
   * @return Status of 200 if trust bundles were removed from the domain or a status of 404 if a
   *     domain with the given name does not exist.
   */
  @DELETE
  @Path("{domain}/deleteFromDomain")
  public Response disassociateTrustBundlesFromDomain(@PathParam("domain") String domainName) {
    // make sure the domain exists
    org.nhindirect.config.store.Domain entityDomain;
    try {
      entityDomain = domainDao.getDomainByName(domainName);
      if (entityDomain == null)
        return Response.status(Status.NOT_FOUND).cacheControl(noCache).build();

    } catch (Exception e) {
      log.error("Error looking up domain.", e);
      return Response.serverError().cacheControl(noCache).build();
    }

    // now make the disassociation
    try {
      bundleDao.disassociateTrustBundlesFromDomain(entityDomain.getId());
      return Response.ok().cacheControl(noCache).build();
    } catch (Exception e) {
      log.error("Error disassociating trust bundles from domain.", e);
      return Response.serverError().cacheControl(noCache).build();
    }
  }