Java 类org.apache.hadoop.hdfs.web.resources.DeleteOpParam 实例源码

项目:hadoop-plus    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hadoop-plus    文件:NamenodeWebHdfsMethods.java   
private Response delete(
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final UserParam username,
    final DoAsParam doAsUser,
    final String fullpath,
    final DeleteOpParam op,
    final RecursiveParam recursive
    ) throws IOException {
  final NameNode namenode = (NameNode)context.getAttribute("name.node");

  switch(op.getValue()) {
  case DELETE:
  {
    final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
    final String js = JsonUtil.toJsonString("boolean", b);
    return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
项目:hops    文件:NamenodeWebHdfsMethods.java   
/**
 * Handle HTTP DELETE request for the root.
 */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context
    final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME)
    @DefaultValue(DelegationParam.DEFAULT)
    final DelegationParam delegation,
    @QueryParam(UserParam.NAME)
    @DefaultValue(UserParam.DEFAULT)
    final UserParam username,
    @QueryParam(DoAsParam.NAME)
    @DefaultValue(DoAsParam.DEFAULT)
    final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME)
    @DefaultValue(DeleteOpParam.DEFAULT)
    final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME)
    @DefaultValue(RecursiveParam.DEFAULT)
    final RecursiveParam recursive) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hops    文件:NamenodeWebHdfsMethods.java   
