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-1965: Sqoop2: Naming support for Connector, Link, Job instances
Date Mon, 22 Jun 2015 21:23:52 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 d593a550a -> d16566ace


SQOOP-1965: Sqoop2: Naming support for Connector, Link, Job instances

(Banmeet Singh 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/d16566ac
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/d16566ac
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/d16566ac

Branch: refs/heads/sqoop2
Commit: d16566ace24d5256f507cfcc3430a6b1a75cbe8d
Parents: d593a55
Author: Abraham Elmahrek <abe@apache.org>
Authored: Mon Jun 22 11:27:20 2015 +0200
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Mon Jun 22 11:27:20 2015 +0200

----------------------------------------------------------------------
 .../org/apache/sqoop/client/SqoopClient.java    | 191 ++++++++++++++++---
 .../client/request/JobResourceRequest.java      |  36 ++--
 .../client/request/LinkResourceRequest.java     |  18 +-
 .../client/request/SqoopResourceRequests.java   |  44 ++---
 .../request/SubmissionResourceRequest.java      |   6 +-
 .../apache/sqoop/shell/CloneJobFunction.java    |   8 +-
 .../apache/sqoop/shell/CloneLinkFunction.java   |   8 +-
 .../apache/sqoop/shell/CreateJobFunction.java   |  10 +-
 .../apache/sqoop/shell/CreateLinkFunction.java  |  40 +++-
 .../apache/sqoop/shell/DeleteJobFunction.java   |   2 +-
 .../apache/sqoop/shell/DeleteLinkFunction.java  |   2 +-
 .../apache/sqoop/shell/DisableJobFunction.java  |   2 +-
 .../apache/sqoop/shell/DisableLinkFunction.java |   2 +-
 .../apache/sqoop/shell/EnableJobFunction.java   |   2 +-
 .../apache/sqoop/shell/EnableLinkFunction.java  |   2 +-
 .../sqoop/shell/ShowConnectorFunction.java      |  17 +-
 .../org/apache/sqoop/shell/ShowJobFunction.java |  16 +-
 .../sqoop/shell/ShowJobStatusFunction.java      |   2 +-
 .../apache/sqoop/shell/ShowLinkFunction.java    |   6 +-
 .../sqoop/shell/ShowSubmissionFunction.java     |  16 +-
 .../apache/sqoop/shell/StartJobFunction.java    |   6 +-
 .../org/apache/sqoop/shell/StopJobFunction.java |   3 +-
 .../apache/sqoop/shell/UpdateJobFunction.java   |   8 +-
 .../apache/sqoop/shell/UpdateLinkFunction.java  |   8 +-
 24 files changed, 317 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/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 3102951..2e09516 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -296,6 +296,7 @@ public class SqoopClient {
     return createLink(connector.getPersistenceId());
   }
 
+
   /**
    * Retrieve link for given id.
    *
@@ -303,7 +304,18 @@ public class SqoopClient {
    * @return
    */
   public MLink getLink(long linkId) {
-    return resourceRequests.readLink(linkId).getLinks().get(0);
+    //Cast long to string and pass (retained to prevent other functionality from breaking)
+    return resourceRequests.readLink(String.valueOf(linkId)).getLinks().get(0);
+  }
+
+  /**
+   * Retrieve link for given name.
+   *
+   * @param linkName Link name
+   * @return
+   */
+  public MLink getLink(String linkName) {
+    return resourceRequests.readLink(linkName).getLinks().get(0);
   }
 
   /**
@@ -336,13 +348,32 @@ public class SqoopClient {
   }
 
   /**
+   * Enable/disable link with given name
+   *
+   * @param linkName link name
+   * @param enabled Enable or disable
+   */
+  public void enableLink(String linkName, boolean enabled) {
+    resourceRequests.enableLink(linkName, enabled);
+  }
+
+  /**
    * Enable/disable link with given id
    *
    * @param linkId link id
    * @param enabled Enable or disable
    */
   public void enableLink(long linkId, boolean enabled) {
-    resourceRequests.enableLink(linkId, enabled);
+    resourceRequests.enableLink(String.valueOf(linkId), enabled);
+  }
+
+  /**
+   * Delete link with given name
+   *
+   * @param linkName link name
+   */
+  public void deleteLink(String linkName) {
+    resourceRequests.deleteLink(linkName);
   }
 
   /**
@@ -351,19 +382,19 @@ public class SqoopClient {
    * @param linkId link id
    */
   public void deleteLink(long linkId) {
-    resourceRequests.deleteLink(linkId);
+    resourceRequests.deleteLink(String.valueOf(linkId));
   }
 
   /**
    * Create new job the for given links.
    *
-   * @param fromLinkId From link id
-   * @param toLinkId To link id
+   * @param fromLinkName From link name
+   * @param toLinkName To link name
    * @return
    */
-  public MJob createJob(long fromLinkId, long toLinkId) {
-    MLink fromLink = getLink(fromLinkId);
-    MLink toLink = getLink(toLinkId);
+  public MJob createJob(String fromLinkName, String toLinkName) {
+    MLink fromLink = getLink(fromLinkName);
+    MLink toLink = getLink(toLinkName);
 
     return new MJob(
       fromLink.getConnectorId(),
@@ -377,13 +408,46 @@ public class SqoopClient {
   }
 
   /**
+   * Create new job the for given links.
+   *
+   * @param fromLinkId From link id
+   * @param toLinkId To link id
+   * @return
+   */
+  public MJob createJob(long fromLinkId, long toLinkId) {
+    MLink fromLink = getLink(fromLinkId);
+    MLink toLink = getLink(toLinkId);
+
+    return new MJob(
+            fromLink.getConnectorId(),
+            toLink.getConnectorId(),
+            fromLink.getPersistenceId(),
+            toLink.getPersistenceId(),
+            getConnector(fromLink.getConnectorId()).getFromConfig(),
+            getConnector(toLink.getConnectorId()).getToConfig(),
+            getDriverConfig()
+    );
+  }
+
+  /**
    * Retrieve job for given id.
    *
    * @param jobId Job id
    * @return
    */
   public MJob getJob(long jobId) {
-    return resourceRequests.readJob(jobId).getJobs().get(0);
+    //Cast long to string and pass (retained to prevent other functionality from breaking)
+    return resourceRequests.readJob(String.valueOf(jobId)).getJobs().get(0);
+  }
+
+  /**
+   * Retrieve job for given name.
+   *
+   * @param jobName Job name
+   * @return
+   */
+  public MJob getJob(String jobName) {
+    return resourceRequests.readJob(jobName).getJobs().get(0);
   }
 
   /**
@@ -396,12 +460,21 @@ public class SqoopClient {
   }
 
   /**
-   * Retrieve list of all jobs by connector
+   * Retrieve list of all jobs by connector id
    *
    * @return
    */
   public List<MJob> getJobsByConnector(long cId) {
-    return resourceRequests.readJobsByConnector(cId).getJobs();
+    return resourceRequests.readJobsByConnector(String.valueOf(cId)).getJobs();
+  }
+
+  /**
+   * Retrieve list of all jobs by connector name
+   *
+   * @return
+   */
+  public List<MJob> getJobsByConnector(String cName) {
+    return resourceRequests.readJobsByConnector(cName).getJobs();
   }
 
   /**
@@ -424,22 +497,51 @@ public class SqoopClient {
   }
 
   /**
+   * Enable/disable job with given name
+   *
+   * @param jName Job that is going to be enabled/disabled
+   * @param enabled Enable or disable
+   */
+  public void enableJob(String jName, boolean enabled) {
+    resourceRequests.enableJob(jName, enabled);
+  }
+
+  /**
    * Enable/disable job with given id
    *
-   * @param jid Job that is going to be enabled/disabled
+   * @param jId Job that is going to be enabled/disabled
    * @param enabled Enable or disable
    */
-  public void enableJob(long jid, boolean enabled) {
-    resourceRequests.enableJob(jid, enabled);
+  public void enableJob(long jId, boolean enabled) {
+    resourceRequests.enableJob(String.valueOf(jId), enabled);
   }
 
   /**
-   * Delete job with given id.
+   * Delete job with given name.
+   *
+   * @param jobName Job name
+   */
+  public void deleteJob(String jobName) {
+    resourceRequests.deleteJob(jobName);
+  }
+
+  /**
+   * Delete job with given id
    *
    * @param jobId Job id
    */
   public void deleteJob(long jobId) {
-    resourceRequests.deleteJob(jobId);
+    resourceRequests.deleteJob(String.valueOf(jobId));
+  }
+
+  /**
+   * Start job with given name.
+   *
+   * @param jobName Job name
+   * @return
+   */
+  public MSubmission startJob(String jobName) {
+    return resourceRequests.startJob(jobName).getSubmissions().get(0);
   }
 
   /**
@@ -449,20 +551,20 @@ public class SqoopClient {
    * @return
    */
   public MSubmission startJob(long jobId) {
-    return resourceRequests.startJob(jobId).getSubmissions().get(0);
+    return resourceRequests.startJob(String.valueOf(jobId)).getSubmissions().get(0);
   }
 
   /**
    * Method used for synchronous job submission.
    * Pass null to callback parameter if submission status is not required and after completion
    * job execution returns MSubmission which contains final status of submission.
-   * @param jobId - Job ID
+   * @param jobName - Job name
    * @param callback - User may set null if submission status is not required, else callback methods invoked
    * @param pollTime - Server poll time
    * @return MSubmission - Final status of job submission
    * @throws InterruptedException
    */
-  public MSubmission startJob(long jobId, SubmissionCallback callback, long pollTime)
+  public MSubmission startJob(String jobName, SubmissionCallback callback, long pollTime)
       throws InterruptedException {
     if(pollTime <= 0) {
       throw new SqoopException(ClientError.CLIENT_0002);
@@ -470,7 +572,7 @@ public class SqoopClient {
     //TODO(https://issues.apache.org/jira/browse/SQOOP-1652): address the submit/start/first terminology difference
     // What does first even mean in s distributed client/server model?
     boolean first = true;
-    MSubmission submission = resourceRequests.startJob(jobId).getSubmissions().get(0);
+    MSubmission submission = resourceRequests.startJob(jobName).getSubmissions().get(0);
     // what happens when the server fails, do we just say finished?
     while(submission.getStatus().isRunning()) {
       if(first) {
@@ -480,12 +582,19 @@ public class SqoopClient {
         invokeSubmissionCallback(callback, submission, SubmissionStatus.UPDATED);
       }
       Thread.sleep(pollTime);
-      submission = getJobStatus(jobId);
+
+      //Works with both name as well as id (in string form) as argument
+      submission = getJobStatus(jobName);
     }
     invokeSubmissionCallback(callback, submission, SubmissionStatus.FINISHED);
     return submission;
   }
 
+    public MSubmission startJob(long jobId, SubmissionCallback callback, long pollTime)
+            throws InterruptedException {
+      return startJob(String.valueOf(jobId), callback, pollTime);
+    }
+
   /**
    * Invokes the callback's methods with MSubmission object
    * based on SubmissionStatus. If callback is null, no operation performed.
@@ -513,13 +622,33 @@ public class SqoopClient {
   }
 
   /**
+   * stop job with given name.
+   *
+   * @param jName Job name
+   * @return
+   */
+  public MSubmission stopJob(String jName) {
+    return resourceRequests.stopJob(jName).getSubmissions().get(0);
+  }
+
+  /**
    * stop job with given id.
    *
-   * @param jid Job id
+   * @param jId Job id
+   * @return
+   */
+  public MSubmission stopJob(long jId) {
+    return resourceRequests.stopJob(String.valueOf(jId)).getSubmissions().get(0);
+  }
+
+  /**
+   * Get status for given job name.
+   *
+   * @param jName Job name
    * @return
    */
-  public MSubmission stopJob(long jid) {
-    return resourceRequests.stopJob(jid).getSubmissions().get(0);
+  public MSubmission getJobStatus(String jName) {
+    return resourceRequests.getJobStatus(jName).getSubmissions().get(0);
   }
 
   /**
@@ -529,7 +658,7 @@ public class SqoopClient {
    * @return
    */
   public MSubmission getJobStatus(long jid) {
-    return resourceRequests.getJobStatus(jid).getSubmissions().get(0);
+    return resourceRequests.getJobStatus(String.valueOf(jid)).getSubmissions().get(0);
   }
 
   /**
@@ -548,7 +677,17 @@ public class SqoopClient {
    * @return
    */
   public List<MSubmission> getSubmissionsForJob(long jobId) {
-    return resourceRequests.readSubmission(jobId).getSubmissions();
+    return resourceRequests.readSubmission(String.valueOf(jobId)).getSubmissions();
+  }
+
+  /**
+   * Retrieve list of submissions for given job name.
+   *
+   * @param jobName Job name
+   * @return
+   */
+  public List<MSubmission> getSubmissionsForJob(String jobName) {
+    return resourceRequests.readSubmission(jobName).getSubmissions();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/client/src/main/java/org/apache/sqoop/client/request/JobResourceRequest.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/JobResourceRequest.java b/client/src/main/java/org/apache/sqoop/client/request/JobResourceRequest.java
index ee0f3f0..1094ae8 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/JobResourceRequest.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/JobResourceRequest.java
@@ -48,27 +48,27 @@ public class JobResourceRequest extends ResourceRequest {
     super(token);
   }
 
-  public JobBean readByConnector(String serverUrl, Long cId) {
+  public JobBean readByConnector(String serverUrl, String cArg) {
     JobsBean bean = new JobsBean();
-    if (cId != null) {
-      String response = super.get(serverUrl + RESOURCE + "?cname=" + cId);
+    if (cArg != null) {
+      String response = super.get(serverUrl + RESOURCE + "?cname=" + cArg);
       JSONObject jsonObject = JSONUtils.parse(response);
       bean.restore(jsonObject);
     }
     return bean;
   }
 
-  public JobBean read(String serverUrl, Long jobId) {
+  public JobBean read(String serverUrl, String jobArg) {
     String response;
-    if (jobId == null) {
+    if (jobArg == null) {
       response = super.get(serverUrl + RESOURCE + "all");
     } else {
-      response = super.get(serverUrl + RESOURCE + jobId);
+      response = super.get(serverUrl + RESOURCE + jobArg);
     }
     JSONObject jsonObject = JSONUtils.parse(response);
     // defaults to all
     JobBean bean = new JobsBean();
-    if (jobId != null) {
+    if (jobArg != null) {
       bean = new JobBean();
     }
     bean.restore(jsonObject);
@@ -96,30 +96,30 @@ public class JobResourceRequest extends ResourceRequest {
     return validationBean;
   }
 
-  public void delete(String serverUrl, Long jobId) {
-    super.delete(serverUrl + RESOURCE + jobId);
+  public void delete(String serverUrl, String jobArg) {
+    super.delete(serverUrl + RESOURCE + jobArg);
   }
 
-  public void enable(String serverUrl, Long jobId, Boolean enabled) {
+  public void enable(String serverUrl, String jobArg, Boolean enabled) {
     if (enabled) {
-      super.put(serverUrl + RESOURCE + jobId + ENABLE, null);
+      super.put(serverUrl + RESOURCE + jobArg + ENABLE, null);
     } else {
-      super.put(serverUrl + RESOURCE + jobId + DISABLE, null);
+      super.put(serverUrl + RESOURCE + jobArg + DISABLE, null);
     }
   }
 
-  public SubmissionBean start(String serverUrl, Long jobId) {
-    String response = super.put(serverUrl + RESOURCE + jobId + START, null);
+  public SubmissionBean start(String serverUrl, String jobArg) {
+    String response = super.put(serverUrl + RESOURCE + jobArg + START, null);
     return createJobSubmissionResponse(response);
   }
 
-  public SubmissionBean stop(String serverUrl, Long jobId) {
-    String response = super.put(serverUrl + RESOURCE + jobId + STOP, null);
+  public SubmissionBean stop(String serverUrl, String jobArg) {
+    String response = super.put(serverUrl + RESOURCE + jobArg + STOP, null);
     return createJobSubmissionResponse(response);
   }
 
-  public SubmissionBean status(String serverUrl, Long jobId) {
-    String response = super.get(serverUrl + RESOURCE + jobId + STATUS);
+  public SubmissionBean status(String serverUrl, String jobArg) {
+    String response = super.get(serverUrl + RESOURCE + jobArg + STATUS);
     return createJobSubmissionResponse(response);
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/client/src/main/java/org/apache/sqoop/client/request/LinkResourceRequest.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/LinkResourceRequest.java b/client/src/main/java/org/apache/sqoop/client/request/LinkResourceRequest.java
index 0783002..8391621 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/LinkResourceRequest.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/LinkResourceRequest.java
@@ -44,17 +44,17 @@ public class LinkResourceRequest extends ResourceRequest {
     super(token);
   }
 
-  public LinkBean read(String serverUrl, Long linkId) {
+  public LinkBean read(String serverUrl, String linkArg) {
     String response;
-    if (linkId == null) {
+    if (linkArg == null) {
       response = super.get(serverUrl + LINK_RESOURCE + "all");
     } else {
-      response = super.get(serverUrl + LINK_RESOURCE + linkId);
+      response = super.get(serverUrl + LINK_RESOURCE + linkArg);
     }
     JSONObject jsonObject = JSONUtils.parse(response);
     // defaults to all
     LinkBean bean = new LinksBean();
-    if (linkId != null) {
+    if (linkArg != null) {
       bean = new LinkBean();
     }
     bean.restore(jsonObject);
@@ -81,15 +81,15 @@ public class LinkResourceRequest extends ResourceRequest {
     return validationBean;
   }
 
-  public void delete(String serverUrl, Long id) {
-     super.delete(serverUrl + LINK_RESOURCE + id);
+  public void delete(String serverUrl, String arg) {
+     super.delete(serverUrl + LINK_RESOURCE + arg);
   }
 
-  public void enable(String serverUrl, Long id, Boolean enabled) {
+  public void enable(String serverUrl, String lArg, Boolean enabled) {
     if (enabled) {
-      super.put(serverUrl + LINK_RESOURCE + id + ENABLE, null);
+      super.put(serverUrl + LINK_RESOURCE + lArg + ENABLE, null);
     } else {
-      super.put(serverUrl + LINK_RESOURCE + id + DISABLE, null);
+      super.put(serverUrl + LINK_RESOURCE + lArg + DISABLE, null);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/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 882c336..1803b70 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
@@ -109,60 +109,60 @@ public class SqoopResourceRequests {
     return getLinkResourceRequest().create(serverUrl, link);
   }
 
-  public LinkBean readLink(Long linkId) {
-    return getLinkResourceRequest().read(serverUrl, linkId);
+  public LinkBean readLink(String linkArg) {
+    return getLinkResourceRequest().read(serverUrl, linkArg);
   }
 
   public ValidationResultBean updateLink(MLink link) {
     return getLinkResourceRequest().update(serverUrl, link);
   }
 
-  public void enableLink(Long lid, Boolean enabled) {
-    getLinkResourceRequest().enable(serverUrl, lid, enabled);
+  public void enableLink(String lArg, Boolean enabled) {
+    getLinkResourceRequest().enable(serverUrl, lArg, enabled);
   }
 
-  public void deleteLink(Long lid) {
-    getLinkResourceRequest().delete(serverUrl, lid);
+  public void deleteLink(String lArg) {
+    getLinkResourceRequest().delete(serverUrl, lArg);
   }
 
   public ValidationResultBean saveJob(MJob job) {
     return getJobResourceRequest().create(serverUrl, job);
   }
 
-  public JobBean readJob(Long jobId) {
-    return getJobResourceRequest().read(serverUrl, jobId);
+  public JobBean readJob(String jobArg) {
+    return getJobResourceRequest().read(serverUrl, jobArg);
   }
 
-  public JobBean readJobsByConnector(Long cId) {
-    return getJobResourceRequest().readByConnector(serverUrl, cId);
+  public JobBean readJobsByConnector(String cArg) {
+    return getJobResourceRequest().readByConnector(serverUrl, cArg);
   }
 
   public ValidationResultBean updateJob(MJob job) {
     return getJobResourceRequest().update(serverUrl, job);
   }
 
-  public void enableJob(Long jid, Boolean enabled) {
-    getJobResourceRequest().enable(serverUrl, jid, enabled);
+  public void enableJob(String jArg, Boolean enabled) {
+    getJobResourceRequest().enable(serverUrl, jArg, enabled);
   }
 
-  public void deleteJob(Long jid) {
-    getJobResourceRequest().delete(serverUrl, jid);
+  public void deleteJob(String jArg) {
+    getJobResourceRequest().delete(serverUrl, jArg);
   }
 
-  public SubmissionBean getJobStatus(Long jid) {
-    return getJobResourceRequest().status(serverUrl, jid);
+  public SubmissionBean getJobStatus(String jArg) {
+    return getJobResourceRequest().status(serverUrl, jArg);
   }
 
-  public SubmissionBean startJob(Long jid) {
-    return getJobResourceRequest().start(serverUrl, jid);
+  public SubmissionBean startJob(String jArg) {
+    return getJobResourceRequest().start(serverUrl, jArg);
   }
 
-  public SubmissionBean stopJob(Long jid) {
-    return getJobResourceRequest().stop(serverUrl, jid);
+  public SubmissionBean stopJob(String jArg) {
+    return getJobResourceRequest().stop(serverUrl, jArg);
   }
 
-  public SubmissionsBean readSubmission(Long jid) {
-    return getSubmissionResourceRequest().read(serverUrl, jid);
+  public SubmissionsBean readSubmission(String jArg) {
+    return getSubmissionResourceRequest().read(serverUrl, jArg);
   }
 
   public RolesBean readRoles() {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/client/src/main/java/org/apache/sqoop/client/request/SubmissionResourceRequest.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/SubmissionResourceRequest.java b/client/src/main/java/org/apache/sqoop/client/request/SubmissionResourceRequest.java
index 2d2d751..f0435ce 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/SubmissionResourceRequest.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/SubmissionResourceRequest.java
@@ -38,14 +38,14 @@ public class SubmissionResourceRequest extends  ResourceRequest {
     super(token);
   }
 
-  public SubmissionsBean read(String serverUrl, Long jid) {
+  public SubmissionsBean read(String serverUrl, String jArg) {
     String response;
-    if (jid == null) {
+    if (jArg == null) {
       // all submissions
       response = super.get(serverUrl + RESOURCE);
     } else {
       // submission per job ( name preferred, we fall back to id)
-      response = super.get(serverUrl + RESOURCE + "?jname=" + jid);
+      response = super.get(serverUrl + RESOURCE + "?jname=" + jArg);
     }
     JSONObject jsonObject = JSONUtils.parse(response);
     SubmissionsBean submissionBean = new SubmissionsBean();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
index d15a7bb..de7774b 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
@@ -52,15 +52,15 @@ public class CloneJobFunction extends SqoopFunction {
 
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return cloneJob(getLong(line, Constants.OPT_JID), line.getArgList(), isInteractive);
+    return cloneJob(line.getOptionValue(Constants.OPT_JID), line.getArgList(), isInteractive);
   }
 
-  private Status cloneJob(Long jobId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_CLONE_CLONING_JOB, jobId);
+  private Status cloneJob(String jobArg, List<String> args, boolean isInteractive) throws IOException {
+    printlnResource(Constants.RES_CLONE_CLONING_JOB, jobArg);
 
     ConsoleReader reader = new ConsoleReader();
 
-    MJob job = client.getJob(jobId);
+    MJob job = client.getJob(jobArg);
     job.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
 
     ResourceBundle fromConnectorBundle = client.getConnectorConfigBundle(

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
index 3db68f9..17ad5cc 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CloneLinkFunction.java
@@ -53,15 +53,15 @@ public class CloneLinkFunction extends SqoopFunction {
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return cloneLink(getLong(line, Constants.OPT_LID), line.getArgList(), isInteractive);
+    return cloneLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
   }
 
-  private Status cloneLink(Long connectionId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_CLONE_CLONING_LINK, connectionId);
+  private Status cloneLink(String linkArg, List<String> args, boolean isInteractive) throws IOException {
+    printlnResource(Constants.RES_CLONE_CLONING_LINK, linkArg);
 
     ConsoleReader reader = new ConsoleReader();
 
-    MLink connection = client.getLink(connectionId);
+    MLink connection = client.getLink(linkArg);
     // Remove persistent id as we're making a clone
     connection.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
index 91dc828..b706397 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
@@ -62,17 +62,17 @@ public class CreateJobFunction extends  SqoopFunction {
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return createJob(getLong(line, Constants.OPT_FROM),
-                     getLong(line, Constants.OPT_TO),
+    return createJob(line.getOptionValue(Constants.OPT_FROM),
+                     line.getOptionValue(Constants.OPT_TO),
                      line.getArgList(),
                      isInteractive);
   }
 
-  private Status createJob(Long fromLinkId, Long toLinkId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_CREATE_CREATING_JOB, fromLinkId, toLinkId);
+  private Status createJob(String fromLinkArg, String toLinkArg, List<String> args, boolean isInteractive) throws IOException {
+    printlnResource(Constants.RES_CREATE_CREATING_JOB, fromLinkArg, toLinkArg);
 
     ConsoleReader reader = new ConsoleReader();
-    MJob job = client.createJob(fromLinkId, toLinkId);
+    MJob job = client.createJob(fromLinkArg, toLinkArg);
 
     MConnector fromConnector = client.getConnector(job.getFromConnectorId());
     if (!fromConnector.getSupportedDirections().isDirectionSupported(Direction.FROM)) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
index 4090597..2619094 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CreateLinkFunction.java
@@ -20,6 +20,7 @@ package org.apache.sqoop.shell;
 import jline.ConsoleReader;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.OptionBuilder;
+import org.apache.sqoop.model.MConnector;
 import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.shell.core.Constants;
 import org.apache.sqoop.shell.utils.LinkDynamicConfigOptions;
@@ -52,17 +53,40 @@ public class CreateLinkFunction extends SqoopFunction {
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return createLink(getLong(line, Constants.OPT_CID), line.getArgList(), isInteractive);
+    return createLink(line, line.getArgList(), isInteractive);
   }
 
-  private Status createLink(long connectorId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_CREATE_CREATING_LINK, connectorId);
+  private Status createLink(CommandLine line, List<String> args, boolean isInteractive) throws IOException {
 
-    ConsoleReader reader = new ConsoleReader();
+    //Check if the command argument is a connector name
+    MLink link = null;
+    Long cid;
+    String connectorName = line.getOptionValue(Constants.OPT_CID);
+    MConnector connector = client.getConnector(connectorName);
+    if (null == connector) {
+      //Now check if command line argument is a connector id
+      //This works as getConnector(String...) does not throw an exception
+      cid = getLong(line, Constants.OPT_CID);
+      client.getConnector(cid);
 
-    MLink link = client.createLink(connectorId);
+      //Would have thrown an exception before this if input was neither a valid name nor an id
+      //This will do an extra getConnector() call again inside createLink()
+      //but should not matter as connectors are cached
+      link = client.createLink(cid);
+      printlnResource(Constants.RES_CREATE_CREATING_LINK, cid);
+    }
+    else {
+      //Command line had connector name
+      //This will do an extra getConnector() call again inside createLink() but
+      //should not matter as connectors are cached
+      cid = connector.getPersistenceId();
+      link = client.createLink(connectorName);
+      printlnResource(Constants.RES_CREATE_CREATING_LINK, connectorName);
+    }
+
+    ConsoleReader reader = new ConsoleReader();
 
-    ResourceBundle connectorConfigBundle = client.getConnectorConfigBundle(connectorId);
+    ResourceBundle connectorConfigBundle = client.getConnectorConfigBundle(cid);
 
     Status status = Status.OK;
     if (isInteractive) {
@@ -85,8 +109,8 @@ public class CreateLinkFunction extends SqoopFunction {
     } else {
       LinkDynamicConfigOptions options = new LinkDynamicConfigOptions();
       options.prepareOptions(link);
-      CommandLine line = ConfigOptions.parseOptions(options, 0, args, false);
-      if (fillLink(line, link)) {
+      CommandLine linkoptsline = ConfigOptions.parseOptions(options, 0, args, false);
+      if (fillLink(linkoptsline, link)) {
         status = client.saveLink(link);
         if (!status.canProceed()) {
           printLinkValidationMessages(link);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java
index bf4e507..229879b 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteJobFunction.java
@@ -42,7 +42,7 @@ public class DeleteJobFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.deleteJob(getLong(line, Constants.OPT_JID));
+    client.deleteJob(line.getOptionValue(Constants.OPT_JID));
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
index 896be3f..bb9c7c5 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DeleteLinkFunction.java
@@ -41,7 +41,7 @@ public class DeleteLinkFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.deleteLink(getLong(line, Constants.OPT_LID));
+    client.deleteLink(line.getOptionValue(Constants.OPT_LID));
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java
index 907c785..a066172 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DisableJobFunction.java
@@ -50,7 +50,7 @@ public class DisableJobFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableJob(getLong(line, Constants.OPT_JID), false);
+    client.enableJob(line.getOptionValue(Constants.OPT_JID), false);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
index 46b35a1..0f38b99 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/DisableLinkFunction.java
@@ -41,7 +41,7 @@ public class DisableLinkFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableLink(getLong(line, Constants.OPT_LID), false);
+    client.enableLink(line.getOptionValue(Constants.OPT_LID), false);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java
index 69ebe73..8b4435e 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/EnableJobFunction.java
@@ -42,7 +42,7 @@ public class EnableJobFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableJob(getLong(line, Constants.OPT_JID), true);
+    client.enableJob(line.getOptionValue(Constants.OPT_JID), true);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
index 728433b..64814d2 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/EnableLinkFunction.java
@@ -41,7 +41,7 @@ public class EnableLinkFunction extends SqoopFunction {
 
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
-    client.enableLink(getLong(line, Constants.OPT_LID), true);
+    client.enableLink(line.getOptionValue(Constants.OPT_LID), true);
     return Status.OK;
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java
index 2a21b85..f248683 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectorFunction.java
@@ -51,7 +51,7 @@ public class ShowConnectorFunction extends SqoopFunction {
     if (line.hasOption(Constants.OPT_ALL)) {
       showConnectors();
     } else if (line.hasOption(Constants.OPT_CID)) {
-      showConnector(getLong(line, Constants.OPT_CID));
+      showConnector(line);
     } else {
       showSummary();
     }
@@ -96,8 +96,19 @@ public class ShowConnectorFunction extends SqoopFunction {
     }
   }
 
-  private void showConnector(Long cid) {
-    MConnector connector = client.getConnector(cid);
+  private void showConnector(CommandLine line) {
+    //Check if the command argument is a connector name
+    String connectorName = line.getOptionValue(Constants.OPT_CID);
+    MConnector connector = client.getConnector(connectorName);
+    if (null == connector) {
+      //Now check if command line argument is a connector id
+      //This works as getConnector(String...) does not throw an exception
+      Long cid  = getLong(line, Constants.OPT_CID);
+      connector = client.getConnector(cid);
+    }
+
+    //No null checks here - as before. This is because getConnector(long...)
+    //throws an exception if connector is not found.
 
     printlnResource(Constants.RES_SHOW_PROMPT_CONNECTORS_TO_SHOW, 1);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
index 33c30bf..c283727 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
@@ -60,9 +60,11 @@ public class ShowJobFunction extends SqoopFunction {
     if (line.hasOption(Constants.OPT_ALL)) {
       showJobs(null);
     } else if (line.hasOption(Constants.OPT_CID)) {
-      showJobs(getLong(line, Constants.OPT_CID));
+      //showJobs(getLong(line, Constants.OPT_CID));
+      showJobs(line.getOptionValue(Constants.OPT_CID));
     } else if (line.hasOption(Constants.OPT_JID)) {
-      showJob(getLong(line, Constants.OPT_JID));
+      //showJob(getLong(line, Constants.OPT_JID));
+      showJob(line.getOptionValue(Constants.OPT_JID));
     } else {
       showSummary();
     }
@@ -121,12 +123,12 @@ public class ShowJobFunction extends SqoopFunction {
     TableDisplayer.display(header, ids, names, fromConnectors, toConnectors, availabilities);
   }
 
-  private void showJobs(Long id) {
+  private void showJobs(String jArg) {
     List<MJob> jobs;
-    if (id == null) {
+    if (jArg == null) {
       jobs = client.getJobs();
     } else {
-      jobs = client.getJobsByConnector(id);
+      jobs = client.getJobsByConnector(jArg);
     }
     printlnResource(Constants.RES_SHOW_PROMPT_JOBS_TO_SHOW, jobs.size());
 
@@ -135,8 +137,8 @@ public class ShowJobFunction extends SqoopFunction {
     }
   }
 
-  private void showJob(Long jid) {
-    MJob job = client.getJob(jid);
+  private void showJob(String jobArg) {
+    MJob job = client.getJob(jobArg);
     printlnResource(Constants.RES_SHOW_PROMPT_JOBS_TO_SHOW, 1);
 
     displayJob(job);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java
index 8e57d33..4be8003 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobStatusFunction.java
@@ -42,7 +42,7 @@ public class ShowJobStatusFunction extends SqoopFunction {
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
     if (line.hasOption(Constants.OPT_JID)) {
-      MSubmission submission = client.getJobStatus(getLong(line, Constants.OPT_JID));
+      MSubmission submission = client.getJobStatus(line.getOptionValue(Constants.OPT_JID));
       if(submission.getStatus().isFailure() || submission.getStatus().equals(SubmissionStatus.SUCCEEDED)) {
         SubmissionDisplayer.displayHeader(submission);
         SubmissionDisplayer.displayFooter(submission);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
index 70f268f..84194d9 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowLinkFunction.java
@@ -58,7 +58,7 @@ public class ShowLinkFunction extends SqoopFunction {
     if (line.hasOption(Constants.OPT_ALL)) {
       showLinks();
     } else if (line.hasOption(Constants.OPT_LID)) {
-      showLink(getLong(line, Constants.OPT_LID));
+      showLink(line.getOptionValue(Constants.OPT_LID));
     } else {
       showSummary();
     }
@@ -103,8 +103,8 @@ public class ShowLinkFunction extends SqoopFunction {
     }
   }
 
-  private void showLink(Long xid) {
-    MLink link = client.getLink(xid);
+  private void showLink(String linkArg) {
+    MLink link = client.getLink(linkArg);
 
     printlnResource(Constants.RES_SHOW_PROMPT_LINKS_TO_SHOW, 1);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
index af6de5b..0c006db 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
@@ -48,13 +48,13 @@ public class ShowSubmissionFunction extends SqoopFunction {
   public Object executeFunction(CommandLine line, boolean isInteractive) {
     if (line.hasOption(Constants.OPT_DETAIL)) {
       if (line.hasOption(Constants.OPT_JID)) {
-        showSubmissions(getLong(line, Constants.OPT_JID));
+        showSubmissions(line.getOptionValue(Constants.OPT_JID));
       } else {
         showSubmissions(null);
       }
     } else {
       if (line.hasOption(Constants.OPT_JID)) {
-        showSummary(getLong(line, Constants.OPT_JID));
+        showSummary(line.getOptionValue(Constants.OPT_JID));
       } else {
         showSummary(null);
       }
@@ -63,12 +63,12 @@ public class ShowSubmissionFunction extends SqoopFunction {
     return Status.OK;
   }
 
-  private void showSummary(Long jid) {
+  private void showSummary(String jArg) {
     List<MSubmission> submissions;
-    if (jid == null) {
+    if (jArg == null) {
       submissions = client.getSubmissions();
     } else {
-      submissions = client.getSubmissionsForJob(jid);
+      submissions = client.getSubmissionsForJob(jArg);
     }
 
     List<String> header = new LinkedList<String>();
@@ -92,12 +92,12 @@ public class ShowSubmissionFunction extends SqoopFunction {
     TableDisplayer.display(header, jids, eids, status, dates);
   }
 
-  private void showSubmissions(Long jid) {
+  private void showSubmissions(String jArg) {
     List<MSubmission> submissions;
-    if (jid == null) {
+    if (jArg == null) {
       submissions = client.getSubmissions();
     } else {
-      submissions = client.getSubmissionsForJob(jid);
+      submissions = client.getSubmissionsForJob(jArg);
     }
 
     for (MSubmission submission : submissions) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java
index dd61d7a..4d32685 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/StartJobFunction.java
@@ -72,12 +72,14 @@ public class StartJobFunction extends SqoopFunction {
       };
 
       try {
-        client.startJob(getLong(line, Constants.OPT_JID), callback, pollTimeout);
+        //client.startJob(getLong(line, Constants.OPT_JID), callback, pollTimeout);
+        client.startJob(line.getOptionValue(Constants.OPT_JID), callback, pollTimeout);
       } catch (InterruptedException e) {
         throw new SqoopException(ShellError.SHELL_0007, e);
       }
     } else if (line.hasOption(Constants.OPT_JID)) {
-      MSubmission submission = client.startJob(getLong(line, Constants.OPT_JID));
+      //MSubmission submission = client.startJob(getLong(line, Constants.OPT_JID));
+      MSubmission submission = client.startJob(line.getOptionValue(Constants.OPT_JID));
       if(submission.getStatus().isFailure()) {
         SubmissionDisplayer.displayFooter(submission);
       } else {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java
index 2b28b3b..a1980d4 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/StopJobFunction.java
@@ -40,7 +40,8 @@ public class StopJobFunction extends SqoopFunction {
   @Override
   public Object executeFunction(CommandLine line, boolean isInteractive) {
     if (line.hasOption(Constants.OPT_JID)) {
-      MSubmission submission = client.stopJob(getLong(line, Constants.OPT_JID));
+      //MSubmission submission = client.stopJob(getLong(line, Constants.OPT_JID));
+      MSubmission submission = client.stopJob(line.getOptionValue(Constants.OPT_JID));
       if(submission.getStatus().isFailure()) {
         SubmissionDisplayer.displayFooter(submission);
       } else {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
index 222814e..5c15532 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
@@ -53,16 +53,16 @@ public class UpdateJobFunction extends SqoopFunction {
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return updateJob(getLong(line, Constants.OPT_JID), line.getArgList(), isInteractive);
+    return updateJob(line.getOptionValue(Constants.OPT_JID), line.getArgList(), isInteractive);
   }
 
-  private Status updateJob(Long jobId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_SQOOP_UPDATING_JOB, jobId);
+  private Status updateJob(String jobArg, List<String> args, boolean isInteractive) throws IOException {
+    printlnResource(Constants.RES_SQOOP_UPDATING_JOB, jobArg);
 
     ConsoleReader reader = new ConsoleReader();
 
     // TODO(SQOOP-1634): using from/to and driver config id, this call can be avoided
-    MJob job = client.getJob(jobId);
+    MJob job = client.getJob(jobArg);
 
     ResourceBundle fromConnectorBundle = client.getConnectorConfigBundle(
         job.getFromConnectorId());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/d16566ac/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
index c0c47e1..bf1ddab 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateLinkFunction.java
@@ -52,16 +52,16 @@ public class UpdateLinkFunction extends SqoopFunction {
   @Override
   @SuppressWarnings("unchecked")
   public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
-    return updateLink(getLong(line, Constants.OPT_LID), line.getArgList(), isInteractive);
+    return updateLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
   }
 
-  private Status updateLink(Long linkId, List<String> args, boolean isInteractive) throws IOException {
-    printlnResource(Constants.RES_SQOOP_UPDATING_LINK, linkId);
+  private Status updateLink(String linkArg, List<String> args, boolean isInteractive) throws IOException {
+    printlnResource(Constants.RES_SQOOP_UPDATING_LINK, linkArg);
 
     ConsoleReader reader = new ConsoleReader();
 
     // TODO(SQOOP-1634): using link config id, this call can be avoided
-    MLink link = client.getLink(linkId);
+    MLink link = client.getLink(linkArg);
 
     ResourceBundle connectorLinkConfigBundle = client.getConnectorConfigBundle(link.getConnectorId());
 


Mime
View raw message