sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2742: Sqoop2: Clear useless method after remove id from public interface
Date Thu, 24 Dec 2015 08:53:49 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 bf5cc533b -> 15328cc92


SQOOP-2742: Sqoop2: Clear useless method after remove id from public interface

(Colin Ma via Jarek Jarcec Cecho)


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

Branch: refs/heads/sqoop2
Commit: 15328cc927dc50596e26d8ead42399478653f2e9
Parents: bf5cc53
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Dec 24 09:53:19 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu Dec 24 09:53:19 2015 +0100

----------------------------------------------------------------------
 .../org/apache/sqoop/client/SqoopClient.java    | 132 +------------------
 .../sqoop/connector/ConnectorManager.java       |  28 ----
 .../org/apache/sqoop/driver/JobManager.java     |   4 -
 .../apache/sqoop/repository/JdbcRepository.java |  40 ------
 .../org/apache/sqoop/repository/Repository.java |  27 +---
 .../org/apache/sqoop/driver/TestJobManager.java |   8 --
 .../sqoop/repository/derby/DerbyTestCase.java   |   1 -
 .../repository/derby/TestConnectorHandling.java |   2 -
 .../sqoop/handler/ConnectorRequestHandler.java  |   5 +-
 .../org/apache/sqoop/handler/HandlerUtils.java  |  28 ----
 .../sqoop/server/v1/ConfigurableServlet.java    |   2 -
 .../sqoop/server/v1/ConnectorServlet.java       |   2 -
 .../org/apache/sqoop/server/v1/JobServlet.java  |  31 ++---
 .../org/apache/sqoop/server/v1/LinkServlet.java |  14 +-
 .../sqoop/shell/ShowSubmissionFunction.java     |   6 +-
 .../apache/sqoop/shell/TestCloneCommand.java    |   4 +-
 .../org/apache/sqoop/shell/TestShowCommand.java |   2 +-
 .../apache/sqoop/shell/TestUpdateCommand.java   |   6 +-
 .../test/infrastructure/SqoopTestCase.java      |   4 +-
 19 files changed, 29 insertions(+), 317 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/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 bac7fe8..f037399 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -130,17 +130,6 @@ public class SqoopClient {
   }
 
   /**
-   * Get connector with given id.
-   * TODO: This method should be removed when MJob link with Connector by name.
-   *
-   * @param cid Connector id.
-   * @return
-   */
-  public MConnector getConnector(long cid) {
-    return retrieveConnector(Long.toString(cid));
-  }
-
-  /**
    * Return connector with given name.
    *
    * @param connectorName Connector name
@@ -180,9 +169,8 @@ public class SqoopClient {
 
   /**
    * Retrieve connector structure from server and cache it.
-   * TODO: The method support both connector name/id, this should support name only when
MJob link with Connector by name.
    *
-   * @param connectorIdentify Connector name/id
+   * @param connectorIdentify Connector name
    */
   private MConnector retrieveConnector(String connectorIdentify) {
     ConnectorBean request = resourceRequests.readConnector(connectorIdentify);
@@ -216,7 +204,7 @@ public class SqoopClient {
   /**
    * Get resource bundle for given connector.
    *
-   * @param connectorId Connector id.
+   * @param connectorName Connector name.
    * @return
    */
   public ResourceBundle getConnectorConfigBundle(String connectorName) {
@@ -290,18 +278,6 @@ public class SqoopClient {
     return new MLink(connectorName, getConnector(connectorName).getLinkConfig());
   }
 
-
-  /**
-   * Retrieve link for given id.
-   *
-   * @param linkId Link id
-   * @return
-   */
-  public MLink getLink(long linkId) {
-    //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.
    *
@@ -352,16 +328,6 @@ public class SqoopClient {
   }
 
   /**
-   * Enable/disable link with given id
-   *
-   * @param linkId link id
-   * @param enabled Enable or disable
-   */
-  public void enableLink(long linkId, boolean enabled) {
-    resourceRequests.enableLink(String.valueOf(linkId), enabled);
-  }
-
-  /**
    * Delete link with given name
    *
    * @param linkName link name
@@ -371,15 +337,6 @@ public class SqoopClient {
   }
 
   /**
-   * Delete link with given id.
-   *
-   * @param linkId link id
-   */
-  public void deleteLink(long linkId) {
-    resourceRequests.deleteLink(String.valueOf(linkId));
-  }
-
-  /**
    * Create new job the for given links.
    *
    * @param fromLinkName From link name
@@ -404,17 +361,6 @@ public class SqoopClient {
   }
 
   /**
-   * Retrieve job for given id.
-   *
-   * @param jobId Job id
-   * @return
-   */
-  public MJob getJob(long jobId) {
-    //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
@@ -434,15 +380,6 @@ public class SqoopClient {
   }
 
   /**
-   * Retrieve list of all jobs by connector id
-   *
-   * @return
-   */
-  public List<MJob> getJobsByConnector(long cId) {
-    return resourceRequests.readJobsByConnector(String.valueOf(cId)).getJobs();
-  }
-
-  /**
    * Retrieve list of all jobs by connector name
    *
    * @return
@@ -481,16 +418,6 @@ public class SqoopClient {
   }
 
   /**
-   * Enable/disable job with given id
-   *
-   * @param jId Job that is going to be enabled/disabled
-   * @param enabled Enable or disable
-   */
-  public void enableJob(long jId, boolean enabled) {
-    resourceRequests.enableJob(String.valueOf(jId), enabled);
-  }
-
-  /**
    * Delete job with given name.
    *
    * @param jobName Job name
@@ -499,15 +426,6 @@ public class SqoopClient {
     resourceRequests.deleteJob(jobName);
   }
 
-  /**
-   * Delete job with given id
-   *
-   * @param jobId Job id
-   */
-  public void deleteJob(long jobId) {
-    resourceRequests.deleteJob(String.valueOf(jobId));
-  }
-
   public void deleteAllLinks(){
     for (MJob job : getJobs()) {
       deleteJob(job.getName());
@@ -536,16 +454,6 @@ public class SqoopClient {
   }
 
   /**
-   * Start job with given id.
-   *
-   * @param jobId Job id
-   * @return
-   */
-  public MSubmission startJob(long jobId) {
-    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.
@@ -574,18 +482,12 @@ public class SqoopClient {
       }
       Thread.sleep(pollTime);
 
-      //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.
@@ -623,16 +525,6 @@ public class SqoopClient {
   }
 
   /**
-   * stop job with given 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
@@ -643,16 +535,6 @@ public class SqoopClient {
   }
 
   /**
-   * Get status for given job id.
-   *
-   * @param jid Job id
-   * @return
-   */
-  public MSubmission getJobStatus(long jid) {
-    return resourceRequests.getJobStatus(String.valueOf(jid)).getSubmissions().get(0);
-  }
-
-  /**
    * Retrieve list of all submissions.
    *
    * @return
@@ -662,16 +544,6 @@ public class SqoopClient {
   }
 
   /**
-   * Retrieve list of submissions for given jobId.
-   *
-   * @param jobId Job id
-   * @return
-   */
-  public List<MSubmission> getSubmissionsForJob(long jobId) {
-    return resourceRequests.readSubmission(String.valueOf(jobId)).getSubmissions();
-  }
-
-  /**
    * Retrieve list of submissions for given job name.
    *
    * @param jobName Job name

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
index 5663445..f5fcb00 100644
--- a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
+++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
@@ -98,8 +98,6 @@ public class ConnectorManager implements Reconfigurable {
     instance = newInstance;
   }
 
-  // key: connector id, value: connector name
-  private Map<Long, String> idToNameMap;
   private Set<String> connectorNames = new HashSet<String>();
 
   // key: connector name, value: connector handler
@@ -113,10 +111,6 @@ public class ConnectorManager implements Reconfigurable {
     return connectors;
   }
 
-  public Set<Long> getConnectorIds() {
-    return idToNameMap.keySet();
-  }
-
   public Map<String, ResourceBundle> getResourceBundles(Locale locale) {
     Map<String, ResourceBundle> bundles = new HashMap<String, ResourceBundle>();
     for (ConnectorHandler handler : handlerMap.values()) {
@@ -127,24 +121,11 @@ public class ConnectorManager implements Reconfigurable {
     return bundles;
   }
 
-  public ResourceBundle getResourceBundle(long connectorId, Locale locale) {
-    return getResourceBundle(idToNameMap.get(connectorId), locale);
-  }
-
   public ResourceBundle getResourceBundle(String connectorName, Locale locale) {
     ConnectorHandler handler = handlerMap.get(connectorName);
     return handler.getSqoopConnector().getBundle(locale);
   }
 
-  public MConnector getConnectorConfigurable(long connectorId) {
-    String connectorName = idToNameMap.get(connectorId);
-    if (connectorName == null) {
-      throw new SqoopException(CommonRepositoryError.COMMON_0057, "Couldn't find"
-          + " connector with id " + connectorId);
-    }
-    return getConnectorConfigurable(connectorName);
-  }
-
   public MConnector getConnectorConfigurable(String connectorName) {
     ConnectorHandler handler = handlerMap.get(connectorName);
     if (handler == null) {
@@ -154,10 +135,6 @@ public class ConnectorManager implements Reconfigurable {
     return handler.getConnectorConfigurable();
   }
 
-  public SqoopConnector getSqoopConnector(long connectorId) {
-    return getSqoopConnector(idToNameMap.get(connectorId));
-  }
-
   public SqoopConnector getSqoopConnector(String uniqueName) {
     if (handlerMap != null && handlerMap.get(uniqueName) != null) {
       return handlerMap.get(uniqueName).getSqoopConnector();
@@ -174,9 +151,6 @@ public class ConnectorManager implements Reconfigurable {
     if (handlerMap == null) {
       handlerMap = new HashMap<String, ConnectorHandler>();
     }
-    if (idToNameMap == null) {
-      idToNameMap = new HashMap<Long, String>();
-    }
     if (connectorNames == null) {
       connectorNames = new HashSet<String>();
     }
@@ -241,7 +215,6 @@ public class ConnectorManager implements Reconfigurable {
         if (!handler.getConnectorConfigurable().hasPersistenceId()) {
           throw new SqoopException(ConnectorError.CONN_0010, connectorName);
         }
-        idToNameMap.put(handler.getConnectorConfigurable().getPersistenceId(), connectorName);
         connectorNames.add(connectorName);
         LOG.debug("Registered connector: " + handler.getConnectorConfigurable());
       }
@@ -260,7 +233,6 @@ public class ConnectorManager implements Reconfigurable {
 
   public synchronized void destroy() {
     handlerMap = null;
-    idToNameMap = null;
     connectorNames = null;
     blacklistedConnectors = null;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/core/src/main/java/org/apache/sqoop/driver/JobManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/driver/JobManager.java b/core/src/main/java/org/apache/sqoop/driver/JobManager.java
index 39a0260..6e1c999 100644
--- a/core/src/main/java/org/apache/sqoop/driver/JobManager.java
+++ b/core/src/main/java/org/apache/sqoop/driver/JobManager.java
@@ -475,10 +475,6 @@ public class JobManager implements Reconfigurable {
     return ConnectorManager.getInstance().getSqoopConnector(connnectorName);
   }
 
-  SqoopConnector getSqoopConnector(Long connnectorId) {
-    return ConnectorManager.getInstance().getSqoopConnector(connnectorId);
-  }
-
   void validateSupportedDirection(SqoopConnector connector, Direction direction) {
     // Make sure that connector supports the given direction
     if (!connector.getSupportedDirections().contains(direction)) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java b/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
index 952ce5d..7a9f1c6 100644
--- a/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
+++ b/core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
@@ -189,19 +189,6 @@ public class JdbcRepository extends Repository {
    * {@inheritDoc}
    */
   @Override
-  public MConnector findConnector(final long id) {
-    return (MConnector) doWithConnection(new DoWithConnection() {
-      @Override
-      public Object doIt(Connection conn) throws Exception {
-        return handler.findConnector(id, conn);
-      }
-    });
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public MConnector findConnector(final String shortName) {
     return (MConnector) doWithConnection(new DoWithConnection() {
       @Override
@@ -363,19 +350,6 @@ public class JdbcRepository extends Repository {
    * {@inheritDoc}
    */
   @Override
-  public MLink findLink(final long id) {
-    return (MLink) doWithConnection(new DoWithConnection() {
-      @Override
-      public Object doIt(Connection conn) {
-        return handler.findLink(id, conn);
-      }
-    });
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public MLink findLink(final String name) {
     return (MLink) doWithConnection(new DoWithConnection() {
       @Override
@@ -519,20 +493,6 @@ public class JdbcRepository extends Repository {
    * {@inheritDoc}
    */
   @Override
-  public MJob findJob(final long id) {
-    return (MJob) doWithConnection(new DoWithConnection() {
-      @Override
-      public Object doIt(Connection conn) {
-        return handler.findJob(id, conn);
-      }
-    });
-  }
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public MJob findJob(final String name) {
     return (MJob) doWithConnection(new DoWithConnection() {
       @Override

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/core/src/main/java/org/apache/sqoop/repository/Repository.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/repository/Repository.java b/core/src/main/java/org/apache/sqoop/repository/Repository.java
index 975e2aa..1f7bcfd 100644
--- a/core/src/main/java/org/apache/sqoop/repository/Repository.java
+++ b/core/src/main/java/org/apache/sqoop/repository/Repository.java
@@ -104,15 +104,6 @@ public abstract class Repository {
   public abstract MDriver registerDriver(MDriver mDriverConfig, boolean autoUpgrade);
 
   /**
-   * Search for connector with given id in repository.
-   *
-   * @param id Connector id
-   * @return null if connector is not yet registered in repository or
-   *   loaded representation.
-   */
-  public abstract MConnector findConnector(long id);
-
-  /**
    * Search for connector with given name in repository.
    *
    * And return corresponding entity structure.
@@ -184,15 +175,7 @@ public abstract class Repository {
   public abstract void deleteLink(String linkName);
 
   /**
-   * Find link with given id in repository.
-   *
-   * @param id Link id
-   * @return link that is saved in repository
-   */
-  public abstract MLink findLink(long id);
-
-  /**
-   * Find link with given id in repository.
+   * Find link with given name in repository.
    *
    * @param name unique link name
    * @return link that is saved in repository or null if it does not exists
@@ -265,14 +248,6 @@ public abstract class Repository {
   public abstract void deleteJob(String jobName);
 
   /**
-   * Find job object with given id.
-   *
-   * @param id Job id
-   * @return job with given id loaded from repository
-   */
-  public abstract MJob findJob(long id);
-
-  /**
    * Find job object with given name.
    *
    * @param name unique name for the job

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
index ee88ddc..93620c4 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
@@ -80,14 +80,6 @@ public class TestJobManager {
   }
 
   @Test
-  public void testGetConnector() {
-    when(connectorMgrMock.getSqoopConnector(123l)).thenReturn(sqoopConnectorMock);
-    when(sqoopConnectorMock.getSupportedDirections()).thenReturn(getSupportedDirections());
-    assertEquals(jobManager.getSqoopConnector(123l), sqoopConnectorMock);
-    verify(connectorMgrMock, times(1)).getSqoopConnector(123l);
-  }
-
-  @Test
   public void testUnsupportedDirectionForConnector() {
     // invalid job id/ direction
     SqoopException exception = new SqoopException(DriverError.DRIVER_0011, "Connector: "

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
index e7b4322..e4cca07 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
@@ -84,7 +84,6 @@ abstract public class DerbyTestCase {
 
     mockConnectorManager = mock(ConnectorManager.class);
 
-    when(mockConnectorManager.getConnectorConfigurable(1L)).thenReturn(getConnector());
     when(mockConnectorManager.getConnectorConfigurable("A")).thenReturn(getConnector());
 
     ConnectorManager.setInstance(mockConnectorManager);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
index fce6e83..e833a1d 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
@@ -57,7 +57,6 @@ public class TestConnectorHandling extends DerbyTestCase {
     assertNull(handler.findConnector(1L, getDerbyDatabaseConnection()));
     // Load connector into repository
     loadConnectorAndDriverConfig();
-    when(mockConnectorManager.getConnectorConfigurable(1L)).thenReturn(getConnector());
     // Retrieve it
     MConnector connector = handler.findConnector(1L, getDerbyDatabaseConnection());
     assertNotNull(connector);
@@ -73,7 +72,6 @@ public class TestConnectorHandling extends DerbyTestCase {
     assertNull(handler.findConnector("A", getDerbyDatabaseConnection()));
     // Load connector into repository
     loadConnectorAndDriverConfig();
-    when(mockConnectorManager.getConnectorConfigurable(1L)).thenReturn(getConnector());
     // Retrieve it
     MConnector connector = handler.findConnector("A", getDerbyDatabaseConnection());
     assertNotNull(connector);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
index efe9bef..2d0c377 100644
--- a/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
@@ -52,7 +52,7 @@ public class ConnectorRequestHandler implements RequestHandler {
     Locale locale = ctx.getAcceptLanguageHeader();
     String cIdentifier = ctx.getLastURLElement();
 
-    LOG.info("ConnectorRequestHandler handles cid: " + cIdentifier);
+    LOG.info("ConnectorRequestHandler handles cname: " + cIdentifier);
 
     if (cIdentifier.equals("all")) {
       connectors = ConnectorManager.getInstance().getConnectorConfigurables();
@@ -66,8 +66,7 @@ public class ConnectorRequestHandler implements RequestHandler {
       return new ConnectorsBean(connectors, configParamBundles);
 
     } else {
-      // NOTE: we now support using unique name as well as the connector id
-      // NOTE: connectorId is a fallback for older sqoop clients if any, since we want to
primarily use unique conenctorNames
+      // support using unique name
       MConnector mConnector = HandlerUtils.getConnectorFromConnectorName(cIdentifier);
 
       configParamBundles = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/handler/HandlerUtils.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/HandlerUtils.java b/server/src/main/java/org/apache/sqoop/handler/HandlerUtils.java
index 1eee2d2..85383af 100644
--- a/server/src/main/java/org/apache/sqoop/handler/HandlerUtils.java
+++ b/server/src/main/java/org/apache/sqoop/handler/HandlerUtils.java
@@ -47,41 +47,13 @@ public class HandlerUtils {
     return link;
   }
 
-  public static MLink getLinkFromLinkId(Long linkId) {
-    Repository repository = RepositoryManager.getInstance().getRepository();
-    MLink link = repository.findLink(linkId);
-    if (link == null) {
-      throw new SqoopException(ServerError.SERVER_0006, "Invalid link id: " + linkId
-              + " doesn't exist");
-    }
-    return link;
-  }
-
   public static MConnector getConnectorFromConnectorName(String connectorName) {
     Repository repository = RepositoryManager.getInstance().getRepository();
     MConnector connector = repository.findConnector(connectorName);
     if (connector == null) {
-      // TODO: get the connector by id from public API should be dropped.
-      try {
-        connector = repository.findConnector(Long.parseLong(connectorName));
-      } catch (NumberFormatException nfe) {
-        // do nothing, connector should be null, and will thrown exception in the following.
-      }
-    }
-    if (connector == null) {
       throw new SqoopException(ServerError.SERVER_0006, "Connector: " + connectorName
               + " doesn't exist");
     }
     return connector;
   }
-
-  public static MConnector getConnectorFromConnectorId(Long connectorId) {
-    Repository repository = RepositoryManager.getInstance().getRepository();
-    MConnector connector = repository.findConnector(connectorId);
-    if (connector == null) {
-      throw new SqoopException(ServerError.SERVER_0006, "Connector id: " + connectorId
-              + " doesn't exist");
-    }
-    return connector;
-  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/server/v1/ConfigurableServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/server/v1/ConfigurableServlet.java b/server/src/main/java/org/apache/sqoop/server/v1/ConfigurableServlet.java
index 7bd1901..5479653 100644
--- a/server/src/main/java/org/apache/sqoop/server/v1/ConfigurableServlet.java
+++ b/server/src/main/java/org/apache/sqoop/server/v1/ConfigurableServlet.java
@@ -28,8 +28,6 @@ import org.apache.sqoop.server.SqoopProtocolServlet;
  * Displays a given configurable registered in sqoop
  * GET v1/configurable/connector/{cname}
  *  Return a registered connector with  given name
- * GET v1/configurable/connector/{cid}
- *  Return a registered connector with given id
  * GET v1/configurable/driver
  *  Return the only driver registered in sqoop
  */

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java b/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
index 5daebc1..ef03be7 100644
--- a/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
+++ b/server/src/main/java/org/apache/sqoop/server/v1/ConnectorServlet.java
@@ -31,8 +31,6 @@ import org.apache.sqoop.server.SqoopProtocolServlet;
  *  Return all connectors registered in the sqoop system with their corresponding config
params
  * GET /v1/connector/{cname}
  *  Return details about one particular connector with name {cname} with its config params
- * GET /v1/connector/{cid}
- *  Return details about one particular connector with id {cid} with its config params
  *
  */
 @SuppressWarnings("serial")

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/server/v1/JobServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/server/v1/JobServlet.java b/server/src/main/java/org/apache/sqoop/server/v1/JobServlet.java
index 7767132..2186718 100644
--- a/server/src/main/java/org/apache/sqoop/server/v1/JobServlet.java
+++ b/server/src/main/java/org/apache/sqoop/server/v1/JobServlet.java
@@ -27,47 +27,34 @@ import org.apache.sqoop.server.SqoopProtocolServlet;
 /**
  * Provides operations for job resource
  *
- * GET /v1/job/{jid}
- * Return details about one particular job with id:jid or about all of
- * them if jid equals to "all"
+ * GET /v1/job/{jname}
+ * Return details about one particular job with name:jname or about all of
+ * them if jname equals to "all"
  *
  * POST /v1/job
  * Create new job
- * POST /v1/job/ with {from-link-id}, {to-link-id} and other job details in the post data
+ * POST /v1/job/ with {from-link-name}, {to-link-name} and other job details in the post
data
  *  Create job with from and to link
- * PUT /v1/link/ with {from-link-id}, {to-link-id} and other job details in the post data
+ * PUT /v1/link/ with {from-link-name}, {to-link-name} and other job details in the post
data
  *  Edit/Update job for the from and to link
  *
- * PUT /v1/job/{jid} and the job details in the post data
- * Update job with id jid.
+ * PUT /v1/job/{jname} and the job details in the post data
+ * Update job with name jname.
  *
- * PUT /v1/job/{jid}/enable
- *  Enable job with id jid
- * PUT /v1/job/{jname}/disable
+ * PUT /v1/job/{jname}/enable
  *  Enable job with name jname
- *
- * PUT /v1/job/{jid}/disable
- *  Disable job with id jid
  * PUT /v1/job/{jname}/disable
- *  Disable job with name jname
+ *  Enable job with name jname
  *
- * DELETE /v1/job/{jid}
- *  Remove job with id jid
  * DELETE /v1/job/{jname}
  *  Remove job with name jname
  *
- * PUT /v1/job/{jid}/submit
- *  Submit job with id jid to create a submission record
  * PUT /v1/job/{jname}/submit
  *  Submit job with name jname to create a submission record
  *
- * PUT /v1/job/{jid}/stop
- *  Abort/Stop last running associated submission with job id jid
  * PUT /v1/job/{jname}/stop
  *  Abort/Stop last running associated submission with job name jname
  *
- * GET /v1/job/{jid}/status
- *  get status of running job with job id jid
  * GET /v1/job/{jname}/status
  *  get status of running job with job name jname
  *

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/server/src/main/java/org/apache/sqoop/server/v1/LinkServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/server/v1/LinkServlet.java b/server/src/main/java/org/apache/sqoop/server/v1/LinkServlet.java
index d803435..d6255ee 100644
--- a/server/src/main/java/org/apache/sqoop/server/v1/LinkServlet.java
+++ b/server/src/main/java/org/apache/sqoop/server/v1/LinkServlet.java
@@ -26,8 +26,6 @@ import org.apache.sqoop.server.SqoopProtocolServlet;
 /**
  * Provides operations for link resource
  *
- * GET /v1/link/{lid}
- *  Return details about one particular link with id lid
  * GET /v1/link/{lname}
  *  Return details about one particular link with name lname
  * GET /v1/link/all
@@ -35,18 +33,14 @@ import org.apache.sqoop.server.SqoopProtocolServlet;
  * GET /v1/link/all?cname={cname}
  *  Return details about all links for given connector (by name)
  *
- * POST /v1/link/ with {connector-id} and {link-config-id} in the post data
- *  Create link for connector with id connector-id
- * PUT /v1/link/ with {connector-id} and {link-config-id} in the post data
- *  Edit/Update link for connector with id connector-id
+ * POST /v1/link/ with {connector-name} and {link-config-id} in the post data
+ *  Create link for connector with name connector-name
+ * PUT /v1/link/ with {connector-name} and {link-config-id} in the post data
+ *  Edit/Update link for connector with name connector-name
  *
- * PUT /v1/link/{lid}
- *  Edit/Update details about one particular link with id lid
  * PUT /v1/link/{lname}
  *  Edit/Update details about one particular link with name lname
  *
- * DELETE /v1/link/{lid}
- *  Delete/Remove one particular link with id lid
  * DELETE /v1/link/{lname}
  *  Delete/Remove one particular link with name lname
  *

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/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 aeac76a..8989913 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowSubmissionFunction.java
@@ -79,19 +79,19 @@ public class ShowSubmissionFunction extends SqoopFunction {
     header.add(resourceString(Constants.RES_TABLE_HEADER_STATUS));
     header.add(resourceString(Constants.RES_TABLE_HEADER_DATE));
 
-    List<String> jids = new LinkedList<String>();
+    List<String> jnames = new LinkedList<String>();
     List<String> eids = new LinkedList<String>();
     List<String> status = new LinkedList<String>();
     List<String> dates = new LinkedList<String>();
 
     for (MSubmission submission : submissions) {
-      jids.add(String.valueOf(submission.getJobName()));
+      jnames.add(String.valueOf(submission.getJobName()));
       eids.add(String.valueOf(submission.getExternalJobId()));
       status.add(submission.getStatus().toString());
       dates.add(submission.getLastUpdateDate().toString());
     }
 
-    TableDisplayer.display(header, jids, eids, status, dates);
+    TableDisplayer.display(header, jnames, eids, status, dates);
   }
 
   private void showSubmissions(String jArg) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
index ec6f18f..53303af 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestCloneCommand.java
@@ -123,7 +123,7 @@ public class TestCloneCommand {
     when(client.getLink("link_test")).thenReturn(link);
     when(client.getConnectorConfigBundle("connector_name_test")).thenReturn(resourceBundle);
     when(client.saveLink(link)).thenReturn(Status.OK);
-    when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null,
null, null));
+    when(client.getConnector(any(String.class))).thenReturn(new MConnector("", "", "", null,
null, null));
 
     // clone link -name link_test
     initData("linkname\r" +         // link name
@@ -163,7 +163,7 @@ public class TestCloneCommand {
     when(client.getConnectorConfigBundle(any(String.class))).thenReturn(new MapResourceBundle(new
HashMap()));
     when(client.getDriverConfigBundle()).thenReturn(new MapResourceBundle(new HashMap()));
     when(client.saveJob(job)).thenReturn(Status.OK);
-    when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null,
null, null));
+    when(client.getConnector(any(String.class))).thenReturn(new MConnector("", "", "", null,
null, null));
 
     // clone job -name job_test
     Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_JOB, "-name", "job_test"));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
index 8f8d3db..6463bd5 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestShowCommand.java
@@ -233,7 +233,7 @@ public class TestShowCommand {
   @Test
   public void testShowJob() {
     when(client.getJobs()).thenReturn(new ArrayList<MJob>());
-    when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null,
null, null));
+    when(client.getConnector(any(String.class))).thenReturn(new MConnector("", "", "", null,
null, null));
     when(client.getJob("jobName")).thenReturn(new MJob("fromConnectorName", "toConnectorName",
"linkName1", "linkName2",
         new MFromConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
         new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
index 4b1f5ad..f5062da 100644
--- a/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
+++ b/shell/src/test/java/org/apache/sqoop/shell/TestUpdateCommand.java
@@ -126,7 +126,7 @@ public class TestUpdateCommand {
     // Missing option name
     try {
       updateCmd.execute(Arrays.asList(Constants.FN_LINK));
-      fail("Update link should fail as option lid is missing");
+      fail("Update link should fail as option name is missing");
     } catch (SqoopException e) {
       assertEquals(ShellError.SHELL_0003, e.getErrorCode());
       assertTrue(e.getMessage().contains("Missing required option"));
@@ -178,7 +178,7 @@ public class TestUpdateCommand {
         new MToConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()),
         new MDriverConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()));
     when(client.getJob("job_test")).thenReturn(job);
-    when(client.getConnector(any(Long.class))).thenReturn(new MConnector("connect_test",
"", "", null, null, null));
+    when(client.getConnector(any(String.class))).thenReturn(new MConnector("connect_test",
"", "", null, null, null));
     when(client.getConnectorConfigBundle(any(String.class))).thenReturn(new MapResourceBundle(new
HashMap()));
     when(client.getDriverConfigBundle()).thenReturn(new MapResourceBundle(new HashMap()));
     when(client.updateJob(job)).thenReturn(Status.OK);
@@ -215,7 +215,7 @@ public class TestUpdateCommand {
         new MToConfig(getConfig("toJobConfig"), new ArrayList<MValidator>()),
         new MDriverConfig(getConfig("driverConfig"), new ArrayList<MValidator>()));
     when(client.getJob("job_test")).thenReturn(job);
-    when(client.getConnector(any(Long.class))).thenReturn(new MConnector("connect_test",
"", "", null, null, null));
+    when(client.getConnector(any(String.class))).thenReturn(new MConnector("connect_test",
"", "", null, null, null));
     when(client.getConnectorConfigBundle(any(String.class))).thenReturn(resourceBundle);
     when(client.getDriverConfigBundle()).thenReturn(resourceBundle);
     when(client.updateJob(job)).thenReturn(Status.OK);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/15328cc9/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java b/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
index dbe2195..2c6a537 100644
--- a/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
+++ b/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
@@ -374,9 +374,9 @@ public class SqoopTestCase implements ITest {
   }
 
   /**
-   * Run job with given jid.
+   * Run job with given jobName.
    *
-   * @param jid Job id
+   * @param jobName Job name
    * @throws Exception
    */
   public void executeJob(String jobName) throws Exception {


Mime
View raw message