You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ja...@apache.org on 2014/08/19 00:58:38 UTC
[2/2] git commit: SQOOP-1417: Sqoop2: From/To: Change ConnectorType
name
SQOOP-1417: Sqoop2: From/To: Change ConnectorType name
(Abraham Elmahrek 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/a41ce9e5
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/a41ce9e5
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/a41ce9e5
Branch: refs/heads/SQOOP-1367
Commit: a41ce9e5111387c704e31baeac6bb6185c8ecf79
Parents: 88eb766
Author: Jarek Jarcec Cecho <ja...@apache.org>
Authored: Mon Aug 18 15:57:19 2014 -0700
Committer: Jarek Jarcec Cecho <ja...@apache.org>
Committed: Mon Aug 18 15:58:01 2014 -0700
----------------------------------------------------------------------
.../org/apache/sqoop/client/SqoopClient.java | 14 ++--
.../org/apache/sqoop/common/ConnectorType.java | 30 ---------
.../apache/sqoop/common/ConnectorTypeError.java | 40 -----------
.../java/org/apache/sqoop/common/Direction.java | 30 +++++++++
.../org/apache/sqoop/common/DirectionError.java | 40 +++++++++++
.../org/apache/sqoop/json/ConnectorBean.java | 10 +--
.../java/org/apache/sqoop/json/JobBean.java | 14 ++--
.../apache/sqoop/json/JobValidationBean.java | 12 ++--
.../java/org/apache/sqoop/model/MConnector.java | 24 +++----
.../main/java/org/apache/sqoop/model/MJob.java | 56 ++++++++--------
.../connector/jdbc/GenericJdbcConnector.java | 6 +-
.../sqoop/connector/ConnectorHandler.java | 6 +-
.../org/apache/sqoop/framework/JobManager.java | 70 ++++++++++----------
.../sqoop/framework/SubmissionRequest.java | 40 +++++------
.../org/apache/sqoop/repository/Repository.java | 12 ++--
.../apache/sqoop/job/mr/ConfigurationUtils.java | 18 ++---
.../sqoop/job/mr/SqoopDestroyerExecutor.java | 9 ++-
.../apache/sqoop/job/mr/SqoopInputFormat.java | 9 ++-
.../org/apache/sqoop/job/mr/SqoopMapper.java | 9 ++-
.../job/mr/SqoopOutputFormatLoadExecutor.java | 11 ++-
.../derby/DerbyRepositoryHandler.java | 28 ++++----
.../apache/sqoop/handler/JobRequestHandler.java | 30 ++++-----
.../apache/sqoop/shell/CloneJobFunction.java | 6 +-
.../apache/sqoop/shell/CreateJobFunction.java | 6 +-
.../org/apache/sqoop/shell/ShowJobFunction.java | 18 ++---
.../apache/sqoop/shell/UpdateJobFunction.java | 6 +-
.../apache/sqoop/shell/utils/FormDisplayer.java | 14 ++--
.../apache/sqoop/shell/utils/FormFiller.java | 12 ++--
.../shell/utils/JobDynamicFormOptions.java | 6 +-
.../sqoop/connector/spi/SqoopConnector.java | 4 +-
.../mapreduce/MapreduceSubmissionEngine.java | 20 +++---
31 files changed, 302 insertions(+), 308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
index b42f234..1d93ae3 100644
--- a/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
+++ b/client/src/main/java/org/apache/sqoop/client/SqoopClient.java
@@ -18,7 +18,7 @@
package org.apache.sqoop.client;
import org.apache.sqoop.client.request.SqoopRequests;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.json.ConnectionValidationBean;
import org.apache.sqoop.json.ConnectorBean;
@@ -368,8 +368,8 @@ public class SqoopClient {
toConnection.getConnectorId(),
fromConnection.getPersistenceId(),
toConnection.getPersistenceId(),
- getConnector(fromConnection.getConnectorId()).getJobForms(ConnectorType.FROM),
- getConnector(fromConnection.getConnectorId()).getJobForms(ConnectorType.TO),
+ getConnector(fromConnection.getConnectorId()).getJobForms(Direction.FROM),
+ getConnector(fromConnection.getConnectorId()).getJobForms(Direction.TO),
getFramework().getJobForms()
);
}
@@ -550,17 +550,17 @@ public class SqoopClient {
}
private Status applyValidations(JobValidationBean bean, MJob job) {
- Validation fromConnector = bean.getConnectorValidation(ConnectorType.FROM);
- Validation toConnector = bean.getConnectorValidation(ConnectorType.TO);
+ Validation fromConnector = bean.getConnectorValidation(Direction.FROM);
+ Validation toConnector = bean.getConnectorValidation(Direction.TO);
Validation framework = bean.getFrameworkValidation();
// @TODO(Abe): From/To validation.
FormUtils.applyValidation(
- job.getConnectorPart(ConnectorType.FROM).getForms(),
+ job.getConnectorPart(Direction.FROM).getForms(),
fromConnector);
FormUtils.applyValidation(job.getFrameworkPart().getForms(), framework);
FormUtils.applyValidation(
- job.getConnectorPart(ConnectorType.TO).getForms(),
+ job.getConnectorPart(Direction.TO).getForms(),
toConnector);
Long id = bean.getId();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/common/ConnectorType.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/common/ConnectorType.java b/common/src/main/java/org/apache/sqoop/common/ConnectorType.java
deleted file mode 100644
index d3d1d19..0000000
--- a/common/src/main/java/org/apache/sqoop/common/ConnectorType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.common;
-
-/**
- * Connectors will have configurations for FROM and TO.
- * If the connector is being used to extract data FROM,
- * then the connector type will be FROM. If the connector
- * is being used to load data TO, then the connector type
- * will be TO.
- */
-public enum ConnectorType {
- FROM,
- TO
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/common/ConnectorTypeError.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/common/ConnectorTypeError.java b/common/src/main/java/org/apache/sqoop/common/ConnectorTypeError.java
deleted file mode 100644
index e61addf..0000000
--- a/common/src/main/java/org/apache/sqoop/common/ConnectorTypeError.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.common;
-
-public enum ConnectorTypeError implements ErrorCode {
-
- /** An unknown error has occurred. */
- CONNECTOR_TYPE_0000("Unknown connector type")
-
- ;
-
- private final String message;
-
- private ConnectorTypeError(String message) {
- this.message = message;
- }
-
- public String getCode() {
- return name();
- }
-
- public String getMessage() {
- return message;
- }
-}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/common/Direction.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/common/Direction.java b/common/src/main/java/org/apache/sqoop/common/Direction.java
new file mode 100644
index 0000000..1576b96
--- /dev/null
+++ b/common/src/main/java/org/apache/sqoop/common/Direction.java
@@ -0,0 +1,30 @@
+/**
+ * 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.common;
+
+/**
+ * Connectors will have configurations for FROM and TO.
+ * If the connector is being used to extract data FROM,
+ * then the connector type will be FROM. If the connector
+ * is being used to load data TO, then the connector type
+ * will be TO.
+ */
+public enum Direction {
+ FROM,
+ TO
+}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/common/DirectionError.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/common/DirectionError.java b/common/src/main/java/org/apache/sqoop/common/DirectionError.java
new file mode 100644
index 0000000..d8d076c
--- /dev/null
+++ b/common/src/main/java/org/apache/sqoop/common/DirectionError.java
@@ -0,0 +1,40 @@
+/**
+ * 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.common;
+
+public enum DirectionError implements ErrorCode {
+
+ /** An unknown error has occurred. */
+ CONNECTOR_TYPE_0000("Unknown connector type")
+
+ ;
+
+ private final String message;
+
+ private DirectionError(String message) {
+ this.message = message;
+ }
+
+ public String getCode() {
+ return name();
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
index ed1de6e..5069f0b 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
@@ -24,7 +24,7 @@ import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MConnectionForms;
import org.apache.sqoop.model.MJobForms;
import org.apache.sqoop.model.MConnector;
@@ -77,9 +77,9 @@ public class ConnectorBean implements JsonBean {
object.put(CON_FORMS, extractForms(connector.getConnectionForms().getForms(), skipSensitive));
object.put(JOB_FORMS, new JSONObject());
((JSONObject)object.get(JOB_FORMS)).put(
- ConnectorType.FROM, extractForms(connector.getJobForms(ConnectorType.FROM).getForms(), skipSensitive));
+ Direction.FROM, extractForms(connector.getJobForms(Direction.FROM).getForms(), skipSensitive));
((JSONObject)object.get(JOB_FORMS)).put(
- ConnectorType.TO, extractForms(connector.getJobForms(ConnectorType.TO).getForms(), skipSensitive));
+ Direction.TO, extractForms(connector.getJobForms(Direction.TO).getForms(), skipSensitive));
array.add(object);
}
@@ -118,8 +118,8 @@ public class ConnectorBean implements JsonBean {
List<MForm> connForms = restoreForms((JSONArray) object.get(CON_FORMS));
JSONObject jobJson = (JSONObject) object.get(JOB_FORMS);
- JSONArray fromJobJson = (JSONArray)jobJson.get(ConnectorType.FROM.name());
- JSONArray toJobJson = (JSONArray)jobJson.get(ConnectorType.TO.name());
+ JSONArray fromJobJson = (JSONArray)jobJson.get(Direction.FROM.name());
+ JSONArray toJobJson = (JSONArray)jobJson.get(Direction.TO.name());
List<MForm> fromJobForms =
restoreForms(fromJobJson);
List<MForm> toJobForms =
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 cb659ae..91edcfc 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -17,7 +17,7 @@
*/
package org.apache.sqoop.json;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MForm;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MJobForms;
@@ -114,14 +114,14 @@ public class JobBean implements JsonBean {
object.put(CREATION_DATE, job.getCreationDate().getTime());
object.put(UPDATE_USER, job.getLastUpdateUser());
object.put(UPDATE_DATE, job.getLastUpdateDate().getTime());
- object.put(FROM_CONNECTION_ID, job.getConnectionId(ConnectorType.FROM));
- object.put(TO_CONNECTION_ID, job.getConnectionId(ConnectorType.TO));
- object.put(FROM_CONNECTOR_ID, job.getConnectorId(ConnectorType.FROM));
- object.put(TO_CONNECTOR_ID, job.getConnectorId(ConnectorType.TO));
+ object.put(FROM_CONNECTION_ID, job.getConnectionId(Direction.FROM));
+ object.put(TO_CONNECTION_ID, job.getConnectionId(Direction.TO));
+ object.put(FROM_CONNECTOR_ID, job.getConnectorId(Direction.FROM));
+ object.put(TO_CONNECTOR_ID, job.getConnectorId(Direction.TO));
object.put(FROM_CONNECTOR_PART,
- extractForms(job.getConnectorPart(ConnectorType.FROM).getForms(),skipSensitive));
+ extractForms(job.getConnectorPart(Direction.FROM).getForms(),skipSensitive));
object.put(TO_CONNECTOR_PART,
- extractForms(job.getConnectorPart(ConnectorType.TO).getForms(), skipSensitive));
+ extractForms(job.getConnectorPart(Direction.TO).getForms(), skipSensitive));
object.put(FRAMEWORK_PART,
extractForms(job.getFrameworkPart().getForms(), skipSensitive));
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/json/JobValidationBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JobValidationBean.java b/common/src/main/java/org/apache/sqoop/json/JobValidationBean.java
index 86a49ea..eb1d741 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobValidationBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobValidationBean.java
@@ -17,8 +17,8 @@
*/
package org.apache.sqoop.json;
-import org.apache.sqoop.common.ConnectorType;
-import org.apache.sqoop.common.ConnectorTypeError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.DirectionError;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.validation.Status;
import org.apache.sqoop.validation.Validation;
@@ -63,7 +63,7 @@ public class JobValidationBean implements JsonBean {
id = null;
}
- public Validation getConnectorValidation(ConnectorType type) {
+ public Validation getConnectorValidation(Direction type) {
switch(type) {
case FROM:
return fromConnectorValidation;
@@ -72,7 +72,7 @@ public class JobValidationBean implements JsonBean {
return toConnectorValidation;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
@@ -98,8 +98,8 @@ public class JobValidationBean implements JsonBean {
object.put(ID, id);
}
- connectorObject.put(FROM, extractValidation(getConnectorValidation(ConnectorType.FROM)));
- connectorObject.put(TO, extractValidation(getConnectorValidation(ConnectorType.TO)));
+ connectorObject.put(FROM, extractValidation(getConnectorValidation(Direction.FROM)));
+ connectorObject.put(TO, extractValidation(getConnectorValidation(Direction.TO)));
object.put(FRAMEWORK, extractValidation(frameworkValidation));
object.put(CONNECTOR, connectorObject);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/common/src/main/java/org/apache/sqoop/model/MConnector.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MConnector.java b/common/src/main/java/org/apache/sqoop/model/MConnector.java
index 0b0b86a..3c95da9 100644
--- a/common/src/main/java/org/apache/sqoop/model/MConnector.java
+++ b/common/src/main/java/org/apache/sqoop/model/MConnector.java
@@ -17,8 +17,8 @@
*/
package org.apache.sqoop.model;
-import org.apache.sqoop.common.ConnectorType;
-import org.apache.sqoop.common.ConnectorTypeError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.DirectionError;
import org.apache.sqoop.common.SqoopException;
/**
@@ -66,8 +66,8 @@ public final class MConnector extends MPersistableEntity implements MClonable {
sb.append(uniqueName).append(":").append(getPersistenceId()).append(":");
sb.append(className);
sb.append(", ").append(getConnectionForms().toString());
- sb.append(", ").append(getJobForms(ConnectorType.FROM).toString());
- sb.append(", ").append(getJobForms(ConnectorType.TO).toString());
+ sb.append(", ").append(getJobForms(Direction.FROM).toString());
+ sb.append(", ").append(getJobForms(Direction.TO).toString());
return sb.toString();
}
@@ -86,15 +86,15 @@ public final class MConnector extends MPersistableEntity implements MClonable {
&& className.equals(mc.className)
&& version.equals(mc.version)
&& connectionForms.equals(mc.getConnectionForms())
- && fromJobForms.equals(mc.getJobForms(ConnectorType.FROM))
- && toJobForms.equals(mc.getJobForms(ConnectorType.TO));
+ && fromJobForms.equals(mc.getJobForms(Direction.FROM))
+ && toJobForms.equals(mc.getJobForms(Direction.TO));
}
@Override
public int hashCode() {
int result = getConnectionForms().hashCode();
- result = 31 * result + getJobForms(ConnectorType.FROM).hashCode();
- result = 31 * result + getJobForms(ConnectorType.TO).hashCode();
+ result = 31 * result + getJobForms(Direction.FROM).hashCode();
+ result = 31 * result + getJobForms(Direction.TO).hashCode();
result = 31 * result + version.hashCode();
result = 31 * result + uniqueName.hashCode();
result = 31 * result + className.hashCode();
@@ -109,8 +109,8 @@ public final class MConnector extends MPersistableEntity implements MClonable {
this.getClassName(),
this.getVersion(),
this.getConnectionForms().clone(cloneWithValue),
- this.getJobForms(ConnectorType.FROM).clone(cloneWithValue),
- this.getJobForms(ConnectorType.TO).clone(cloneWithValue));
+ this.getJobForms(Direction.FROM).clone(cloneWithValue),
+ this.getJobForms(Direction.TO).clone(cloneWithValue));
copy.setPersistenceId(this.getPersistenceId());
return copy;
}
@@ -119,7 +119,7 @@ public final class MConnector extends MPersistableEntity implements MClonable {
return connectionForms;
}
- public MJobForms getJobForms(ConnectorType type) {
+ public MJobForms getJobForms(Direction type) {
switch(type) {
case FROM:
return fromJobForms;
@@ -128,7 +128,7 @@ public final class MConnector extends MPersistableEntity implements MClonable {
return toJobForms;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 f561434..813e8c1 100644
--- a/common/src/main/java/org/apache/sqoop/model/MJob.java
+++ b/common/src/main/java/org/apache/sqoop/model/MJob.java
@@ -17,8 +17,8 @@
*/
package org.apache.sqoop.model;
-import org.apache.sqoop.common.ConnectorType;
-import org.apache.sqoop.common.ConnectorTypeError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.DirectionError;
import org.apache.sqoop.common.SqoopException;
/**
@@ -85,8 +85,8 @@ public class MJob extends MAccountableEntity implements MClonable {
*/
public MJob(MJob other) {
this(other,
- other.getConnectorPart(ConnectorType.FROM).clone(true),
- other.getConnectorPart(ConnectorType.TO).clone(true),
+ other.getConnectorPart(Direction.FROM).clone(true),
+ other.getConnectorPart(Direction.TO).clone(true),
other.frameworkPart.clone(true));
}
@@ -106,10 +106,10 @@ public class MJob extends MAccountableEntity implements MClonable {
this.name = other.name;
- this.fromConnectorId = other.getConnectorId(ConnectorType.FROM);
- this.toConnectorId = other.getConnectorId(ConnectorType.TO);
- this.fromConnectionId = other.getConnectionId(ConnectorType.FROM);
- this.toConnectionId = other.getConnectionId(ConnectorType.TO);
+ this.fromConnectorId = other.getConnectorId(Direction.FROM);
+ this.toConnectorId = other.getConnectorId(Direction.TO);
+ this.fromConnectionId = other.getConnectionId(Direction.FROM);
+ this.toConnectionId = other.getConnectionId(Direction.TO);
this.fromConnectorPart = fromPart;
this.toConnectorPart = toPart;
this.frameworkPart = frameworkPart;
@@ -118,8 +118,8 @@ public class MJob extends MAccountableEntity implements MClonable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("job");
- sb.append(" connector-from-part: ").append(getConnectorPart(ConnectorType.FROM));
- sb.append(", connector-to-part: ").append(getConnectorPart(ConnectorType.TO));
+ sb.append(" connector-from-part: ").append(getConnectorPart(Direction.FROM));
+ sb.append(", connector-to-part: ").append(getConnectorPart(Direction.TO));
sb.append(", framework-part: ").append(frameworkPart);
return sb.toString();
@@ -133,7 +133,7 @@ public class MJob extends MAccountableEntity implements MClonable {
this.name = name;
}
- public long getConnectionId(ConnectorType type) {
+ public long getConnectionId(Direction type) {
switch(type) {
case FROM:
return fromConnectionId;
@@ -142,11 +142,11 @@ public class MJob extends MAccountableEntity implements MClonable {
return toConnectionId;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public long getConnectorId(ConnectorType type) {
+ public long getConnectorId(Direction type) {
switch(type) {
case FROM:
return fromConnectorId;
@@ -155,11 +155,11 @@ public class MJob extends MAccountableEntity implements MClonable {
return toConnectorId;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public MJobForms getConnectorPart(ConnectorType type) {
+ public MJobForms getConnectorPart(Direction type) {
switch(type) {
case FROM:
return fromConnectorPart;
@@ -168,7 +168,7 @@ public class MJob extends MAccountableEntity implements MClonable {
return toConnectorPart;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
@@ -182,12 +182,12 @@ public class MJob extends MAccountableEntity implements MClonable {
return new MJob(this);
} else {
return new MJob(
- getConnectorId(ConnectorType.FROM),
- getConnectorId(ConnectorType.TO),
- getConnectionId(ConnectorType.FROM),
- getConnectionId(ConnectorType.TO),
- getConnectorPart(ConnectorType.FROM).clone(false),
- getConnectorPart(ConnectorType.TO).clone(false),
+ getConnectorId(Direction.FROM),
+ getConnectorId(Direction.TO),
+ getConnectionId(Direction.FROM),
+ getConnectionId(Direction.TO),
+ getConnectorPart(Direction.FROM).clone(false),
+ getConnectorPart(Direction.TO).clone(false),
frameworkPart.clone(false));
}
}
@@ -203,13 +203,13 @@ public class MJob extends MAccountableEntity implements MClonable {
}
MJob job = (MJob)object;
- return (job.getConnectorId(ConnectorType.FROM) == this.getConnectorId(ConnectorType.FROM))
- && (job.getConnectorId(ConnectorType.TO) == this.getConnectorId(ConnectorType.TO))
- && (job.getConnectionId(ConnectorType.FROM) == this.getConnectionId(ConnectorType.FROM))
- && (job.getConnectionId(ConnectorType.TO) == this.getConnectionId(ConnectorType.TO))
+ return (job.getConnectorId(Direction.FROM) == this.getConnectorId(Direction.FROM))
+ && (job.getConnectorId(Direction.TO) == this.getConnectorId(Direction.TO))
+ && (job.getConnectionId(Direction.FROM) == this.getConnectionId(Direction.FROM))
+ && (job.getConnectionId(Direction.TO) == this.getConnectionId(Direction.TO))
&& (job.getPersistenceId() == this.getPersistenceId())
- && (job.getConnectorPart(ConnectorType.FROM).equals(this.getConnectorPart(ConnectorType.FROM)))
- && (job.getConnectorPart(ConnectorType.TO).equals(this.getConnectorPart(ConnectorType.TO)))
+ && (job.getConnectorPart(Direction.FROM).equals(this.getConnectorPart(Direction.FROM)))
+ && (job.getConnectorPart(Direction.TO).equals(this.getConnectorPart(Direction.TO)))
&& (job.frameworkPart.equals(this.frameworkPart));
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java
index 1473dba..3790daa 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java
@@ -20,10 +20,8 @@ package org.apache.sqoop.connector.jdbc;
import java.util.Locale;
import java.util.ResourceBundle;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.VersionInfo;
-import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
-import org.apache.sqoop.connector.idf.IntermediateDataFormat;
import org.apache.sqoop.connector.jdbc.configuration.ConnectionConfiguration;
import org.apache.sqoop.connector.jdbc.configuration.FromJobConfiguration;
import org.apache.sqoop.connector.jdbc.configuration.ToJobConfiguration;
@@ -72,7 +70,7 @@ public class GenericJdbcConnector extends SqoopConnector {
}
@Override
- public Class getJobConfigurationClass(ConnectorType jobType) {
+ public Class getJobConfigurationClass(Direction jobType) {
switch (jobType) {
case FROM:
return FromJobConfiguration.class;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java
index ca4b253..d17ebef 100644
--- a/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java
+++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorHandler.java
@@ -22,7 +22,7 @@ import java.net.URL;
import java.util.Properties;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.core.ConfigurationConstants;
import org.apache.sqoop.model.FormUtils;
import org.apache.sqoop.model.MConnectionForms;
@@ -92,11 +92,11 @@ public final class ConnectorHandler {
// Initialize Metadata
MJobForms fromJobForms = new MJobForms(FormUtils.toForms(
- connector.getJobConfigurationClass(ConnectorType.FROM)));
+ connector.getJobConfigurationClass(Direction.FROM)));
MConnectionForms connectionForms = new MConnectionForms(
FormUtils.toForms(connector.getConnectionConfigurationClass()));
MJobForms toJobForms = new MJobForms(FormUtils.toForms(
- connector.getJobConfigurationClass(ConnectorType.TO)));
+ connector.getJobConfigurationClass(Direction.TO)));
MConnectionForms toConnectionForms = new MConnectionForms(
FormUtils.toForms(connector.getConnectionConfigurationClass()));
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 ac82284..48360ea 100644
--- a/core/src/main/java/org/apache/sqoop/framework/JobManager.java
+++ b/core/src/main/java/org/apache/sqoop/framework/JobManager.java
@@ -18,7 +18,7 @@
package org.apache.sqoop.framework;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.MapContext;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.ConnectorManager;
@@ -280,8 +280,8 @@ public class JobManager implements Reconfigurable {
"Job id: " + job.getPersistenceId());
}
- MConnection fromConnection = repository.findConnection(job.getConnectionId(ConnectorType.FROM));
- MConnection toConnection = repository.findConnection(job.getConnectionId(ConnectorType.TO));
+ MConnection fromConnection = repository.findConnection(job.getConnectionId(Direction.FROM));
+ MConnection toConnection = repository.findConnection(job.getConnectionId(Direction.TO));
if (!fromConnection.getEnabled()) {
throw new SqoopException(FrameworkError.FRAMEWORK_0010,
@@ -294,9 +294,9 @@ public class JobManager implements Reconfigurable {
}
SqoopConnector fromConnector =
- ConnectorManager.getInstance().getConnector(job.getConnectorId(ConnectorType.FROM));
+ ConnectorManager.getInstance().getConnector(job.getConnectorId(Direction.FROM));
SqoopConnector toConnector =
- ConnectorManager.getInstance().getConnector(job.getConnectorId(ConnectorType.TO));
+ ConnectorManager.getInstance().getConnector(job.getConnectorId(Direction.TO));
// Transform forms to fromConnector specific classes
Object fromConnectorConnection = ClassUtils.instantiate(
@@ -305,9 +305,9 @@ public class JobManager implements Reconfigurable {
fromConnectorConnection);
Object fromJob = ClassUtils.instantiate(
- fromConnector.getJobConfigurationClass(ConnectorType.FROM));
+ fromConnector.getJobConfigurationClass(Direction.FROM));
FormUtils.fromForms(
- job.getConnectorPart(ConnectorType.FROM).getForms(), fromJob);
+ job.getConnectorPart(Direction.FROM).getForms(), fromJob);
// Transform forms to toConnector specific classes
Object toConnectorConnection = ClassUtils.instantiate(
@@ -316,8 +316,8 @@ public class JobManager implements Reconfigurable {
toConnectorConnection);
Object toJob = ClassUtils.instantiate(
- toConnector.getJobConfigurationClass(ConnectorType.TO));
- FormUtils.fromForms(job.getConnectorPart(ConnectorType.TO).getForms(), toJob);
+ toConnector.getJobConfigurationClass(Direction.TO));
+ FormUtils.fromForms(job.getConnectorPart(Direction.TO).getForms(), toJob);
// Transform framework specific forms
Object fromFrameworkConnection = ClassUtils.instantiate(
@@ -342,15 +342,15 @@ public class JobManager implements Reconfigurable {
// Save important variables to the submission request
request.setSummary(summary);
- request.setConnector(ConnectorType.FROM, fromConnector);
- request.setConnector(ConnectorType.TO, toConnector);
- request.setConnectorConnectionConfig(ConnectorType.FROM, fromConnectorConnection);
- request.setConnectorConnectionConfig(ConnectorType.TO, toConnectorConnection);
- request.setConnectorJobConfig(ConnectorType.FROM, fromJob);
- request.setConnectorJobConfig(ConnectorType.TO, toJob);
+ request.setConnector(Direction.FROM, fromConnector);
+ request.setConnector(Direction.TO, toConnector);
+ request.setConnectorConnectionConfig(Direction.FROM, fromConnectorConnection);
+ request.setConnectorConnectionConfig(Direction.TO, toConnectorConnection);
+ request.setConnectorJobConfig(Direction.FROM, fromJob);
+ request.setConnectorJobConfig(Direction.TO, toJob);
// @TODO(Abe): Should we actually have 2 different Framework Connection config objects?
- request.setFrameworkConnectionConfig(ConnectorType.FROM, fromFrameworkConnection);
- request.setFrameworkConnectionConfig(ConnectorType.TO, toFrameworkConnection);
+ request.setFrameworkConnectionConfig(Direction.FROM, fromFrameworkConnection);
+ request.setFrameworkConnectionConfig(Direction.TO, toFrameworkConnection);
request.setConfigFrameworkJob(frameworkJob);
request.setJobName(job.getName());
request.setJobId(job.getPersistenceId());
@@ -410,24 +410,24 @@ public class JobManager implements Reconfigurable {
}
// Initializer context
- initializerContext = new InitializerContext(request.getConnectorContext(ConnectorType.FROM));
+ initializerContext = new InitializerContext(request.getConnectorContext(Direction.FROM));
// Initialize submission from fromConnector perspective
initializer.initialize(initializerContext,
- request.getConnectorConnectionConfig(ConnectorType.FROM),
- request.getConnectorJobConfig(ConnectorType.FROM));
+ request.getConnectorConnectionConfig(Direction.FROM),
+ request.getConnectorJobConfig(Direction.FROM));
// Add job specific jars to
request.addJars(initializer.getJars(initializerContext,
- request.getConnectorConnectionConfig(ConnectorType.FROM),
- request.getConnectorJobConfig(ConnectorType.FROM)));
+ request.getConnectorConnectionConfig(Direction.FROM),
+ request.getConnectorJobConfig(Direction.FROM)));
// @TODO(Abe): Alter behavior of Schema here. Need from Schema.
// Retrieve and persist the schema
request.getSummary().setConnectorSchema(initializer.getSchema(
initializerContext,
- request.getConnectorConnectionConfig(ConnectorType.FROM),
- request.getConnectorJobConfig(ConnectorType.FROM)
+ request.getConnectorConnectionConfig(Direction.FROM),
+ request.getConnectorJobConfig(Direction.FROM)
));
// Initialize To Connector callback.
@@ -444,17 +444,17 @@ public class JobManager implements Reconfigurable {
}
// Initializer context
- initializerContext = new InitializerContext(request.getConnectorContext(ConnectorType.TO));
+ initializerContext = new InitializerContext(request.getConnectorContext(Direction.TO));
// Initialize submission from fromConnector perspective
initializer.initialize(initializerContext,
- request.getConnectorConnectionConfig(ConnectorType.TO),
- request.getConnectorJobConfig(ConnectorType.TO));
+ request.getConnectorConnectionConfig(Direction.TO),
+ request.getConnectorJobConfig(Direction.TO));
// Add job specific jars to
request.addJars(initializer.getJars(initializerContext,
- request.getConnectorConnectionConfig(ConnectorType.TO),
- request.getConnectorJobConfig(ConnectorType.TO)));
+ request.getConnectorConnectionConfig(Direction.TO),
+ request.getConnectorJobConfig(Direction.TO)));
// @TODO(Abe): Alter behavior of Schema here. Need To Schema.
// Retrieve and persist the schema
@@ -531,17 +531,17 @@ public class JobManager implements Reconfigurable {
// @TODO(Abe): Update context to manage multiple connectors. As well as summary.
DestroyerContext fromDestroyerContext = new DestroyerContext(
- request.getConnectorContext(ConnectorType.FROM), false, request.getSummary()
+ request.getConnectorContext(Direction.FROM), false, request.getSummary()
.getConnectorSchema());
DestroyerContext toDestroyerContext = new DestroyerContext(
- request.getConnectorContext(ConnectorType.TO), false, request.getSummary()
+ request.getConnectorContext(Direction.TO), false, request.getSummary()
.getConnectorSchema());
// Initialize submission from connector perspective
- fromDestroyer.destroy(fromDestroyerContext, request.getConnectorConnectionConfig(ConnectorType.FROM),
- request.getConnectorJobConfig(ConnectorType.FROM));
- toDestroyer.destroy(toDestroyerContext, request.getConnectorConnectionConfig(ConnectorType.TO),
- request.getConnectorJobConfig(ConnectorType.TO));
+ fromDestroyer.destroy(fromDestroyerContext, request.getConnectorConnectionConfig(Direction.FROM),
+ request.getConnectorJobConfig(Direction.FROM));
+ toDestroyer.destroy(toDestroyerContext, request.getConnectorConnectionConfig(Direction.TO),
+ request.getConnectorJobConfig(Direction.TO));
}
public MSubmission stop(long jobId, HttpEventContext ctx) {
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/core/src/main/java/org/apache/sqoop/framework/SubmissionRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/framework/SubmissionRequest.java b/core/src/main/java/org/apache/sqoop/framework/SubmissionRequest.java
index 901937f..30dc5b2 100644
--- a/core/src/main/java/org/apache/sqoop/framework/SubmissionRequest.java
+++ b/core/src/main/java/org/apache/sqoop/framework/SubmissionRequest.java
@@ -17,8 +17,8 @@
*/
package org.apache.sqoop.framework;
-import org.apache.sqoop.common.ConnectorType;
-import org.apache.sqoop.common.ConnectorTypeError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.DirectionError;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.idf.IntermediateDataFormat;
@@ -159,7 +159,7 @@ public class SubmissionRequest {
this.jobId = jobId;
}
- public SqoopConnector getConnector(ConnectorType type) {
+ public SqoopConnector getConnector(Direction type) {
switch(type) {
case FROM:
return fromConnector;
@@ -168,11 +168,11 @@ public class SubmissionRequest {
return toConnector;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public void setConnector(ConnectorType type, SqoopConnector connector) {
+ public void setConnector(Direction type, SqoopConnector connector) {
switch(type) {
case FROM:
fromConnector = connector;
@@ -181,7 +181,7 @@ public class SubmissionRequest {
toConnector = connector;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
@@ -221,7 +221,7 @@ public class SubmissionRequest {
this.toCallback = toCallback;
}
- public Object getConnectorConnectionConfig(ConnectorType type) {
+ public Object getConnectorConnectionConfig(Direction type) {
switch(type) {
case FROM:
return fromConnectorConnectionConfig;
@@ -230,11 +230,11 @@ public class SubmissionRequest {
return toConnectorConnectionConfig;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public void setConnectorConnectionConfig(ConnectorType type, Object config) {
+ public void setConnectorConnectionConfig(Direction type, Object config) {
switch(type) {
case FROM:
fromConnectorConnectionConfig = config;
@@ -243,11 +243,11 @@ public class SubmissionRequest {
toConnectorConnectionConfig = config;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public Object getConnectorJobConfig(ConnectorType type) {
+ public Object getConnectorJobConfig(Direction type) {
switch(type) {
case FROM:
return fromConnectorJobConfig;
@@ -256,11 +256,11 @@ public class SubmissionRequest {
return toConnectorJobConfig;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public void setConnectorJobConfig(ConnectorType type, Object config) {
+ public void setConnectorJobConfig(Direction type, Object config) {
switch(type) {
case FROM:
fromConnectorJobConfig = config;
@@ -269,11 +269,11 @@ public class SubmissionRequest {
toConnectorJobConfig = config;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public Object getFrameworkConnectionConfig(ConnectorType type) {
+ public Object getFrameworkConnectionConfig(Direction type) {
switch(type) {
case FROM:
return fromFrameworkConnectionConfig;
@@ -282,11 +282,11 @@ public class SubmissionRequest {
return toFrameworkConnectionConfig;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
- public void setFrameworkConnectionConfig(ConnectorType type, Object config) {
+ public void setFrameworkConnectionConfig(Direction type, Object config) {
switch(type) {
case FROM:
fromFrameworkConnectionConfig = config;
@@ -295,7 +295,7 @@ public class SubmissionRequest {
toFrameworkConnectionConfig = config;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
@@ -307,7 +307,7 @@ public class SubmissionRequest {
configFrameworkJob = config;
}
- public MutableMapContext getConnectorContext(ConnectorType type) {
+ public MutableMapContext getConnectorContext(Direction type) {
switch(type) {
case FROM:
return fromConnectorContext;
@@ -316,7 +316,7 @@ public class SubmissionRequest {
return toConnectorContext;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/core/src/main/java/org/apache/sqoop/repository/Repository.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/sqoop/repository/Repository.java b/core/src/main/java/org/apache/sqoop/repository/Repository.java
index 3f12d0a..e9c32e0 100644
--- a/core/src/main/java/org/apache/sqoop/repository/Repository.java
+++ b/core/src/main/java/org/apache/sqoop/repository/Repository.java
@@ -18,7 +18,7 @@
package org.apache.sqoop.repository;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.ConnectorManager;
import org.apache.sqoop.connector.spi.MetadataUpgrader;
@@ -446,16 +446,16 @@ public abstract class Repository {
// Make a new copy of the forms from the connector,
// else the values will get set in the forms in the connector for
// each connection.
- List<MForm> forms = newConnector.getJobForms(ConnectorType.FROM).clone(false).getForms();
+ List<MForm> forms = newConnector.getJobForms(Direction.FROM).clone(false).getForms();
MJobForms newJobForms = new MJobForms(forms);
- upgrader.upgrade(job.getConnectorPart(ConnectorType.FROM), newJobForms);
+ upgrader.upgrade(job.getConnectorPart(Direction.FROM), newJobForms);
// @TODO(Abe): Check From and To
MJob newJob = new MJob(job, newJobForms, newJobForms, job.getFrameworkPart());
// Transform form structures to objects for validations
// @TODO(Abe): Check From and To
- Object newConfigurationObject = ClassUtils.instantiate(connector.getJobConfigurationClass(ConnectorType.FROM));
- FormUtils.fromForms(newJob.getConnectorPart(ConnectorType.FROM).getForms(), newConfigurationObject);
+ Object newConfigurationObject = ClassUtils.instantiate(connector.getJobConfigurationClass(Direction.FROM));
+ FormUtils.fromForms(newJob.getConnectorPart(Direction.FROM).getForms(), newConfigurationObject);
Validation validation = validator.validateJob(newConfigurationObject);
if (validation.getStatus().canProceed()) {
@@ -536,7 +536,7 @@ public abstract class Repository {
List<MForm> forms = framework.getJobForms().clone(false).getForms();
MJobForms newJobForms = new MJobForms(forms);
upgrader.upgrade(job.getFrameworkPart(), newJobForms);
- MJob newJob = new MJob(job, job.getConnectorPart(ConnectorType.FROM), job.getConnectorPart(ConnectorType.TO), newJobForms);
+ MJob newJob = new MJob(job, job.getConnectorPart(Direction.FROM), job.getConnectorPart(Direction.TO), newJobForms);
// Transform form structures to objects for validations
Object newConfigurationObject = ClassUtils.instantiate(FrameworkManager.getInstance().getJobConfigurationClass());
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/ConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/ConfigurationUtils.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/ConfigurationUtils.java
index 791d27f..92414d8 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/ConfigurationUtils.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/ConfigurationUtils.java
@@ -22,7 +22,7 @@ import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapreduce.Job;
import org.apache.log4j.PropertyConfigurator;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.job.JobConstants;
import org.apache.sqoop.json.util.SchemaSerialization;
import org.apache.sqoop.model.FormUtils;
@@ -100,7 +100,7 @@ public final class ConfigurationUtils {
* @param job MapReduce job object
* @param obj Configuration object
*/
- public static void setConnectorConnectionConfig(ConnectorType type, Job job, Object obj) {
+ public static void setConnectorConnectionConfig(Direction type, Job job, Object obj) {
switch (type) {
case FROM:
job.getConfiguration().set(JOB_CONFIG_CLASS_FROM_CONNECTOR_CONNECTION, obj.getClass().getName());
@@ -120,7 +120,7 @@ public final class ConfigurationUtils {
* @param job MapReduce job object
* @param obj Configuration object
*/
- public static void setConnectorJobConfig(ConnectorType type, Job job, Object obj) {
+ public static void setConnectorJobConfig(Direction type, Job job, Object obj) {
switch (type) {
case FROM:
job.getConfiguration().set(JOB_CONFIG_CLASS_FROM_CONNECTOR_JOB, obj.getClass().getName());
@@ -140,7 +140,7 @@ public final class ConfigurationUtils {
* @param job MapReduce job object
* @param obj Configuration object
*/
- public static void setFrameworkConnectionConfig(ConnectorType type, Job job, Object obj) {
+ public static void setFrameworkConnectionConfig(Direction type, Job job, Object obj) {
switch (type) {
case FROM:
job.getConfiguration().set(JOB_CONFIG_CLASS_FROM_FRAMEWORK_CONNECTION, obj.getClass().getName());
@@ -171,7 +171,7 @@ public final class ConfigurationUtils {
* @param configuration MapReduce configuration object
* @return Configuration object
*/
- public static Object getConnectorConnectionConfig(ConnectorType type, Configuration configuration) {
+ public static Object getConnectorConnectionConfig(Direction type, Configuration configuration) {
switch (type) {
case FROM:
return loadConfiguration((JobConf) configuration, JOB_CONFIG_CLASS_FROM_CONNECTOR_CONNECTION, JOB_CONFIG_FROM_CONNECTOR_CONNECTION_KEY);
@@ -189,7 +189,7 @@ public final class ConfigurationUtils {
* @param configuration MapReduce configuration object
* @return Configuration object
*/
- public static Object getConnectorJobConfig(ConnectorType type, Configuration configuration) {
+ public static Object getConnectorJobConfig(Direction type, Configuration configuration) {
switch (type) {
case FROM:
return loadConfiguration((JobConf) configuration, JOB_CONFIG_CLASS_FROM_CONNECTOR_JOB, JOB_CONFIG_FROM_CONNECTOR_JOB_KEY);
@@ -207,7 +207,7 @@ public final class ConfigurationUtils {
* @param configuration MapReduce configuration object
* @return Configuration object
*/
- public static Object getFrameworkConnectionConfig(ConnectorType type, Configuration configuration) {
+ public static Object getFrameworkConnectionConfig(Direction type, Configuration configuration) {
switch (type) {
case FROM:
return loadConfiguration((JobConf) configuration, JOB_CONFIG_CLASS_FROM_FRAMEWORK_CONNECTION, JOB_CONFIG_FROM_FRAMEWORK_CONNECTION_KEY);
@@ -235,7 +235,7 @@ public final class ConfigurationUtils {
* @param job MapReduce Job object
* @param schema Schema
*/
- public static void setConnectorSchema(ConnectorType type, Job job, Schema schema) {
+ public static void setConnectorSchema(Direction type, Job job, Schema schema) {
if(schema != null) {
switch (type) {
case FROM:
@@ -253,7 +253,7 @@ public final class ConfigurationUtils {
* @param type The FROM or TO connector
* @param configuration MapReduce configuration object
*/
- public static Schema getConnectorSchema(ConnectorType type, Configuration configuration) {
+ public static Schema getConnectorSchema(Direction type, Configuration configuration) {
switch (type) {
case FROM:
return getSchemaFromBytes(((JobConf) configuration).getCredentials().getSecretKey(SCHEMA_FROM_CONNECTOR_KEY));
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopDestroyerExecutor.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopDestroyerExecutor.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopDestroyerExecutor.java
index b4e9c2b..8e31ef5 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopDestroyerExecutor.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopDestroyerExecutor.java
@@ -19,12 +19,11 @@ package org.apache.sqoop.job.mr;
import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.job.JobConstants;
import org.apache.sqoop.job.PrefixContext;
import org.apache.sqoop.job.etl.Destroyer;
import org.apache.sqoop.job.etl.DestroyerContext;
-import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.utils.ClassUtils;
@@ -54,12 +53,12 @@ public class SqoopDestroyerExecutor {
// Objects that should be pass to the Destroyer execution
PrefixContext subContext = new PrefixContext(configuration, JobConstants.PREFIX_CONNECTOR_FROM_CONTEXT);
- Object fromConfigConnection = ConfigurationUtils.getConnectorConnectionConfig(ConnectorType.FROM, configuration);
- Object fromConfigJob = ConfigurationUtils.getConnectorJobConfig(ConnectorType.FROM, configuration);
+ Object fromConfigConnection = ConfigurationUtils.getConnectorConnectionConfig(Direction.FROM, configuration);
+ Object fromConfigJob = ConfigurationUtils.getConnectorJobConfig(Direction.FROM, configuration);
// Propagate connector schema in every case for now
// TODO: Change to coditional choosing between Connector schemas.
- Schema schema = ConfigurationUtils.getConnectorSchema(ConnectorType.FROM, configuration);
+ Schema schema = ConfigurationUtils.getConnectorSchema(Direction.FROM, configuration);
DestroyerContext destroyerContext = new DestroyerContext(subContext, success, schema);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopInputFormat.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopInputFormat.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopInputFormat.java
index 4bd7bce..e96909a 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopInputFormat.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopInputFormat.java
@@ -29,7 +29,7 @@ import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.job.JobConstants;
import org.apache.sqoop.job.MapreduceExecutionError;
@@ -37,7 +37,6 @@ import org.apache.sqoop.job.PrefixContext;
import org.apache.sqoop.job.etl.Partition;
import org.apache.sqoop.job.etl.Partitioner;
import org.apache.sqoop.job.etl.PartitionerContext;
-import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.utils.ClassUtils;
@@ -64,9 +63,9 @@ public class SqoopInputFormat extends InputFormat<SqoopSplit, NullWritable> {
Partitioner partitioner = (Partitioner) ClassUtils.instantiate(partitionerName);
PrefixContext connectorContext = new PrefixContext(conf, JobConstants.PREFIX_CONNECTOR_FROM_CONTEXT);
- Object connectorConnection = ConfigurationUtils.getConnectorConnectionConfig(ConnectorType.FROM, conf);
- Object connectorJob = ConfigurationUtils.getConnectorJobConfig(ConnectorType.FROM, conf);
- Schema schema = ConfigurationUtils.getConnectorSchema(ConnectorType.FROM, conf);
+ Object connectorConnection = ConfigurationUtils.getConnectorConnectionConfig(Direction.FROM, conf);
+ Object connectorJob = ConfigurationUtils.getConnectorJobConfig(Direction.FROM, conf);
+ Schema schema = ConfigurationUtils.getConnectorSchema(Direction.FROM, conf);
long maxPartitions = conf.getLong(JobConstants.JOB_ETL_EXTRACTOR_NUM, 10);
PartitionerContext partitionerContext = new PartitionerContext(connectorContext, maxPartitions, schema);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
index c3b6ae9..6e2cfbf 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopMapper.java
@@ -26,7 +26,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.idf.IntermediateDataFormat;
import org.apache.sqoop.job.JobConstants;
@@ -35,7 +35,6 @@ import org.apache.sqoop.job.PrefixContext;
import org.apache.sqoop.job.etl.Extractor;
import org.apache.sqoop.job.etl.ExtractorContext;
import org.apache.sqoop.etl.io.DataWriter;
-import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.job.io.SqoopWritable;
import org.apache.sqoop.submission.counter.SqoopCounters;
@@ -67,7 +66,7 @@ public class SqoopMapper extends Mapper<SqoopSplit, NullWritable, SqoopWritable,
// Propagate connector schema in every case for now
// TODO: Change to coditional choosing between Connector schemas.
- Schema schema = ConfigurationUtils.getConnectorSchema(ConnectorType.FROM, conf);
+ Schema schema = ConfigurationUtils.getConnectorSchema(Direction.FROM, conf);
String intermediateDataFormatName = conf.get(JobConstants
.INTERMEDIATE_DATA_FORMAT);
@@ -82,8 +81,8 @@ public class SqoopMapper extends Mapper<SqoopSplit, NullWritable, SqoopWritable,
// Get configs for extractor
subContext = new PrefixContext(conf, JobConstants.PREFIX_CONNECTOR_FROM_CONTEXT);
- configConnection = ConfigurationUtils.getConnectorConnectionConfig(ConnectorType.FROM, conf);
- configJob = ConfigurationUtils.getConnectorJobConfig(ConnectorType.FROM, conf);
+ configConnection = ConfigurationUtils.getConnectorConnectionConfig(Direction.FROM, conf);
+ configJob = ConfigurationUtils.getConnectorJobConfig(Direction.FROM, conf);
SqoopSplit split = context.getCurrentKey();
ExtractorContext extractorContext = new ExtractorContext(subContext, new MapDataWriter(context), schema);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java
index bed99a2..01c32e4 100644
--- a/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java
+++ b/execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java
@@ -30,7 +30,7 @@ import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.log4j.Logger;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
import org.apache.sqoop.connector.idf.IntermediateDataFormat;
@@ -40,7 +40,6 @@ import org.apache.sqoop.job.PrefixContext;
import org.apache.sqoop.job.etl.Loader;
import org.apache.sqoop.job.etl.LoaderContext;
import org.apache.sqoop.etl.io.DataReader;
-import org.apache.sqoop.model.MConnector;
import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.job.io.SqoopWritable;
import org.apache.sqoop.utils.ClassUtils;
@@ -73,7 +72,7 @@ public class SqoopOutputFormatLoadExecutor {
producer = new SqoopRecordWriter();
data = (IntermediateDataFormat) ClassUtils.instantiate(context
.getConfiguration().get(JobConstants.INTERMEDIATE_DATA_FORMAT));
- data.setSchema(ConfigurationUtils.getConnectorSchema(ConnectorType.FROM, context.getConfiguration()));
+ data.setSchema(ConfigurationUtils.getConnectorSchema(Direction.FROM, context.getConfiguration()));
}
public RecordWriter<SqoopWritable, NullWritable> getRecordWriter() {
@@ -229,11 +228,11 @@ public class SqoopOutputFormatLoadExecutor {
// Propagate connector schema in every case for now
// TODO: Change to coditional choosing between Connector schemas.
// @TODO(Abe): Maybe use TO schema?
- schema = ConfigurationUtils.getConnectorSchema(ConnectorType.FROM, conf);
+ schema = ConfigurationUtils.getConnectorSchema(Direction.FROM, conf);
subContext = new PrefixContext(conf, JobConstants.PREFIX_CONNECTOR_TO_CONTEXT);
- configConnection = ConfigurationUtils.getConnectorConnectionConfig(ConnectorType.TO, conf);
- configJob = ConfigurationUtils.getConnectorJobConfig(ConnectorType.TO, conf);
+ configConnection = ConfigurationUtils.getConnectorConnectionConfig(Direction.TO, conf);
+ configJob = ConfigurationUtils.getConnectorJobConfig(Direction.TO, conf);
}
// Create loader context
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 060a687..3af84d7 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
@@ -38,8 +38,8 @@ import javax.sql.DataSource;
import org.apache.log4j.Logger;
import org.apache.commons.lang.StringUtils;
-import org.apache.sqoop.common.ConnectorType;
-import org.apache.sqoop.common.ConnectorTypeError;
+import org.apache.sqoop.common.Direction;
+import org.apache.sqoop.common.DirectionError;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.model.MBooleanInput;
import org.apache.sqoop.model.MConnection;
@@ -150,9 +150,9 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
MFormType.CONNECTION.name(), baseFormStmt, baseInputStmt);
// Register all jobs
- registerForms(connectorId, ConnectorType.FROM, mc.getJobForms(ConnectorType.FROM).getForms(),
+ registerForms(connectorId, Direction.FROM, mc.getJobForms(Direction.FROM).getForms(),
MFormType.JOB.name(), baseFormStmt, baseInputStmt);
- registerForms(connectorId, ConnectorType.TO, mc.getJobForms(ConnectorType.TO).getForms(),
+ registerForms(connectorId, Direction.TO, mc.getJobForms(Direction.TO).getForms(),
MFormType.JOB.name(), baseFormStmt, baseInputStmt);
} catch (SQLException ex) {
@@ -925,8 +925,8 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
stmt = conn.prepareStatement(STMT_INSERT_JOB,
Statement.RETURN_GENERATED_KEYS);
stmt.setString(1, job.getName());
- stmt.setLong(2, job.getConnectionId(ConnectorType.FROM));
- stmt.setLong(3, job.getConnectionId(ConnectorType.TO));
+ stmt.setLong(2, job.getConnectionId(Direction.FROM));
+ stmt.setLong(3, job.getConnectionId(Direction.TO));
stmt.setBoolean(4, job.getEnabled());
stmt.setString(5, job.getCreationUser());
stmt.setTimestamp(6, new Timestamp(job.getCreationDate().getTime()));
@@ -949,7 +949,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
createInputValues(STMT_INSERT_JOB_INPUT,
jobId,
- job.getConnectorPart(ConnectorType.FROM).getForms(),
+ job.getConnectorPart(Direction.FROM).getForms(),
conn);
createInputValues(STMT_INSERT_JOB_INPUT,
jobId,
@@ -957,7 +957,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
conn);
createInputValues(STMT_INSERT_JOB_INPUT,
jobId,
- job.getConnectorPart(ConnectorType.TO).getForms(),
+ job.getConnectorPart(Direction.TO).getForms(),
conn);
job.setPersistenceId(jobId);
@@ -995,7 +995,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
// And reinsert new values
createInputValues(STMT_INSERT_JOB_INPUT,
job.getPersistenceId(),
- job.getConnectorPart(ConnectorType.FROM).getForms(),
+ job.getConnectorPart(Direction.FROM).getForms(),
conn);
createInputValues(STMT_INSERT_JOB_INPUT,
job.getPersistenceId(),
@@ -1791,7 +1791,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
* @return short number of forms registered.
* @throws SQLException
*/
- private short registerForms(Long connectorId, ConnectorType connectorType,
+ private short registerForms(Long connectorId, Direction direction,
List<MForm> forms, String type, PreparedStatement baseFormStmt,
PreparedStatement baseInputStmt)
throws SQLException {
@@ -1803,10 +1803,10 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
} else {
baseFormStmt.setLong(1, connectorId);
}
- if(connectorType == null) {
+ if(direction == null) {
baseFormStmt.setNull(2, Types.VARCHAR);
} else {
- baseFormStmt.setString(2, connectorType.name());
+ baseFormStmt.setString(2, direction.name());
}
baseFormStmt.setString(3, form.getName());
baseFormStmt.setString(4, type);
@@ -2155,7 +2155,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
connectionForms.add(mf);
break;
case JOB:
- ConnectorType type = ConnectorType.valueOf(operation);
+ Direction type = Direction.valueOf(operation);
List<MForm> jobForms;
switch(type) {
case FROM:
@@ -2167,7 +2167,7 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler {
break;
default:
- throw new SqoopException(ConnectorTypeError.CONNECTOR_TYPE_0000, "Connector type: " + type);
+ throw new SqoopException(DirectionError.CONNECTOR_TYPE_0000, "Connector type: " + type);
}
if (jobForms.size() != formIndex) {
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 473bb46..6f2df93 100644
--- a/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
+++ b/server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.handler;
import org.apache.log4j.Logger;
import org.apache.sqoop.audit.AuditLoggerManager;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.connector.ConnectorManager;
import org.apache.sqoop.connector.spi.SqoopConnector;
@@ -165,26 +165,26 @@ public class JobRequestHandler implements RequestHandler {
// Verify that user is not trying to spoof us
MJobForms fromConnectorForms = ConnectorManager.getInstance()
- .getConnectorMetadata(job.getConnectorId(ConnectorType.FROM))
- .getJobForms(ConnectorType.FROM);
+ .getConnectorMetadata(job.getConnectorId(Direction.FROM))
+ .getJobForms(Direction.FROM);
MJobForms toConnectorForms = ConnectorManager.getInstance()
- .getConnectorMetadata(job.getConnectorId(ConnectorType.TO))
- .getJobForms(ConnectorType.TO);
+ .getConnectorMetadata(job.getConnectorId(Direction.TO))
+ .getJobForms(Direction.TO);
MJobForms frameworkForms = FrameworkManager.getInstance().getFramework()
.getJobForms();
- if(!fromConnectorForms.equals(job.getConnectorPart(ConnectorType.FROM))
+ if(!fromConnectorForms.equals(job.getConnectorPart(Direction.FROM))
|| !frameworkForms.equals(job.getFrameworkPart())
- || !toConnectorForms.equals(job.getConnectorPart(ConnectorType.TO))) {
+ || !toConnectorForms.equals(job.getConnectorPart(Direction.TO))) {
throw new SqoopException(ServerError.SERVER_0003,
"Detected incorrect form structure");
}
// Responsible connector for this session
SqoopConnector fromConnector =
- ConnectorManager.getInstance().getConnector(job.getConnectorId(ConnectorType.FROM));
+ ConnectorManager.getInstance().getConnector(job.getConnectorId(Direction.FROM));
SqoopConnector toConnector =
- ConnectorManager.getInstance().getConnector(job.getConnectorId(ConnectorType.TO));
+ ConnectorManager.getInstance().getConnector(job.getConnectorId(Direction.TO));
// Get validator objects
Validator fromConnectorValidator = fromConnector.getValidator();
@@ -193,15 +193,15 @@ public class JobRequestHandler implements RequestHandler {
// We need translate forms to configuration objects
Object fromConnectorConfig = ClassUtils.instantiate(
- fromConnector.getJobConfigurationClass(ConnectorType.FROM));
+ fromConnector.getJobConfigurationClass(Direction.FROM));
Object frameworkConfig = ClassUtils.instantiate(
FrameworkManager.getInstance().getJobConfigurationClass());
Object toConnectorConfig = ClassUtils.instantiate(
- toConnector.getJobConfigurationClass(ConnectorType.TO));
+ toConnector.getJobConfigurationClass(Direction.TO));
- FormUtils.fromForms(job.getConnectorPart(ConnectorType.FROM).getForms(), fromConnectorConfig);
+ FormUtils.fromForms(job.getConnectorPart(Direction.FROM).getForms(), fromConnectorConfig);
FormUtils.fromForms(job.getFrameworkPart().getForms(), frameworkConfig);
- FormUtils.fromForms(job.getConnectorPart(ConnectorType.TO).getForms(), toConnectorConfig);
+ FormUtils.fromForms(job.getConnectorPart(Direction.TO).getForms(), toConnectorConfig);
// Validate all parts
Validation fromConnectorValidation =
@@ -262,7 +262,7 @@ public class JobRequestHandler implements RequestHandler {
// Add associated resources into the bean
// @TODO(Abe): From/To.
for( MJob job : jobs) {
- long connectorId = job.getConnectorId(ConnectorType.FROM);
+ long connectorId = job.getConnectorId(Direction.FROM);
if(!bean.hasConnectorBundle(connectorId)) {
bean.addConnectorBundle(connectorId,
ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
@@ -273,7 +273,7 @@ public class JobRequestHandler implements RequestHandler {
MJob job = repository.findJob(jid);
// @TODO(Abe): From/To
- long connectorId = job.getConnectorId(ConnectorType.FROM);
+ long connectorId = job.getConnectorId(Direction.FROM);
bean = new JobBean(job);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
index 1b8f2b8..ed461ab 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CloneJobFunction.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.shell;
import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MPersistableEntity;
import org.apache.sqoop.shell.core.Constants;
@@ -64,10 +64,10 @@ public class CloneJobFunction extends SqoopFunction {
job.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
ResourceBundle fromConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.FROM));
+ job.getConnectorId(Direction.FROM));
ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
ResourceBundle toConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.TO));
+ job.getConnectorId(Direction.TO));
Status status = Status.FINE;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
index 9c558e2..88afde3 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/CreateJobFunction.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.shell;
import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
@@ -75,9 +75,9 @@ public class CreateJobFunction extends SqoopFunction {
// @TODO(Abe): From/To.
ResourceBundle fromConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.FROM));
+ job.getConnectorId(Direction.FROM));
ResourceBundle toConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.TO));
+ job.getConnectorId(Direction.TO));
ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
Status status = Status.FINE;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/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 464f66e..2fcd729 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/ShowJobFunction.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.shell;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.TableDisplayer;
@@ -82,9 +82,9 @@ public class ShowJobFunction extends SqoopFunction {
ids.add(String.valueOf(job.getPersistenceId()));
names.add(job.getName());
fromConnectors.add(String.valueOf(
- job.getConnectorId(ConnectorType.FROM)));
+ job.getConnectorId(Direction.FROM)));
toConnectors.add(String.valueOf(
- job.getConnectorId(ConnectorType.TO)));
+ job.getConnectorId(Direction.TO)));
availabilities.add(String.valueOf(job.getEnabled()));
}
@@ -121,15 +121,15 @@ public class ShowJobFunction extends SqoopFunction {
formatter.format(job.getLastUpdateDate())
);
printlnResource(Constants.RES_SHOW_PROMPT_JOB_XID_CID_INFO,
- job.getConnectionId(ConnectorType.FROM),
- job.getConnectorId(ConnectorType.FROM));
+ job.getConnectionId(Direction.FROM),
+ job.getConnectorId(Direction.FROM));
// Display connector part
- displayForms(job.getConnectorPart(ConnectorType.FROM).getForms(),
- client.getResourceBundle(job.getConnectorId(ConnectorType.FROM)));
+ displayForms(job.getConnectorPart(Direction.FROM).getForms(),
+ client.getResourceBundle(job.getConnectorId(Direction.FROM)));
displayForms(job.getFrameworkPart().getForms(),
client.getFrameworkResourceBundle());
- displayForms(job.getConnectorPart(ConnectorType.TO).getForms(),
- client.getResourceBundle(job.getConnectorId(ConnectorType.TO)));
+ displayForms(job.getConnectorPart(Direction.TO).getForms(),
+ client.getResourceBundle(job.getConnectorId(Direction.TO)));
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
index 9f5366d..9fc9181 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/UpdateJobFunction.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.shell;
import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.shell.core.Constants;
import org.apache.sqoop.shell.utils.FormDisplayer;
@@ -64,10 +64,10 @@ public class UpdateJobFunction extends SqoopFunction {
MJob job = client.getJob(jobId);
ResourceBundle fromConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.FROM));
+ job.getConnectorId(Direction.FROM));
ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();
ResourceBundle toConnectorBundle = client.getResourceBundle(
- job.getConnectorId(ConnectorType.TO));
+ job.getConnectorId(Direction.TO));
Status status = Status.FINE;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java b/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java
index 1e15eb5..e04d7b5 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/utils/FormDisplayer.java
@@ -18,7 +18,7 @@
package org.apache.sqoop.shell.utils;
import org.apache.commons.lang.StringUtils;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MAccountableEntity;
import org.apache.sqoop.model.MBooleanInput;
import org.apache.sqoop.model.MConnection;
@@ -70,13 +70,13 @@ public final class FormDisplayer {
// @TODO(Abe): Validate From/To output is correct.
displayFormsMetadata(
- connector.getJobForms(ConnectorType.FROM).getForms(),
- ConnectorType.FROM.toString() + " " + resourceString(Constants.RES_FORMDISPLAYER_JOB),
+ connector.getJobForms(Direction.FROM).getForms(),
+ Direction.FROM.toString() + " " + resourceString(Constants.RES_FORMDISPLAYER_JOB),
bundle);
displayFormsMetadata(
- connector.getJobForms(ConnectorType.TO).getForms(),
- ConnectorType.TO.toString() + " " + resourceString(Constants.RES_FORMDISPLAYER_JOB),
+ connector.getJobForms(Direction.TO).getForms(),
+ Direction.TO.toString() + " " + resourceString(Constants.RES_FORMDISPLAYER_JOB),
bundle);
}
@@ -153,9 +153,9 @@ public final class FormDisplayer {
formList.addAll(connection.getFrameworkPart().getForms());
} else if(entity instanceof MJob) {
MJob job = (MJob) entity;
- formList.addAll(job.getConnectorPart(ConnectorType.FROM).getForms());
+ formList.addAll(job.getConnectorPart(Direction.FROM).getForms());
formList.addAll(job.getFrameworkPart().getForms());
- formList.addAll(job.getConnectorPart(ConnectorType.TO).getForms());
+ formList.addAll(job.getConnectorPart(Direction.TO).getForms());
}
for(MForm form : formList) {
if(form.getValidationStatus() == Status.ACCEPTABLE) {
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java b/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java
index cc75d94..9d63c6e 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/utils/FormFiller.java
@@ -21,7 +21,7 @@ import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.lang.StringUtils;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MBooleanInput;
import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.model.MEnumInput;
@@ -69,7 +69,7 @@ public final class FormFiller {
// Fill in data from user
return fillForms(line,
- job.getConnectorPart(ConnectorType.FROM).getForms(),
+ job.getConnectorPart(Direction.FROM).getForms(),
job.getFrameworkPart().getForms());
}
@@ -94,11 +94,11 @@ public final class FormFiller {
// Fill in data from user
return fillForms(reader,
- job.getConnectorPart(ConnectorType.FROM).getForms(),
+ job.getConnectorPart(Direction.FROM).getForms(),
fromConnectorBundle,
job.getFrameworkPart().getForms(),
frameworkBundle,
- job.getConnectorPart(ConnectorType.TO).getForms(),
+ job.getConnectorPart(Direction.TO).getForms(),
toConnectorBundle);
}
@@ -909,7 +909,7 @@ public final class FormFiller {
}
public static void printJobValidationMessages(MJob job) {
- for (MForm form : job.getConnectorPart(ConnectorType.FROM).getForms()) {
+ for (MForm form : job.getConnectorPart(Direction.FROM).getForms()) {
for (MInput<?> input : form.getInputs()) {
printValidationMessage(input, true);
}
@@ -919,7 +919,7 @@ public final class FormFiller {
printValidationMessage(input, true);
}
}
- for (MForm form : job.getConnectorPart(ConnectorType.TO).getForms()) {
+ for (MForm form : job.getConnectorPart(Direction.TO).getForms()) {
for (MInput<?> input : form.getInputs()) {
printValidationMessage(input, true);
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/a41ce9e5/shell/src/main/java/org/apache/sqoop/shell/utils/JobDynamicFormOptions.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/sqoop/shell/utils/JobDynamicFormOptions.java b/shell/src/main/java/org/apache/sqoop/shell/utils/JobDynamicFormOptions.java
index 40a4e33..87c0776 100644
--- a/shell/src/main/java/org/apache/sqoop/shell/utils/JobDynamicFormOptions.java
+++ b/shell/src/main/java/org/apache/sqoop/shell/utils/JobDynamicFormOptions.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.shell.utils;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
-import org.apache.sqoop.common.ConnectorType;
+import org.apache.sqoop.common.Direction;
import org.apache.sqoop.model.MJob;
/**
@@ -35,13 +35,13 @@ public class JobDynamicFormOptions extends DynamicFormOptions<MJob> {
.withLongOpt("name")
.hasArg()
.create());
- for (Option option : FormOptions.getFormsOptions("connector", job.getConnectorPart(ConnectorType.FROM).getForms())) {
+ for (Option option : FormOptions.getFormsOptions("connector", job.getConnectorPart(Direction.FROM).getForms())) {
this.addOption(option);
}
for (Option option : FormOptions.getFormsOptions("framework", job.getFrameworkPart().getForms())) {
this.addOption(option);
}
- for (Option option : FormOptions.getFormsOptions("connector", job.getConnectorPart(ConnectorType.TO).getForms())) {
+ for (Option option : FormOptions.getFormsOptions("connector", job.getConnectorPart(Direction.TO).getForms())) {
this.addOption(option);
}
}