5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-19 02:10:54 +08:00

SQOOP-1645: Update label text and (optional) required info for the generic jdbc connector config properties

(Veena Basavaraj via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2014-10-30 07:37:05 -07:00
parent 753f991fc2
commit f5d29aec86
5 changed files with 61 additions and 55 deletions

View File

@ -128,8 +128,8 @@ private void configureTableProperties(MutableContext context, LinkConfiguration
String schemaName = toJobConfig.toJobConfig.schemaName;
String tableName = toJobConfig.toJobConfig.tableName;
String stageTableName = toJobConfig.toJobConfig.stageTableName;
boolean clearStageTable = toJobConfig.toJobConfig.clearStageTable == null ?
false : toJobConfig.toJobConfig.clearStageTable;
boolean clearStageTable = toJobConfig.toJobConfig.shouldClearStageTable == null ?
false : toJobConfig.toJobConfig.shouldClearStageTable;
final boolean stageEnabled =
stageTableName != null && stageTableName.length() > 0;
String tableSql = toJobConfig.toJobConfig.sql;

View File

@ -28,7 +28,7 @@
/**
*
*/
@ConfigClass( validators = {@Validator(FromJobConfig.ConfigValidator.class)})
@ConfigClass(validators = { @Validator(FromJobConfig.ConfigValidator.class) })
public class FromJobConfig {
@Input(size = 50)
public String schemaName;
@ -36,7 +36,7 @@ public class FromJobConfig {
@Input(size = 50)
public String tableName;
@Input(size = 2000, validators = {@Validator(value = NullOrContains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN)})
@Input(size = 2000, validators = { @Validator(value = NullOrContains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN) })
public String sql;
@Input(size = 50)
@ -54,13 +54,13 @@ public class FromJobConfig {
public static class ConfigValidator extends AbstractValidator<FromJobConfig> {
@Override
public void validate(FromJobConfig config) {
if(config.tableName == null && config.sql == null) {
if (config.tableName == null && config.sql == null) {
addMessage(Status.UNACCEPTABLE, "Either table name or SQL must be specified");
}
if(config.tableName != null && config.sql != null) {
if (config.tableName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
}
if(config.schemaName != null && config.sql != null) {
if (config.schemaName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both schema name and SQL cannot be specified");
}
}

View File

@ -26,29 +26,42 @@
/**
*
*/
@ConfigClass(validators = {@Validator(ToJobConfig.ConfigValidator.class)})
@ConfigClass(validators = { @Validator(ToJobConfig.ConfigValidator.class) })
public class ToJobConfig {
@Input(size = 50) public String schemaName;
@Input(size = 2000) public String tableName;
@Input(size = 50) public String sql;
@Input(size = 50) public String columns;
@Input(size = 2000) public String stageTableName;
@Input public Boolean clearStageTable;
@Input(size = 50)
public String schemaName;
@Input(size = 2000)
public String tableName;
@Input(size = 50)
public String sql;
@Input(size = 50)
public String columns;
@Input(size = 2000)
public String stageTableName;
@Input
public Boolean shouldClearStageTable;
public static class ConfigValidator extends AbstractValidator<ToJobConfig> {
@Override
public void validate(ToJobConfig config) {
if(config.tableName == null && config.sql == null) {
if (config.tableName == null && config.sql == null) {
addMessage(Status.UNACCEPTABLE, "Either table name or SQL must be specified");
}
if(config.tableName != null && config.sql != null) {
if (config.tableName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
}
if(config.tableName == null && config.stageTableName != null) {
addMessage(Status.UNACCEPTABLE, "Stage table name cannot be specified without specifying table name");
if (config.tableName == null && config.stageTableName != null) {
addMessage(Status.UNACCEPTABLE,
"Stage table name cannot be specified without specifying table name");
}
if(config.stageTableName == null && config.clearStageTable != null) {
addMessage(Status.UNACCEPTABLE, "Clear stage table cannot be specified without specifying name of the stage table.");
if (config.stageTableName == null && config.shouldClearStageTable != null) {
addMessage(Status.UNACCEPTABLE,
"Should Clear stage table cannot be specified without specifying the name of the stage table.");
}
}
}

View File

@ -20,17 +20,18 @@
#
linkConfig.label = Link configuration
linkConfig.help = You must supply the information requested in order to \
create a connection object.
create a link object.
# jdbc driver
linkConfig.jdbcDriver.label = JDBC Driver Class
linkConfig.jdbcDriver.help = Enter the fully qualified class name of the JDBC \
driver that will be used for establishing this connection.
driver that will be used for establishing this connection.\
Note: The driver jar must be in the sqoop lib directory.
# connect string
linkConfig.connectionString.label = JDBC Connection String
linkConfig.connectionString.help = Enter the value of JDBC connection string to be \
used by this connector for creating connections.
used by this connector for creating database connections.
# username string
linkConfig.username.label = Username
@ -50,78 +51,70 @@ linkConfig.jdbcProperties.help = Enter any JDBC properties that should be \
# From Job Config
#
fromJobConfig.label = From database configuration
fromJobConfig.help = You must supply the information requested in order to create \
a job object.
fromJobConfig.help = You must supply the information requested below in order to create \
the FROM part of the job object
# From schema name
fromJobConfig.schemaName.label = Schema name
fromJobConfig.schemaName.help = Schema name to process data in the remote database
fromJobConfig.schemaName.help = Schema name to read data from
# From table name
fromJobConfig.tableName.label = Table name
fromJobConfig.tableName.help = Table name to process data in the remote database
fromJobConfig.tableName.help = Table name to read data from
# From table SQL
fromJobConfig.sql.label = Table SQL statement
fromJobConfig.sql.help = SQL statement to process data in the remote database
fromJobConfig.sql.help = SQL statement to read data from (Optional if table name is already given)
# From table columns
fromJobConfig.columns.label = Table column names
fromJobConfig.columns.help = Specific columns of a table name or a table SQL
fromJobConfig.columns.help = Specific columns in the given table name or the SQL query (Optional)
# From table warehouse
fromJobConfig.warehouse.label = Data warehouse
fromJobConfig.warehouse.help = The root directory for data
# From table datadir
fromJobConfig.dataDirectory.label = Data directory
fromJobConfig.dataDirectory.help = The sub-directory under warehouse for data
# From table pcol
# From table partition column
fromJobConfig.partitionColumn.label = Partition column name
fromJobConfig.partitionColumn.help = A specific column for data partition
fromJobConfig.partitionColumn.help = A specific column for data partition (Optional)
# From table pcol is null
fromJobConfig.partitionColumnNull.label = Nulls in partition column
fromJobConfig.partitionColumnNull.help = Whether there are null values in partition column
# From table allow nulls in partition column
fromJobConfig.allowNullValueInPartitionColumn.label = Null value allowed for the partition column
fromJobConfig.allowNullValueInPartitionColumn.help = Whether there are null values in partition column (Defaults to false)
# From table boundary
fromJobConfig.boundaryQuery.label = Boundary query
fromJobConfig.boundaryQuery.help = The boundary query for data partition
fromJobConfig.boundaryQuery.help = The boundary query for data partition (Optional)
# ToJob Config
#
toJobConfig.label = To database configuration
toJobConfig.help = You must supply the information requested in order to create \
a job object.
the TO part of the job object.
# To schema name
toJobConfig.schemaName.label = Schema name
toJobConfig.schemaName.help = Schema name to process data in the remote database
toJobConfig.schemaName.help = Schema name to write data into
# To table name
toJobConfig.tableName.label = Table name
toJobConfig.tableName.help = Table name to process data in the remote database
toJobConfig.tableName.help = Table name to write data into
# To table SQL
toJobConfig.sql.label = Table SQL statement
toJobConfig.sql.help = SQL statement to process data in the remote database
toJobConfig.sql.help = SQL statement to use to write data into (Optional if table name is already given)
# To table columns
toJobConfig.columns.label = Table column names
toJobConfig.columns.help = Specific columns of a table name or a table SQL
toJobConfig.columns.help = Specific columns to use in the given table name or the table SQL (Optional)
# To stage table name
toJobConfig.stageTableName.label = Stage table name
toJobConfig.stageTableName.help = Name of the stage table to use
toJobConfig.stageTableName.help = Name of the staging table to use (Optional)
# To clear stage table
toJobConfig.clearStageTable.label = Clear stage table
toJobConfig.clearStageTable.help = Indicate if the stage table should be cleared
toJobConfig.shouldClearStageTable.label = Should clear stage table
toJobConfig.shouldClearStageTable.help = Indicate if the stage table should be cleared (Defaults to false)
# Placeholders to have some entities created
ignored.label = Ignored
ignored.help = This is completely ignored
ignored.ignored.label = Ignored
ignored.ignored.help = This is completely ignored
ignored.ignored.help = This is completely ignored

View File

@ -288,7 +288,7 @@ public void testClearStageTableValidation() throws Exception {
//specifying clear stage table flag without specifying name of
// the stage table
jobConfig.toJobConfig.tableName = schemalessTableName;
jobConfig.toJobConfig.clearStageTable = false;
jobConfig.toJobConfig.shouldClearStageTable = false;
ConfigValidationRunner validationRunner = new ConfigValidationRunner();
ConfigValidationResult result = validationRunner.validate(jobConfig);
assertEquals("User should not specify clear stage table flag without " +
@ -298,7 +298,7 @@ public void testClearStageTableValidation() throws Exception {
assertTrue(result.getMessages().containsKey(
"toJobConfig"));
jobConfig.toJobConfig.clearStageTable = true;
jobConfig.toJobConfig.shouldClearStageTable = true;
result = validationRunner.validate(jobConfig);
assertEquals("User should not specify clear stage table flag without " +
"specifying name of the stage table",
@ -339,7 +339,7 @@ public void testClearStageTable() throws Exception {
linkConfig.linkConfig.connectionString = GenericJdbcTestConstants.URL;
jobConfig.toJobConfig.tableName = schemalessTableName;
jobConfig.toJobConfig.stageTableName = stageTableName;
jobConfig.toJobConfig.clearStageTable = true;
jobConfig.toJobConfig.shouldClearStageTable = true;
createTable(fullStageTableName);
executor.executeUpdate("INSERT INTO " + fullStageTableName +
" VALUES(1, 1.1, 'one')");