sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-1142: Sqoop2: Provide creater and last edited by to metadata structures
Date Wed, 14 Aug 2013 22:28:17 GMT
Updated Branches:
  refs/heads/sqoop2 ee4e4c476 -> c07c85758


SQOOP-1142: Sqoop2: Provide creater and last edited by to metadata structures

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

Branch: refs/heads/sqoop2
Commit: c07c857589bfea989b818017e11c138f5201eebc
Parents: ee4e4c4
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Wed Aug 14 15:27:48 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Wed Aug 14 15:27:48 2013 -0700

----------------------------------------------------------------------
 .../org/apache/sqoop/json/ConnectionBean.java   |  12 +-
 .../java/org/apache/sqoop/json/JobBean.java     |  12 +-
 .../org/apache/sqoop/json/SubmissionBean.java   |  14 ++
 .../sqoop/json/util/FormSerialization.java      |   6 +-
 .../apache/sqoop/model/MAccountableEntity.java  |  28 ++++
 .../apache/sqoop/json/TestConnectionBean.java   |   6 +
 .../apache/sqoop/json/TestSubmissionBean.java   |  46 ++++++
 .../sqoop/model/TestMAccountableEntity.java     |   4 +
 .../org/apache/sqoop/framework/JobManager.java  |  14 +-
 .../apache/sqoop/request/HttpEventContext.java  |  35 +++++
 .../derby/DerbyRepositoryHandler.java           |  89 +++++++----
 .../repository/derby/DerbySchemaConstants.java  |  12 ++
 .../repository/derby/DerbySchemaQuery.java      | 149 ++++++++++++++-----
 .../sqoop/repository/derby/DerbyTestCase.java   |   6 +
 .../sqoop/handler/ConnectionRequestHandler.java |   6 +
 .../apache/sqoop/handler/JobRequestHandler.java |   5 +
 .../sqoop/handler/SubmissionRequestHandler.java |  17 ++-
 .../sqoop/shell/ShowConnectionFunction.java     |   2 +
 .../org/apache/sqoop/shell/ShowJobFunction.java |   2 +
 .../org/apache/sqoop/shell/core/Constants.java  |   4 +
 .../sqoop/shell/utils/SubmissionDisplayer.java  |   6 +
 .../main/resources/shell-resource.properties    |   6 +-
 22 files changed, 389 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java b/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
index a014ddd..688bb64 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
@@ -104,9 +104,11 @@ public class ConnectionBean implements JsonBean {
 
       object.put(ID, connection.getPersistenceId());
       object.put(NAME, connection.getName());
-      object.put(CREATED, connection.getCreationDate().getTime());
-      object.put(UPDATED, connection.getLastUpdateDate().getTime());
       object.put(ENABLED, connection.getEnabled());
+      object.put(CREATION_USER, connection.getCreationUser());
+      object.put(CREATION_DATE, connection.getCreationDate().getTime());
+      object.put(UPDATE_USER, connection.getLastUpdateUser());
+      object.put(UPDATE_DATE, connection.getLastUpdateDate().getTime());
       object.put(CONNECTOR_ID, connection.getConnectorId());
       object.put(CONNECTOR_PART,
         extractForms(connection.getConnectorPart().getForms(), skipSensitive));
@@ -158,9 +160,11 @@ public class ConnectionBean implements JsonBean {
 
       connection.setPersistenceId((Long) object.get(ID));
       connection.setName((String) object.get(NAME));
-      connection.setCreationDate(new Date((Long) object.get(CREATED)));
-      connection.setLastUpdateDate(new Date((Long) object.get(UPDATED)));
       connection.setEnabled((Boolean) object.get(ENABLED));
+      connection.setCreationUser((String) object.get(CREATION_USER));
+      connection.setCreationDate(new Date((Long) object.get(CREATION_DATE)));
+      connection.setLastUpdateUser((String) object.get(UPDATE_USER));
+      connection.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE)));
 
       connections.add(connection);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/main/java/org/apache/sqoop/json/JobBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JobBean.java b/common/src/main/java/org/apache/sqoop/json/JobBean.java
index 4685797..1555bd5 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -107,9 +107,11 @@ public class JobBean implements JsonBean {
       object.put(ID, job.getPersistenceId());
       object.put(NAME, job.getName());
       object.put(TYPE, job.getType().name());
-      object.put(CREATED, job.getCreationDate().getTime());
-      object.put(UPDATED, job.getLastUpdateDate().getTime());
       object.put(ENABLED, job.getEnabled());
+      object.put(CREATION_USER, job.getCreationUser());
+      object.put(CREATION_DATE, job.getCreationDate().getTime());
+      object.put(UPDATE_USER, job.getLastUpdateUser());
+      object.put(UPDATE_DATE, job.getLastUpdateDate().getTime());
       object.put(CONNECTION_ID, job.getConnectionId());
       object.put(CONNECTOR_ID, job.getConnectorId());
       object.put(CONNECTOR_PART,
@@ -170,9 +172,11 @@ public class JobBean implements JsonBean {
 
       job.setPersistenceId((Long) object.get(ID));
       job.setName((String) object.get(NAME));
-      job.setCreationDate(new Date((Long) object.get(CREATED)));
-      job.setLastUpdateDate(new Date((Long) object.get(UPDATED)));
       job.setEnabled((Boolean) object.get(ENABLED));
+      job.setCreationUser((String) object.get(CREATION_USER));
+      job.setCreationDate(new Date((Long) object.get(CREATION_DATE)));
+      job.setLastUpdateUser((String) object.get(UPDATE_USER));
+      job.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE)));
 
       jobs.add(job);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java b/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
