sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cheol...@apache.org
Subject git commit: SQOOP-806: Put "creation" and "lastUpdate" date to Connection and Job objects
Date Wed, 09 Jan 2013 20:48:28 GMT
Updated Branches:
  refs/heads/sqoop2 4f8eb4373 -> 5b2fbfd1c


SQOOP-806: Put "creation" and "lastUpdate" date to Connection and Job objects

(Jarek Jarcec Cecho via Cheolsoo Park)


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

Branch: refs/heads/sqoop2
Commit: 5b2fbfd1c7d4cb5ebaa613491b1677b05b359c98
Parents: 4f8eb43
Author: Cheolsoo Park <cheolsoo@apache.org>
Authored: Wed Jan 9 12:47:32 2013 -0800
Committer: Cheolsoo Park <cheolsoo@apache.org>
Committed: Wed Jan 9 12:47:32 2013 -0800

----------------------------------------------------------------------
 .../sqoop/client/shell/ShowConnectionFunction.java |   13 +-
 .../apache/sqoop/client/shell/ShowJobFunction.java |   13 +-
 .../src/main/resources/client-resource.properties  |    4 +-
 .../java/org/apache/sqoop/json/ConnectionBean.java |    5 +
 .../main/java/org/apache/sqoop/json/JobBean.java   |    5 +
 .../apache/sqoop/json/util/FormSerialization.java  |    2 +
 .../org/apache/sqoop/model/MAccountableEntity.java |   58 +++++++
 .../java/org/apache/sqoop/model/MConnection.java   |    2 +-
 .../src/main/java/org/apache/sqoop/model/MJob.java |    2 +-
 .../java/org/apache/sqoop/model/MSubmission.java   |   40 +----
 .../org/apache/sqoop/json/TestConnectionBean.java  |    8 +
 .../java/org/apache/sqoop/json/TestJobBean.java    |    8 +
 .../repository/derby/DerbyRepositoryHandler.java   |   20 ++-
 .../repository/derby/DerbySchemaConstants.java     |    8 +
 .../sqoop/repository/derby/DerbySchemaQuery.java   |  133 ++++++++++-----
 15 files changed, 229 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/client/src/main/java/org/apache/sqoop/client/shell/ShowConnectionFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/ShowConnectionFunction.java
b/client/src/main/java/org/apache/sqoop/client/shell/ShowConnectionFunction.java
index 17cb84a..8066789 100644
--- a/client/src/main/java/org/apache/sqoop/client/shell/ShowConnectionFunction.java
+++ b/client/src/main/java/org/apache/sqoop/client/shell/ShowConnectionFunction.java
@@ -25,6 +25,7 @@ import org.apache.sqoop.model.MConnection;
 import org.codehaus.groovy.tools.shell.IO;
 
 import java.io.PrintWriter;
+import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.util.List;
 
