knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject knox git commit: KNOX-809 Enhance the 'put' in HFDS for ClientDSL (Vincent Devillers via Sumit Gupta)
Date Thu, 05 Jan 2017 22:40:10 GMT
Repository: knox
Updated Branches:
  refs/heads/master 215cedac6 -> b9a30a3e8


KNOX-809 Enhance the 'put' in HFDS for ClientDSL (Vincent Devillers via Sumit Gupta)


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/b9a30a3e
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/b9a30a3e
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/b9a30a3e

Branch: refs/heads/master
Commit: b9a30a3e82ec668e769666604cdf7d259b4c689b
Parents: 215ceda
Author: Sumit Gupta <sumit@apache.org>
Authored: Thu Jan 5 17:38:40 2017 -0500
Committer: Sumit Gupta <sumit@apache.org>
Committed: Thu Jan 5 17:38:40 2017 -0500

----------------------------------------------------------------------
 .../home/samples/ExampleWebHdfsPutGet.groovy    |  2 ++
 .../apache/hadoop/gateway/shell/hdfs/Put.java   | 35 ++++++++++++++++++++
 2 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/b9a30a3e/gateway-release/home/samples/ExampleWebHdfsPutGet.groovy
----------------------------------------------------------------------
diff --git a/gateway-release/home/samples/ExampleWebHdfsPutGet.groovy b/gateway-release/home/samples/ExampleWebHdfsPutGet.groovy
index f24c0b0..68b5f67 100644
--- a/gateway-release/home/samples/ExampleWebHdfsPutGet.groovy
+++ b/gateway-release/home/samples/ExampleWebHdfsPutGet.groovy
@@ -38,6 +38,8 @@ Hdfs.rm( session ).file( dataDir ).recursive().now()
 
 Hdfs.put( session ).file( dataFile ).to( dataDir + "/" + dataFile ).now()
 
+Hdfs.put( session ).file( dataFile ).to( dataDir + "/" + dataFile ).overwrite( true ).permission(
777 ).now()
+
 println Hdfs.get( session ).from( dataDir + "/" + dataFile ).now().string
 
 session.shutdown()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/b9a30a3e/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java b/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java
index 8fa3257..23af27e 100644
--- a/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java
+++ b/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java
@@ -41,6 +41,11 @@ class Put {
     private String text;
     private String file;
     private String to;
+    private boolean overwrite = false;
+    private int permission = 755;
+    private Integer blocksize;
+    private Integer buffersize;
+    private Short replication;
 
     Request( Hadoop session ) {
       super( session );
@@ -61,12 +66,42 @@ class Put {
       return this;
     }
 
+    public Request overwrite( boolean overwrite ) {
+      this.overwrite = overwrite;
+      return this;
+    }
+
+    public Request permission( int permission ) {
+      this.permission = permission;
+      return this;
+    }
+
+    public Request blocksize( Integer blocksize ) {
+      this.blocksize = blocksize;
+      return this;
+    }
+
+    public Request replication( Short replication ) {
+      this.replication = replication;
+      return this;
+    }
+
+    public Request buffersize( Integer buffersize ) {
+      this.buffersize = buffersize;
+      return this;
+    }
+
     protected Callable<Response> callable() {
       return new Callable<Response>() {
         @Override
         public Response call() throws Exception {
           URIBuilder uri = uri( Hdfs.SERVICE_PATH, to );
           addQueryParam( uri, "op", "CREATE" );
+          addQueryParam( uri, "overwrite", overwrite );
+          addQueryParam( uri, "permission", permission );
+          addQueryParam( uri, "blocksize", blocksize );
+          addQueryParam( uri, "replication", replication );
+          addQueryParam( uri, "buffersize", buffersize );
           HttpPut nn = new HttpPut( uri.build() );
           HttpResponse r = execute( nn );
           if( r.getStatusLine().getStatusCode() != HttpStatus.SC_TEMPORARY_REDIRECT ) {


Mime
View raw message