Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 f241f82c3 -> a3c374723


http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
 
b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
index 560fd58..aa872ab 100644
--- 
a/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
+++ 
b/repository/repository-common/src/main/java/org/apache/sqoop/repository/common/CommonRepositoryInsertUpdateDeleteSelectQuery.java
@@ -277,25 +277,24 @@ public class 
CommonRepositoryInsertUpdateDeleteSelectQuery {
   private static final String STMT_ENABLE_LINK =
       "UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME) + " SET "
           + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ENABLED) + " = ? "
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " 
= ?";
-
-
-  // UPDATE the LINK Input
-  private static final String STMT_UPDATE_LINK_INPUT =
-      "UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_INPUT_NAME) + " SET "
-          + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_VALUE) + " = ? "
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_INPUT) 
+ " = ?"
-          + " AND " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK) + 
" = ?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + 
" = ?";
 
   // DML: Delete rows from link input table
-  private static final String STMT_DELETE_LINK_INPUT =
+  private static final String STMT_DELETE_LINK_INPUT_BY_NAME =
+      "DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_INPUT_NAME)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK)
+          + " IN (SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID)
+          + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + 
" = ?)";
+
+  private static final String STMT_DELETE_LINK_INPUT_BY_ID =
       "DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_INPUT_NAME)
           + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNKI_LINK) 
+ " = ?";
 
   // DML: Delete row from link table
   private static final String STMT_DELETE_LINK =
       "DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " 
= ?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + 
" = ?";
 
   // DML: Select all links
   private static final String STMT_SELECT_LINK_ALL =
@@ -332,12 +331,14 @@ public class 
CommonRepositoryInsertUpdateDeleteSelectQuery {
           + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_UPDATE_USER) + ", "
           + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_UPDATE_DATE)
           + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
-          + " WHERE " + 
CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + " = ?";
+          + " INNER JOIN " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_CONFIGURABLE_NAME)
+          + " ON " + 
CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_CONFIGURABLE) + " = " + 
CommonRepoUtils.escapeColumnName(COLUMN_SQC_ID)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQC_NAME) + " 
= ?";
 
   // DML: Check if given link exists
-  private static final String STMT_SELECT_LINK_CHECK_BY_ID =
+  private static final String STMT_SELECT_LINK_CHECK_BY_NAME =
       "SELECT count(*) FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " 