@@ -89,10 +90,16 @@ public class ShowConnectionFunction extends SqoopFunction {
 
     io.out.println(s);
 
+    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+
     for (MConnection connection : connections) {
-      s =  MessageFormat.format(getResource().getString
-          (Constants.RES_SHOW_PROMPT_CONN_INFO), connection.getPersistenceId(),
-          connection.getName());
+      s =  MessageFormat.format(
+        getResource().getString(Constants.RES_SHOW_PROMPT_CONN_INFO),
+        connection.getPersistenceId(),
+        connection.getName(),
+        formatter.format(connection.getCreationDate()),
+        formatter.format(connection.getLastUpdateDate())
+      );
       io.out.println(s);
 
       long connectorId = connection.getConnectorId();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/client/src/main/java/org/apache/sqoop/client/shell/ShowJobFunction.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/shell/ShowJobFunction.java b/client/src/main/java/org/apache/sqoop/client/shell/ShowJobFunction.java
index b0780ef..851ddca 100644
--- a/client/src/main/java/org/apache/sqoop/client/shell/ShowJobFunction.java
+++ b/client/src/main/java/org/apache/sqoop/client/shell/ShowJobFunction.java
@@ -25,6 +25,7 @@ import org.apache.sqoop.model.MJob;
 import org.codehaus.groovy.tools.shell.IO;
 
 import java.io.PrintWriter;
+import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.util.List;
 
@@ -84,10 +85,16 @@ public class ShowJobFunction extends SqoopFunction {
     String s = MessageFormat.format(getResource().getString(Constants.RES_SHOW_PROMPT_JOBS_TO_SHOW),
jobs.size());
     io.out.println(s);
 
+    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+
     for (MJob job : jobs) {
-      s = MessageFormat.format(getResource().getString
-          (Constants.RES_SHOW_PROMPT_JOB_INFO), job.getPersistenceId(),
-          job.getName());
+      s = MessageFormat.format(
+        getResource().getString(Constants.RES_SHOW_PROMPT_JOB_INFO),
+        job.getPersistenceId(),
+        job.getName(),
+        formatter.format(job.getCreationDate()),
+        formatter.format(job.getLastUpdateDate())
+      );
       io.out.println(s);
 
       long connectorId = job.getConnectorId();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/client/src/main/resources/client-resource.properties
----------------------------------------------------------------------
diff --git a/client/src/main/resources/client-resource.properties b/client/src/main/resources/client-resource.properties
index 7bc7486..8d69463 100644
--- a/client/src/main/resources/client-resource.properties
+++ b/client/src/main/resources/client-resource.properties
@@ -120,7 +120,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}
+show.prompt_conn_info = Connection with id {0} and name {1} (Created {2}, Updated {3})
 
 show.prompt_display_all_connectors = Display all connectors
 show.prompt_display_connector_cid = Display the connector with xid
@@ -136,7 +136,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}
+show.prompt_job_info = Job with id {0} and name {1} (Created {2}, Updated {3})
 
 show.prompt_display_all_servers = Display all server information
 show.prompt_display_server_host = Display server host name

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 4562047..dbc0f93 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
@@ -24,6 +24,7 @@ import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -103,6 +104,8 @@ 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(CONNECTOR_ID, connection.getConnectorId());
       object.put(CONNECTOR_PART,
         extractForms(connection.getConnectorPart().getForms()));
@@ -154,6 +157,8 @@ 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)));
 
       connections.add(connection);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 539efe0..a16c06e 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -24,6 +24,7 @@ import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -106,6 +107,8 @@ 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(CONNECTION_ID, job.getConnectionId());
       object.put(CONNECTOR_ID, job.getConnectorId());
       object.put(CONNECTOR_PART,
@@ -166,6 +169,8 @@ 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)));
 
       jobs.add(job);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 e4919b2..8b40a54 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