index 79490f8..61d6576 100644
--- a/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
@@ -41,7 +41,9 @@ public class SubmissionBean implements JsonBean {
 
   private static final String ALL = "all";
   private static final String JOB = "job";
+  private static final String CREATION_USER = "creation-user";
   private static final String CREATION_DATE = "creation-date";
+  private static final String LAST_UPDATE_USER = "last-udpate-user";
   private static final String LAST_UPDATE_DATE = "last-update-date";
   private static final String STATUS = "status";
   private static final String EXTERNAL_ID = "external-id";
@@ -87,9 +89,15 @@ public class SubmissionBean implements JsonBean {
       object.put(STATUS, submission.getStatus().name());
       object.put(PROGRESS, submission.getProgress());
 
+      if(submission.getCreationUser() != null) {
+        object.put(CREATION_USER, submission.getCreationUser());
+      }
       if(submission.getCreationDate() != null) {
         object.put(CREATION_DATE, submission.getCreationDate().getTime());
       }
+      if(submission.getLastUpdateUser() != null) {
+        object.put(LAST_UPDATE_USER, submission.getLastUpdateUser());
+      }
       if(submission.getLastUpdateDate() != null) {
         object.put(LAST_UPDATE_DATE, submission.getLastUpdateDate().getTime());
       }
@@ -153,9 +161,15 @@ public class SubmissionBean implements JsonBean {
       submission.setStatus(SubmissionStatus.valueOf((String) object.get(STATUS)));
       submission.setProgress((Double) object.get(PROGRESS));
 
+      if(object.containsKey(CREATION_USER)) {
+        submission.setCreationUser((String) object.get(CREATION_USER));
+      }
       if(object.containsKey(CREATION_DATE)) {
         submission.setCreationDate(new Date((Long) object.get(CREATION_DATE)));
       }
+      if(object.containsKey(LAST_UPDATE_USER)) {
+        submission.setLastUpdateUser((String) object.get(LAST_UPDATE_USER));
+      }
       if(object.containsKey(LAST_UPDATE_DATE)) {
         submission.setLastUpdateDate(new Date((Long) object.get(LAST_UPDATE_DATE)));
       }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java b/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
index 3daf8d2..9558941 100644
--- a/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
+++ b/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
@@ -46,9 +46,11 @@ public final class FormSerialization {
   public static final String VERSION = "version";
   public static final String FRAMEWORK_VERSION = "framework-version";
   public static final String CLASS = "class";
-  public static final String CREATED = "created";
-  public static final String UPDATED = "updated";
   public static final String ENABLED = "enabled";
+  public static final String CREATION_USER = "creation-user";
+  public static final String CREATION_DATE = "creation-date";
+  public static final String UPDATE_USER = "update-user";
+  public static final String UPDATE_DATE = "update-date";
   public static final String CON_FORMS = "con-forms";
   public static final String JOB_FORMS = "job-forms";
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
index 5524983..8af7c15 100644
--- a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
+++ b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
@@ -28,11 +28,21 @@ abstract public class MAccountableEntity extends MPersistableEntity {
   private final boolean DEFAULT_ENABLED = true;
 
   /**
+   * The user who creates the entity
+   */
+  private String creationUser;
+
+  /**
    * Date when the entity was created.
    */
   private Date creationDate;
 
   /**
+   * The user who lastly updates the entity
+   */
+  private String lastUpdateUser;
+
+  /**
    * Date when the entity was lastly updated.
    */
   private Date lastUpdateDate;
@@ -43,11 +53,21 @@ abstract public class MAccountableEntity extends MPersistableEntity {
   private boolean enabled;
 
   public MAccountableEntity() {
+    this.creationUser = null;
     this.creationDate = new Date();
+    this.lastUpdateUser = this.creationUser;
     this.lastUpdateDate = this.creationDate;
     this.enabled = DEFAULT_ENABLED;
   }
 
+  public void setCreationUser(String name) {
+    this.creationUser = name;
+  }
+
+  public String getCreationUser() {
+    return creationUser;
+  }
+
   public void setCreationDate(Date createDate) {
     this.creationDate = createDate;
   }
@@ -56,6 +76,14 @@ abstract public class MAccountableEntity extends MPersistableEntity {
     return creationDate;
   }
 
+  public void setLastUpdateUser(String name) {
+    this.lastUpdateUser = name;
+  }
+
+  public String getLastUpdateUser() {
+    return lastUpdateUser;
+  }
+
   public void setLastUpdateDate(Date lastUpdateDate) {
     this.lastUpdateDate = lastUpdateDate;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java b/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
index 2f2b974..19f81a8 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
@@ -41,7 +41,9 @@ public class TestConnectionBean {
     MConnection connection = getConnection("ahoj");
     connection.setName("Connection");
     connection.setPersistenceId(666);
+    connection.setCreationUser("admin");
     connection.setCreationDate(created);
+    connection.setLastUpdateUser("user");
     connection.setLastUpdateDate(updated);
     connection.setEnabled(false);
 
@@ -76,7 +78,9 @@ public class TestConnectionBean {
     // Check id and name
     assertEquals(666, target.getPersistenceId());
     assertEquals("Connection", target.getName());
+    assertEquals("admin", target.getCreationUser());
     assertEquals(created, target.getCreationDate());
+    assertEquals("user", target.getLastUpdateUser());
     assertEquals(updated, target.getLastUpdateDate());
     assertEquals(false, target.getEnabled());
 
@@ -93,7 +97,9 @@ public class TestConnectionBean {
     MConnection connection = getConnection("ahoj");
     connection.setName("Connection");
     connection.setPersistenceId(666);
+    connection.setCreationUser("admin");
     connection.setCreationDate(created);
+    connection.setLastUpdateUser("user");
     connection.setLastUpdateDate(updated);
     connection.setEnabled(true);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
index 3b56171..d87655e 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
@@ -69,6 +69,29 @@ public class TestSubmissionBean extends TestCase {
     assertEquals(888, targets.get(1).getJobId());
   }
 
+  public void testTransferCreationUser() {
+    String username = "admin";
+    MSubmission source = new MSubmission();
+    source.setCreationUser(username);
+
+    MSubmission target = transfer(source);
+    assertEquals("admin", target.getCreationUser());
+
+    List<MSubmission> sources = new ArrayList<MSubmission>();
+    MSubmission sourcex = new MSubmission();
+    sourcex.setCreationUser("userA");
+    sources.add(sourcex);
+    MSubmission sourcey = new MSubmission();
+    sourcey.setCreationUser("userB");
+    sources.add(sourcey);
+
+    List<MSubmission> targets = transfer(sources);
+    assertNotNull(targets.get(0));
+    assertEquals("userA", targets.get(0).getCreationUser());
+    assertNotNull(targets.get(1));
+    assertEquals("userB", targets.get(1).getCreationUser());
+  }
+
   public void testTransferCreationDate() {
     Date date = new Date();
     MSubmission source = new MSubmission();
@@ -94,6 +117,29 @@ public class TestSubmissionBean extends TestCase {
     assertEquals(datey, targets.get(1).getCreationDate());
   }
 
+  public void testTransferLastUpdateUser() {
+    String username = "admin";
+    MSubmission source = new MSubmission();
+    source.setLastUpdateUser(username);
+
+    MSubmission target = transfer(source);
+    assertEquals("admin", target.getLastUpdateUser());
+
+    List<MSubmission> sources = new ArrayList<MSubmission>();
+    MSubmission sourcex = new MSubmission();
+    sourcex.setLastUpdateUser("userA");
+    sources.add(sourcex);
+    MSubmission sourcey = new MSubmission();
+    sourcey.setLastUpdateUser("userB");
+    sources.add(sourcey);
+
+    List<MSubmission> targets = transfer(sources);
+    assertNotNull(targets.get(0));
+    assertEquals("userA", targets.get(0).getLastUpdateUser());
+    assertNotNull(targets.get(1));
+    assertEquals("userB", targets.get(1).getLastUpdateUser());
+  }
+
   public void testTransferLastUpdateDate() {
     Date date = new Date();
     MSubmission source = new MSubmission();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
index bf103e4..f3d4166 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
@@ -47,11 +47,15 @@ public class TestMAccountableEntity {
     assertEquals(connection.getCreationDate(), connection.getLastUpdateDate());
     Date testCreationDate = new Date();
     Date testLastUpdateDate = new Date();
+    connection.setCreationUser("admin");
     connection.setCreationDate(testCreationDate);
+    connection.setLastUpdateUser("user");
     connection.setLastUpdateDate(testLastUpdateDate);
     connection.setEnabled(false);
     assertEquals(testCreationDate, connection.getCreationDate());
+    assertEquals("admin", connection.getCreationUser());
     assertEquals(testLastUpdateDate, connection.getLastUpdateDate());
     assertEquals(false, connection.getEnabled());
+    assertEquals("user", connection.getLastUpdateUser());
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/core/src/main/java/org/apache/sqoop/framework/JobManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/framework/JobManager.java b/core/src/main/java/org/apache/sqoop/framework/JobManager.java
index d0a087d..e052584 100644
--- a/core/src/main/java/org/apache/sqoop/framework/JobManager.java
+++ b/core/src/main/java/org/apache/sqoop/framework/JobManager.java
@@ -21,6 +21,7 @@ import org.apache.log4j.Logger;
 import org.apache.sqoop.common.MapContext;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.connector.ConnectorManager;
+import org.apache.sqoop.request.HttpEventContext;
 import org.apache.sqoop.connector.spi.SqoopConnector;
 import org.apache.sqoop.core.Reconfigurable;
 import org.apache.sqoop.core.SqoopConfiguration;
@@ -262,7 +263,9 @@ public class JobManager implements Reconfigurable {
     LOG.info("Submission manager initialized: OK");
   }
 
-  public MSubmission submit(long jobId) {
+  public MSubmission submit(long jobId, HttpEventContext ctx) {
+    String username = ctx.getUsername();
+
     Repository repository = RepositoryManager.getInstance().getRepository();
 
     MJob job = repository.findJob(jobId);
@@ -310,6 +313,9 @@ public class JobManager implements Reconfigurable {
     MSubmission summary = new MSubmission(jobId);
     SubmissionRequest request = executionEngine.createSubmissionRequest();
 
+    summary.setCreationUser(username);
+    summary.setLastUpdateUser(username);
+
     // Save important variables to the submission request
     request.setSummary(summary);
     request.setConnector(connector);
@@ -477,7 +483,9 @@ public class JobManager implements Reconfigurable {
       request.getConfigConnectorJob());
   }
 
-  public MSubmission stop(long jobId) {
+  public MSubmission stop(long jobId, HttpEventContext ctx) {
+    String username = ctx.getUsername();
+
     Repository repository = RepositoryManager.getInstance().getRepository();
     MSubmission submission = repository.findSubmissionLastForJob(jobId);
 
@@ -489,6 +497,8 @@ public class JobManager implements Reconfigurable {
     String externalId = submission.getExternalId();
     submissionEngine.stop(externalId);
 
+    submission.setLastUpdateUser(username);
+
     // Fetch new information to verify that the stop command has actually worked
     update(submission);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/core/src/main/java/org/apache/sqoop/request/HttpEventContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/request/HttpEventContext.java b/core/src/main/java/org/apache/sqoop/request/HttpEventContext.java
new file mode 100644
index 0000000..fda75eb
--- /dev/null
+++ b/core/src/main/java/org/apache/sqoop/request/HttpEventContext.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.request;
+
+/**
+ * Context for all events in the server
+ */
+public class HttpEventContext {
+
+  // The user who executes this Http event
+  private String username;
+
+  public String getUsername() {
+    return username;
+  }
+
+  public void setUsername(String value) {
+    username = value;
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
index f025ee9..f6bd5b5 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
@@ -388,6 +388,12 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
       runQuery(QUERY_CREATE_TABLE_SQ_SYSTEM, conn);
       runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_ENABLED, conn);
       runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_ENABLED, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_CREATION_USER, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_UPDATE_USER, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_CREATION_USER, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_UPDATE_USER, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_CREATION_USER, conn);
+      runQuery(QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_UPDATE_USER, conn);
     }
 
     ResultSet rs = null;
@@ -600,9 +606,11 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
         Statement.RETURN_GENERATED_KEYS);
       stmt.setString(1, connection.getName());
       stmt.setLong(2, connection.getConnectorId());
-      stmt.setTimestamp(3, new Timestamp(connection.getCreationDate().getTime()));
-      stmt.setTimestamp(4, new Timestamp(connection.getLastUpdateDate().getTime()));
-      stmt.setBoolean(5, connection.getEnabled());
+      stmt.setBoolean(3, connection.getEnabled());
+      stmt.setString(4, connection.getCreationUser());
+      stmt.setTimestamp(5, new Timestamp(connection.getCreationDate().getTime()));
+      stmt.setString(6, connection.getLastUpdateUser());
+      stmt.setTimestamp(7, new Timestamp(connection.getLastUpdateDate().getTime()));
 
       result = stmt.executeUpdate();
       if (result != 1) {
@@ -653,9 +661,10 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
       // Update CONNECTION table
       updateStmt = conn.prepareStatement(STMT_UPDATE_CONNECTION);
       updateStmt.setString(1, connection.getName());
-      updateStmt.setTimestamp(2, new Timestamp(new Date().getTime()));
+      updateStmt.setString(2, connection.getLastUpdateUser());
+      updateStmt.setTimestamp(3, new Timestamp(new Date().getTime()));
 
-      updateStmt.setLong(3, connection.getPersistenceId());
+      updateStmt.setLong(4, connection.getPersistenceId());
       updateStmt.executeUpdate();
 
       // And reinsert new values
@@ -923,9 +932,11 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
       stmt.setString(1, job.getName());
       stmt.setLong(2, job.getConnectionId());
       stmt.setString(3, job.getType().name());
-      stmt.setTimestamp(4, new Timestamp(job.getCreationDate().getTime()));
-      stmt.setTimestamp(5, new Timestamp(job.getLastUpdateDate().getTime()));
-      stmt.setBoolean(6, job.getEnabled());
+      stmt.setBoolean(4, job.getEnabled());
+      stmt.setString(5, job.getCreationUser());
+      stmt.setTimestamp(6, new Timestamp(job.getCreationDate().getTime()));
+      stmt.setString(7, job.getLastUpdateUser());
+      stmt.setTimestamp(8, new Timestamp(job.getLastUpdateDate().getTime()));
 
       result = stmt.executeUpdate();
       if (result != 1) {
@@ -976,9 +987,10 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
       // Update job table
       updateStmt = conn.prepareStatement(STMT_UPDATE_JOB);
       updateStmt.setString(1, job.getName());
-      updateStmt.setTimestamp(2, new Timestamp(new Date().getTime()));
+      updateStmt.setString(2, job.getLastUpdateUser());
+      updateStmt.setTimestamp(3, new Timestamp(new Date().getTime()));
 
-      updateStmt.setLong(3, job.getPersistenceId());
+      updateStmt.setLong(4, job.getPersistenceId());
       updateStmt.executeUpdate();
 
       // And reinsert new values
@@ -1173,12 +1185,14 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
         Statement.RETURN_GENERATED_KEYS);
       stmt.setLong(1, submission.getJobId());
       stmt.setString(2, submission.getStatus().name());
-      stmt.setTimestamp(3, new Timestamp(submission.getCreationDate().getTime()));
-      stmt.setTimestamp(4, new Timestamp(submission.getLastUpdateDate().getTime()));
-      stmt.setString(5, submission.getExternalId());
-      stmt.setString(6, submission.getExternalLink());
-      stmt.setString(7, submission.getExceptionInfo());
-      stmt.setString(8, submission.getExceptionStackTrace());
+      stmt.setString(3, submission.getCreationUser());
+      stmt.setTimestamp(4, new Timestamp(submission.getCreationDate().getTime()));
+      stmt.setString(5, submission.getLastUpdateUser());
+      stmt.setTimestamp(6, new Timestamp(submission.getLastUpdateDate().getTime()));
+      stmt.setString(7, submission.getExternalId());
+      stmt.setString(8, submission.getExternalLink());
+      stmt.setString(9, submission.getExceptionInfo());
+      stmt.setString(10, submission.getExceptionStackTrace());
 
       result = stmt.executeUpdate();
       if (result != 1) {
@@ -1245,11 +1259,12 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
       //  Update properties in main table
       stmt = conn.prepareStatement(STMT_UPDATE_SUBMISSION);
       stmt.setString(1, submission.getStatus().name());
-      stmt.setTimestamp(2, new Timestamp(submission.getLastUpdateDate().getTime()));
-      stmt.setString(3, submission.getExceptionInfo());
-      stmt.setString(4, submission.getExceptionStackTrace());
+      stmt.setString(2, submission.getLastUpdateUser());
+      stmt.setTimestamp(3, new Timestamp(submission.getLastUpdateDate().getTime()));
+      stmt.setString(4, submission.getExceptionInfo());
+      stmt.setString(5, submission.getExceptionStackTrace());
 
-      stmt.setLong(5, submission.getPersistenceId());
+      stmt.setLong(6, submission.getPersistenceId());
       stmt.executeUpdate();
 
       // Delete previous counters
@@ -1534,12 +1549,14 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
     submission.setPersistenceId(rs.getLong(1));
     submission.setJobId(rs.getLong(2));
     submission.setStatus(SubmissionStatus.valueOf(rs.getString(3)));
-    submission.setCreationDate(rs.getTimestamp(4));
-    submission.setLastUpdateDate(rs.getTimestamp(5));
-    submission.setExternalId(rs.getString(6));
-    submission.setExternalLink(rs.getString(7));
-    submission.setExceptionInfo(rs.getString(8));
-    submission.setExceptionStackTrace(rs.getString(9));
+    submission.setCreationUser(rs.getString(4));
+    submission.setCreationDate(rs.getTimestamp(5));
+    submission.setLastUpdateUser(rs.getString(6));
+    submission.setLastUpdateDate(rs.getTimestamp(7));
+    submission.setExternalId(rs.getString(8));
+    submission.setExternalLink(rs.getString(9));
+    submission.setExceptionInfo(rs.getString(10));
+    submission.setExceptionStackTrace(rs.getString(11));
 
     Counters counters = loadCountersSubmission(rs.getLong(1), conn);
     submission.setCounters(counters);
@@ -1602,9 +1619,11 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
         long id = rsConnection.getLong(1);
         String name = rsConnection.getString(2);
         long connectorId = rsConnection.getLong(3);
-        Date creationDate = rsConnection.getTimestamp(4);
-        Date lastUpdateDate = rsConnection.getTimestamp(5);
-        boolean enabled = rsConnection.getBoolean(6);
+        boolean enabled = rsConnection.getBoolean(4);
+        String creationUser = rsConnection.getString(5);
+        Date creationDate = rsConnection.getTimestamp(6);
+        String updateUser = rsConnection.getString(7);
+        Date lastUpdateDate = rsConnection.getTimestamp(8);
 
         formConnectorFetchStmt.setLong(1, connectorId);
 
@@ -1631,7 +1650,9 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
 
         connection.setPersistenceId(id);
         connection.setName(name);
+        connection.setCreationUser(creationUser);
         connection.setCreationDate(creationDate);
+        connection.setLastUpdateUser(updateUser);
         connection.setLastUpdateDate(lastUpdateDate);
         connection.setEnabled(enabled);
 
@@ -1668,9 +1689,11 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
         String name = rsJob.getString(3);
         long connectionId = rsJob.getLong(4);
         String stringType = rsJob.getString(5);
-        Date creationDate = rsJob.getTimestamp(6);
-        Date lastUpdateDate = rsJob.getTimestamp(7);
-        boolean enabled = rsJob.getBoolean(8);
+        boolean enabled = rsJob.getBoolean(6);
+        String createBy = rsJob.getString(7);
+        Date creationDate = rsJob.getTimestamp(8);
+        String updateBy = rsJob.getString(9);
+        Date lastUpdateDate = rsJob.getTimestamp(10);
 
         MJob.Type type = MJob.Type.valueOf(stringType);
 
@@ -1699,7 +1722,9 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
 
         job.setPersistenceId(id);
         job.setName(name);
+        job.setCreationUser(createBy);
         job.setCreationDate(creationDate);
+        job.setLastUpdateUser(updateBy);
         job.setLastUpdateDate(lastUpdateDate);
         job.setEnabled(enabled);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
index 49bf607..fcbb475 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
@@ -119,8 +119,12 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQN_CONNECTOR = "SQN_CONNECTOR";
 
+  public static final String COLUMN_SQN_CREATION_USER = "SQN_CREATION_USER";
+
   public static final String COLUMN_SQN_CREATION_DATE = "SQN_CREATION_DATE";
 
+  public static final String COLUMN_SQN_UPDATE_USER = "SQN_UPDATE_USER";
+
   public static final String COLUMN_SQN_UPDATE_DATE = "SQN_UPDATE_DATE";
 
   public static final String COLUMN_SQN_ENABLED = "SQN_ENABLED";
@@ -144,8 +148,12 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQB_CONNECTION = "SQB_CONNECTION";
 
+  public static final String COLUMN_SQB_CREATION_USER = "SQB_CREATION_USER";
+
   public static final String COLUMN_SQB_CREATION_DATE = "SQB_CREATION_DATE";
 
+  public static final String COLUMN_SQB_UPDATE_USER = "SQB_UPDATE_USER";
+
   public static final String COLUMN_SQB_UPDATE_DATE = "SQB_UPDATE_DATE";
 
   public static final String COLUMN_SQB_ENABLED = "SQB_ENABLED";
@@ -212,8 +220,12 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQS_STATUS = "SQS_STATUS";
 
+  public static final String COLUMN_SQS_CREATION_USER = "SQS_CREATION_USER";
+
   public static final String COLUMN_SQS_CREATION_DATE = "SQS_CREATION_DATE";
 
+  public static final String COLUMN_SQS_UPDATE_USER = "SQS_UPDATE_USER";
+
   public static final String COLUMN_SQS_UPDATE_DATE = "SQS_UPDATE_DATE";
 
   public static final String COLUMN_SQS_EXTERNAL_ID = "SQS_EXTERNAL_ID";

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
index b08f7ab..1bbba8a 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
@@ -82,32 +82,36 @@ import static org.apache.sqoop.repository.derby.DerbySchemaConstants.*;
  * <p>
  * <strong>SQ_CONNECTION</strong>: Stored connections
  * <pre>
- *    +------------------------------+
- *    | SQ_CONNECTION                |
- *    +------------------------------+
- *    | SQN_ID: BIGINT PK AUTO-GEN   |
- *    | SQN_NAME: VARCHAR(64)        |
- *    | SQN_CONNECTOR: BIGINT        | FK SQ_CONNECTOR(SQC_ID)
- *    | SQN_CREATION_DATE: TIMESTAMP |
- *    | SQN_UPDATE_DATE: TIMESTAMP   |
- *    | SQN_ENABLED: BOOLEAN         |
- *    +------------------------------+
+ *    +--------------------------------+
+ *    | SQ_CONNECTION                  |
+ *    +--------------------------------+
+ *    | SQN_ID: BIGINT PK AUTO-GEN     |
+ *    | SQN_NAME: VARCHAR(64)          |
+ *    | SQN_CONNECTOR: BIGINT          | FK SQ_CONNECTOR(SQC_ID)
+ *    | SQN_CREATION_USER: VARCHAR(32) |
+ *    | SQN_CREATION_DATE: TIMESTAMP   |
+ *    | SQN_UPDATE_USER: VARCHAR(32)   |
+ *    | SQN_UPDATE_DATE: TIMESTAMP     |
+ *    | SQN_ENABLED: BOOLEAN           |
+ *    +--------------------------------+
  * </pre>
  * </p>
  * <p>
  * <strong>SQ_JOB</strong>: Stored jobs
  * <pre>
- *    +------------------------------+
- *    | SQ_JOB                       |
- *    +------------------------------+
- *    | SQB_ID: BIGINT PK AUTO-GEN   |
- *    | SQB_NAME: VARCHAR(64)        |
- *    | SQB_TYPE: VARCHAR(64)        |
- *    | SQB_CONNECTION: BIGINT       | FK SQ_CONNECTION(SQN_ID)
- *    | SQB_CREATION_DATE: TIMESTAMP |
- *    | SQB_UPDATE_DATE: TIMESTAMP   |
- *    | SQB_ENABLED: BOOLEAN         |
- *    +------------------------------+
+ *    +--------------------------------+
+ *    | SQ_JOB                         |
+ *    +--------------------------------+
+ *    | SQB_ID: BIGINT PK AUTO-GEN     |
+ *    | SQB_NAME: VARCHAR(64)          |
+ *    | SQB_TYPE: VARCHAR(64)          |
+ *    | SQB_CONNECTION: BIGINT         | FK SQ_CONNECTION(SQN_ID)
+ *    | SQB_CREATION_USER: VARCHAR(32) |
+ *    | SQB_CREATION_DATE: TIMESTAMP   |
+ *    | SQB_UPDATE_USER: VARCHAR(32)   |
+ *    | SQB_UPDATE_DATE: TIMESTAMP     |
+ *    | SQB_ENABLED: BOOLEAN           |
+ *    +--------------------------------+
  * </pre>
  * </p>
  * <p>
@@ -143,7 +147,9 @@ import static org.apache.sqoop.repository.derby.DerbySchemaConstants.*;
  *    | SQS_ID: BIGINT PK                 |
  *    | SQS_JOB: BIGINT                   | FK SQ_JOB(SQB_ID)
  *    | SQS_STATUS: VARCHAR(20)           |
+ *    | SQS_CREATION_USER: VARCHAR(32)    |
  *    | SQS_CREATION_DATE: TIMESTAMP      |
+ *    | SQS_UPDATE_USER: VARCHAR(32)      |
  *    | SQS_UPDATE_DATE: TIMESTAMP        |
  *    | SQS_EXTERNAL_ID: VARCHAR(25)      |
  *    | SQS_EXTERNAL_LINK: VARCHAR(150)   |
@@ -264,6 +270,18 @@ public final class DerbySchemaQuery {
       + COLUMN_SQN_ENABLED + " BOOLEAN "
       + "DEFAULT TRUE";
 
+  // DDL: Add creation_user column to table SQ_CONNECTION
+  public static final String QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_CREATION_USER =
+      "ALTER TABLE " + TABLE_SQ_CONNECTION + " ADD "
+      + COLUMN_SQN_CREATION_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
+  // DDL: Add update_user column to table SQ_CONNECTION
+  public static final String QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_UPDATE_USER =
+      "ALTER TABLE " + TABLE_SQ_CONNECTION + " ADD "
+      + COLUMN_SQN_UPDATE_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
   // DDL: Create table SQ_JOB
   public static final String QUERY_CREATE_TABLE_SQ_JOB =
       "CREATE TABLE " + TABLE_SQ_JOB + " ("
@@ -284,6 +302,18 @@ public final class DerbySchemaQuery {
       + COLUMN_SQB_ENABLED + " BOOLEAN "
       + "DEFAULT TRUE";
 
+  // DDL: Add creation_user column to table SQ_JOB
+  public static final String QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_CREATION_USER =
+      "ALTER TABLE " + TABLE_SQ_JOB + " ADD "
+      + COLUMN_SQB_CREATION_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
+  // DDL: Add update_user column to table SQ_JOB
+  public static final String QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_UPDATE_USER =
+      "ALTER TABLE " + TABLE_SQ_JOB + " ADD "
+      + COLUMN_SQB_UPDATE_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
   // DDL: Create table SQ_CONNECTION_INPUT
   public static final String QUERY_CREATE_TABLE_SQ_CONNECTION_INPUT =
       "CREATE TABLE " + TABLE_SQ_CONNECTION_INPUT + " ("
@@ -332,6 +362,18 @@ public final class DerbySchemaQuery {
         + "REFERENCES " + TABLE_SQ_JOB + "("  + COLUMN_SQB_ID + ") ON DELETE CASCADE"
     +  ")";
 
+  // DDL: Add creation_user column to table SQ_SUBMISSION
+  public static final String QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_CREATION_USER =
+      "ALTER TABLE " + TABLE_SQ_SUBMISSION + " ADD "
+      + COLUMN_SQS_CREATION_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
+  // DDL: Add update_user column to table SQ_SUBMISSION
+  public static final String QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_UPDATE_USER =
+      "ALTER TABLE " + TABLE_SQ_SUBMISSION + " ADD "
+      + COLUMN_SQS_UPDATE_USER + " VARCHAR(32) "
+      + "DEFAULT NULL";
+
   // DDL: Create table SQ_COUNTER_GROUP
   public static final String QUERY_CREATE_TABLE_SQ_COUNTER_GROUP =
     "CREATE TABLE " + TABLE_SQ_COUNTER_GROUP + " ("
@@ -558,10 +600,12 @@ public final class DerbySchemaQuery {
     "INSERT INTO " + TABLE_SQ_CONNECTION + " ("
     + COLUMN_SQN_NAME + ", "
     + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_ENABLED + ", "
+    + COLUMN_SQN_CREATION_USER + ", "
     + COLUMN_SQN_CREATION_DATE + ", "
-    + COLUMN_SQN_UPDATE_DATE + ", "
-    + COLUMN_SQN_ENABLED
-    + ") VALUES (?, ?, ?, ?, ?)";
+    + COLUMN_SQN_UPDATE_USER + ", "
+    + COLUMN_SQN_UPDATE_DATE
+    + ") VALUES (?, ?, ?, ?, ?, ?, ?)";
 
   // DML: Insert new connection inputs
   public static final String STMT_INSERT_CONNECTION_INPUT =
@@ -575,6 +619,7 @@ public final class DerbySchemaQuery {
   public static final String STMT_UPDATE_CONNECTION =
     "UPDATE " + TABLE_SQ_CONNECTION + " SET "
     + COLUMN_SQN_NAME + " = ?, "
+    + COLUMN_SQN_UPDATE_USER + " = ?, "
     + COLUMN_SQN_UPDATE_DATE + " = ? "
     + " WHERE " + COLUMN_SQN_ID + " = ?";
 
@@ -600,9 +645,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQN_ID + ", "
     + COLUMN_SQN_NAME + ", "
     + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_ENABLED + ", "
+    + COLUMN_SQN_CREATION_USER + ", "
     + COLUMN_SQN_CREATION_DATE + ", "
-    + COLUMN_SQN_UPDATE_DATE + ", "
-    + COLUMN_SQN_ENABLED
+    + COLUMN_SQN_UPDATE_USER + ", "
+    + COLUMN_SQN_UPDATE_DATE
     + " FROM " + TABLE_SQ_CONNECTION
     + " WHERE " + COLUMN_SQN_ID + " = ?";
 
@@ -612,9 +659,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQN_ID + ", "
     + COLUMN_SQN_NAME + ", "
     + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_ENABLED + ", "
+    + COLUMN_SQN_CREATION_USER + ", "
     + COLUMN_SQN_CREATION_DATE + ", "
-    + COLUMN_SQN_UPDATE_DATE + ", "
-    + COLUMN_SQN_ENABLED
+    + COLUMN_SQN_UPDATE_USER + ", "
+    + COLUMN_SQN_UPDATE_DATE
     + " FROM " + TABLE_SQ_CONNECTION;
 
   // DML: Select all connections for a specific connector.
@@ -623,9 +672,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQN_ID + ", "
     + COLUMN_SQN_NAME + ", "
     + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_CREATION_USER + ", "
     + COLUMN_SQN_CREATION_DATE + ", "
-    + COLUMN_SQN_UPDATE_DATE + ", "
-    + COLUMN_SQN_ENABLED
+    + COLUMN_SQN_ENABLED + ", "
+    + COLUMN_SQN_UPDATE_USER + ", "
+    + COLUMN_SQN_UPDATE_DATE
     + " FROM " + TABLE_SQ_CONNECTION
     + " WHERE " + COLUMN_SQN_CONNECTOR + " = ?";
 
@@ -640,10 +691,12 @@ public final class DerbySchemaQuery {
     + COLUMN_SQB_NAME + ", "
     + COLUMN_SQB_CONNECTION + ", "
     + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_ENABLED + ", "
+    + COLUMN_SQB_CREATION_USER + ", "
     + COLUMN_SQB_CREATION_DATE + ", "
-    + COLUMN_SQB_UPDATE_DATE + ", "
-    + COLUMN_SQB_ENABLED
-    + ") VALUES (?, ?, ?, ?, ?, ?)";
+    + COLUMN_SQB_UPDATE_USER + ", "
+    + COLUMN_SQB_UPDATE_DATE
+    + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
 
   // DML: Insert new job inputs
   public static final String STMT_INSERT_JOB_INPUT =
@@ -656,6 +709,7 @@ public final class DerbySchemaQuery {
   public static final String STMT_UPDATE_JOB =
     "UPDATE " + TABLE_SQ_JOB + " SET "
     + COLUMN_SQB_NAME + " = ?, "
+    + COLUMN_SQB_UPDATE_USER + " = ?, "
     + COLUMN_SQB_UPDATE_DATE + " = ? "
     + " WHERE " + COLUMN_SQB_ID + " = ?";
 
@@ -697,9 +751,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQB_NAME + ", "
     + COLUMN_SQB_CONNECTION + ", "
     + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_ENABLED + ", "
+    + COLUMN_SQB_CREATION_USER + ", "
     + COLUMN_SQB_CREATION_DATE + ", "
-    + COLUMN_SQB_UPDATE_DATE + ", "
-    + COLUMN_SQB_ENABLED
+    + COLUMN_SQB_UPDATE_USER + ", "
+    + COLUMN_SQB_UPDATE_DATE
     + " FROM " + TABLE_SQ_JOB
     + " LEFT JOIN " + TABLE_SQ_CONNECTION
     + " ON " + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID
@@ -713,9 +769,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQB_NAME + ", "
     + COLUMN_SQB_CONNECTION + ", "
     + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_ENABLED + ", "
+    + COLUMN_SQB_CREATION_USER + ", "
     + COLUMN_SQB_CREATION_DATE + ", "
-    + COLUMN_SQB_UPDATE_DATE + ", "
-    + COLUMN_SQB_ENABLED
+    + COLUMN_SQB_UPDATE_USER + ", "
+    + COLUMN_SQB_UPDATE_DATE
     + " FROM " + TABLE_SQ_JOB
     + " LEFT JOIN " + TABLE_SQ_CONNECTION
       + " ON " + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID;
@@ -728,9 +786,11 @@ public final class DerbySchemaQuery {
     + COLUMN_SQB_NAME + ", "
     + COLUMN_SQB_CONNECTION + ", "
     + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_ENABLED + ", "
+    + COLUMN_SQB_CREATION_USER + ", "
     + COLUMN_SQB_CREATION_DATE + ", "
-    + COLUMN_SQB_UPDATE_DATE + ", "
-    + COLUMN_SQB_ENABLED
+    + COLUMN_SQB_UPDATE_USER + ", "
+    + COLUMN_SQB_UPDATE_DATE
     + " FROM " + TABLE_SQ_JOB
     + " LEFT JOIN " + TABLE_SQ_CONNECTION
       + " ON " + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID
@@ -741,18 +801,21 @@ public final class DerbySchemaQuery {
     "INSERT INTO " + TABLE_SQ_SUBMISSION + "("
     + COLUMN_SQS_JOB + ", "
     + COLUMN_SQS_STATUS + ", "
+    + COLUMN_SQS_CREATION_USER + ", "
     + COLUMN_SQS_CREATION_DATE + ", "
+    + COLUMN_SQS_UPDATE_USER + ", "
     + COLUMN_SQS_UPDATE_DATE + ", "
     + COLUMN_SQS_EXTERNAL_ID + ", "
     + COLUMN_SQS_EXTERNAL_LINK + ", "
     + COLUMN_SQS_EXCEPTION + ", "
     + COLUMN_SQS_EXCEPTION_TRACE + ") "
-    + " VALUES(?, ?, ?, ?, ?, substr(?, 1, 150) , substr(?, 1, 150), substr(?, 1, 750))";
+    + " VALUES(?, ?, ?, ?, ?, ?, ?, substr(?, 1, 150) , substr(?, 1, 150), substr(?, 1, 750))";
 
   // DML: Update existing submission
   public static final String STMT_UPDATE_SUBMISSION =
     "UPDATE " + TABLE_SQ_SUBMISSION + " SET "
     + COLUMN_SQS_STATUS + " = ?, "
+    + COLUMN_SQS_UPDATE_USER + " = ?, "
     + COLUMN_SQS_UPDATE_DATE + " = ?, "
     + COLUMN_SQS_EXCEPTION + " = ?, "
     + COLUMN_SQS_EXCEPTION_TRACE + " = ?"
@@ -776,7 +839,9 @@ public final class DerbySchemaQuery {
     + COLUMN_SQS_ID + ", "
     + COLUMN_SQS_JOB + ", "
     + COLUMN_SQS_STATUS + ", "
+    + COLUMN_SQS_CREATION_USER + ", "
     + COLUMN_SQS_CREATION_DATE + ", "
+    + COLUMN_SQS_UPDATE_USER + ", "
     + COLUMN_SQS_UPDATE_DATE + ", "
     + COLUMN_SQS_EXTERNAL_ID + ", "
     + COLUMN_SQS_EXTERNAL_LINK + ", "
@@ -791,7 +856,9 @@ public final class DerbySchemaQuery {
     + COLUMN_SQS_ID + ", "
     + COLUMN_SQS_JOB + ", "
     + COLUMN_SQS_STATUS + ", "
+    + COLUMN_SQS_CREATION_USER + ", "
     + COLUMN_SQS_CREATION_DATE + ", "
+    + COLUMN_SQS_UPDATE_USER + ", "
     + COLUMN_SQS_UPDATE_DATE + ", "
     + COLUMN_SQS_EXTERNAL_ID + ", "
     + COLUMN_SQS_EXTERNAL_LINK + ", "
@@ -806,7 +873,9 @@ public final class DerbySchemaQuery {
     + COLUMN_SQS_ID + ", "
     + COLUMN_SQS_JOB + ", "
     + COLUMN_SQS_STATUS + ", "
+    + COLUMN_SQS_CREATION_USER + ", "
     + COLUMN_SQS_CREATION_DATE + ", "
+    + COLUMN_SQS_UPDATE_USER + ", "
     + COLUMN_SQS_UPDATE_DATE + ", "
     + COLUMN_SQS_EXTERNAL_ID + ", "
     + COLUMN_SQS_EXTERNAL_LINK + ", "

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/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 eac87b8..8a5aee8 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
@@ -102,6 +102,12 @@ abstract public class DerbyTestCase extends TestCase {
     runQuery(QUERY_CREATE_TABLE_SQ_SYSTEM);
     runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_ENABLED);
     runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_ENABLED);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_CREATION_USER);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_CONNECTION_ADD_COLUMN_UPDATE_USER);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_CREATION_USER);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_COLUMN_UPDATE_USER);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_CREATION_USER);
+    runQuery(QUERY_UPGRADE_TABLE_SQ_SUBMISSION_ADD_COLUMN_UPDATE_USER);
     runQuery("INSERT INTO SQOOP.SQ_SYSTEM(SQM_KEY, SQM_VALUE) VALUES('version', '2')");
     runQuery("INSERT INTO SQOOP.SQ_SYSTEM(SQM_KEY, SQM_VALUE) " +
       "VALUES('framework.version', '1')");

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
index 875729f..c9c7648 100644
--- a/server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
@@ -138,11 +138,14 @@ public class ConnectionRequestHandler implements RequestHandler {
 //    String sxid = ctx.getLastURLElement();
 //    long xid = Long.valueOf(sxid);
 
+    String username = ctx.getUserName();
+
     ConnectionBean bean = new ConnectionBean();
 
     try {
       JSONObject json =
         (JSONObject) JSONValue.parse(ctx.getRequest().getReader());
+
       bean.restore(json);
     } catch (IOException e) {
       throw new SqoopException(ServerError.SERVER_0003,
@@ -211,8 +214,11 @@ public class ConnectionRequestHandler implements RequestHandler {
             .logAuditEvent(ctx.getUserName(), ctx.getRequest().getRemoteAddr(),
             "update", "connection", String.valueOf(connection.getPersistenceId()));
 
+        connection.setLastUpdateUser(username);
         RepositoryManager.getInstance().getRepository().updateConnection(connection);
       } else {
+        connection.setCreationUser(username);
+        connection.setLastUpdateUser(username);
         RepositoryManager.getInstance().getRepository().createConnection(connection);
         outputBean.setId(connection.getPersistenceId());
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/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 59a4511..362ba79 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -138,6 +138,8 @@ public class JobRequestHandler implements RequestHandler {
 //    String sxid = ctx.getLastURLElement();
 //    long xid = Long.valueOf(sxid);
 
+    String username = ctx.getUserName();
+
     JobBean bean = new JobBean();
 
     try {
@@ -210,8 +212,11 @@ public class JobRequestHandler implements RequestHandler {
             .logAuditEvent(ctx.getUserName(), ctx.getRequest().getRemoteAddr(),
             "update", "job", String.valueOf(job.getPersistenceId()));
 
+        job.setLastUpdateUser(username);
         RepositoryManager.getInstance().getRepository().updateJob(job);
       } else {
+        job.setCreationUser(username);
+        job.setLastUpdateUser(username);
         RepositoryManager.getInstance().getRepository().createJob(job);
         outputBean.setId(job.getPersistenceId());
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/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 6d9777a..6e21dd9 100644
--- a/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
@@ -28,6 +28,7 @@ import org.apache.sqoop.json.JsonBean;
 import org.apache.sqoop.json.SubmissionBean;
 import org.apache.sqoop.model.MSubmission;
 import org.apache.sqoop.repository.RepositoryManager;
+import org.apache.sqoop.request.HttpEventContext;
 import org.apache.sqoop.server.RequestContext;
 import org.apache.sqoop.server.RequestHandler;
 import org.apache.sqoop.server.common.ServerError;
@@ -95,6 +96,10 @@ public class SubmissionRequestHandler implements RequestHandler {
   private JsonBean handleActionEvent(RequestContext ctx, String sjid) {
     long jid = Long.parseLong(sjid);
 
+    String username = ctx.getUserName();
+    HttpEventContext ectx = new HttpEventContext();
+    ectx.setUsername(username);
+
     switch (ctx.getMethod()) {
       case GET:
         AuditLoggerManager.getInstance()
@@ -114,13 +119,13 @@ public class SubmissionRequestHandler implements RequestHandler {
             .logAuditEvent(ctx.getUserName(), ctx.getRequest().getRemoteAddr(),
             "submit", "submission", String.valueOf(jid));
 
-        return submissionSubmit(jid);
+        return submissionSubmit(jid, ectx);
       case DELETE:
         AuditLoggerManager.getInstance()
             .logAuditEvent(ctx.getUserName(), ctx.getRequest().getRemoteAddr(),
             "stop", "submission", String.valueOf(jid));
 
-        return submissionStop(jid);
+        return submissionStop(jid, ectx);
     }
 
     return null;
@@ -138,13 +143,13 @@ public class SubmissionRequestHandler implements RequestHandler {
     }
   }
 
-  private JsonBean submissionStop(long jid) {
-    MSubmission submission = JobManager.getInstance().stop(jid);
+  private JsonBean submissionStop(long jid, HttpEventContext ctx) {
+    MSubmission submission = JobManager.getInstance().stop(jid, ctx);
     return new SubmissionBean(submission);
   }
 
-  private JsonBean submissionSubmit(long jid) {
-    MSubmission submission = JobManager.getInstance().submit(jid);
+  private JsonBean submissionSubmit(long jid, HttpEventContext ctx) {
+    MSubmission submission = JobManager.getInstance().submit(jid, ctx);
     return new SubmissionBean(submission);
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java
index b7204ff..b55d5d1 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowConnectionFunction.java
@@ -107,7 +107,9 @@ public class ShowConnectionFunction extends SqoopFunction {
       connection.getPersistenceId(),
       connection.getName(),
       connection.getEnabled(),
+      connection.getCreationUser(),
       formatter.format(connection.getCreationDate()),
+      connection.getLastUpdateUser(),
       formatter.format(connection.getLastUpdateDate())
     );
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
index fc6f416..da4a4ff 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
@@ -109,7 +109,9 @@ public class ShowJobFunction extends SqoopFunction {
       job.getPersistenceId(),
       job.getName(),
       job.getEnabled(),
+      job.getCreationUser(),
       formatter.format(job.getCreationDate()),
+      job.getLastUpdateUser(),
       formatter.format(job.getLastUpdateDate())
     );
     printlnResource(Constants.RES_SHOW_PROMPT_JOB_XID_CID_INFO,

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
index 0e33d42..475f41c 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java
@@ -428,8 +428,12 @@ public class Constants {
       "submission.submission_detail";
   public static final String RES_SUBMISSION_JOB_ID =
       "submission.job_id";
+  public static final String RES_SUBMISSION_CREATION_USER =
+      "submission.creation_user";
   public static final String RES_SUBMISSION_CREATION_DATE =
       "submission.creation_date";
+  public static final String RES_SUBMISSION_UPDATE_USER =
+      "submission.update_user";
   public static final String RES_SUBMISSION_EXTERNAL_ID =
       "submission.external_id";
   public static final String RES_SUBMISSION_PROGRESS_NOT_AVAIL =

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java b/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java
index 1f61fb2..6dbd870 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/utils/SubmissionDisplayer.java
@@ -48,9 +48,15 @@ public final class SubmissionDisplayer {
     print(resourceString(Constants.RES_SUBMISSION_SERVER_URL)+": ");
     println(getServerUrl());
 
+    print(resourceString(Constants.RES_SUBMISSION_CREATION_USER) + ": ");
+    println(submission.getCreationUser());
+
     print(resourceString(Constants.RES_SUBMISSION_CREATION_DATE)+": ");
     println(dateFormat.format(submission.getCreationDate()));
 
+    print(resourceString(Constants.RES_SUBMISSION_UPDATE_USER) + ": ");
+    println(submission.getLastUpdateUser());
+
     String externalId = submission.getExternalId();
     if(externalId != null) {
       print(resourceString(Constants.RES_SUBMISSION_EXTERNAL_ID)+": ");

http://git-wip-us.apache.org/repos/asf/sqoop/blob/c07c8575/shell/src/main/resources/shell-resource.properties
----------------------------------------------------------------------
diff --git a/shell/src/main/resources/shell-resource.properties b/shell/src/main/resources/shell-resource.properties
index 1a8f963..df9457d 100644
--- a/shell/src/main/resources/shell-resource.properties
+++ b/shell/src/main/resources/shell-resource.properties
@@ -136,7 +136,7 @@ show.prompt_display_all_conns = Display all connections
 show.prompt_display_conn_xid = Display the connection with xid
 show.conn_usage = Usage: show connection
 show.prompt_conns_to_show = @|bold {0} connection(s) to show: |@
-show.prompt_conn_info = Connection with id {0} and name {1} (Enabled: {2}, Created {3}, Updated {4})
+show.prompt_conn_info = Connection with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6})
 show.prompt_conn_cid_info = Using Connector id {0}
 
 show.prompt_display_all_connectors = Display all connectors
@@ -153,7 +153,7 @@ show.prompt_display_all_jobs = Display all jobs
 show.prompt_display_job_jid = Display jobwith given jid
 show.job_usage = Usage: show job
 show.prompt_jobs_to_show = @|bold {0} job(s) to show: |@
-show.prompt_job_info = Job with id {0} and name {1} (Enabled: {2}, Created {3}, Updated {4})
+show.prompt_job_info = Job with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6})
 show.prompt_job_xid_cid_info = Using Connection id {0} and Connector id {1}
 
 show.prompt_display_all_submissions = Display all submissions
@@ -222,7 +222,9 @@ formdisplayer.warning_message = There were warnings while create or update, but
 
 submission.submission_detail = Submission details
 submission.job_id = Job ID
+submission.creation_user = Created by
 submission.creation_date = Creation date
+submission.update_user = Lastly updated by
 submission.external_id = External ID
 submission.progress_not_available = Progress is not available
 submission.counters = Counters


Mime
View raw message