зеркало из https://github.com/github/sqoop.git
SQOOP-1142: Sqoop2: Provide creater and last edited by to metadata structures
(Mengwei Ding via Jarek Jarcec Cecho)
This commit is contained in:
Родитель
ee4e4c476f
Коммит
c07c857589
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -27,11 +27,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.
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 + ", "
|
||||
|
|
|
@ -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')");
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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)+": ");
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче