You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2018/10/27 17:41:12 UTC
[1/2] knox git commit: KNOX-1541 - Rename Hadoop class in KnoxShell
to KnoxSession
Repository: knox
Updated Branches:
refs/heads/master e08d54530 -> 381eef37a
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Status.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Status.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Status.java
index a7ba974..e49ba8e 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Status.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Status.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -33,7 +33,7 @@ public class Status {
private String file;
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Hive.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Hive.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Hive.java
index 7ab79d9..2ac0dd9 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Hive.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Hive.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.job;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -41,7 +41,7 @@ public class Hive {
private String statusDir;
List<NameValuePair> params = new ArrayList<>();
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Java.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Java.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Java.java
index eb1cba6..69b50ed 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Java.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Java.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.job;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -43,7 +43,7 @@ class Java {
String output;
List<NameValuePair> params = new ArrayList<>();
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Job.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Job.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Job.java
index ec57df1..68a4d09 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Job.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Job.java
@@ -17,33 +17,33 @@
*/
package org.apache.knox.gateway.shell.job;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
public class Job {
static final String SERVICE_PATH = "/templeton/v1";
- public static Java.Request submitJava( Hadoop session ) {
+ public static Java.Request submitJava( KnoxSession session ) {
return new Java.Request( session );
}
- public static Sqoop.Request submitSqoop( Hadoop session ) {
+ public static Sqoop.Request submitSqoop( KnoxSession session ) {
return new Sqoop.Request( session );
}
- public static Pig.Request submitPig( Hadoop session ) {
+ public static Pig.Request submitPig( KnoxSession session ) {
return new Pig.Request( session );
}
- public static Hive.Request submitHive( Hadoop session ) {
+ public static Hive.Request submitHive( KnoxSession session ) {
return new Hive.Request( session );
}
- public static Queue.Request queryQueue( Hadoop session ) {
+ public static Queue.Request queryQueue( KnoxSession session ) {
return new Queue.Request( session );
}
- public static Status.Request queryStatus( Hadoop session ) {
+ public static Status.Request queryStatus( KnoxSession session ) {
return new Status.Request( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Pig.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Pig.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Pig.java
index 5203d81..77383a5 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Pig.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Pig.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.job;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -41,7 +41,7 @@ public class Pig {
private String statusDir;
List<NameValuePair> params = new ArrayList<>();
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Queue.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Queue.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Queue.java
index d2609a2..79ac9f2 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Queue.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Queue.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.job;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -30,7 +30,7 @@ class Queue {
public static class Request extends AbstractRequest<Response> {
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Sqoop.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Sqoop.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Sqoop.java
index a5b9556..030b0c1 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Sqoop.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Sqoop.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.job;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -39,7 +39,7 @@ public class Sqoop {
private String statusDir;
List<NameValuePair> params = new ArrayList<>();
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Status.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Status.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Status.java
index 0aa203c..52bf296 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Status.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/job/Status.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.job;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -32,7 +32,7 @@ class Status {
private String jobId;
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Get.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Get.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Get.java
index 83b9c9a..cf7ab19 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Get.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Get.java
@@ -22,7 +22,7 @@ import java.util.concurrent.Callable;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -33,7 +33,7 @@ import org.apache.http.client.utils.URIBuilder;
*/
public class Get {
public static class Request extends AbstractRequest<Response> {
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Token.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Token.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Token.java
index e70b699..35c4250 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Token.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knox/token/Token.java
@@ -17,13 +17,13 @@
*/
package org.apache.knox.gateway.shell.knox.token;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
public class Token {
static String SERVICE_PATH = "/knoxtoken/api/v1/token";
- public static Get.Request get( Hadoop session ) {
+ public static Get.Request get( KnoxSession session ) {
return new Get.Request( session );
}
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/DeployResourceRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/DeployResourceRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/DeployResourceRequest.java
index 3c7613e..01f03e5 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/DeployResourceRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/DeployResourceRequest.java
@@ -24,7 +24,7 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.FileEntity;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import java.io.File;
import java.io.FileNotFoundException;
@@ -38,7 +38,7 @@ class DeployResourceRequest extends AbstractRequest<BasicResponse> {
private String resourceFileName = null;
- DeployResourceRequest(Hadoop session, ResourceType type, String name, String resourceFileName) {
+ DeployResourceRequest(KnoxSession session, ResourceType type, String name, String resourceFileName) {
super(session);
this.resourceType = type;
this.resourceName = name;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListDescriptorsRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListDescriptorsRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListDescriptorsRequest.java
index 42fea37..3cb5d52 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListDescriptorsRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListDescriptorsRequest.java
@@ -16,11 +16,11 @@
*/
package org.apache.knox.gateway.shell.manager;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
class ListDescriptorsRequest extends ListResourcesRequest {
- ListDescriptorsRequest(Hadoop session) {
+ ListDescriptorsRequest(KnoxSession session) {
super(session, ResourceType.Descriptor);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListProviderConfigurationsRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListProviderConfigurationsRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListProviderConfigurationsRequest.java
index ef5785c..865d27a 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListProviderConfigurationsRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListProviderConfigurationsRequest.java
@@ -16,11 +16,11 @@
*/
package org.apache.knox.gateway.shell.manager;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
class ListProviderConfigurationsRequest extends ListResourcesRequest {
- ListProviderConfigurationsRequest(Hadoop session) {
+ ListProviderConfigurationsRequest(KnoxSession session) {
super(session, ResourceType.ProviderConfiguration);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListResourcesRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListResourcesRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListResourcesRequest.java
index 2b688d1..3074b47 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListResourcesRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListResourcesRequest.java
@@ -23,7 +23,7 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import java.util.ArrayList;
import java.util.List;
@@ -33,7 +33,7 @@ class ListResourcesRequest extends AbstractRequest<BasicResponse> {
private ResourceType resourceType = null;
- ListResourcesRequest(Hadoop session, ResourceType resourceType) {
+ ListResourcesRequest(KnoxSession session, ResourceType resourceType) {
super(session);
this.resourceType = resourceType;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListTopologiesRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListTopologiesRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListTopologiesRequest.java
index 5bcee79..2bb3d67 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListTopologiesRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/ListTopologiesRequest.java
@@ -20,14 +20,14 @@ import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import java.util.ArrayList;
import java.util.List;
class ListTopologiesRequest extends ListResourcesRequest {
- ListTopologiesRequest(Hadoop session) {
+ ListTopologiesRequest(KnoxSession session) {
super(session, ResourceType.Topology);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/Manager.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/Manager.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/Manager.java
index 0396d53..377a6ff 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/Manager.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/Manager.java
@@ -16,7 +16,7 @@
*/
package org.apache.knox.gateway.shell.manager;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import java.util.List;
@@ -25,39 +25,39 @@ import java.util.List;
*/
public class Manager {
- public static List<String> listDescriptors(Hadoop session) throws Exception {
+ public static List<String> listDescriptors(KnoxSession session) throws Exception {
return (new ListDescriptorsRequest(session)).execute();
}
- public static void deployDescriptor(Hadoop session, String name, String descriptorFileName) throws Exception {
+ public static void deployDescriptor(KnoxSession session, String name, String descriptorFileName) throws Exception {
(new DeployResourceRequest(session, ResourceType.Descriptor, name, descriptorFileName)).execute();
}
- public static void undeployDescriptor(Hadoop session, String name) throws Exception {
+ public static void undeployDescriptor(KnoxSession session, String name) throws Exception {
(new UndeployResourceRequest(session, ResourceType.Descriptor, name)).execute();
}
- public static List<String> listProviderConfigurations(Hadoop session) throws Exception {
+ public static List<String> listProviderConfigurations(KnoxSession session) throws Exception {
return (new ListProviderConfigurationsRequest(session)).execute();
}
- public static void deployProviderConfiguration(Hadoop session,
+ public static void deployProviderConfiguration(KnoxSession session,
String name,
String providerConfigFileName) throws Exception {
(new DeployResourceRequest(session, ResourceType.ProviderConfiguration, name, providerConfigFileName)).execute();
}
- public static void undeployProviderConfiguration(Hadoop session, String name) throws Exception {
+ public static void undeployProviderConfiguration(KnoxSession session, String name) throws Exception {
(new UndeployResourceRequest(session, ResourceType.ProviderConfiguration, name)).execute();
}
- public static List<String> listTopologies(Hadoop session) throws Exception {
+ public static List<String> listTopologies(KnoxSession session) throws Exception {
return (new ListTopologiesRequest(session)).execute();
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/UndeployResourceRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/UndeployResourceRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/UndeployResourceRequest.java
index a6c6495..c6a21b4 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/UndeployResourceRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/manager/UndeployResourceRequest.java
@@ -20,7 +20,7 @@ import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.utils.URIBuilder;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import java.util.concurrent.Callable;
@@ -30,7 +30,7 @@ class UndeployResourceRequest extends AbstractRequest<BasicResponse> {
private String resourceName = null;
- UndeployResourceRequest(Hadoop session, ResourceType type, String name) {
+ UndeployResourceRequest(KnoxSession session, ResourceType type, String name) {
super(session);
this.resourceType = type;
this.resourceName = name;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Status.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Status.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Status.java
index 2f18eaf..2c5612e 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Status.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Status.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.workflow;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -32,7 +32,7 @@ class Status {
private String jobId;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Submit.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Submit.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Submit.java
index f7c920b..d22d85e 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Submit.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Submit.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.workflow;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -42,7 +42,7 @@ class Submit {
private String file;
private String action = "start";
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Workflow.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Workflow.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Workflow.java
index 13619da..09ce177 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Workflow.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/workflow/Workflow.java
@@ -17,17 +17,17 @@
*/
package org.apache.knox.gateway.shell.workflow;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
public class Workflow {
static final String SERVICE_PATH = "/oozie/v1";
- public static Submit.Request submit( Hadoop session ) {
+ public static Submit.Request submit( KnoxSession session ) {
return new Submit.Request( session );
}
- public static Status.Request status( Hadoop session ) {
+ public static Status.Request status( KnoxSession session ) {
return new Status.Request( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/AppState.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/AppState.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/AppState.java
index 5cdeb46..729432c 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/AppState.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/AppState.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.yarn;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -34,7 +34,7 @@ public class AppState {
private String appId;
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/KillApp.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/KillApp.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/KillApp.java
index 245a036..b5972c5 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/KillApp.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/KillApp.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.yarn;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
@@ -34,7 +34,7 @@ public class KillApp {
private String appId;
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/NewApp.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/NewApp.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/NewApp.java
index 6ffa7dd..8f3cc4d 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/NewApp.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/NewApp.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.yarn;
import com.jayway.jsonpath.JsonPath;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
@@ -32,7 +32,7 @@ public class NewApp {
public static class Request extends AbstractRequest<Response> {
- protected Request(Hadoop session) {
+ protected Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/SubmitApp.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/SubmitApp.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/SubmitApp.java
index a9d734e..65e7f1e 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/SubmitApp.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/SubmitApp.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.yarn;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -38,7 +38,7 @@ public class SubmitApp {
private String text;
private String file;
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/Yarn.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/Yarn.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/Yarn.java
index 31cfbf2..a9f3bf4 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/Yarn.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/yarn/Yarn.java
@@ -17,25 +17,25 @@
*/
package org.apache.knox.gateway.shell.yarn;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
public class Yarn {
static final String SERVICE_PATH = "/resourcemanager";
- public static NewApp.Request newApp(Hadoop session) {
+ public static NewApp.Request newApp(KnoxSession session) {
return new NewApp.Request(session);
}
- public static SubmitApp.Request submitApp(Hadoop session) {
+ public static SubmitApp.Request submitApp(KnoxSession session) {
return new SubmitApp.Request(session);
}
- public static KillApp.Request killApp(Hadoop session) {
+ public static KillApp.Request killApp(KnoxSession session) {
return new KillApp.Request(session);
}
- public static AppState.Request appState(Hadoop session) {
+ public static AppState.Request appState(KnoxSession session) {
return new AppState.Request(session);
}
[2/2] knox git commit: KNOX-1541 - Rename Hadoop class in KnoxShell
to KnoxSession
Posted by lm...@apache.org.
KNOX-1541 - Rename Hadoop class in KnoxShell to KnoxSession
Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/381eef37
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/381eef37
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/381eef37
Branch: refs/heads/master
Commit: 381eef37a43054279b89344ab55086e5c5adb47f
Parents: e08d545
Author: Larry McCay <lm...@apache.org>
Authored: Sat Oct 27 13:41:00 2018 -0400
Committer: Larry McCay <lm...@apache.org>
Committed: Sat Oct 27 13:41:00 2018 -0400
----------------------------------------------------------------------
.../main/resources/samples/ExampleHBase.groovy | 4 +-
.../samples/ExampleManagerListResources.groovy | 4 +-
.../ExampleManagerResourceDeployment.groovy | 4 +-
.../samples/ExampleOozieWorkflow.groovy | 4 +-
.../resources/samples/ExampleWebHCatJob.groovy | 4 +-
.../samples/ExampleWebHCatJobTeragen.groovy | 4 +-
.../resources/samples/ExampleWebHCatPig.groovy | 4 +-
.../samples/ExampleWebHCatQueue.groovy | 4 +-
.../samples/ExampleWebHCatSqoop.groovy | 4 +-
.../resources/samples/ExampleWebHdfsLs.groovy | 4 +-
.../samples/ExampleWebHdfsPutGet.groovy | 4 +-
.../samples/SampleComplexCommand.groovy | 4 +-
.../main/resources/samples/SampleScript.groovy | 4 +-
.../main/resources/samples/SampleService.groovy | 6 +-
.../samples/SampleSimpleCommand.groovy | 4 +-
.../knox/gateway/shell/AbstractRequest.java | 10 +-
.../org/apache/knox/gateway/shell/Hadoop.java | 289 +----------------
.../knox/gateway/shell/HadoopException.java | 7 +-
.../apache/knox/gateway/shell/KnoxSession.java | 319 +++++++++++++++++++
.../org/apache/knox/gateway/shell/KnoxSh.java | 6 +-
.../knox/gateway/shell/KnoxShellException.java | 34 ++
.../org/apache/knox/gateway/shell/Shell.java | 2 +-
.../gateway/shell/hbase/ClusterVersion.java | 4 +-
.../apache/knox/gateway/shell/hbase/HBase.java | 8 +-
.../apache/knox/gateway/shell/hbase/Status.java | 4 +-
.../knox/gateway/shell/hbase/SystemVersion.java | 4 +-
.../gateway/shell/hbase/table/CreateTable.java | 4 +-
.../gateway/shell/hbase/table/DeleteTable.java | 4 +-
.../knox/gateway/shell/hbase/table/Table.java | 8 +-
.../gateway/shell/hbase/table/TableList.java | 4 +-
.../gateway/shell/hbase/table/TableRegions.java | 4 +-
.../gateway/shell/hbase/table/TableSchema.java | 4 +-
.../shell/hbase/table/TruncateTable.java | 4 +-
.../gateway/shell/hbase/table/UpdateTable.java | 4 +-
.../shell/hbase/table/row/DeleteRows.java | 4 +-
.../shell/hbase/table/row/QueryRows.java | 4 +-
.../gateway/shell/hbase/table/row/StoreRow.java | 4 +-
.../hbase/table/scanner/CreateScanner.java | 4 +-
.../hbase/table/scanner/DeleteScanner.java | 4 +-
.../hbase/table/scanner/ScannerGetNext.java | 4 +-
.../org/apache/knox/gateway/shell/hdfs/Get.java | 4 +-
.../apache/knox/gateway/shell/hdfs/Hdfs.java | 16 +-
.../org/apache/knox/gateway/shell/hdfs/Ls.java | 4 +-
.../apache/knox/gateway/shell/hdfs/Mkdir.java | 4 +-
.../org/apache/knox/gateway/shell/hdfs/Put.java | 10 +-
.../apache/knox/gateway/shell/hdfs/Rename.java | 4 +-
.../org/apache/knox/gateway/shell/hdfs/Rm.java | 4 +-
.../apache/knox/gateway/shell/hdfs/Status.java | 4 +-
.../org/apache/knox/gateway/shell/job/Hive.java | 4 +-
.../org/apache/knox/gateway/shell/job/Java.java | 4 +-
.../org/apache/knox/gateway/shell/job/Job.java | 14 +-
.../org/apache/knox/gateway/shell/job/Pig.java | 4 +-
.../apache/knox/gateway/shell/job/Queue.java | 4 +-
.../apache/knox/gateway/shell/job/Sqoop.java | 4 +-
.../apache/knox/gateway/shell/job/Status.java | 4 +-
.../knox/gateway/shell/knox/token/Get.java | 4 +-
.../knox/gateway/shell/knox/token/Token.java | 4 +-
.../shell/manager/DeployResourceRequest.java | 4 +-
.../shell/manager/ListDescriptorsRequest.java | 4 +-
.../ListProviderConfigurationsRequest.java | 4 +-
.../shell/manager/ListResourcesRequest.java | 4 +-
.../shell/manager/ListTopologiesRequest.java | 4 +-
.../knox/gateway/shell/manager/Manager.java | 16 +-
.../shell/manager/UndeployResourceRequest.java | 4 +-
.../knox/gateway/shell/workflow/Status.java | 4 +-
.../knox/gateway/shell/workflow/Submit.java | 4 +-
.../knox/gateway/shell/workflow/Workflow.java | 6 +-
.../knox/gateway/shell/yarn/AppState.java | 4 +-
.../apache/knox/gateway/shell/yarn/KillApp.java | 4 +-
.../apache/knox/gateway/shell/yarn/NewApp.java | 4 +-
.../knox/gateway/shell/yarn/SubmitApp.java | 4 +-
.../apache/knox/gateway/shell/yarn/Yarn.java | 10 +-
72 files changed, 536 insertions(+), 449 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleHBase.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleHBase.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleHBase.groovy
index 87f362d..180017a 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleHBase.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleHBase.groovy
@@ -17,7 +17,7 @@
*/
package org.apache.knox.gateway.shell.hbase
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import static java.util.concurrent.TimeUnit.SECONDS
@@ -34,7 +34,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login(gateway, username, pass)
+session = KnoxSession.login(gateway, username, pass)
println "System version : " + HBase.session(session).systemVersion().now().string
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleManagerListResources.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleManagerListResources.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleManagerListResources.groovy
index b995ef3..bdcb094 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleManagerListResources.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleManagerListResources.groovy
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.manager.Manager
import org.apache.knox.gateway.shell.Credentials
@@ -30,7 +30,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
List<String> pcs = Manager.listProviderConfigurations(session);
System.out.println("Provider Configurations")
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleManagerResourceDeployment.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleManagerResourceDeployment.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleManagerResourceDeployment.groovy
index db7d86d..1a1ab89 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleManagerResourceDeployment.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleManagerResourceDeployment.groovy
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.manager.Manager
import org.apache.knox.gateway.shell.Credentials
@@ -33,7 +33,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login( GATEWAY, username, pass )
+session = KnoxSession.login( GATEWAY, username, pass )
// Present the existing provider configurations
List<String> pcs = Manager.listProviderConfigurations(session);
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleOozieWorkflow.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleOozieWorkflow.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleOozieWorkflow.groovy
index f459ddd..3b4e048 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleOozieWorkflow.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleOozieWorkflow.groovy
@@ -17,7 +17,7 @@
*/
import com.jayway.jsonpath.JsonPath
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.workflow.Workflow
@@ -91,7 +91,7 @@ configuration = """\
</configuration>
"""
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Delete " + jobDir + ": " + Hdfs.rm( session ).file( jobDir ).recursive().now().statusCode
println "Mkdir " + jobDir + ": " + Hdfs.mkdir( session ).dir( jobDir ).now().statusCode
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJob.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJob.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJob.groovy
index b0d593f..c87890c 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJob.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJob.groovy
@@ -17,7 +17,7 @@
*/
import com.jayway.jsonpath.JsonPath
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.job.Job
@@ -38,7 +38,7 @@ pass = credentials.get("pass").string()
jobDir = "/user/" + username + "/test"
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Delete " + jobDir + ": " + Hdfs.rm( session ).file( jobDir ).recursive().now().statusCode
println "Create " + jobDir + ": " + Hdfs.mkdir( session ).dir( jobDir ).now().statusCode
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJobTeragen.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJobTeragen.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJobTeragen.groovy
index a6b88da..83cdd87 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJobTeragen.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatJobTeragen.groovy
@@ -17,7 +17,7 @@
*/
import com.jayway.jsonpath.JsonPath
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.job.Job
@@ -41,7 +41,7 @@ pass = credentials.get("pass").string()
jobDir = "/user/" + username + "/test"
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Delete " + jobDir + ": " + Hdfs.rm( session ).file( jobDir ).recursive().now().statusCode
println "Create " + jobDir + ": " + Hdfs.mkdir( session ).dir( jobDir ).now().statusCode
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatPig.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatPig.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatPig.groovy
index be00d9c..47be110 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatPig.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatPig.groovy
@@ -17,7 +17,7 @@
*/
import com.jayway.jsonpath.JsonPath
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.job.Job
@@ -36,7 +36,7 @@ pass = credentials.get("pass").string()
jobDir = "/user/" + username + "/test"
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Delete " + jobDir + ": " + Hdfs.rm( session ).file( jobDir ).recursive().now().statusCode
println "Create " + jobDir + ": " + Hdfs.mkdir( session ).dir( jobDir ).now().statusCode
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatQueue.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatQueue.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatQueue.groovy
index c180e5f..6e13a17 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatQueue.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatQueue.groovy
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.job.Job
import static java.util.concurrent.TimeUnit.SECONDS
@@ -31,7 +31,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Queue: " + Job.queryQueue( session ).now().string
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatSqoop.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatSqoop.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatSqoop.groovy
index b89736f..05609a9 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatSqoop.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHCatSqoop.groovy
@@ -17,7 +17,7 @@
*/
import com.jayway.jsonpath.JsonPath
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.job.Job
@@ -36,7 +36,7 @@ pass = credentials.get("pass").string()
jobDir = "/user/" + username + "/test"
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "Delete " + jobDir + ": " + Hdfs.rm( session ).file( jobDir ).recursive().now().statusCode
println "Create " + jobDir + ": " + Hdfs.mkdir( session ).dir( jobDir ).now().statusCode
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsLs.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsLs.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsLs.groovy
index a142917..73b7007 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsLs.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsLs.groovy
@@ -17,7 +17,7 @@
*/
import groovy.json.JsonSlurper
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.Credentials
@@ -32,7 +32,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
text = Hdfs.ls( session ).dir( "/" ).now().string
json = (new JsonSlurper()).parseText( text )
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsPutGet.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsPutGet.groovy b/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsPutGet.groovy
index 297481f..f8d9ebc 100644
--- a/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsPutGet.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/ExampleWebHdfsPutGet.groovy
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.hdfs.Hdfs
import org.apache.knox.gateway.shell.Credentials
@@ -32,7 +32,7 @@ pass = credentials.get("pass").string()
dataDir = "/user/" + username + "/example"
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
Hdfs.rm( session ).file( dataDir ).recursive().now()
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/SampleComplexCommand.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/SampleComplexCommand.groovy b/gateway-shell-samples/src/main/resources/samples/SampleComplexCommand.groovy
index a80663d..5886d91 100644
--- a/gateway-shell-samples/src/main/resources/samples/SampleComplexCommand.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/SampleComplexCommand.groovy
@@ -18,7 +18,7 @@
import com.jayway.jsonpath.JsonPath
import org.apache.knox.gateway.shell.AbstractRequest
import org.apache.knox.gateway.shell.BasicResponse
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.http.HttpResponse
import org.apache.http.client.methods.HttpGet
import org.apache.http.client.utils.URIBuilder
@@ -29,7 +29,7 @@ class SampleComplexCommand {
static class Request extends AbstractRequest<Response> {
- Request( Hadoop hadoop ) {
+ Request( KnoxSession hadoop ) {
super( hadoop )
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/SampleScript.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/SampleScript.groovy b/gateway-shell-samples/src/main/resources/samples/SampleScript.groovy
index 56a87ad..3196cbc 100644
--- a/gateway-shell-samples/src/main/resources/samples/SampleScript.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/SampleScript.groovy
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.knox.gateway.shell.Credentials
gateway = "https://localhost:8443/gateway/sandbox"
@@ -28,7 +28,7 @@ credentials.collect()
username = credentials.get("user").string()
pass = credentials.get("pass").string()
-session = Hadoop.login( gateway, username, pass )
+session = KnoxSession.login( gateway, username, pass )
println "JSON=" + SampleService.simple( session ).param( "/tmp" ).now().string
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/SampleService.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/SampleService.groovy b/gateway-shell-samples/src/main/resources/samples/SampleService.groovy
index e87834e..283f6c6 100644
--- a/gateway-shell-samples/src/main/resources/samples/SampleService.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/SampleService.groovy
@@ -15,17 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
class SampleService {
static String PATH = "/webhdfs/v1"
- static SampleSimpleCommand simple( Hadoop hadoop ) {
+ static SampleSimpleCommand simple( KnoxSession hadoop ) {
return new SampleSimpleCommand( hadoop )
}
- static SampleComplexCommand.Request complex( Hadoop hadoop ) {
+ static SampleComplexCommand.Request complex( KnoxSession hadoop ) {
return new SampleComplexCommand.Request( hadoop )
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell-samples/src/main/resources/samples/SampleSimpleCommand.groovy
----------------------------------------------------------------------
diff --git a/gateway-shell-samples/src/main/resources/samples/SampleSimpleCommand.groovy b/gateway-shell-samples/src/main/resources/samples/SampleSimpleCommand.groovy
index 1e178c6..9f14015 100644
--- a/gateway-shell-samples/src/main/resources/samples/SampleSimpleCommand.groovy
+++ b/gateway-shell-samples/src/main/resources/samples/SampleSimpleCommand.groovy
@@ -17,7 +17,7 @@
*/
import org.apache.knox.gateway.shell.AbstractRequest
import org.apache.knox.gateway.shell.BasicResponse
-import org.apache.knox.gateway.shell.Hadoop
+import org.apache.knox.gateway.shell.KnoxSession
import org.apache.http.client.methods.HttpGet
import org.apache.http.client.utils.URIBuilder
@@ -25,7 +25,7 @@ import java.util.concurrent.Callable
class SampleSimpleCommand extends AbstractRequest<BasicResponse> {
- SampleSimpleCommand( Hadoop hadoop ) {
+ SampleSimpleCommand( KnoxSession hadoop ) {
super( hadoop )
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/AbstractRequest.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/AbstractRequest.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/AbstractRequest.java
index 21bb120..c95c3f0 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/AbstractRequest.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/AbstractRequest.java
@@ -35,13 +35,13 @@ import java.util.concurrent.Future;
public abstract class AbstractRequest<T> {
- private Hadoop session;
+ private KnoxSession session;
- protected AbstractRequest( Hadoop session ) {
+ protected AbstractRequest( KnoxSession session ) {
this.session = session;
}
- protected Hadoop hadoop() {
+ protected KnoxSession hadoop() {
return session;
}
@@ -78,11 +78,11 @@ public abstract class AbstractRequest<T> {
abstract protected Callable<T> callable();
- public T now() throws HadoopException {
+ public T now() throws KnoxShellException {
try {
return callable().call();
} catch( Exception e ) {
- throw new HadoopException( e );
+ throw new KnoxShellException( e );
}
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Hadoop.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Hadoop.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Hadoop.java
index c5d4380..a1f89f5 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Hadoop.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Hadoop.java
@@ -17,79 +17,24 @@
*/
package org.apache.knox.gateway.shell;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpHost;
-import org.apache.http.HttpRequest;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.AuthCache;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.config.ConnectionConfig;
-import org.apache.http.config.Registry;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.config.SocketConfig;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.NoopHostnameVerifier;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
-import org.apache.http.conn.ssl.TrustStrategy;
-import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.impl.client.BasicAuthCache;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.ssl.SSLContexts;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class Hadoop implements Closeable {
-
- private static final String GATEWAY_CLIENT_TRUST_DEFAULT_PASS = "changeit";
- private static final String KNOX_CLIENT_TRUSTSTORE_PASS = "KNOX_CLIENT_TRUSTSTORE_PASS";
- private static final String GATEWAY_CLIENT_TRUST = "gateway-client-trust.jks";
- private static final String KNOX_CLIENT_TRUSTSTORE_FILENAME = "KNOX_CLIENT_TRUSTSTORE_FILENAME";
- private static final String KNOX_CLIENT_TRUSTSTORE_DIR = "KNOX_CLIENT_TRUSTSTORE_DIR";
- String base;
- HttpHost host;
- CloseableHttpClient client;
- BasicHttpContext context;
- ExecutorService executor;
- Map<String, String> headers = new HashMap<>();
+@Deprecated
+public class Hadoop extends KnoxSession {
- public Map<String, String> getHeaders() {
- return headers;
- }
+ public Hadoop(ClientContext clientContext) throws KnoxShellException, URISyntaxException {
+ super(clientContext);
+ this.executor = Executors.newCachedThreadPool();
+ this.base = clientContext.url();
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
+ try {
+ client = createClient(clientContext);
+ } catch (KnoxShellException | GeneralSecurityException e) {
+ throw new HadoopException("Failed to create HTTP client.", e);
+ }
}
public static Hadoop login( String url, Map<String,String> headers ) throws URISyntaxException {
@@ -103,217 +48,7 @@ public class Hadoop implements Closeable {
}
public static Hadoop loginInsecure(String url, String username, String password) throws URISyntaxException {
- return new Hadoop(ClientContext.with(username, password, url)
+ return new Hadoop(ClientContext.with(username, password, url)
.connection().secure(false).end());
}
-
- public Hadoop( ClientContext clientContext) throws HadoopException, URISyntaxException {
- this.executor = Executors.newCachedThreadPool();
- this.base = clientContext.url();
-
- try {
- client = createClient(clientContext);
- } catch (GeneralSecurityException e) {
- throw new HadoopException("Failed to create HTTP client.", e);
- }
- }
-
- private CloseableHttpClient createClient(ClientContext clientContext) throws GeneralSecurityException {
-
- // SSL
- HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
- TrustStrategy trustStrategy = null;
- if (clientContext.connection().secure()) {
- hostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier();
- } else {
- trustStrategy = TrustSelfSignedStrategy.INSTANCE;
- System.out.println("**************** WARNING ******************\n"
- + "This is an insecure client instance and may\n"
- + "leave the interactions subject to a man in\n"
- + "the middle attack. Please use the login()\n"
- + "method instead of loginInsecure() for any\n"
- + "sensitive or production usecases.\n"
- + "*******************************************");
- }
-
- KeyStore trustStore = getTrustStore();
- SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStore, trustStrategy).build();
- Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
- .register("http", PlainConnectionSocketFactory.getSocketFactory())
- .register("https", new SSLConnectionSocketFactory(sslContext, hostnameVerifier)).build();
-
- // Pool
- PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
- connectionManager.setMaxTotal(clientContext.pool().maxTotal());
- connectionManager.setDefaultMaxPerRoute(clientContext.pool().defaultMaxPerRoute());
-
- ConnectionConfig connectionConfig = ConnectionConfig.custom()
- .setBufferSize(clientContext.connection().bufferSize())
- .build();
- connectionManager.setDefaultConnectionConfig(connectionConfig);
-
- SocketConfig socketConfig = SocketConfig.custom()
- .setSoKeepAlive(clientContext.socket().keepalive())
- .setSoLinger(clientContext.socket().linger())
- .setSoReuseAddress(clientContext.socket().reuseAddress())
- .setSoTimeout(clientContext.socket().timeout())
- .setTcpNoDelay(clientContext.socket().tcpNoDelay())
- .build();
- connectionManager.setDefaultSocketConfig(socketConfig);
-
- // Auth
- URI uri = URI.create(clientContext.url());
- host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
-
- CredentialsProvider credentialsProvider = null;
- if (clientContext.username() != null && clientContext.password() != null) {
- credentialsProvider = new BasicCredentialsProvider();
- credentialsProvider.setCredentials(
- new AuthScope(host.getHostName(), host.getPort()),
- new UsernamePasswordCredentials(clientContext.username(), clientContext.password()));
-
- AuthCache authCache = new BasicAuthCache();
- BasicScheme authScheme = new BasicScheme();
- authCache.put(host, authScheme);
- context = new BasicHttpContext();
- context.setAttribute(org.apache.http.client.protocol.HttpClientContext.AUTH_CACHE, authCache);
- }
- return HttpClients.custom()
- .setConnectionManager(connectionManager)
- .setDefaultCredentialsProvider(credentialsProvider)
- .build();
-
- }
-
- private static KeyStore getTrustStore() throws GeneralSecurityException {
- KeyStore ks = null;
- String truststoreDir = System.getenv(KNOX_CLIENT_TRUSTSTORE_DIR);
- if (truststoreDir == null) {
- truststoreDir = System.getProperty("user.home");
- }
- String truststoreFileName = System.getenv(KNOX_CLIENT_TRUSTSTORE_FILENAME);
- if (truststoreFileName == null) {
- truststoreFileName = GATEWAY_CLIENT_TRUST;
- }
- String truststorePass = System.getenv(KNOX_CLIENT_TRUSTSTORE_PASS);
- if (truststorePass == null) {
- truststorePass = GATEWAY_CLIENT_TRUST_DEFAULT_PASS;
- }
-
- InputStream is = null;
- try {
- ks = KeyStore.getInstance("JKS");
- File file = new File(truststoreDir, truststoreFileName);
- if (!file.exists()) {
- String truststore = System.getProperty("javax.net.ssl.trustStore");
- if (truststore == null) {
- truststoreDir = System.getProperty("java.home");
- truststore = truststoreDir + File.separator + "lib" + File.separator
- + "security" + File.separator + "cacerts";
- truststorePass = System.getProperty("javax.net.ssl.trustStorePassword", "changeit");
- }
- file = new File(truststore);
- }
-
- if (file.exists()) {
- is = new FileInputStream(file);
- ks.load(is, truststorePass.toCharArray());
- }
- else {
- throw new HadoopException("Unable to find a truststore for secure login."
- + "Please import the gateway-identity certificate into the JVM"
- + " truststore or set the truststore location ENV variables.");
- }
- } catch (KeyStoreException e) {
- throw new HadoopException("Unable to create keystore of expected type.", e);
- } catch (FileNotFoundException e) {
- throw new HadoopException("Unable to read truststore."
- + " Please import the gateway-identity certificate into the JVM"
- + " truststore or set the truststore location ENV variables.", e);
- } catch (NoSuchAlgorithmException e) {
- throw new HadoopException("Unable to load the truststore."
- + " Please import the gateway-identity certificate into the JVM"
- + " truststore or set the truststore location ENV variables.", e);
- } catch (CertificateException e) {
- throw new HadoopException("Certificate cannot be found in the truststore."
- + " Please import the gateway-identity certificate into the JVM"
- + " truststore or set the truststore location ENV variables.", e);
- } catch (IOException e) {
- throw new HadoopException("Unable to load truststore."
- + " May be related to password setting or truststore format.", e);
- } finally {
- IOUtils.closeQuietly(is);
- }
-
- return ks;
- }
-
- public String base() {
- return base;
- }
-
- public CloseableHttpResponse executeNow(HttpRequest request ) throws IOException {
- CloseableHttpResponse response = client.execute( host, request, context );
- if( response.getStatusLine().getStatusCode() < 400 ) {
- return response;
- } else {
- throw new ErrorResponse( response );
- }
- }
-
- public <T> Future<T> executeLater( Callable<T> callable ) {
- return executor.submit( callable );
- }
-
- public void waitFor( Future<?>... futures ) throws ExecutionException, InterruptedException {
- if( futures != null ) {
- for( Future future : futures ) {
- future.get();
- }
- }
- }
-
- public void waitFor( long timeout, TimeUnit units, Future<?>... futures ) throws ExecutionException, TimeoutException, InterruptedException {
- if( futures != null ) {
- timeout = TimeUnit.MILLISECONDS.convert( timeout, units );
- long start;
- for( Future future : futures ) {
- start = System.currentTimeMillis();
- future.get( timeout, TimeUnit.MILLISECONDS );
- timeout -= ( System.currentTimeMillis() - start );
- }
- }
- }
-
- private void closeClient() throws IOException {
- if(client != null) {
- client.close();
- }
- }
-
- public void shutdown() throws InterruptedException, IOException {
- try {
- executor.shutdownNow();
- } finally {
- closeClient();
- }
- }
-
- public boolean shutdown( long timeout, TimeUnit unit ) throws InterruptedException, IOException {
- try{
- executor.shutdown();
- return executor.awaitTermination( timeout, unit );
- } finally {
- closeClient();
- }
- }
-
- @Override
- public void close() throws IOException {
- try {
- shutdown();
- } catch (InterruptedException e) {
- throw new HadoopException("Can not shutdown underlying resources", e);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/HadoopException.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/HadoopException.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/HadoopException.java
index a4c29b0..b6ed2da 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/HadoopException.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/HadoopException.java
@@ -17,10 +17,10 @@
*/
package org.apache.knox.gateway.shell;
-public class HadoopException extends RuntimeException {
+public class HadoopException extends KnoxShellException {
- public HadoopException( String message ) {
- super( message );
+ public HadoopException(String message) {
+ super(message);
}
public HadoopException( Throwable throwable ) {
@@ -30,5 +30,4 @@ public class HadoopException extends RuntimeException {
public HadoopException( String message, Throwable throwable ) {
super( message, throwable );
}
-
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
new file mode 100644
index 0000000..eb30a4f
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
@@ -0,0 +1,319 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.AuthCache;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.config.ConnectionConfig;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.impl.auth.BasicScheme;
+import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.ssl.SSLContexts;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class KnoxSession implements Closeable {
+
+ private static final String GATEWAY_CLIENT_TRUST_DEFAULT_PASS = "changeit";
+ private static final String KNOX_CLIENT_TRUSTSTORE_PASS = "KNOX_CLIENT_TRUSTSTORE_PASS";
+ private static final String GATEWAY_CLIENT_TRUST = "gateway-client-trust.jks";
+ private static final String KNOX_CLIENT_TRUSTSTORE_FILENAME = "KNOX_CLIENT_TRUSTSTORE_FILENAME";
+ private static final String KNOX_CLIENT_TRUSTSTORE_DIR = "KNOX_CLIENT_TRUSTSTORE_DIR";
+
+ String base;
+ HttpHost host;
+ CloseableHttpClient client;
+ BasicHttpContext context;
+ ExecutorService executor;
+ Map<String, String> headers = new HashMap<>();
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+ public static KnoxSession login( String url, Map<String,String> headers ) throws URISyntaxException {
+ KnoxSession instance = new KnoxSession(ClientContext.with(url));
+ instance.setHeaders(headers);
+ return instance;
+ }
+
+ public static KnoxSession login( String url, String username, String password ) throws URISyntaxException {
+ return new KnoxSession(ClientContext.with(username, password, url));
+ }
+
+ public static KnoxSession loginInsecure(String url, String username, String password) throws URISyntaxException {
+ return new KnoxSession(ClientContext.with(username, password, url)
+ .connection().secure(false).end());
+ }
+
+ public KnoxSession( ClientContext clientContext) throws KnoxShellException, URISyntaxException {
+ this.executor = Executors.newCachedThreadPool();
+ this.base = clientContext.url();
+
+ try {
+ client = createClient(clientContext);
+ } catch (GeneralSecurityException e) {
+ throw new KnoxShellException("Failed to create HTTP client.", e);
+ }
+ }
+
+ protected CloseableHttpClient createClient(ClientContext clientContext) throws GeneralSecurityException {
+
+ // SSL
+ HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
+ TrustStrategy trustStrategy = null;
+ if (clientContext.connection().secure()) {
+ hostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier();
+ } else {
+ trustStrategy = TrustSelfSignedStrategy.INSTANCE;
+ System.out.println("**************** WARNING ******************\n"
+ + "This is an insecure client instance and may\n"
+ + "leave the interactions subject to a man in\n"
+ + "the middle attack. Please use the login()\n"
+ + "method instead of loginInsecure() for any\n"
+ + "sensitive or production usecases.\n"
+ + "*******************************************");
+ }
+
+ KeyStore trustStore = getTrustStore();
+ SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStore, trustStrategy).build();
+ Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
+ .register("http", PlainConnectionSocketFactory.getSocketFactory())
+ .register("https", new SSLConnectionSocketFactory(sslContext, hostnameVerifier)).build();
+
+ // Pool
+ PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
+ connectionManager.setMaxTotal(clientContext.pool().maxTotal());
+ connectionManager.setDefaultMaxPerRoute(clientContext.pool().defaultMaxPerRoute());
+
+ ConnectionConfig connectionConfig = ConnectionConfig.custom()
+ .setBufferSize(clientContext.connection().bufferSize())
+ .build();
+ connectionManager.setDefaultConnectionConfig(connectionConfig);
+
+ SocketConfig socketConfig = SocketConfig.custom()
+ .setSoKeepAlive(clientContext.socket().keepalive())
+ .setSoLinger(clientContext.socket().linger())
+ .setSoReuseAddress(clientContext.socket().reuseAddress())
+ .setSoTimeout(clientContext.socket().timeout())
+ .setTcpNoDelay(clientContext.socket().tcpNoDelay())
+ .build();
+ connectionManager.setDefaultSocketConfig(socketConfig);
+
+ // Auth
+ URI uri = URI.create(clientContext.url());
+ host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
+
+ CredentialsProvider credentialsProvider = null;
+ if (clientContext.username() != null && clientContext.password() != null) {
+ credentialsProvider = new BasicCredentialsProvider();
+ credentialsProvider.setCredentials(
+ new AuthScope(host.getHostName(), host.getPort()),
+ new UsernamePasswordCredentials(clientContext.username(), clientContext.password()));
+
+ AuthCache authCache = new BasicAuthCache();
+ BasicScheme authScheme = new BasicScheme();
+ authCache.put(host, authScheme);
+ context = new BasicHttpContext();
+ context.setAttribute(org.apache.http.client.protocol.HttpClientContext.AUTH_CACHE, authCache);
+ }
+ return HttpClients.custom()
+ .setConnectionManager(connectionManager)
+ .setDefaultCredentialsProvider(credentialsProvider)
+ .build();
+
+ }
+
+ private static KeyStore getTrustStore() throws GeneralSecurityException {
+ KeyStore ks = null;
+ String truststoreDir = System.getenv(KNOX_CLIENT_TRUSTSTORE_DIR);
+ if (truststoreDir == null) {
+ truststoreDir = System.getProperty("user.home");
+ }
+ String truststoreFileName = System.getenv(KNOX_CLIENT_TRUSTSTORE_FILENAME);
+ if (truststoreFileName == null) {
+ truststoreFileName = GATEWAY_CLIENT_TRUST;
+ }
+ String truststorePass = System.getenv(KNOX_CLIENT_TRUSTSTORE_PASS);
+ if (truststorePass == null) {
+ truststorePass = GATEWAY_CLIENT_TRUST_DEFAULT_PASS;
+ }
+
+ InputStream is = null;
+ try {
+ ks = KeyStore.getInstance("JKS");
+ File file = new File(truststoreDir, truststoreFileName);
+ if (!file.exists()) {
+ String truststore = System.getProperty("javax.net.ssl.trustStore");
+ if (truststore == null) {
+ truststoreDir = System.getProperty("java.home");
+ truststore = truststoreDir + File.separator + "lib" + File.separator
+ + "security" + File.separator + "cacerts";
+ truststorePass = System.getProperty("javax.net.ssl.trustStorePassword", "changeit");
+ }
+ file = new File(truststore);
+ }
+
+ if (file.exists()) {
+ is = new FileInputStream(file);
+ ks.load(is, truststorePass.toCharArray());
+ }
+ else {
+ throw new KnoxShellException("Unable to find a truststore for secure login."
+ + "Please import the gateway-identity certificate into the JVM"
+ + " truststore or set the truststore location ENV variables.");
+ }
+ } catch (KeyStoreException e) {
+ throw new KnoxShellException("Unable to create keystore of expected type.", e);
+ } catch (FileNotFoundException e) {
+ throw new KnoxShellException("Unable to read truststore."
+ + " Please import the gateway-identity certificate into the JVM"
+ + " truststore or set the truststore location ENV variables.", e);
+ } catch (NoSuchAlgorithmException e) {
+ throw new KnoxShellException("Unable to load the truststore."
+ + " Please import the gateway-identity certificate into the JVM"
+ + " truststore or set the truststore location ENV variables.", e);
+ } catch (CertificateException e) {
+ throw new KnoxShellException("Certificate cannot be found in the truststore."
+ + " Please import the gateway-identity certificate into the JVM"
+ + " truststore or set the truststore location ENV variables.", e);
+ } catch (IOException e) {
+ throw new KnoxShellException("Unable to load truststore."
+ + " May be related to password setting or truststore format.", e);
+ } finally {
+ IOUtils.closeQuietly(is);
+ }
+
+ return ks;
+ }
+
+ public String base() {
+ return base;
+ }
+
+ public CloseableHttpResponse executeNow(HttpRequest request ) throws IOException {
+ CloseableHttpResponse response = client.execute( host, request, context );
+ if( response.getStatusLine().getStatusCode() < 400 ) {
+ return response;
+ } else {
+ throw new ErrorResponse( response );
+ }
+ }
+
+ public <T> Future<T> executeLater( Callable<T> callable ) {
+ return executor.submit( callable );
+ }
+
+ public void waitFor( Future<?>... futures ) throws ExecutionException, InterruptedException {
+ if( futures != null ) {
+ for( Future future : futures ) {
+ future.get();
+ }
+ }
+ }
+
+ public void waitFor( long timeout, TimeUnit units, Future<?>... futures ) throws ExecutionException, TimeoutException, InterruptedException {
+ if( futures != null ) {
+ timeout = TimeUnit.MILLISECONDS.convert( timeout, units );
+ long start;
+ for( Future future : futures ) {
+ start = System.currentTimeMillis();
+ future.get( timeout, TimeUnit.MILLISECONDS );
+ timeout -= ( System.currentTimeMillis() - start );
+ }
+ }
+ }
+
+ private void closeClient() throws IOException {
+ if(client != null) {
+ client.close();
+ }
+ }
+
+ public void shutdown() throws InterruptedException, IOException {
+ try {
+ executor.shutdownNow();
+ } finally {
+ closeClient();
+ }
+ }
+
+ public boolean shutdown( long timeout, TimeUnit unit ) throws InterruptedException, IOException {
+ try{
+ executor.shutdown();
+ return executor.awaitTermination( timeout, unit );
+ } finally {
+ closeClient();
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ try {
+ shutdown();
+ } catch (InterruptedException e) {
+ throw new KnoxShellException("Can not shutdown underlying resources", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSh.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSh.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSh.java
index 9f44412..34914f5 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSh.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSh.java
@@ -175,10 +175,10 @@ public class KnoxSh {
String username = credentials.get("user").string();
String pass = credentials.get("pass").string();
- Hadoop session = null;
+ KnoxSession session = null;
Get.Response response = null;
try {
- session = Hadoop.login(gateway, username, pass);
+ session = KnoxSession.login(gateway, username, pass);
response = Token.get( session ).now();
String text = response.getString();
@@ -197,7 +197,7 @@ public class KnoxSh {
perms.add(PosixFilePermission.OWNER_WRITE);
Files.setPosixFilePermissions(Paths.get(System.getProperty("user.home") + "/.knoxtokencache"), perms);
}
- } catch(HadoopException he) {
+ } catch(KnoxShellException he) {
System.out.println("Failure to acquire token. Please verify your credentials and Knox URL and try again.");
}
if ( session != null ) {
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxShellException.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxShellException.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxShellException.java
new file mode 100644
index 0000000..296cf7f
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxShellException.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell;
+
+public class KnoxShellException extends RuntimeException {
+
+ public KnoxShellException( String message ) {
+ super( message );
+ }
+
+ public KnoxShellException( Throwable throwable ) {
+ super( throwable );
+ }
+
+ public KnoxShellException( String message, Throwable throwable ) {
+ super( message, throwable );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
index 22cd107..fa95af7 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
public class Shell {
private static final String[] IMPORTS = new String[] {
- Hadoop.class.getName(),
+ KnoxSession.class.getName(),
HBase.class.getName(),
Hdfs.class.getName(),
Job.class.getName(),
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/ClusterVersion.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/ClusterVersion.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/ClusterVersion.java
index 78af40d..6a472ac 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/ClusterVersion.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/ClusterVersion.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -29,7 +29,7 @@ public class ClusterVersion {
public static class Request extends AbstractRequest<Response> {
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/HBase.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/HBase.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/HBase.java
index 6061830..c1fd8dc 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/HBase.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/HBase.java
@@ -16,20 +16,20 @@
*/
package org.apache.knox.gateway.shell.hbase;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.table.Table;
public class HBase {
public static final String SERVICE_PATH = "/hbase";
- private Hadoop session;
+ private KnoxSession session;
- public HBase( Hadoop session ) {
+ public HBase( KnoxSession session ) {
this.session = session;
}
- public static HBase session( Hadoop session ) {
+ public static HBase session( KnoxSession session ) {
HBase hbase = new HBase( session );
return hbase;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/Status.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/Status.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/Status.java
index dfec1e8..1cc7953 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/Status.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/Status.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -29,7 +29,7 @@ public class Status {
public static class Request extends AbstractRequest<Response> {
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/SystemVersion.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/SystemVersion.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/SystemVersion.java
index a487589..c2505d4 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/SystemVersion.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/SystemVersion.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -29,7 +29,7 @@ public class SystemVersion {
public static class Request extends AbstractRequest<Response> {
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/CreateTable.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/CreateTable.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/CreateTable.java
index 8be5bd6..dc54037 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/CreateTable.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/CreateTable.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.knox.gateway.util.XmlUtils;
import org.apache.http.HttpEntity;
@@ -50,7 +50,7 @@ public class CreateTable {
private List<Attribute> attributes = new ArrayList<>();
private List<Family<Request>> families = new ArrayList<>();
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/DeleteTable.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/DeleteTable.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/DeleteTable.java
index b16931a..5389eea 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/DeleteTable.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/DeleteTable.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpDelete;
@@ -32,7 +32,7 @@ public class DeleteTable {
private String tableName;
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/Table.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/Table.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/Table.java
index c8304e2..e2e4094 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/Table.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/Table.java
@@ -16,14 +16,14 @@
*/
package org.apache.knox.gateway.shell.hbase.table;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.table.row.Row;
import org.apache.knox.gateway.shell.hbase.table.scanner.Scanner;
public class Table {
private String name;
- private Hadoop session;
+ private KnoxSession session;
public Table( String name ) {
this.name = name;
@@ -33,12 +33,12 @@ public class Table {
return name;
}
- public Table session( Hadoop session ) {
+ public Table session( KnoxSession session ) {
this.session = session;
return this;
}
- public Hadoop session() {
+ public KnoxSession session() {
return session;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableList.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableList.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableList.java
index 2cb4686..cdc022b 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableList.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableList.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -30,7 +30,7 @@ public class TableList {
public static class Request extends AbstractRequest<Response> {
- public Request( Hadoop session ) {
+ public Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableRegions.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableRegions.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableRegions.java
index da43c13..7455d56 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableRegions.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableRegions.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -32,7 +32,7 @@ public class TableRegions {
private String tableName;
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableSchema.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableSchema.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableSchema.java
index 3666aa0..97956bd 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableSchema.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TableSchema.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -32,7 +32,7 @@ public class TableSchema {
private String tableName;
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TruncateTable.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TruncateTable.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TruncateTable.java
index 8e8c948..c67e9bd 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TruncateTable.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/TruncateTable.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -39,7 +39,7 @@ public class TruncateTable {
private String tableName;
- public Request(Hadoop session, String tableName) {
+ public Request(KnoxSession session, String tableName) {
super(session);
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/UpdateTable.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/UpdateTable.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/UpdateTable.java
index 1498b02..eb6d879 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/UpdateTable.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/UpdateTable.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.knox.gateway.util.XmlUtils;
import org.apache.http.HttpEntity;
@@ -49,7 +49,7 @@ public class UpdateTable {
private String tableName;
private List<Family<Request>> families = new ArrayList<>();
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/DeleteRows.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/DeleteRows.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/DeleteRows.java
index 4d027f0..8671b7f 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/DeleteRows.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/DeleteRows.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table.row;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpDelete;
@@ -35,7 +35,7 @@ public class DeleteRows {
private Column column;
private Long time;
- public Request( Hadoop session, String rowsId, String tableName ) {
+ public Request( KnoxSession session, String rowsId, String tableName ) {
super( session );
this.rowsId = rowsId;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/QueryRows.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/QueryRows.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/QueryRows.java
index b0445d6..a30b3af 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/QueryRows.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/QueryRows.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table.row;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -39,7 +39,7 @@ public class QueryRows {
private Long endTime;
private Long numVersions;
- public Request( Hadoop session, String rowsId, String tableName ) {
+ public Request( KnoxSession session, String rowsId, String tableName ) {
super( session );
this.rowsId = rowsId;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/StoreRow.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/StoreRow.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/StoreRow.java
index caa222c..77ba041 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/StoreRow.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/row/StoreRow.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hbase.table.row;
import org.apache.commons.codec.binary.Base64;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.knox.gateway.util.XmlUtils;
import org.apache.http.HttpEntity;
@@ -54,7 +54,7 @@ public class StoreRow {
private String tableName;
private List<InsertableColumn> columns = new ArrayList<>();
- public Request( Hadoop session, String rowId, String tableName ) {
+ public Request( KnoxSession session, String rowId, String tableName ) {
super( session );
this.rowId = rowId;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/CreateScanner.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/CreateScanner.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/CreateScanner.java
index acb424d..26816ee 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/CreateScanner.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/CreateScanner.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hbase.table.scanner;
import org.apache.commons.codec.binary.Base64;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.knox.gateway.shell.hbase.table.row.Column;
import org.apache.knox.gateway.util.XmlUtils;
@@ -65,7 +65,7 @@ public class CreateScanner {
private String filter;
private Integer maxVersions;
- public Request( Hadoop session, String tableName ) {
+ public Request( KnoxSession session, String tableName ) {
super( session );
this.tableName = tableName;
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/DeleteScanner.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/DeleteScanner.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/DeleteScanner.java
index 403ffe1..a25acf6 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/DeleteScanner.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/DeleteScanner.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table.scanner;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpDelete;
@@ -33,7 +33,7 @@ public class DeleteScanner {
private String scannerId;
private String tableName;
- public Request( Hadoop session, String scannerId, String tableName ) {
+ public Request( KnoxSession session, String scannerId, String tableName ) {
super( session );
this.scannerId = scannerId;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/ScannerGetNext.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/ScannerGetNext.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/ScannerGetNext.java
index 76c123f..28f26b2 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/ScannerGetNext.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hbase/table/scanner/ScannerGetNext.java
@@ -18,7 +18,7 @@ package org.apache.knox.gateway.shell.hbase.table.scanner;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.knox.gateway.shell.hbase.HBase;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -33,7 +33,7 @@ public class ScannerGetNext {
private String scannerId;
private String tableName;
- public Request( Hadoop session, String scannerId, String tableName ) {
+ public Request( KnoxSession session, String scannerId, String tableName ) {
super( session );
this.scannerId = scannerId;
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Get.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Get.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Get.java
index 188ac2d..202e735 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Get.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Get.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.commons.io.FileUtils;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -36,7 +36,7 @@ public class Get {
private String from;
private String to;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Hdfs.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Hdfs.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Hdfs.java
index c2fe1da..68424ad 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Hdfs.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Hdfs.java
@@ -17,37 +17,37 @@
*/
package org.apache.knox.gateway.shell.hdfs;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
public class Hdfs {
static final String SERVICE_PATH = "/webhdfs/v1";
- public static Rename.Request rename( Hadoop session ) {
+ public static Rename.Request rename( KnoxSession session ) {
return new Rename.Request( session );
}
- public static Status.Request status(Hadoop session ) {
+ public static Status.Request status(KnoxSession session ) {
return new Status.Request( session );
}
- public static Ls.Request ls( Hadoop session ) {
+ public static Ls.Request ls( KnoxSession session ) {
return new Ls.Request( session );
}
- public static Rm.Request rm( Hadoop session ) {
+ public static Rm.Request rm( KnoxSession session ) {
return new Rm.Request( session );
}
- public static Put.Request put( Hadoop session ) {
+ public static Put.Request put( KnoxSession session ) {
return new Put.Request( session );
}
- public static Get.Request get( Hadoop session ) {
+ public static Get.Request get( KnoxSession session ) {
return new Get.Request( session );
}
- public static Mkdir.Request mkdir( Hadoop session ) {
+ public static Mkdir.Request mkdir( KnoxSession session ) {
return new Mkdir.Request( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Ls.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Ls.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Ls.java
index b394d46..04c0a06 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Ls.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Ls.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.BasicResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
@@ -32,7 +32,7 @@ class Ls {
String dir;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Mkdir.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Mkdir.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Mkdir.java
index 69a3066..3dd5d82 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Mkdir.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Mkdir.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
@@ -33,7 +33,7 @@ class Mkdir {
String dir = null;
String perm = null;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Put.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Put.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Put.java
index 03486b5..733185a 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Put.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Put.java
@@ -19,8 +19,8 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
-import org.apache.knox.gateway.shell.HadoopException;
+import org.apache.knox.gateway.shell.KnoxSession;
+import org.apache.knox.gateway.shell.KnoxShellException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -47,7 +47,7 @@ class Put {
private Integer buffersize;
private Short replication;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}
@@ -105,12 +105,12 @@ class Put {
HttpPut nn = new HttpPut( uri.build() );
HttpResponse r = execute( nn );
if( r.getStatusLine().getStatusCode() != HttpStatus.SC_TEMPORARY_REDIRECT ) {
- throw new HadoopException( r.getStatusLine().toString() );
+ throw new KnoxShellException( r.getStatusLine().toString() );
}
EntityUtils.consumeQuietly( r.getEntity() );
Header[] h = r.getHeaders( "Location" );
if( h == null || h.length != 1 ) {
- throw new HadoopException( "Invalid Location header." );
+ throw new KnoxShellException( "Invalid Location header." );
}
String loc = h[0].getValue();
HttpPut dn = new HttpPut( loc );
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rename.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rename.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rename.java
index 1afa670..af85643 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rename.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rename.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
@@ -33,7 +33,7 @@ public class Rename {
private String file;
private String to;
- Request(Hadoop session) {
+ Request(KnoxSession session) {
super(session);
}
http://git-wip-us.apache.org/repos/asf/knox/blob/381eef37/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rm.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rm.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rm.java
index e0ff52d..4076da3 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rm.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/hdfs/Rm.java
@@ -19,7 +19,7 @@ package org.apache.knox.gateway.shell.hdfs;
import org.apache.knox.gateway.shell.AbstractRequest;
import org.apache.knox.gateway.shell.EmptyResponse;
-import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.knox.gateway.shell.KnoxSession;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.utils.URIBuilder;
@@ -34,7 +34,7 @@ class Rm {
String file;
Boolean recursive;
- Request( Hadoop session ) {
+ Request( KnoxSession session ) {
super( session );
}