private Response delete(final UserGroupInformation ugi,
    final DelegationParam delegation, final UserParam username,
    final DoAsParam doAsUser, final String fullpath, final DeleteOpParam op,
    final RecursiveParam recursive) throws IOException {
  final NameNode namenode = (NameNode) context.getAttribute("name.node");

  switch (op.getValue()) {
    case DELETE: {
      final boolean b =
          namenode.getRpcServer().delete(fullpath, recursive.getValue());
      final String js = JsonUtil.toJsonString("boolean", b);
      return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
    }
    default:
      throw new UnsupportedOperationException(op + " is not supported");
  }
}
项目:hadoop-TCP    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hadoop-TCP    文件:NamenodeWebHdfsMethods.java   
private Response delete(
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final UserParam username,
    final DoAsParam doAsUser,
    final String fullpath,
    final DeleteOpParam op,
    final RecursiveParam recursive
    ) throws IOException {
  final NameNode namenode = (NameNode)context.getAttribute("name.node");

  switch(op.getValue()) {
  case DELETE:
  {
    final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
    final String js = JsonUtil.toJsonString("boolean", b);
    return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
项目:hadoop-on-lustre    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hardfs    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hardfs    文件:NamenodeWebHdfsMethods.java   
private Response delete(
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final UserParam username,
    final DoAsParam doAsUser,
    final String fullpath,
    final DeleteOpParam op,
    final RecursiveParam recursive
    ) throws IOException {
  final NameNode namenode = (NameNode)context.getAttribute("name.node");

  switch(op.getValue()) {
  case DELETE:
  {
    final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
    final String js = JsonUtil.toJsonString("boolean", b);
    return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
项目:hadoop-on-lustre2    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hadoop-on-lustre2    文件:NamenodeWebHdfsMethods.java   
private Response delete(
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final UserParam username,
    final DoAsParam doAsUser,
    final String fullpath,
    final DeleteOpParam op,
    final RecursiveParam recursive
    ) throws IOException {
  final NameNode namenode = (NameNode)context.getAttribute("name.node");

  switch(op.getValue()) {
  case DELETE:
  {
    final boolean b = getRPCServer(namenode).delete(fullpath, recursive.getValue());
    final String js = JsonUtil.toJsonString("boolean", b);
    return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
项目:hortonworks-extension    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hortonworks-extension    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request for the root. */
@DELETE
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteRoot(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {
  return delete(ugi, delegation, username, doAsUser, ROOT, op, recursive);
}
项目:hadoop-plus    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {
        return delete(ugi, delegation, username, doAsUser,
            path.getAbsolutePath(), op, recursive);
      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hops    文件:NamenodeWebHdfsMethods.java   
/**
 * Handle HTTP DELETE request.
 */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context
    final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME)
    @DefaultValue(DelegationParam.DEFAULT)
    final DelegationParam delegation,
    @QueryParam(UserParam.NAME)
    @DefaultValue(UserParam.DEFAULT)
    final UserParam username,
    @QueryParam(DoAsParam.NAME)
    @DefaultValue(DoAsParam.DEFAULT)
    final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME)
    final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME)
    @DefaultValue(DeleteOpParam.DEFAULT)
    final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME)
    @DefaultValue(RecursiveParam.DEFAULT)
    final RecursiveParam recursive) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {
        return delete(ugi, delegation, username, doAsUser,
            path.getAbsolutePath(), op, recursive);
      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hadoop-TCP    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {
        return delete(ugi, delegation, username, doAsUser,
            path.getAbsolutePath(), op, recursive);
      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hardfs    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {
        return delete(ugi, delegation, username, doAsUser,
            path.getAbsolutePath(), op, recursive);
      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hadoop-on-lustre2    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {
        return delete(ugi, delegation, username, doAsUser,
            path.getAbsolutePath(), op, recursive);
      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hadoop-plus    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hadoop-plus    文件:TestWebHdfsTokens.java   
@Test(timeout=1000)
public void testDeleteOpRequireAuth() {    
  for (HttpOpParam.Op op : DeleteOpParam.Op.values()) {
    assertFalse(op.getRequireAuth());
  }
}
项目:hops    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean) json.get("boolean");
}
项目:hadoop-TCP    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hadoop-TCP    文件:TestWebHdfsTokens.java   
@Test(timeout=1000)
public void testDeleteOpRequireAuth() {    
  for (HttpOpParam.Op op : DeleteOpParam.Op.values()) {
    assertFalse(op.getRequireAuth());
  }
}
项目:hadoop-on-lustre    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hadoop-on-lustre    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {

      final NameNode namenode = (NameNode)context.getAttribute("name.node");
      final String fullpath = path.getAbsolutePath();

      switch(op.getValue()) {
      case DELETE:
      {
        final boolean b = namenode.delete(fullpath, recursive.getValue());
        final String js = JsonUtil.toJsonString("boolean", b);
        return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
      }
      default:
        throw new UnsupportedOperationException(op + " is not supported");
      }

      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hardfs    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hardfs    文件:TestWebHdfsTokens.java   
@Test(timeout=1000)
public void testDeleteOpRequireAuth() {    
  for (HttpOpParam.Op op : DeleteOpParam.Op.values()) {
    assertFalse(op.getRequireAuth());
  }
}
项目:hadoop-on-lustre2    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hadoop-on-lustre2    文件:TestWebHdfsTokens.java   
@Test(timeout = 1000)
public void testDeleteOpRequireAuth() {
  for (HttpOpParam.Op op : DeleteOpParam.Op.values()) {
    assertFalse(op.getRequireAuth());
  }
}
项目:hortonworks-extension    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hortonworks-extension    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {

      final NameNode namenode = (NameNode)context.getAttribute("name.node");
      final String fullpath = path.getAbsolutePath();

      switch(op.getValue()) {
      case DELETE:
      {
        final boolean b = namenode.delete(fullpath, recursive.getValue());
        final String js = JsonUtil.toJsonString("boolean", b);
        return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
      }
      default:
        throw new UnsupportedOperationException(op + " is not supported");
      }

      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}
项目:hortonworks-extension    文件:WebHdfsFileSystem.java   
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
  final HttpOpParam.Op op = DeleteOpParam.Op.DELETE;
  final Map<?, ?> json = run(op, f, new RecursiveParam(recursive));
  return (Boolean)json.get("boolean");
}
项目:hortonworks-extension    文件:NamenodeWebHdfsMethods.java   
/** Handle HTTP DELETE request. */
@DELETE
@Path("{" + UriFsPathParam.NAME + ":.*}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete(
    @Context final UserGroupInformation ugi,
    @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT)
        final DelegationParam delegation,
    @QueryParam(UserParam.NAME) @DefaultValue(UserParam.DEFAULT)
        final UserParam username,
    @QueryParam(DoAsParam.NAME) @DefaultValue(DoAsParam.DEFAULT)
        final DoAsParam doAsUser,
    @PathParam(UriFsPathParam.NAME) final UriFsPathParam path,
    @QueryParam(DeleteOpParam.NAME) @DefaultValue(DeleteOpParam.DEFAULT)
        final DeleteOpParam op,
    @QueryParam(RecursiveParam.NAME) @DefaultValue(RecursiveParam.DEFAULT)
        final RecursiveParam recursive
    ) throws IOException, InterruptedException {

  init(ugi, delegation, username, doAsUser, path, op, recursive);

  return ugi.doAs(new PrivilegedExceptionAction<Response>() {
    @Override
    public Response run() throws IOException {
      REMOTE_ADDRESS.set(request.getRemoteAddr());
      try {

      final NameNode namenode = (NameNode)context.getAttribute("name.node");
      final String fullpath = path.getAbsolutePath();

      switch(op.getValue()) {
      case DELETE:
      {
        final boolean b = namenode.delete(fullpath, recursive.getValue());
        final String js = JsonUtil.toJsonString("boolean", b);
        return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
      }
      default:
        throw new UnsupportedOperationException(op + " is not supported");
      }

      } finally {
        REMOTE_ADDRESS.set(null);
      }
    }
  });
}