@@ -42,6 +42,8 @@ public final class FormSerialization {
   public static final String NAME = "name";
   public static final String VERSION = "version";
   public static final String CLASS = "class";
+  public static final String CREATED = "created";
+  public static final String UPDATED = "updated";
   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/5b2fbfd1/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
new file mode 100644
index 0000000..137e71c
--- /dev/null
+++ b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
@@ -0,0 +1,58 @@
+/**
+ * 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.model;
+
+import java.util.Date;
+
+/**
+ * Accountable entity provides additional fields that might help with identifying
+ * what and when has happened.
+ */
+abstract public class MAccountableEntity extends MPersistableEntity {
+
+  /**
+   * Date when the entity was created.
+   */
+  private Date creationDate;
+
+  /**
+   * Date when the entity was lastly updated.
+   */
+  private Date lastUpdateDate;
+
+  public MAccountableEntity() {
+    this.creationDate = new Date();
+    this.lastUpdateDate = this.creationDate;
+  }
+
+  public void setCreationDate(Date createDate) {
+    this.creationDate = createDate;
+  }
+
+  public Date getCreationDate() {
+    return creationDate;
+  }
+
+  public void setLastUpdateDate(Date lastUpdateDate) {
+    this.lastUpdateDate = lastUpdateDate;
+  }
+
+  public Date getLastUpdateDate() {
+    return lastUpdateDate;
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/common/src/main/java/org/apache/sqoop/model/MConnection.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MConnection.java b/common/src/main/java/org/apache/sqoop/model/MConnection.java
index 5af25a9..bc730bb 100644
--- a/common/src/main/java/org/apache/sqoop/model/MConnection.java
+++ b/common/src/main/java/org/apache/sqoop/model/MConnection.java
@@ -21,7 +21,7 @@ package org.apache.sqoop.model;
  * Model describing entire connection object including both connector and
  * framework part.
  */
-public class MConnection extends MPersistableEntity {
+public class MConnection extends MAccountableEntity {
   private long connectorId;
   private String name;
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/common/src/main/java/org/apache/sqoop/model/MJob.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MJob.java b/common/src/main/java/org/apache/sqoop/model/MJob.java
index 87f222d..a53f04e 100644
--- a/common/src/main/java/org/apache/sqoop/model/MJob.java
+++ b/common/src/main/java/org/apache/sqoop/model/MJob.java
@@ -23,7 +23,7 @@ import org.apache.sqoop.common.SqoopException;
  * Model describing entire job object including both connector and
  * framework part.
  */
-public class MJob extends MPersistableEntity {
+public class MJob extends MAccountableEntity {
 
   public static enum Type {
     IMPORT,

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/common/src/main/java/org/apache/sqoop/model/MSubmission.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MSubmission.java b/common/src/main/java/org/apache/sqoop/model/MSubmission.java
index 24f175b..e15c466 100644
--- a/common/src/main/java/org/apache/sqoop/model/MSubmission.java
+++ b/common/src/main/java/org/apache/sqoop/model/MSubmission.java
@@ -30,7 +30,7 @@ import java.util.Date;
  * Please note that not all properties are persisted in repository at the
  * moment.
  */
-public class MSubmission extends MPersistableEntity {
+public class MSubmission extends MAccountableEntity {
 
   /**
    * Job id that this submission object belongs.
@@ -43,20 +43,6 @@ public class MSubmission extends MPersistableEntity {
   private long jobId;
 
   /**
-   * Point in time when we submitted this submission.
-   *
-   * This property is required and will be always present.
-   */
-  private Date creationDate;
-
-  /**
-   * Date of last update to this submission instance
-   *
-   * This property is required and will be always present.
-   */
-  private Date lastUpdateDate;
-
-  /**
    * Last known submission status.
    *
    * This property is required and will be always present.
@@ -108,15 +94,11 @@ public class MSubmission extends MPersistableEntity {
   public MSubmission() {
     status = SubmissionStatus.UNKNOWN;
     progress = -1;
-    creationDate = new Date();
-    lastUpdateDate = creationDate;
   }
 
   public MSubmission(long jobId, Date creationDate, SubmissionStatus status) {
     this();
     this.jobId = jobId;
-    this.creationDate = creationDate;
-    this.lastUpdateDate = creationDate;
     this.status = status;
   }
 
@@ -145,22 +127,6 @@ public class MSubmission extends MPersistableEntity {
     return jobId;
   }
 
-  public void setCreationDate(Date submissionDate) {
-    this.creationDate = submissionDate;
-  }
-
-  public Date getCreationDate() {
-    return creationDate;
-  }
-
-  public void setLastUpdateDate(Date date) {
-    this.lastUpdateDate = date;
-  }
-
-  public Date getLastUpdateDate() {
-    return lastUpdateDate;
-  }
-
   public void setStatus(SubmissionStatus status) {
     this.status = status;
   }
@@ -232,8 +198,8 @@ public class MSubmission extends MPersistableEntity {
   public String toString() {
     return "MSubmission{" +
       "jobId=" + jobId +
-      ", creationDate=" + creationDate +
-      ", lastUpdateDate=" + lastUpdateDate +
+      ", creationDate=" + getCreationDate() +
+      ", lastUpdateDate=" + getLastUpdateDate() +
       ", status=" + status +
       ", externalId='" + externalId + '\'' +
       ", progress=" + progress +

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 c11b600..1322dd3 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
@@ -23,6 +23,8 @@ import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.junit.Test;
 
+import java.util.Date;
+
 import static junit.framework.Assert.*;
 import static org.apache.sqoop.json.TestUtil.*;
 
@@ -32,9 +34,13 @@ import static org.apache.sqoop.json.TestUtil.*;
 public class TestConnectionBean {
   @Test
   public void testSerialization() {
+    Date created = new Date();
+    Date updated = new Date();
     MConnection connection = getConnection("ahoj");
     connection.setName("Connection");
     connection.setPersistenceId(666);
+    connection.setCreationDate(created);
+    connection.setLastUpdateDate(updated);
 
     // Fill some data at the beginning
     MStringInput input = (MStringInput) connection.getConnectorPart().getForms()
@@ -57,6 +63,8 @@ public class TestConnectionBean {
     // Check id and name
     assertEquals(666, target.getPersistenceId());
     assertEquals("Connection", target.getName());
+    assertEquals(created, target.getCreationDate());
+    assertEquals(updated, target.getLastUpdateDate());
 
     // Test that value was correctly moved
     MStringInput targetInput = (MStringInput) target.getConnectorPart()

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
index 521b2b9..3ea30ce 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
@@ -24,6 +24,8 @@ import org.json.simple.JSONValue;
 import org.json.simple.parser.ParseException;
 import org.junit.Test;
 
+import java.util.Date;
+
 import static junit.framework.Assert.assertEquals;
 import static org.apache.sqoop.json.TestUtil.getJob;
 
@@ -33,9 +35,13 @@ import static org.apache.sqoop.json.TestUtil.getJob;
 public class TestJobBean {
   @Test
   public void testSerialization() throws ParseException {
+    Date created = new Date();
+    Date updated = new Date();
     MJob job = getJob("ahoj", MJob.Type.IMPORT);
     job.setName("The big job");
     job.setPersistenceId(666);
+    job.setCreationDate(created);
+    job.setLastUpdateDate(updated);
 
     // Fill some data at the beginning
     MStringInput input = (MStringInput) job.getConnectorPart().getForms()
@@ -59,6 +65,8 @@ public class TestJobBean {
     assertEquals(666, target.getPersistenceId());
     assertEquals(MJob.Type.IMPORT, target.getType());
     assertEquals("The big job", target.getName());
+    assertEquals(created, target.getCreationDate());
+    assertEquals(updated, target.getLastUpdateDate());
 
     // Test that value was correctly moved
     MStringInput targetInput = (MStringInput) target.getConnectorPart()

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 9793898..5e24ae3 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
@@ -424,6 +424,8 @@ public class DerbyRepositoryHandler implements 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()));
 
       result = stmt.executeUpdate();
       if (result != 1) {
@@ -473,7 +475,9 @@ public class DerbyRepositoryHandler implements JdbcRepositoryHandler {
       // Update CONNECTION table
       updateStmt = conn.prepareStatement(STMT_UPDATE_CONNECTION);
       updateStmt.setString(1, connection.getName());
-      updateStmt.setLong(2, connection.getPersistenceId());
+      updateStmt.setTimestamp(2, new Timestamp(new Date().getTime()));
+
+      updateStmt.setLong(3, connection.getPersistenceId());
       updateStmt.executeUpdate();
 
       // And reinsert new values
@@ -622,6 +626,8 @@ public class DerbyRepositoryHandler implements 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()));
 
       result = stmt.executeUpdate();
       if (result != 1) {
@@ -671,7 +677,9 @@ public class DerbyRepositoryHandler implements JdbcRepositoryHandler {
       // Update job table
       updateStmt = conn.prepareStatement(STMT_UPDATE_JOB);
       updateStmt.setString(1, job.getName());
-      updateStmt.setLong(2, job.getPersistenceId());
+      updateStmt.setTimestamp(2, new Timestamp(new Date().getTime()));
+
+      updateStmt.setLong(3, job.getPersistenceId());
       updateStmt.executeUpdate();
 
       // And reinsert new values
@@ -1171,6 +1179,8 @@ public class DerbyRepositoryHandler implements 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);
 
         formConnectorFetchStmt =
           conn.prepareStatement(STMT_FETCH_FORM_CONNECTOR);
@@ -1203,6 +1213,8 @@ public class DerbyRepositoryHandler implements JdbcRepositoryHandler
{
 
         connection.setPersistenceId(id);
         connection.setName(name);
+        connection.setCreationDate(creationDate);
+        connection.setLastUpdateDate(lastUpdateDate);
 
         connections.add(connection);
       }
@@ -1233,6 +1245,8 @@ public class DerbyRepositoryHandler implements 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);
 
         MJob.Type type = MJob.Type.valueOf(stringType);
 
@@ -1267,6 +1281,8 @@ public class DerbyRepositoryHandler implements JdbcRepositoryHandler
{
 
         job.setPersistenceId(id);
         job.setName(name);
+        job.setCreationDate(creationDate);
+        job.setLastUpdateDate(lastUpdateDate);
 
         jobs.add(job);
       }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 875b41a..e1b1128 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
@@ -93,6 +93,10 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQN_CONNECTOR = "SQN_CONNECTOR";
 
+  public static final String COLUMN_SQN_CREATION_DATE = "SQN_CREATION_DATE";
+
+  public static final String COLUMN_SQN_UPDATE_DATE = "SQN_UPDATE_DATE";
+
   // SQ_JOB
 
   public static final String TABLE_SQ_JOB_NAME = "SQ_JOB";
@@ -108,6 +112,10 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQB_CONNECTION = "SQB_CONNECTION";
 
+  public static final String COLUMN_SQB_CREATION_DATE = "SQB_CREATION_DATE";
+
+  public static final String COLUMN_SQB_UPDATE_DATE = "SQB_UPDATE_DATE";
+
   // SQ_CONNECTION_INPUT
 
   public static final String TABLE_SQ_CONNECTION_INPUT_NAME =

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5b2fbfd1/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 d0fd598..d94ecc5 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
@@ -71,26 +71,30 @@ 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)
- *    +----------------------------+
+ *    +------------------------------+
+ *    | 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   |
+ *    +------------------------------+
  * </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)
- *    +----------------------------+
+ *    +------------------------------+
+ *    | 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   |
+ *    +------------------------------+
  * </pre>
  * </p>
  * <p>
@@ -222,6 +226,8 @@ public final class DerbySchemaQuery {
       + COLUMN_SQN_ID + " BIGINT GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY
1) PRIMARY KEY, "
       + COLUMN_SQN_CONNECTOR + " BIGINT, "
       + COLUMN_SQN_NAME  + " VARCHAR(32),"
+      + COLUMN_SQN_CREATION_DATE + " TIMESTAMP,"
+      + COLUMN_SQN_UPDATE_DATE + " TIMESTAMP,"
       + " FOREIGN KEY(" + COLUMN_SQN_CONNECTOR + ") REFERENCES " + TABLE_SQ_CONNECTOR + "
(" + COLUMN_SQC_ID + ")"
       + ")";
 
@@ -232,6 +238,8 @@ public final class DerbySchemaQuery {
       + COLUMN_SQB_CONNECTION + " BIGINT, "
       + COLUMN_SQB_NAME + " VARCHAR(64), "
       + COLUMN_SQB_TYPE + " VARCHAR(64),"
+      + COLUMN_SQB_CREATION_DATE + " TIMESTAMP,"
+      + COLUMN_SQB_UPDATE_DATE + " TIMESTAMP,"
       + " FOREIGN KEY(" + COLUMN_SQB_CONNECTION + ") REFERENCES " + TABLE_SQ_CONNECTION +
" (" + COLUMN_SQN_ID + ")"
       + ")";
 
@@ -384,18 +392,27 @@ public final class DerbySchemaQuery {
 
   // DML: Insert new connection
   public static final String STMT_INSERT_CONNECTION =
-    "INSERT INTO " + TABLE_SQ_CONNECTION + " (" + COLUMN_SQN_NAME + ", "
-    + COLUMN_SQN_CONNECTOR + ") VALUES (?, ?)";
+    "INSERT INTO " + TABLE_SQ_CONNECTION + " ("
+    + COLUMN_SQN_NAME + ", "
+    + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_CREATION_DATE + ", "
+    + COLUMN_SQN_UPDATE_DATE
+    + ") VALUES (?, ?, ?, ?)";
 
   // DML: Insert new connection inputs
   public static final String STMT_INSERT_CONNECTION_INPUT =
-    "INSERT INTO " + TABLE_SQ_CONNECTION_INPUT + " (" + COLUMN_SQNI_CONNECTION
-    + ", " + COLUMN_SQNI_INPUT + ", " + COLUMN_SQNI_VALUE + ") "
-    + "VALUES (?, ?, ?)";
+    "INSERT INTO " + TABLE_SQ_CONNECTION_INPUT + " ("
+    + COLUMN_SQNI_CONNECTION + ", "
+    + COLUMN_SQNI_INPUT + ", "
+    + COLUMN_SQNI_VALUE
+    + ") VALUES (?, ?, ?)";
 
+  // DML: Update connection
   public static final String STMT_UPDATE_CONNECTION =
-    "UPDATE " + TABLE_SQ_CONNECTION + " SET " + COLUMN_SQN_NAME + " = ? WHERE "
-    + COLUMN_SQN_ID + " = ?";
+    "UPDATE " + TABLE_SQ_CONNECTION + " SET "
+    + COLUMN_SQN_NAME + " = ?, "
+    + COLUMN_SQN_UPDATE_DATE + " = ? "
+    + " WHERE " + COLUMN_SQN_ID + " = ?";
 
   // DML: Delete rows from connection input table
   public static final String STMT_DELETE_CONNECTION_INPUT =
@@ -408,14 +425,24 @@ public final class DerbySchemaQuery {
 
   // DML: Select one specific connection
   public static final String STMT_SELECT_CONNECTION_SINGLE =
-    "SELECT " + COLUMN_SQN_ID + ", " + COLUMN_SQN_NAME + ", "
-    + COLUMN_SQN_CONNECTOR + " FROM " + TABLE_SQ_CONNECTION + " WHERE "
-    + COLUMN_SQN_ID + " = ?";
+    "SELECT "
+    + COLUMN_SQN_ID + ", "
+    + COLUMN_SQN_NAME + ", "
+    + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_CREATION_DATE + ", "
+    + COLUMN_SQN_UPDATE_DATE
+    + " FROM " + TABLE_SQ_CONNECTION
+    + " WHERE " + COLUMN_SQN_ID + " = ?";
 
   // DML: Select all connections
   public static final String STMT_SELECT_CONNECTION_ALL =
-    "SELECT " + COLUMN_SQN_ID + ", " + COLUMN_SQN_NAME + ", "
-      + COLUMN_SQN_CONNECTOR + " FROM " + TABLE_SQ_CONNECTION;
+    "SELECT "
+    + COLUMN_SQN_ID + ", "
+    + COLUMN_SQN_NAME + ", "
+    + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQN_CREATION_DATE + ", "
+    + COLUMN_SQN_UPDATE_DATE
+    + " FROM " + TABLE_SQ_CONNECTION;
 
   // DML: Check if given connection exists
   public static final String STMT_SELECT_CONNECTION_CHECK =
@@ -424,18 +451,27 @@ public final class DerbySchemaQuery {
 
   // DML: Insert new job
   public static final String STMT_INSERT_JOB =
-    "INSERT INTO " + TABLE_SQ_JOB + " (" + COLUMN_SQB_NAME + ", "
-      + COLUMN_SQB_CONNECTION + ", " + COLUMN_SQB_TYPE + ") VALUES (?, ?, ?)";
+    "INSERT INTO " + TABLE_SQ_JOB + " ("
+    + COLUMN_SQB_NAME + ", "
+    + COLUMN_SQB_CONNECTION + ", "
+    + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_CREATION_DATE + ", "
+    + COLUMN_SQB_UPDATE_DATE
+    + ") VALUES (?, ?, ?, ?, ?)";
 
   // DML: Insert new job inputs
   public static final String STMT_INSERT_JOB_INPUT =
-    "INSERT INTO " + TABLE_SQ_JOB_INPUT + " (" + COLUMN_SQBI_JOB
-    + ", " + COLUMN_SQBI_INPUT + ", " + COLUMN_SQBI_VALUE + ") "
-    + "VALUES (?, ?, ?)";
+    "INSERT INTO " + TABLE_SQ_JOB_INPUT + " ("
+    + COLUMN_SQBI_JOB + ", "
+    + COLUMN_SQBI_INPUT + ", "
+    + COLUMN_SQBI_VALUE
+    + ") VALUES (?, ?, ?)";
 
   public static final String STMT_UPDATE_JOB =
-    "UPDATE " + TABLE_SQ_JOB + " SET " + COLUMN_SQB_NAME + " = ? WHERE "
-      + COLUMN_SQB_ID + " = ?";
+    "UPDATE " + TABLE_SQ_JOB + " SET "
+    + COLUMN_SQB_NAME + " = ?, "
+    + COLUMN_SQB_UPDATE_DATE + " = ? "
+    + " WHERE " + COLUMN_SQB_ID + " = ?";
 
   // DML: Delete rows from job input table
   public static final String STMT_DELETE_JOB_INPUT =
@@ -457,18 +493,29 @@ public final class DerbySchemaQuery {
 
   // DML: Select one specific job
   public static final String STMT_SELECT_JOB_SINGLE =
-    "SELECT " + COLUMN_SQN_CONNECTOR + ", " + COLUMN_SQB_ID + ", "
-    + COLUMN_SQB_NAME + ", " + COLUMN_SQB_CONNECTION + ", " + COLUMN_SQB_TYPE
-    + " FROM " + TABLE_SQ_JOB + " LEFT JOIN " + TABLE_SQ_CONNECTION + " ON "
-    + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID    + " WHERE "
-    + COLUMN_SQB_ID + " = ?";
+    "SELECT "
+    + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQB_ID + ", "
+    + COLUMN_SQB_NAME + ", "
+    + COLUMN_SQB_CONNECTION + ", "
+    + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_CREATION_DATE + ", "
+    + COLUMN_SQB_UPDATE_DATE
+    + " FROM " + TABLE_SQ_JOB
+    + " LEFT JOIN " + TABLE_SQ_CONNECTION + " ON " + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID
+    + " WHERE " + COLUMN_SQB_ID + " = ?";
 
   // DML: Select all jobs
   public static final String STMT_SELECT_JOB_ALL =
-    "SELECT " + COLUMN_SQN_CONNECTOR + ", " + COLUMN_SQB_ID + ", "
-    + COLUMN_SQB_NAME + ", " + COLUMN_SQB_CONNECTION + ", " + COLUMN_SQB_TYPE
-    + " FROM " + TABLE_SQ_JOB + " LEFT JOIN " + TABLE_SQ_CONNECTION + " ON "
-    + COLUMN_SQB_CONNECTION + " = " + COLUMN_SQN_ID;
+    "SELECT "
+    + COLUMN_SQN_CONNECTOR + ", "
+    + COLUMN_SQB_ID + ", "
+    + COLUMN_SQB_NAME + ", "
+    + COLUMN_SQB_CONNECTION + ", "
+    + COLUMN_SQB_TYPE + ", "
+    + COLUMN_SQB_CREATION_DATE + ", "
+    + COLUMN_SQB_UPDATE_DATE
+    + " FROM " + TABLE_SQ_JOB + " LEFT JOIN " + TABLE_SQ_CONNECTION + " ON " + COLUMN_SQB_CONNECTION
+ " = " + COLUMN_SQN_ID;
 
   // DML: Insert new submission
   public static final String STMT_INSERT_SUBMISSION =


Mime
View raw message