private Response processUpdate(NamespacesInstanceModel model, final boolean updateExisting,
    final UriInfo uriInfo) {
    if (LOG.isTraceEnabled()) {
      LOG.trace((updateExisting ? "PUT " : "POST ") + uriInfo.getAbsolutePath());
    }
    if (model == null) {
      try {
        model = new NamespacesInstanceModel(namespace);
      } catch (IOException ioe) {
        servlet.getMetrics().incrementFailedPutRequests(1);
        throw new RuntimeException("Cannot retrieve info for '" + namespace + "'.");
      }
    }
    servlet.getMetrics().incrementRequests(1);

    if (servlet.isReadOnly()) {
      servlet.getMetrics().incrementFailedPutRequests(1);
      return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT)
        .entity("Forbidden" + CRLF).build();
    }

    Admin admin = null;
    boolean namespaceExists = false;
    try {
      admin = servlet.getAdmin();
      namespaceExists = doesNamespaceExist(admin, namespace);
    } catch (IOException e) {
      servlet.getMetrics().incrementFailedPutRequests(1);
      return processException(e);
    }

    // Do not allow creation if namespace already exists.
    if (!updateExisting && namespaceExists) {
      servlet.getMetrics().incrementFailedPutRequests(1);
      return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT).entity("Namespace '"
        + namespace + "' already exists.  Use REST PUT " + "to alter the existing namespace.")
        .build();
    }

    // Do not allow altering if namespace does not exist.
    if (updateExisting && !namespaceExists) {
      servlet.getMetrics().incrementFailedPutRequests(1);
      return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT).entity(
        "Namespace '" + namespace + "' does not exist. Use " + "REST POST to create the namespace.")
        .build();
    }

    return createOrUpdate(model, uriInfo, admin, updateExisting);
  }
Build a response for POST create namespace with properties specified.
@param model   properties used for create.
@param uriInfo (JAX-RS context variable) request URL
@return response code.
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesInstanceResource.java