mirror of
https://github.com/apache/sqoop.git
synced 2025-05-13 23:41:56 +08:00
SQOOP-887: Sqoop2: Move string constants from FormDisplayer to resource file
(Vasanth kumar RJ via Jarek Jarcec Cecho)
This commit is contained in:
parent
0cc834928a
commit
daccebac51
@ -316,6 +316,37 @@ public class Constants {
|
|||||||
public static final String RES_TABLE_HEADER_CONNECTOR =
|
public static final String RES_TABLE_HEADER_CONNECTOR =
|
||||||
"table.header.connector";
|
"table.header.connector";
|
||||||
|
|
||||||
|
public static final String RES_FORMDISPLAYER_SUPPORTED_JOBTYPE =
|
||||||
|
"formdisplayer.supported_job_types";
|
||||||
|
public static final String RES_FORMDISPLAYER_CONNECTION =
|
||||||
|
"formdisplayer.connection";
|
||||||
|
public static final String RES_FORMDISPLAYER_JOB =
|
||||||
|
"formdisplayer.job";
|
||||||
|
public static final String RES_FORMDISPLAYER_FORM_JOBTYPE =
|
||||||
|
"formdisplayer.forms_jobtype";
|
||||||
|
public static final String RES_FORMDISPLAYER_FORM =
|
||||||
|
"formdisplayer.form";
|
||||||
|
public static final String RES_FORMDISPLAYER_NAME =
|
||||||
|
"formdisplayer.name";
|
||||||
|
public static final String RES_FORMDISPLAYER_LABEL =
|
||||||
|
"formdisplayer.label";
|
||||||
|
public static final String RES_FORMDISPLAYER_HELP =
|
||||||
|
"formdisplayer.help";
|
||||||
|
public static final String RES_FORMDISPLAYER_INPUT =
|
||||||
|
"formdisplayer.input";
|
||||||
|
public static final String RES_FORMDISPLAYER_TYPE =
|
||||||
|
"formdisplayer.type";
|
||||||
|
public static final String RES_FORMDISPLAYER_MASK =
|
||||||
|
"formdisplayer.mask";
|
||||||
|
public static final String RES_FORMDISPLAYER_SIZE =
|
||||||
|
"formdisplayer.size";
|
||||||
|
public static final String RES_FORMDISPLAYER_POSSIBLE_VALUES =
|
||||||
|
"formdisplayer.possible_values";
|
||||||
|
public static final String RES_FORMDISPLAYER_UNSUPPORTED_DATATYPE =
|
||||||
|
"formdisplayer.unsupported_datatype";
|
||||||
|
public static final String RES_FORMDISPLAYER_INPUT_SENSITIVE =
|
||||||
|
"formdisplayer.input_sensitive";
|
||||||
|
|
||||||
private Constants() {
|
private Constants() {
|
||||||
// Instantiation is prohibited
|
// Instantiation is prohibited
|
||||||
}
|
}
|
||||||
|
@ -144,4 +144,8 @@ public static void print(String str) {
|
|||||||
public static void print(Object obj) {
|
public static void print(Object obj) {
|
||||||
io.out.print(obj);
|
io.out.print(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void print(String format, Object... args) {
|
||||||
|
io.out.printf(format, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.client.utils;
|
package org.apache.sqoop.client.utils;
|
||||||
|
|
||||||
|
import org.apache.sqoop.client.core.Constants;
|
||||||
import org.apache.sqoop.model.MEnumInput;
|
import org.apache.sqoop.model.MEnumInput;
|
||||||
import org.apache.sqoop.model.MForm;
|
import org.apache.sqoop.model.MForm;
|
||||||
import org.apache.sqoop.model.MFramework;
|
import org.apache.sqoop.model.MFramework;
|
||||||
@ -42,20 +43,20 @@ public final class FormDisplayer {
|
|||||||
|
|
||||||
public static void displayFormMetadataDetails(MFramework framework,
|
public static void displayFormMetadataDetails(MFramework framework,
|
||||||
ResourceBundle bundle) {
|
ResourceBundle bundle) {
|
||||||
print(" Supported job types: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_SUPPORTED_JOBTYPE));
|
||||||
println(framework.getAllJobsForms().keySet().toString());
|
println(framework.getAllJobsForms().keySet().toString());
|
||||||
|
|
||||||
displayFormsMetadata(
|
displayFormsMetadata(
|
||||||
framework.getConnectionForms().getForms(),
|
framework.getConnectionForms().getForms(),
|
||||||
"Connection",
|
resourceString(Constants.RES_FORMDISPLAYER_CONNECTION),
|
||||||
bundle);
|
bundle);
|
||||||
|
|
||||||
for (MJobForms jobForms : framework.getAllJobsForms().values()) {
|
for (MJobForms jobForms : framework.getAllJobsForms().values()) {
|
||||||
print(" Forms for job type ");
|
print(" %s ", resourceString(Constants.RES_FORMDISPLAYER_FORM_JOBTYPE));
|
||||||
print(jobForms.getType().name());
|
print(jobForms.getType().name());
|
||||||
println(":");
|
println(":");
|
||||||
|
|
||||||
displayFormsMetadata(jobForms.getForms(), "Job", bundle);
|
displayFormsMetadata(jobForms.getForms(), resourceString(Constants.RES_FORMDISPLAYER_JOB), bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,46 +68,46 @@ public static void displayFormsMetadata(List<MForm> forms,
|
|||||||
while (fiter.hasNext()) {
|
while (fiter.hasNext()) {
|
||||||
print(" ");
|
print(" ");
|
||||||
print(type);
|
print(type);
|
||||||
print(" form ");
|
print(" %s ", resourceString(Constants.RES_FORMDISPLAYER_FORM));
|
||||||
print(findx++);
|
print(findx++);
|
||||||
println(":");
|
println(":");
|
||||||
|
|
||||||
MForm form = fiter.next();
|
MForm form = fiter.next();
|
||||||
print(" Name: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_NAME));
|
||||||
println(form.getName());
|
println(form.getName());
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print(" Label: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_LABEL));
|
||||||
println(bundle.getString(form.getLabelKey()));
|
println(bundle.getString(form.getLabelKey()));
|
||||||
|
|
||||||
// Help text
|
// Help text
|
||||||
print(" Help: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_HELP));
|
||||||
println(bundle.getString(form.getHelpKey()));
|
println(bundle.getString(form.getHelpKey()));
|
||||||
|
|
||||||
List<MInput<?>> inputs = form.getInputs();
|
List<MInput<?>> inputs = form.getInputs();
|
||||||
Iterator<MInput<?>> iiter = inputs.iterator();
|
Iterator<MInput<?>> iiter = inputs.iterator();
|
||||||
int iindx = 1;
|
int iindx = 1;
|
||||||
while (iiter.hasNext()) {
|
while (iiter.hasNext()) {
|
||||||
print(" Input ");
|
print(" %s ", resourceString(Constants.RES_FORMDISPLAYER_INPUT));
|
||||||
print(iindx++);
|
print(iindx++);
|
||||||
println(":");
|
println(":");
|
||||||
|
|
||||||
MInput<?> input = iiter.next();
|
MInput<?> input = iiter.next();
|
||||||
print(" Name: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_NAME));
|
||||||
println(input.getName());
|
println(input.getName());
|
||||||
print(" Label: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_LABEL));
|
||||||
println(bundle.getString(input.getLabelKey()));
|
println(bundle.getString(input.getLabelKey()));
|
||||||
print(" Help: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_HELP));
|
||||||
println(bundle.getString(input.getHelpKey()));
|
println(bundle.getString(input.getHelpKey()));
|
||||||
print(" Type: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_TYPE));
|
||||||
println(input.getType());
|
println(input.getType());
|
||||||
if (input.getType() == MInputType.STRING) {
|
if (input.getType() == MInputType.STRING) {
|
||||||
print(" Mask: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_MASK));
|
||||||
println(((MStringInput)input).isMasked());
|
println(((MStringInput)input).isMasked());
|
||||||
print(" Size: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_SIZE));
|
||||||
println(((MStringInput)input).getMaxLength());
|
println(((MStringInput)input).getMaxLength());
|
||||||
} else if(input.getType() == MInputType.ENUM) {
|
} else if(input.getType() == MInputType.ENUM) {
|
||||||
print(" Possible values: ");
|
print(" %s: ", resourceString(Constants.RES_FORMDISPLAYER_POSSIBLE_VALUES));
|
||||||
println(StringUtils.join(((MEnumInput)input).getValues(), ","));
|
println(StringUtils.join(((MEnumInput)input).getValues(), ","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +144,7 @@ private static void displayForm(MForm form, ResourceBundle bundle) {
|
|||||||
displayInputEnum((MEnumInput) input);
|
displayInputEnum((MEnumInput) input);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
println("Unsupported data type " + input.getType());
|
print("\n%s " + input.getType(), resourceString(Constants.RES_FORMDISPLAYER_UNSUPPORTED_DATATYPE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ private static void displayForm(MForm form, ResourceBundle bundle) {
|
|||||||
*/
|
*/
|
||||||
private static void displayInputString(MStringInput input) {
|
private static void displayInputString(MStringInput input) {
|
||||||
if (input.isMasked()) {
|
if (input.isMasked()) {
|
||||||
print("(This input is sensitive)");
|
print("(%s)", resourceString(Constants.RES_FORMDISPLAYER_INPUT_SENSITIVE));
|
||||||
} else {
|
} else {
|
||||||
print(input.getValue());
|
print(input.getValue());
|
||||||
}
|
}
|
||||||
|
@ -170,3 +170,20 @@ table.header.version = Version
|
|||||||
table.header.class = Class
|
table.header.class = Class
|
||||||
table.header.type = Type
|
table.header.type = Type
|
||||||
table.header.connector = Connector
|
table.header.connector = Connector
|
||||||
|
|
||||||
|
#Form displayer resources
|
||||||
|
formdisplayer.supported_job_types = Supported job types
|
||||||
|
formdisplayer.connection = Connection
|
||||||
|
formdisplayer.job = Job
|
||||||
|
formdisplayer.forms_jobtype = Forms for job type
|
||||||
|
formdisplayer.form = form
|
||||||
|
formdisplayer.name = Name
|
||||||
|
formdisplayer.label = Label
|
||||||
|
formdisplayer.help = Help
|
||||||
|
formdisplayer.input = Input
|
||||||
|
formdisplayer.type = Type
|
||||||
|
formdisplayer.mask = Mask
|
||||||
|
formdisplayer.size = Size
|
||||||
|
formdisplayer.possible_values = Possible values
|
||||||
|
formdisplayer.unsupported_datatype = Unsupported data type
|
||||||
|
formdisplayer.input_sensitive = This input is sensitive
|
||||||
|
Loading…
Reference in New Issue
Block a user