sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-1961: Sqoop2: addDelegationTokens is not exposed in SqoopClient
Date Thu, 05 Feb 2015 01:20:36 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 332a7bdd8 -> 433a42d7a


SQOOP-1961: Sqoop2: addDelegationTokens is not exposed in SqoopClient

(Richard Zhou via Abraham Elmahrek)


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

Branch: refs/heads/sqoop2
Commit: 433a42d7a9447a3ecbba3c84ee58f5a98bee2570
Parents: 332a7bd
Author: Abraham Elmahrek <abe@apache.org>
Authored: Wed Feb 4 17:19:13 2015 -0800
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Wed Feb 4 17:19:52 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/sqoop/client/SqoopClient.java    | 15 +++++++++++++++
 .../sqoop/client/request/SqoopResourceRequests.java  |  9 +++++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/433a42d7/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
index 612f97b..9e15c03 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -17,12 +17,15 @@
  */
 package org.apache.sqoop.client;
 
+import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
 
+import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.security.token.Token;
 import org.apache.sqoop.classification.InterfaceAudience;
 import org.apache.sqoop.classification.InterfaceStability;
 import org.apache.sqoop.client.request.SqoopResourceRequests;
@@ -556,6 +559,18 @@ public class SqoopClient {
     return resourceRequests.readSubmission(jobId).getSubmissions();
   }
 
+  /**
+   * Add delegation token into credentials of Hadoop security.
+   *
+   * @param renewer renewer string
+   * @param credentials credentials of Hadoop security, which will be added delegation token
+   * @return
+   */
+  public Token<?>[] addDelegationTokens(String renewer,
+                                        Credentials credentials) throws IOException {
+    return resourceRequests.addDelegationTokens(renewer, credentials);
+  }
+
   private Status applyLinkValidations(ValidationResultBean bean, MLink link) {
     ConfigValidationResult linkConfig = bean.getValidationResults()[0];
     // Apply validation results

http://git-wip-us.apache.org/repos/asf/sqoop/blob/433a42d7/client/src/main/java/org/apache/sqoop/client/request/SqoopResourceRequests.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/SqoopResourceRequests.java
b/client/src/main/java/org/apache/sqoop/client/request/SqoopResourceRequests.java
index adb2c47..1825cf3 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/SqoopResourceRequests.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/SqoopResourceRequests.java
@@ -17,7 +17,9 @@
  */
 package org.apache.sqoop.client.request;
 
+import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL;
+import org.apache.hadoop.security.Credentials;
 import org.apache.sqoop.json.ConnectorBean;
 import org.apache.sqoop.json.DriverBean;
 import org.apache.sqoop.json.JobBean;
@@ -28,6 +30,8 @@ import org.apache.sqoop.json.ValidationResultBean;
 import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MLink;
 
+import java.io.IOException;
+
 /**
  * Unified class for all request objects.
  */
@@ -157,4 +161,9 @@ public class SqoopResourceRequests {
   public SubmissionsBean readSubmission(Long jid) {
     return getSubmissionResourceRequest().read(serverUrl, jid);
   }
+
+  public Token<?>[] addDelegationTokens(String renewer,
+                                        Credentials credentials) throws IOException {
+    return getDriverResourceRequest().addDelegationTokens(serverUrl + DriverResourceRequest.RESOURCE,
renewer, credentials);
+  }
 }


Mime
View raw message