= ?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + 
" = ?";
 
   /**
    * *******JOB TABLE *************
@@ -374,38 +375,34 @@ public class 
CommonRepositoryInsertUpdateDeleteSelectQuery {
   private static final String STMT_ENABLE_JOB =
       "UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME) + " SET "
           + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ENABLED) + " = ? "
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = 
?";
-
-  // UPDATE the JOB Input
-  private static final String STMT_UPDATE_JOB_INPUT =
-      "UPDATE " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_INPUT_NAME) + " SET "
-          + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_VALUE) + " = ? "
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_INPUT) + 
" = ?"
-          + " AND " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB) + " = 
?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " 
= ?";
 
   // DML: Delete rows from job input table
   private static final String STMT_DELETE_JOB_INPUT =
       "DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_INPUT_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB) + " 
= ?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQBI_JOB)
+          + " IN (SELECT " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID)
+          + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " 
= ?)";
 
   // DML: Delete row from job table
   private static final String STMT_DELETE_JOB =
       "DELETE FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = 
?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " 
= ?";
 
   // DML: Check if given job exists
-  private static final String STMT_SELECT_JOB_CHECK_BY_ID =
+  private static final String STMT_SELECT_JOB_CHECK_BY_NAME =
       "SELECT count(*) FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID) + " = 
?";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " 
= ?";
 
   // DML: Check if there are jobs for given link
   private static final String STMT_SELECT_JOBS_FOR_LINK_CHECK =
       "SELECT"
           + " count(*)"
           + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME)
-          + " JOIN " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
+          + " INNER JOIN " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_LINK_NAME)
           + " ON " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_FROM_LINK) + 
" = " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_ID) + " 
= ? ";
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQ_LNK_NAME) + 
" = ? ";
 
   //DML: Select all jobs
   private static final String STMT_SELECT_JOB_ALL =
@@ -537,7 +534,9 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
           + CommonRepoUtils.escapeColumnName(COLUMN_SQS_ERROR_SUMMARY) + ", "
           + CommonRepoUtils.escapeColumnName(COLUMN_SQS_ERROR_DETAILS)
           + " FROM " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_SUBMISSION_NAME)
-          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + " = 
?"
+          + " INNER JOIN " + CommonRepoUtils.getTableName(SCHEMA_SQOOP, 
TABLE_SQ_JOB_NAME)
+          + " ON " + CommonRepoUtils.escapeColumnName(COLUMN_SQS_JOB) + " = " 
+ CommonRepoUtils.escapeColumnName(COLUMN_SQB_ID)
+          + " WHERE " + CommonRepoUtils.escapeColumnName(COLUMN_SQB_NAME) + " 
= ?"
           + " ORDER BY " + 
CommonRepoUtils.escapeColumnName(COLUMN_SQS_UPDATE_DATE) + " DESC";
 
   // DML: Select context type
@@ -747,12 +746,12 @@ public class 
CommonRepositoryInsertUpdateDeleteSelectQuery {
     return STMT_ENABLE_LINK;
   }
 
-  public String getStmtUpdateLinkInput() {
-    return STMT_UPDATE_LINK_INPUT;
+  public String getStmtDeleteLinkInputByLinkId() {
+    return STMT_DELETE_LINK_INPUT_BY_ID;
   }
 
-  public String getStmtDeleteLinkInput() {
-    return STMT_DELETE_LINK_INPUT;
+  public String getStmtDeleteLinkInputByLinkName() {
+    return STMT_DELETE_LINK_INPUT_BY_NAME;
   }
 
   public String getStmtDeleteLink() {
@@ -775,8 +774,8 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
     return STMT_SELECT_LINK_FOR_CONNECTOR_CONFIGURABLE;
   }
 
-  public String getStmtSelectLinkCheckById() {
-    return STMT_SELECT_LINK_CHECK_BY_ID;
+  public String getStmtSelectLinkCheckByName() {
+    return STMT_SELECT_LINK_CHECK_BY_NAME;
   }
 
   public String getStmtInsertJob() {
@@ -795,10 +794,6 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery 
{
     return STMT_ENABLE_JOB;
   }
 
-  public String getStmtUpdateJobInput() {
-    return STMT_UPDATE_JOB_INPUT;
-  }
-
   public String getStmtDeleteJobInput() {
     return STMT_DELETE_JOB_INPUT;
   }
@@ -807,8 +802,8 @@ public class CommonRepositoryInsertUpdateDeleteSelectQuery {
     return STMT_DELETE_JOB;
   }
 
-  public String getStmtSelectJobCheckById() {
-    return STMT_SELECT_JOB_CHECK_BY_ID;
+  public String getStmtSelectJobCheckByName() {
+    return STMT_SELECT_JOB_CHECK_BY_NAME;
   }
 
   public String getStmtSelectJobsForLinkCheck() {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
index 6c36f02..9f8e570 100644
--- 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
+++ 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
@@ -22,24 +22,18 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
 
 import java.sql.Connection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.sqoop.common.Direction;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.model.MConfig;
-import org.apache.sqoop.model.MConfigUpdateEntityType;
 import org.apache.sqoop.model.MDriver;
-import org.apache.sqoop.model.MFromConfig;
 import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
-import org.apache.sqoop.model.MToConfig;
-import org.apache.sqoop.error.code.CommonRepositoryError;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -150,19 +144,19 @@ public class TestJobHandling extends DerbyTestCase {
   @Test
   public void testExistsJob() throws Exception {
     // There shouldn't be anything on empty repository
-    assertFalse(handler.existsJob(1, derbyConnection));
-    assertFalse(handler.existsJob(2, derbyConnection));
-    assertFalse(handler.existsJob(3, derbyConnection));
-    assertFalse(handler.existsJob(4, derbyConnection));
-    assertFalse(handler.existsJob(5, derbyConnection));
+    assertFalse(handler.existsJob("JA0", derbyConnection));
+    assertFalse(handler.existsJob("JB0", derbyConnection));
+    assertFalse(handler.existsJob("JC0", derbyConnection));
+    assertFalse(handler.existsJob("JD0", derbyConnection));
+    assertFalse(handler.existsJob("NONEXISTJOB", derbyConnection));
 
     loadJobsForLatestVersion();
 
-    assertTrue(handler.existsJob(1, derbyConnection));
-    assertTrue(handler.existsJob(2, derbyConnection));
-    assertTrue(handler.existsJob(3, derbyConnection));
-    assertTrue(handler.existsJob(4, derbyConnection));
-    assertFalse(handler.existsJob(5, derbyConnection));
+    assertTrue(handler.existsJob("JA0", derbyConnection));
+    assertTrue(handler.existsJob("JB0", derbyConnection));
+    assertTrue(handler.existsJob("JC0", derbyConnection));
+    assertTrue(handler.existsJob("JD0", derbyConnection));
+    assertFalse(handler.existsJob("NONEXISTJOB", derbyConnection));
   }
 
   @Test
@@ -170,10 +164,10 @@ public class TestJobHandling extends DerbyTestCase {
     loadJobsForLatestVersion();
     loadSubmissions();
 
-    assertTrue(handler.inUseJob(1, derbyConnection));
-    assertFalse(handler.inUseJob(2, derbyConnection));
-    assertFalse(handler.inUseJob(3, derbyConnection));
-    assertFalse(handler.inUseJob(4, derbyConnection));
+    assertTrue(handler.inUseJob("JA0", derbyConnection));
+    assertFalse(handler.inUseJob("JB0", derbyConnection));
+    assertFalse(handler.inUseJob("JC0", derbyConnection));
+    assertFalse(handler.inUseJob("JD0", derbyConnection));
   }
 
   @Test
@@ -295,14 +289,14 @@ public class TestJobHandling extends DerbyTestCase {
     loadJobsForLatestVersion();
 
     // disable job 1
-    handler.enableJob(1, false, derbyConnection);
+    handler.enableJob("JA0", false, derbyConnection);
 
     MJob retrieved = handler.findJob(1, derbyConnection);
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable job 1
-    handler.enableJob(1, true, derbyConnection);
+    handler.enableJob("JA0", true, derbyConnection);
 
     retrieved = handler.findJob(1, derbyConnection);
     assertNotNull(retrieved);
@@ -313,150 +307,23 @@ public class TestJobHandling extends DerbyTestCase {
   public void testDeleteJob() throws Exception {
     loadJobsForLatestVersion();
 
-    handler.deleteJob(1, derbyConnection);
+    handler.deleteJob("JA0", derbyConnection);
     assertCountForTable("SQOOP.SQ_JOB", 3);
     assertCountForTable("SQOOP.SQ_JOB_INPUT", 18);
 
-    handler.deleteJob(2, derbyConnection);
+    handler.deleteJob("JB0", derbyConnection);
     assertCountForTable("SQOOP.SQ_JOB", 2);
     assertCountForTable("SQOOP.SQ_JOB_INPUT", 12);
 
-    handler.deleteJob(3, derbyConnection);
+    handler.deleteJob("JC0", derbyConnection);
     assertCountForTable("SQOOP.SQ_JOB", 1);
     assertCountForTable("SQOOP.SQ_JOB_INPUT", 6);
 
-    handler.deleteJob(4, derbyConnection);
+    handler.deleteJob("JD0", derbyConnection);
     assertCountForTable("SQOOP.SQ_JOB", 0);
     assertCountForTable("SQOOP.SQ_JOB_INPUT", 0);
   }
 
-  @Test
-  public void testUpdateJobConfig() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    MJob job = handler.findJob(1, derbyConnection);
-
-    List<MConfig> fromConfigs = job.getFromJobConfig().getConfigs();
-    MConfig fromConfig = fromConfigs.get(0).clone(false);
-    MConfig newFromConfig = new MConfig(fromConfig.getName(), 
fromConfig.getInputs());
-
-    ((MStringInput) 
newFromConfig.getInputs().get(0)).setValue("FromJobConfigUpdated");
-
-    handler.updateJobConfig(job.getPersistenceId(), newFromConfig, 
MConfigUpdateEntityType.USER,
-        derbyConnection);
-
-    MJob updatedJob = handler.findJob(1, derbyConnection);
-    MFromConfig newFromConfigs = updatedJob.getFromJobConfig();
-    assertEquals(2, newFromConfigs.getConfigs().size());
-    MConfig updatedFromConfig = newFromConfigs.getConfigs().get(0);
-    assertEquals("FromJobConfigUpdated", 
updatedFromConfig.getInputs().get(0).getValue());
-
-    List<MConfig> toConfigs = job.getToJobConfig().getConfigs();
-    MConfig toConfig = toConfigs.get(0).clone(false);
-    MConfig newToConfig = new MConfig(toConfig.getName(), 
toConfig.getInputs());
-
-    ((MStringInput) 
newToConfig.getInputs().get(0)).setValue("ToJobConfigUpdated");
-
-    handler.updateJobConfig(job.getPersistenceId(), newToConfig, 
MConfigUpdateEntityType.USER,
-        derbyConnection);
-
-    updatedJob = handler.findJob(1, derbyConnection);
-    MToConfig newToConfigs = updatedJob.getToJobConfig();
-    assertEquals(2, newToConfigs.getConfigs().size());
-    MConfig updatedToConfig = newToConfigs.getConfigs().get(0);
-    assertEquals("ToJobConfigUpdated", 
updatedToConfig.getInputs().get(0).getValue());
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testIncorrectEntityCausingConfigUpdate() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    MJob job = handler.findJob(1, derbyConnection);
-
-    List<MConfig> fromConfigs = job.getFromJobConfig().getConfigs();
-    MConfig fromConfig = fromConfigs.get(0).clone(false);
-    MConfig newFromConfig = new MConfig(fromConfig.getName(), 
fromConfig.getInputs());
-    HashMap<String, String> newMap = new HashMap<String, String>();
-    newMap.put("1", "foo");
-    newMap.put("2", "bar");
-
-    ((MMapInput) newFromConfig.getInputs().get(1)).setValue(newMap);
-
-    handler.updateJobConfig(job.getPersistenceId(), newFromConfig, 
MConfigUpdateEntityType.USER,
-        derbyConnection);
-  }
-
-  @Test
-  public void testFindAndUpdateJobConfig() throws Exception {
-    loadJobsForLatestVersion();
-    MJob job = handler.findJob(1, derbyConnection);
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    MConfig fromConfig = handler.findFromJobConfig(1, "C1JOB1", 
derbyConnection);
-    assertEquals("Value5", fromConfig.getInputs().get(0).getValue());
-    assertNull(fromConfig.getInputs().get(1).getValue());
-
-    MConfig toConfig = handler.findToJobConfig(1, "C2JOB2", derbyConnection);
-    assertEquals("Value11", toConfig.getInputs().get(0).getValue());
-    assertNull(toConfig.getInputs().get(1).getValue());
-    HashMap<String, String> newMap = new HashMap<String, String>();
-    newMap.put("1UPDATED", "foo");
-    newMap.put("2UPDATED", "bar");
-    ((MStringInput) toConfig.getInputs().get(0)).setValue("test");
-    ((MMapInput) toConfig.getInputs().get(1)).setValue(newMap);
-
-    handler.updateJobConfig(job.getPersistenceId(), toConfig, 
MConfigUpdateEntityType.USER,
-        derbyConnection);
-    assertEquals("test", toConfig.getInputs().get(0).getValue());
-    assertEquals(newMap, toConfig.getInputs().get(1).getValue());
-
-    MConfig driverConfig = handler.findDriverJobConfig(1, "d1", 
derbyConnection);
-    assertEquals("Value13", driverConfig.getInputs().get(0).getValue());
-    assertNull(driverConfig.getInputs().get(1).getValue());
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testNonExistingFromConfigFetch() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    handler.findFromJobConfig(1, "Non-ExistingC1JOB1", derbyConnection);
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testNonExistingToConfigFetch() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    handler.findToJobConfig(1, "Non-ExistingC2JOB1", derbyConnection);
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testNonExistingDriverConfigFetch() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    handler.findDriverJobConfig(1, "Non-Existingd1", derbyConnection);
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testNonExistingJobConfig() throws Exception {
-    loadJobsForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_JOB", 4);
-    assertCountForTable("SQOOP.SQ_JOB_INPUT", 24);
-    // 11 does not exist
-    handler.findDriverJobConfig(11, "Non-d1", derbyConnection);
-  }
-
   public MJob getJob() {
     return new MJob(1, 1, 1, 1, handler.findConnector("A", 
derbyConnection).getFromConfig(),
         handler.findConnector("A", derbyConnection).getToConfig(), 
handler.findDriver(

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
index 4be3641..40bac8b 100644
--- 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
+++ 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
@@ -22,18 +22,14 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
 
 import java.util.List;
 
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.model.MConfig;
-import org.apache.sqoop.model.MConfigUpdateEntityType;
 import org.apache.sqoop.model.MLink;
-import org.apache.sqoop.model.MLinkConfig;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
-import org.apache.sqoop.error.code.CommonRepositoryError;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -129,7 +125,7 @@ public class TestLinkHandling extends DerbyTestCase {
     loadLinksForLatestVersion();
 
     // Load all two links on loaded repository
-    list = handler.findLinksForConnector(1, getDerbyDatabaseConnection());
+    list = handler.findLinksForConnector("A", getDerbyDatabaseConnection());
     assertEquals(2, list.size());
 
     assertEquals("CA", list.get(0).getName());
@@ -145,22 +141,22 @@ public class TestLinkHandling extends DerbyTestCase {
 
     loadLinksForLatestVersion();
 
-    list = handler.findLinksForConnector(2, getDerbyDatabaseConnection());
+    list = handler.findLinksForConnector("NONEXISTCONNECTOR", 
getDerbyDatabaseConnection());
     assertEquals(0, list.size());
   }
 
   @Test
   public void testExistsLink() throws Exception {
     // There shouldn't be anything on empty repository
-    assertFalse(handler.existsLink(1, getDerbyDatabaseConnection()));
-    assertFalse(handler.existsLink(2, getDerbyDatabaseConnection()));
-    assertFalse(handler.existsLink(3, getDerbyDatabaseConnection()));
+    assertFalse(handler.existsLink("CA", getDerbyDatabaseConnection()));
+    assertFalse(handler.existsLink("CB", getDerbyDatabaseConnection()));
+    assertFalse(handler.existsLink("CC", getDerbyDatabaseConnection()));
 
     loadLinksForLatestVersion();
 
-    assertTrue(handler.existsLink(1, getDerbyDatabaseConnection()));
-    assertTrue(handler.existsLink(2, getDerbyDatabaseConnection()));
-    assertFalse(handler.existsLink(3, getDerbyDatabaseConnection()));
+    assertTrue(handler.existsLink("CA", getDerbyDatabaseConnection()));
+    assertTrue(handler.existsLink("CB", getDerbyDatabaseConnection()));
+    assertFalse(handler.existsLink("CC", getDerbyDatabaseConnection()));
   }
 
   @Test
@@ -213,11 +209,11 @@ public class TestLinkHandling extends DerbyTestCase {
   public void testInUseLink() throws Exception {
     loadLinksForLatestVersion();
 
-    assertFalse(handler.inUseLink(1, getDerbyDatabaseConnection()));
+    assertFalse(handler.inUseLink("CA", getDerbyDatabaseConnection()));
 
     loadJobsForLatestVersion();
 
-    assertTrue(handler.inUseLink(1, getDerbyDatabaseConnection()));
+    assertTrue(handler.inUseLink("CA", getDerbyDatabaseConnection()));
   }
 
   @Test
@@ -257,14 +253,14 @@ public class TestLinkHandling extends DerbyTestCase {
     loadLinksForLatestVersion();
 
     // disable link 1
-    handler.enableLink(1, false, getDerbyDatabaseConnection());
+    handler.enableLink("CA", false, getDerbyDatabaseConnection());
 
     MLink retrieved = handler.findLink(1, getDerbyDatabaseConnection());
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable link 1
-    handler.enableLink(1, true, getDerbyDatabaseConnection());
+    handler.enableLink("CA", true, getDerbyDatabaseConnection());
 
     retrieved = handler.findLink(1, getDerbyDatabaseConnection());
     assertNotNull(retrieved);
@@ -275,57 +271,15 @@ public class TestLinkHandling extends DerbyTestCase {
   public void testDeleteLink() throws Exception {
     loadLinksForLatestVersion();
 
-    handler.deleteLink(1, getDerbyDatabaseConnection());
+    handler.deleteLink("CA", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_LINK", 1);
     assertCountForTable("SQOOP.SQ_LINK_INPUT", 4);
 
-    handler.deleteLink(2, getDerbyDatabaseConnection());
+    handler.deleteLink("CB", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_LINK", 0);
     assertCountForTable("SQOOP.SQ_LINK_INPUT", 0);
   }
 
-  @Test
-  public void testUpdateLinkConfig() throws Exception {
-    loadLinksForLatestVersion();
-
-    assertCountForTable("SQOOP.SQ_LINK", 2);
-    assertCountForTable("SQOOP.SQ_LINK_INPUT", 8);
-    MLink link = handler.findLink(1, getDerbyDatabaseConnection());
-
-    List<MConfig> configs = link.getConnectorLinkConfig().getConfigs();
-    MConfig config = configs.get(0).clone(false);
-    MConfig newConfig = new MConfig(config.getName(), config.getInputs());
-
-    ((MStringInput) 
newConfig.getInputs().get(0)).setValue("LinkConfigUpdated");
-
-    handler.updateLinkConfig(link.getPersistenceId(), newConfig, 
MConfigUpdateEntityType.USER,
-        getDerbyDatabaseConnection());
-
-    MLink updatedLink = handler.findLink(1, getDerbyDatabaseConnection());
-    MLinkConfig newConfigs = updatedLink.getConnectorLinkConfig();
-    assertEquals(2, newConfigs.getConfigs().size());
-    MConfig updatedLinkConfig = newConfigs.getConfigs().get(0);
-    assertEquals("LinkConfigUpdated", 
updatedLinkConfig.getInputs().get(0).getValue());
-  }
-
-  @Test(expectedExceptions = SqoopException.class)
-  public void testNonExistingLinkConfigFetch() throws Exception {
-    loadLinksForLatestVersion();
-    assertCountForTable("SQOOP.SQ_LINK", 2);
-    assertCountForTable("SQOOP.SQ_LINK_INPUT", 8);
-    handler.findLinkConfig(1, "Non-ExistingC1LINK1", 
getDerbyDatabaseConnection());
-  }
-
-  @Test
-  public void testLinkConfigFetch() throws Exception {
-    loadLinksForLatestVersion();
-    assertCountForTable("SQOOP.SQ_LINK", 2);
-    assertCountForTable("SQOOP.SQ_LINK_INPUT", 8);
-    MConfig config = handler.findLinkConfig(1, "C1LINK0", 
getDerbyDatabaseConnection());
-    assertEquals("Value1", config.getInputs().get(0).getValue());
-    assertNull(config.getInputs().get(1).getValue());
-  }
-
   public MLink getLink() {
     return new MLink(1, handler.findConnector("A", 
getDerbyDatabaseConnection()).getLinkConfig());
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
index 405c0b8..79aced7 100644
--- 
a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
+++ 
b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
@@ -242,7 +242,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     submission.getError().setErrorSummary(errorSummary + "morethan150");
 
     handler.createSubmission(submission, getDerbyDatabaseConnection());
-    List<MSubmission> submissions = handler.findSubmissionsForJob(1, 
getDerbyDatabaseConnection());
+    List<MSubmission> submissions = handler.findSubmissionsForJob("JA0", 
getDerbyDatabaseConnection());
     assertNotNull(submissions);
 
     assertEquals(errorDetail, submissions.get(0).getError().getErrorDetails());
@@ -333,16 +333,16 @@ public class TestSubmissionHandling extends DerbyTestCase 
{
     loadSubmissions();
     assertCountForTable("SQOOP.SQ_SUBMISSION", 5);
 
-    handler.deleteJob(1, getDerbyDatabaseConnection());
+    handler.deleteJob("JA0", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_SUBMISSION", 3);
 
-    handler.deleteJob(2, getDerbyDatabaseConnection());
+    handler.deleteJob("JB0", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_SUBMISSION", 2);
 
-    handler.deleteJob(3, getDerbyDatabaseConnection());
+    handler.deleteJob("JC0", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_SUBMISSION", 1);
 
-    handler.deleteJob(4, getDerbyDatabaseConnection());
+    handler.deleteJob("JD0", getDerbyDatabaseConnection());
     assertCountForTable("SQOOP.SQ_SUBMISSION", 0);
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
index 0614d7a..ed6543d 100644
--- 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
+++ 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
@@ -76,7 +76,7 @@ public class TestJobHandling extends MySqlTestCase {
   @Test
   public void testFindJobFail() throws Exception {
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // Let's try to find non existing job
@@ -125,7 +125,7 @@ public class TestJobHandling extends MySqlTestCase {
 
     // Delete jobs
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // Load all two links on loaded repository
@@ -153,30 +153,30 @@ public class TestJobHandling extends MySqlTestCase {
 
   @Test
   public void testExistsJob() throws Exception {
-    assertTrue(handler.existsJob(1, provider.getConnection()));
-    assertTrue(handler.existsJob(2, provider.getConnection()));
-    assertFalse(handler.existsJob(3, provider.getConnection()));
+    assertTrue(handler.existsJob(JOB_A_NAME, provider.getConnection()));
+    assertTrue(handler.existsJob(JOB_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob("NONEXISTJOB", provider.getConnection()));
 
     // Delete jobs
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // There shouldn't be anything on empty repository
-    assertFalse(handler.existsJob(1, provider.getConnection()));
-    assertFalse(handler.existsJob(2, provider.getConnection()));
-    assertFalse(handler.existsJob(3, provider.getConnection()));
+    assertFalse(handler.existsJob(JOB_A_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob(JOB_A_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob("NONEXISTJOB", provider.getConnection()));
   }
 
   @Test
   public void testInUseJob() throws Exception {
     MSubmission submission = getSubmission(
-        handler.findJob(1, provider.getConnection()), 
SubmissionStatus.RUNNING);
+        handler.findJob(JOB_A_NAME, provider.getConnection()), 
SubmissionStatus.RUNNING);
     handler.createSubmission(submission, provider.getConnection());
 
-    assertTrue(handler.inUseJob(1, provider.getConnection()));
-    assertFalse(handler.inUseJob(2, provider.getConnection()));
-    assertFalse(handler.inUseJob(3, provider.getConnection()));
+    assertTrue(handler.inUseJob(JOB_A_NAME, provider.getConnection()));
+    assertFalse(handler.inUseJob(JOB_B_NAME, provider.getConnection()));
+    assertFalse(handler.inUseJob("NONEXISTJOB", provider.getConnection()));
   }
 
   @Test
@@ -273,14 +273,14 @@ public class TestJobHandling extends MySqlTestCase {
   @Test
   public void testEnableAndDisableJob() throws Exception {
     // disable job 1
-    handler.enableJob(1, false, provider.getConnection());
+    handler.enableJob(JOB_A_NAME, false, provider.getConnection());
 
     MJob retrieved = handler.findJob(1, provider.getConnection());
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable job 1
-    handler.enableJob(1, true, provider.getConnection());
+    handler.enableJob(JOB_A_NAME, true, provider.getConnection());
 
     retrieved = handler.findJob(1, provider.getConnection());
     assertNotNull(retrieved);
@@ -289,12 +289,12 @@ public class TestJobHandling extends MySqlTestCase {
 
   @Test
   public void testDeleteJob() throws Exception {
-    handler.deleteJob(1, provider.getConnection());
+    handler.deleteJob(JOB_A_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_JOB")), 
1);
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_JOB_INPUT")), 6);
 
-    handler.deleteJob(2, provider.getConnection());
+    handler.deleteJob(JOB_B_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_JOB")), 
0);
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_JOB_INPUT")), 0);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestLinkHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestLinkHandling.java
 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestLinkHandling.java
index cceef09..72fa981 100644
--- 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestLinkHandling.java
+++ 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestLinkHandling.java
@@ -69,7 +69,7 @@ public class TestLinkHandling extends MySqlTestCase {
   public void testFindLinkFail() {
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     assertNull(handler.findLink(1, provider.getConnection()));
@@ -120,7 +120,7 @@ public class TestLinkHandling extends MySqlTestCase {
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     // Load empty list on empty repository
@@ -131,45 +131,43 @@ public class TestLinkHandling extends MySqlTestCase {
   @Test
   public void testFindLinksByConnector() throws Exception {
     List<MLink> list;
-    Long connectorId = handler.findConnector("A", provider.getConnection())
-        .getPersistenceId();
 
     // Load all two links on loaded repository
-    list = handler.findLinksForConnector(connectorId, 
provider.getConnection());
+    list = handler.findLinksForConnector("A", provider.getConnection());
     assertEquals(1, list.size());
     assertEquals(LINK_A_NAME, list.get(0).getName());
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     // Load empty list on empty repository
-    list = handler.findLinksForConnector(connectorId, 
provider.getConnection());
+    list = handler.findLinksForConnector("A", provider.getConnection());
     assertEquals(0, list.size());
   }
 
   @Test
   public void testFindLinksByNonExistingConnector() throws Exception {
-    List<MLink> list = handler.findLinksForConnector(11,
+    List<MLink> list = handler.findLinksForConnector("NONEXISTCONNECTOR",
         provider.getConnection());
     assertEquals(0, list.size());
   }
 
   @Test
   public void testExistsLink() throws Exception {
-    assertTrue(handler.existsLink(1, provider.getConnection()));
-    assertTrue(handler.existsLink(2, provider.getConnection()));
-    assertFalse(handler.existsLink(3, provider.getConnection()));
+    assertTrue(handler.existsLink(LINK_A_NAME, provider.getConnection()));
+    assertTrue(handler.existsLink(LINK_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink("NONEXISTLINK", provider.getConnection()));
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
-    assertFalse(handler.existsLink(1, provider.getConnection()));
-    assertFalse(handler.existsLink(2, provider.getConnection()));
-    assertFalse(handler.existsLink(3, provider.getConnection()));
+    assertFalse(handler.existsLink(LINK_A_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink(LINK_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink("NONEXISTLINK", provider.getConnection()));
   }
 
   @Test
@@ -214,7 +212,7 @@ public class TestLinkHandling extends MySqlTestCase {
 
   @Test
   public void testInUseLink() throws Exception {
-    assertFalse(handler.inUseLink(1, provider.getConnection()));
+    assertFalse(handler.inUseLink(LINK_A_NAME, provider.getConnection()));
 
     // Create job and submission and make that job in use to make sure link is
     // in use.
@@ -227,7 +225,7 @@ public class TestLinkHandling extends MySqlTestCase {
     MSubmission submission = getSubmission(job, SubmissionStatus.RUNNING);
     handler.createSubmission(submission, provider.getConnection());
 
-    assertTrue(handler.inUseLink(linkA.getPersistenceId(),
+    assertTrue(handler.inUseLink(linkA.getName(),
         provider.getConnection()));
   }
 
@@ -266,14 +264,14 @@ public class TestLinkHandling extends MySqlTestCase {
   @Test
   public void testEnableAndDisableLink() throws Exception {
     // disable link 1
-    handler.enableLink(1, false, provider.getConnection());
+    handler.enableLink(LINK_A_NAME, false, provider.getConnection());
 
     MLink retrieved = handler.findLink(1, provider.getConnection());
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable link 1
-    handler.enableLink(1, true, provider.getConnection());
+    handler.enableLink(LINK_A_NAME, true, provider.getConnection());
 
     retrieved = handler.findLink(1, provider.getConnection());
     assertNotNull(retrieved);
@@ -282,13 +280,13 @@ public class TestLinkHandling extends MySqlTestCase {
 
   @Test
   public void testDeleteLink() throws Exception {
-    handler.deleteLink(1, provider.getConnection());
+    handler.deleteLink(LINK_A_NAME, provider.getConnection());
     Assert
         .assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_LINK")), 1);
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_LINK_INPUT")), 2);
 
-    handler.deleteLink(2, provider.getConnection());
+    handler.deleteLink(LINK_B_NAME, provider.getConnection());
     Assert
         .assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_LINK")), 0);
     Assert.assertEquals(

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestSubmissionHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestSubmissionHandling.java
 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestSubmissionHandling.java
index e2a3011..faf01cb 100644
--- 
a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestSubmissionHandling.java
+++ 
b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestSubmissionHandling.java
@@ -291,7 +291,7 @@ public class TestSubmissionHandling extends MySqlTestCase {
     submission.getError().setErrorSummary(errorSummary + "morethan150");
 
     handler.createSubmission(submission, provider.getConnection());
-    List<MSubmission> submissions = handler.findSubmissionsForJob(1,
+    List<MSubmission> submissions = handler.findSubmissionsForJob(JOB_A_NAME,
         provider.getConnection());
     assertNotNull(submissions);
 
@@ -395,11 +395,11 @@ public class TestSubmissionHandling extends MySqlTestCase 
{
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_SUBMISSION")), 4);
 
-    handler.deleteJob(jobA.getPersistenceId(), provider.getConnection());
+    handler.deleteJob(jobA.getName(), provider.getConnection());
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_SUBMISSION")), 2);
 
-    handler.deleteJob(jobB.getPersistenceId(), provider.getConnection());
+    handler.deleteJob(jobB.getName(), provider.getConnection());
     Assert.assertEquals(
         provider.rowCount(new TableName("SQOOP", "SQ_SUBMISSION")), 0);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestJobHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestJobHandling.java
 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestJobHandling.java
index 2ad43dd..3a08268 100644
--- 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestJobHandling.java
+++ 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestJobHandling.java
@@ -79,7 +79,7 @@ public class TestJobHandling extends PostgresqlTestCase {
   @Test
   public void testFindJobFail() throws Exception {
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // Let's try to find non existing job
@@ -128,7 +128,7 @@ public class TestJobHandling extends PostgresqlTestCase {
 
     // Delete jobs
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // Load all two links on loaded repository
@@ -154,19 +154,19 @@ public class TestJobHandling extends PostgresqlTestCase {
 
   @Test
   public void testExistsJob() throws Exception {
-    assertTrue(handler.existsJob(1, provider.getConnection()));
-    assertTrue(handler.existsJob(2, provider.getConnection()));
-    assertFalse(handler.existsJob(3, provider.getConnection()));
+    assertTrue(handler.existsJob(JOB_A_NAME, provider.getConnection()));
+    assertTrue(handler.existsJob(JOB_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob("NONEXISTJOB", provider.getConnection()));
 
     // Delete jobs
     for (MJob job : handler.findJobs(provider.getConnection())) {
-      handler.deleteJob(job.getPersistenceId(), provider.getConnection());
+      handler.deleteJob(job.getName(), provider.getConnection());
     }
 
     // There shouldn't be anything on empty repository
-    assertFalse(handler.existsJob(1, provider.getConnection()));
-    assertFalse(handler.existsJob(2, provider.getConnection()));
-    assertFalse(handler.existsJob(3, provider.getConnection()));
+    assertFalse(handler.existsJob(JOB_A_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob(JOB_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsJob("NONEXISTJOB", provider.getConnection()));
   }
 
   @Test
@@ -174,9 +174,9 @@ public class TestJobHandling extends PostgresqlTestCase {
     MSubmission submission = getSubmission(handler.findJob(1, 
provider.getConnection()), SubmissionStatus.RUNNING);
     handler.createSubmission(submission, provider.getConnection());
 
-    assertTrue(handler.inUseJob(1, provider.getConnection()));
-    assertFalse(handler.inUseJob(2, provider.getConnection()));
-    assertFalse(handler.inUseJob(3, provider.getConnection()));
+    assertTrue(handler.inUseJob(JOB_A_NAME, provider.getConnection()));
+    assertFalse(handler.inUseJob(JOB_B_NAME, provider.getConnection()));
+    assertFalse(handler.inUseJob("NONEXISTJOB", provider.getConnection()));
   }
 
   @Test
@@ -263,14 +263,14 @@ public class TestJobHandling extends PostgresqlTestCase {
   @Test
   public void testEnableAndDisableJob() throws Exception {
     // disable job 1
-    handler.enableJob(1, false, provider.getConnection());
+    handler.enableJob(JOB_A_NAME, false, provider.getConnection());
 
     MJob retrieved = handler.findJob(1, provider.getConnection());
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable job 1
-    handler.enableJob(1, true, provider.getConnection());
+    handler.enableJob(JOB_A_NAME, true, provider.getConnection());
 
     retrieved = handler.findJob(1, provider.getConnection());
     assertNotNull(retrieved);
@@ -279,11 +279,11 @@ public class TestJobHandling extends PostgresqlTestCase {
 
   @Test
   public void testDeleteJob() throws Exception {
-    handler.deleteJob(1, provider.getConnection());
+    handler.deleteJob(JOB_A_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_JOB")), 
1);
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_JOB_INPUT")), 6);
 
-    handler.deleteJob(2, provider.getConnection());
+    handler.deleteJob(JOB_B_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_JOB")), 
0);
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_JOB_INPUT")), 0);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestLinkHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestLinkHandling.java
 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestLinkHandling.java
index 92bb15b..498f18f 100644
--- 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestLinkHandling.java
+++ 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestLinkHandling.java
@@ -73,7 +73,7 @@ public class TestLinkHandling extends PostgresqlTestCase {
   public void testFindLinkFail() {
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     assertNull(handler.findLink(1, provider.getConnection()));
@@ -124,7 +124,7 @@ public class TestLinkHandling extends PostgresqlTestCase {
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     // Load empty list on empty repository
@@ -135,43 +135,42 @@ public class TestLinkHandling extends PostgresqlTestCase {
   @Test
   public void testFindLinksByConnector() throws Exception {
     List<MLink> list;
-    Long connectorId = handler.findConnector("A", 
provider.getConnection()).getPersistenceId();
 
     // Load all two links on loaded repository
-    list = handler.findLinksForConnector(connectorId, 
provider.getConnection());
+    list = handler.findLinksForConnector("A", provider.getConnection());
     assertEquals(1, list.size());
     assertEquals(LINK_A_NAME, list.get(0).getName());
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
     // Load empty list on empty repository
-    list = handler.findLinksForConnector(connectorId, 
provider.getConnection());
+    list = handler.findLinksForConnector("A", provider.getConnection());
     assertEquals(0, list.size());
   }
 
   @Test
   public void testFindLinksByNonExistingConnector() throws Exception {
-    List<MLink> list = handler.findLinksForConnector(11, 
provider.getConnection());
+    List<MLink> list = handler.findLinksForConnector("NONEXISTCONNECTOR", 
provider.getConnection());
     assertEquals(0, list.size());
   }
 
   @Test
   public void testExistsLink() throws Exception {
-    assertTrue(handler.existsLink(1, provider.getConnection()));
-    assertTrue(handler.existsLink(2, provider.getConnection()));
-    assertFalse(handler.existsLink(3, provider.getConnection()));
+    assertTrue(handler.existsLink(LINK_A_NAME, provider.getConnection()));
+    assertTrue(handler.existsLink(LINK_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink("NONEXISTLINK", provider.getConnection()));
 
     // Delete links
     for (MLink link : handler.findLinks(provider.getConnection())) {
-      handler.deleteLink(link.getPersistenceId(), provider.getConnection());
+      handler.deleteLink(link.getName(), provider.getConnection());
     }
 
-    assertFalse(handler.existsLink(1, provider.getConnection()));
-    assertFalse(handler.existsLink(2, provider.getConnection()));
-    assertFalse(handler.existsLink(3, provider.getConnection()));
+    assertFalse(handler.existsLink(LINK_A_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink(LINK_B_NAME, provider.getConnection()));
+    assertFalse(handler.existsLink("NONEXISTLINK", provider.getConnection()));
   }
 
   @Test
@@ -209,7 +208,7 @@ public class TestLinkHandling extends PostgresqlTestCase {
 
   @Test
   public void testInUseLink() throws Exception {
-    assertFalse(handler.inUseLink(1, provider.getConnection()));
+    assertFalse(handler.inUseLink(LINK_A_NAME, provider.getConnection()));
 
     // Create job and submission and make that job in use to make sure link is 
in use.
     MLink linkA = handler.findLink(LINK_A_NAME, provider.getConnection());
@@ -222,7 +221,7 @@ public class TestLinkHandling extends PostgresqlTestCase {
     MSubmission submission = getSubmission(job, SubmissionStatus.RUNNING);
     handler.createSubmission(submission, provider.getConnection());
 
-    assertTrue(handler.inUseLink(linkA.getPersistenceId(), 
provider.getConnection()));
+    assertTrue(handler.inUseLink(linkA.getName(), provider.getConnection()));
   }
 
   @Test
@@ -258,14 +257,14 @@ public class TestLinkHandling extends PostgresqlTestCase {
   @Test
   public void testEnableAndDisableLink() throws Exception {
     // disable link 1
-    handler.enableLink(1, false, provider.getConnection());
+    handler.enableLink(LINK_A_NAME, false, provider.getConnection());
 
     MLink retrieved = handler.findLink(1, provider.getConnection());
     assertNotNull(retrieved);
     assertEquals(false, retrieved.getEnabled());
 
     // enable link 1
-    handler.enableLink(1, true, provider.getConnection());
+    handler.enableLink(LINK_A_NAME, true, provider.getConnection());
 
     retrieved = handler.findLink(1, provider.getConnection());
     assertNotNull(retrieved);
@@ -274,11 +273,11 @@ public class TestLinkHandling extends PostgresqlTestCase {
 
   @Test
   public void testDeleteLink() throws Exception {
-    handler.deleteLink(1, provider.getConnection());
+    handler.deleteLink(LINK_A_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_LINK")), 
1);
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_LINK_INPUT")), 2);
 
-    handler.deleteLink(2, provider.getConnection());
+    handler.deleteLink(LINK_B_NAME, provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", "SQ_LINK")), 
0);
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_LINK_INPUT")), 0);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestSubmissionHandling.java
----------------------------------------------------------------------
diff --git 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestSubmissionHandling.java
 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestSubmissionHandling.java
index c97b4f8..cd3367e 100644
--- 
a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestSubmissionHandling.java
+++ 
b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/TestSubmissionHandling.java
@@ -276,7 +276,7 @@ public class TestSubmissionHandling extends 
PostgresqlTestCase {
     submission.getError().setErrorSummary(errorSummary + "morethan150");
 
     handler.createSubmission(submission, provider.getConnection());
-    List<MSubmission> submissions = handler.findSubmissionsForJob(1, 
provider.getConnection());
+    List<MSubmission> submissions = handler.findSubmissionsForJob(JOB_A_NAME, 
provider.getConnection());
     assertNotNull(submissions);
 
     assertEquals(errorDetail, submissions.get(0).getError().getErrorDetails());
@@ -370,10 +370,10 @@ public class TestSubmissionHandling extends 
PostgresqlTestCase {
     loadSubmissions();
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_SUBMISSION")), 4);
 
-    handler.deleteJob(jobA.getPersistenceId(), provider.getConnection());
+    handler.deleteJob(jobA.getName(), provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_SUBMISSION")), 2);
 
-    handler.deleteJob(jobB.getPersistenceId(), provider.getConnection());
+    handler.deleteJob(jobB.getName(), provider.getConnection());
     Assert.assertEquals(provider.rowCount(new TableName("SQOOP", 
"SQ_SUBMISSION")), 0);
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/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 60b124c..f9c1de2 100644
--- a/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
@@ -79,12 +79,13 @@ public class ConnectorRequestHandler implements 
RequestHandler {
     } 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
-      long cId = HandlerUtils.getConnectorIdFromIdentifier(cIdentifier);
+      String cName = HandlerUtils.getConnectorNameFromIdentifier(cIdentifier);
 
       configParamBundles = new HashMap<Long, ResourceBundle>();
 
-      MConnector connector = 
ConnectorManager.getInstance().getConnectorConfigurable(cId);
-      configParamBundles.put(cId, 
ConnectorManager.getInstance().getResourceBundle(cId, locale));
+      MConnector connector = 
ConnectorManager.getInstance().getConnectorConfigurable(cName);
+      configParamBundles.put(connector.getPersistenceId(),
+          ConnectorManager.getInstance().getResourceBundle(cName, locale));
 
       AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
           ctx.getRequest().getRemoteAddr(), "get", "connector", 
String.valueOf(cIdentifier));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java 
b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
index cb9485f..f65cb81 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -139,7 +139,6 @@ public class JobRequestHandler implements RequestHandler {
     Repository repository = RepositoryManager.getInstance().getRepository();
 
     String jobIdentifier = ctx.getLastURLElement();
-    long jobId = HandlerUtils.getJobIdFromIdentifier(jobIdentifier);
     String jobName = HandlerUtils.getJobNameFromIdentifier(jobIdentifier);
 
     // Authorization check
@@ -147,7 +146,7 @@ public class JobRequestHandler implements RequestHandler {
 
     AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
         ctx.getRequest().getRemoteAddr(), "delete", "job", jobIdentifier);
-    repository.deleteJob(jobId);
+    repository.deleteJob(jobName);
     MResource resource = new MResource(jobName, MResource.TYPE.JOB);
     
AuthorizationManager.getInstance().getAuthorizationHandler().removeResource(resource);
     return JsonBean.EMPTY_BEAN;
@@ -322,19 +321,19 @@ public class JobRequestHandler implements RequestHandler {
 
   private JobBean createJobBean(List<MJob> jobs, Locale locale) {
     JobBean jobBean = new JobBean(jobs);
-    addJob(jobs, locale, jobBean);
+    addConnectorConfigBundle(jobBean, locale);
     return jobBean;
   }
 
   private JobsBean createJobsBean(List<MJob> jobs, Locale locale) {
     JobsBean jobsBean = new JobsBean(jobs);
-    addJob(jobs, locale, jobsBean);
+    addConnectorConfigBundle(jobsBean, locale);
     return jobsBean;
   }
 
-  private void addJob(List<MJob> jobs, Locale locale, JobBean bean) {
+  private void addConnectorConfigBundle(JobBean bean, Locale locale) {
     // Add associated resources into the bean
-    for (MJob job : jobs) {
+    for (MJob job : bean.getJobs()) {
       long fromConnectorId = job.getFromConnectorId();
       long toConnectorId = job.getToConnectorId();
       // replace it only if it does not already exist
@@ -353,13 +352,12 @@ public class JobRequestHandler implements RequestHandler {
     Repository repository = RepositoryManager.getInstance().getRepository();
     String[] elements = ctx.getUrlElements();
     String jobIdentifier = elements[elements.length - 2];
-    long jobId = HandlerUtils.getJobIdFromIdentifier(jobIdentifier);
     String jobName = HandlerUtils.getJobNameFromIdentifier(jobIdentifier);
 
     // Authorization check
     AuthorizationEngine.enableDisableJob(ctx.getUserName(), jobName);
 
-    repository.enableJob(jobId, enabled);
+    repository.enableJob(jobName, enabled);
     return JsonBean.EMPTY_BEAN;
   }
 
@@ -385,7 +383,7 @@ public class JobRequestHandler implements RequestHandler {
     }
 
     MSubmission submission = JobManager.getInstance()
-        .start(jobId, prepareRequestEventContext(ctx));
+        .start(jobId, jobName, prepareRequestEventContext(ctx));
     return new SubmissionBean(submission);
   }
 
@@ -400,7 +398,7 @@ public class JobRequestHandler implements RequestHandler {
 
     AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
         ctx.getRequest().getRemoteAddr(), "stop", "job", 
String.valueOf(jobId));
-    MSubmission submission = JobManager.getInstance().stop(jobId, 
prepareRequestEventContext(ctx));
+    MSubmission submission = JobManager.getInstance().stop(jobId, jobName, 
prepareRequestEventContext(ctx));
     return new SubmissionBean(submission);
   }
 
@@ -415,7 +413,7 @@ public class JobRequestHandler implements RequestHandler {
 
     AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
         ctx.getRequest().getRemoteAddr(), "status", "job", 
String.valueOf(jobId));
-    MSubmission submission = JobManager.getInstance().status(jobId);
+    MSubmission submission = JobManager.getInstance().status(jobId, jobName);
 
     return new SubmissionBean(submission);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java 
b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
index 3041646..fe0c4d8 100644
--- a/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
@@ -93,7 +93,6 @@ public class LinkRequestHandler implements RequestHandler {
     Repository repository = RepositoryManager.getInstance().getRepository();
     String linkIdentifier = ctx.getLastURLElement();
     // support linkName or linkId for the api
-    long linkId = HandlerUtils.getLinkIdFromIdentifier(linkIdentifier);
     String linkName = HandlerUtils.getLinkNameFromIdentifier(linkIdentifier);
 
     // Authorization check
@@ -102,7 +101,7 @@ public class LinkRequestHandler implements RequestHandler {
     AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
         ctx.getRequest().getRemoteAddr(), "delete", "link", linkIdentifier);
 
-    repository.deleteLink(linkId);
+    repository.deleteLink(linkName);
     MResource resource = new MResource(linkName, MResource.TYPE.LINK);
     
AuthorizationManager.getInstance().getAuthorizationHandler().removeResource(resource);
     return JsonBean.EMPTY_BEAN;
@@ -156,9 +155,9 @@ public class LinkRequestHandler implements RequestHandler {
     if (!create) {
       String linkIdentifier = ctx.getLastURLElement();
       // support linkName or linkId for the api
-      long linkId = HandlerUtils.getLinkIdFromIdentifier(linkIdentifier);
+      String linkName = HandlerUtils.getLinkNameFromIdentifier(linkIdentifier);
       if (postedLink.getPersistenceId() == 
MPersistableEntity.PERSISTANCE_ID_DEFAULT) {
-        MLink existingLink = repository.findLink(linkId);
+        MLink existingLink = repository.findLink(linkName);
         postedLink.setPersistenceId(existingLink.getPersistenceId());
       }
     }
@@ -207,8 +206,8 @@ public class LinkRequestHandler implements RequestHandler {
       AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
           ctx.getRequest().getRemoteAddr(), "get", "linksByConnector", 
identifier);
       if (repository.findConnector(identifier) != null) {
-        long connectorId = 
repository.findConnector(identifier).getPersistenceId();
-        List<MLink> linkList = repository.findLinksForConnector(connectorId);
+        String connectorName = 
repository.findConnector(identifier).getUniqueName();
+        List<MLink> linkList = repository.findLinksForConnector(connectorName);
 
         // Authorization check
         linkList = AuthorizationEngine.filterResource(ctx.getUserName(), 
MResource.TYPE.LINK, linkList);
@@ -237,8 +236,8 @@ public class LinkRequestHandler implements RequestHandler {
       AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
           ctx.getRequest().getRemoteAddr(), "get", "link", identifier);
 
-      long linkId = HandlerUtils.getLinkIdFromIdentifier(identifier);
-      MLink link = repository.findLink(linkId);
+      String linkName = HandlerUtils.getLinkNameFromIdentifier(identifier);
+      MLink link = repository.findLink(linkName);
 
       // Authorization check
       AuthorizationEngine.readLink(ctx.getUserName(), link.getName());
@@ -250,19 +249,19 @@ public class LinkRequestHandler implements RequestHandler 
{
 
   private LinkBean createLinkBean(List<MLink> links, Locale locale) {
     LinkBean linkBean = new LinkBean(links);
-    addLink(links, locale, linkBean);
+    addConnectorConfigBundle(locale, linkBean);
     return linkBean;
   }
 
   private LinksBean createLinksBean(List<MLink> links, Locale locale) {
     LinksBean linksBean = new LinksBean(links);
-    addLink(links, locale, linksBean);
+    addConnectorConfigBundle(locale, linksBean);
     return linksBean;
   }
 
-  private void addLink(List<MLink> links, Locale locale, LinkBean bean) {
+  private void addConnectorConfigBundle(Locale locale, LinkBean bean) {
     // Add associated resources into the bean
-    for (MLink link : links) {
+    for (MLink link : bean.getLinks()) {
       long connectorId = link.getConnectorId();
       if (!bean.hasConnectorConfigBundle(connectorId)) {
         bean.addConnectorConfigBundle(connectorId, 
ConnectorManager.getInstance()
@@ -275,13 +274,12 @@ public class LinkRequestHandler implements RequestHandler 
{
     Repository repository = RepositoryManager.getInstance().getRepository();
     String[] elements = ctx.getUrlElements();
     String linkIdentifier = elements[elements.length - 2];
-    long linkId = HandlerUtils.getLinkIdFromIdentifier(linkIdentifier);
     String linkName = HandlerUtils.getLinkNameFromIdentifier(linkIdentifier);
 
     // Authorization check
     AuthorizationEngine.enableDisableLink(ctx.getUserName(), linkName);
 
-    repository.enableLink(linkId, enabled);
+    repository.enableLink(linkName, enabled);
     return JsonBean.EMPTY_BEAN;
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/a3c37472/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java 
b/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
index 4b99239..02937bb 100644
--- 
a/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
+++ 
b/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
@@ -75,14 +75,13 @@ public class SubmissionRequestHandler implements 
RequestHandler {
   }
 
   private JsonBean getSubmissionsForJob(String jobIdentifier, RequestContext 
ctx) {
-    long jobId = HandlerUtils.getJobIdFromIdentifier(jobIdentifier);
     String jobName = HandlerUtils.getJobNameFromIdentifier(jobIdentifier);
 
     //Authorization check
     AuthorizationEngine.statusJob(ctx.getUserName(), jobName);
 
     List<MSubmission> submissions = 
RepositoryManager.getInstance().getRepository()
-        .findSubmissionsForJob(jobId);
+        .findSubmissionsForJob(jobName);
 
     return new SubmissionsBean(submissions);
   }

Reply via email to