зеркало из https://github.com/github/sqoop.git
SQOOP-1417: Sqoop2: From/To: Change ConnectorType name
(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
Родитель
a53e4141ac
Коммит
1ebf1b89b3
|
@ -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();
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.apache.sqoop.common;
|
|||
* is being used to load data TO, then the connector type
|
||||
* will be TO.
|
||||
*/
|
||||
public enum ConnectorType {
|
||||
public enum Direction {
|
||||
FROM,
|
||||
TO
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.sqoop.common;
|
||||
|
||||
public enum ConnectorTypeError implements ErrorCode {
|
||||
public enum DirectionError implements ErrorCode {
|
||||
|
||||
/** An unknown error has occurred. */
|
||||
CONNECTOR_TYPE_0000("Unknown connector type")
|
||||
|
@ -26,7 +26,7 @@ public enum ConnectorTypeError implements ErrorCode {
|
|||
|
||||
private final String message;
|
||||
|
||||
private ConnectorTypeError(String message) {
|
||||
private DirectionError(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
|
@ -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 =
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()));
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.sqoop.connector.spi;
|
|||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.sqoop.common.ConnectorType;
|
||||
import org.apache.sqoop.common.Direction;
|
||||
import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
|
||||
import org.apache.sqoop.connector.idf.IntermediateDataFormat;
|
||||
import org.apache.sqoop.job.etl.From;
|
||||
|
@ -53,7 +53,7 @@ public abstract class SqoopConnector {
|
|||
/**
|
||||
* @return Get job configuration class for given type or null if not supported
|
||||
*/
|
||||
public abstract Class getJobConfigurationClass(ConnectorType jobType);
|
||||
public abstract Class getJobConfigurationClass(Direction jobType);
|
||||
|
||||
/**
|
||||
* @return an <tt>From</tt> that provides classes for performing import.
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.hadoop.mapred.JobStatus;
|
|||
import org.apache.hadoop.mapred.RunningJob;
|
||||
import org.apache.hadoop.mapreduce.Job;
|
||||
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.execution.mapreduce.MRSubmissionRequest;
|
||||
|
@ -164,7 +164,7 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
|
|||
}
|
||||
|
||||
// Serialize connector context as a sub namespace
|
||||
for(Map.Entry<String, String> entry : request.getConnectorContext(ConnectorType.FROM)) {
|
||||
for(Map.Entry<String, String> entry : request.getConnectorContext(Direction.FROM)) {
|
||||
if (entry.getValue() == null) {
|
||||
LOG.warn("Ignoring null connector context value for key " + entry.getKey());
|
||||
continue;
|
||||
|
@ -174,7 +174,7 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
|
|||
entry.getValue());
|
||||
}
|
||||
|
||||
for(Map.Entry<String, String> entry : request.getConnectorContext(ConnectorType.TO)) {
|
||||
for(Map.Entry<String, String> entry : request.getConnectorContext(Direction.TO)) {
|
||||
if (entry.getValue() == null) {
|
||||
LOG.warn("Ignoring null connector context value for key " + entry.getKey());
|
||||
continue;
|
||||
|
@ -200,15 +200,15 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
|
|||
Job job = new Job(configuration);
|
||||
|
||||
// And finally put all configuration objects to credentials cache
|
||||
ConfigurationUtils.setConnectorConnectionConfig(ConnectorType.FROM, job, request.getConnectorConnectionConfig(ConnectorType.FROM));
|
||||
ConfigurationUtils.setConnectorJobConfig(ConnectorType.FROM, job, request.getConnectorJobConfig(ConnectorType.FROM));
|
||||
ConfigurationUtils.setConnectorConnectionConfig(ConnectorType.TO, job, request.getConnectorConnectionConfig(ConnectorType.TO));
|
||||
ConfigurationUtils.setConnectorJobConfig(ConnectorType.TO, job, request.getConnectorJobConfig(ConnectorType.TO));
|
||||
ConfigurationUtils.setFrameworkConnectionConfig(ConnectorType.FROM, job, request.getFrameworkConnectionConfig(ConnectorType.FROM));
|
||||
ConfigurationUtils.setFrameworkConnectionConfig(ConnectorType.TO, job, request.getFrameworkConnectionConfig(ConnectorType.TO));
|
||||
ConfigurationUtils.setConnectorConnectionConfig(Direction.FROM, job, request.getConnectorConnectionConfig(Direction.FROM));
|
||||
ConfigurationUtils.setConnectorJobConfig(Direction.FROM, job, request.getConnectorJobConfig(Direction.FROM));
|
||||
ConfigurationUtils.setConnectorConnectionConfig(Direction.TO, job, request.getConnectorConnectionConfig(Direction.TO));
|
||||
ConfigurationUtils.setConnectorJobConfig(Direction.TO, job, request.getConnectorJobConfig(Direction.TO));
|
||||
ConfigurationUtils.setFrameworkConnectionConfig(Direction.FROM, job, request.getFrameworkConnectionConfig(Direction.FROM));
|
||||
ConfigurationUtils.setFrameworkConnectionConfig(Direction.TO, job, request.getFrameworkConnectionConfig(Direction.TO));
|
||||
ConfigurationUtils.setFrameworkJobConfig(job, request.getConfigFrameworkJob());
|
||||
// @TODO(Abe): Persist TO schema.
|
||||
ConfigurationUtils.setConnectorSchema(ConnectorType.FROM, job, request.getSummary().getConnectorSchema());
|
||||
ConfigurationUtils.setConnectorSchema(Direction.FROM, job, request.getSummary().getConnectorSchema());
|
||||
|
||||
if(request.getJobName() != null) {
|
||||
job.setJobName("Sqoop: " + request.getJobName());
|
||||
|
|
Загрузка…
Ссылка в новой задаче