You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ch...@apache.org on 2012/12/17 22:11:06 UTC
git commit: SQOOP-776: show connection command shows password in
plain text
Updated Branches:
refs/heads/sqoop2 32c420678 -> 7b5994cfa
SQOOP-776: show connection command shows password in plain text
(Jarek Jarcec Cecho via Cheolsoo Park)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/7b5994cf
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/7b5994cf
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/7b5994cf
Branch: refs/heads/sqoop2
Commit: 7b5994cfadc2d698d576739bff7d4368ca8b7617
Parents: 32c4206
Author: Cheolsoo Park <ch...@apache.org>
Authored: Mon Dec 17 13:10:11 2012 -0800
Committer: Cheolsoo Park <ch...@apache.org>
Committed: Mon Dec 17 13:10:11 2012 -0800
----------------------------------------------------------------------
.../apache/sqoop/client/utils/FormDisplayer.java | 72 ++++++++++++++-
1 files changed, 71 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/7b5994cf/client/src/main/java/org/apache/sqoop/client/utils/FormDisplayer.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/utils/FormDisplayer.java b/client/src/main/java/org/apache/sqoop/client/utils/FormDisplayer.java
index 97eea79..4d0442f 100644
--- a/client/src/main/java/org/apache/sqoop/client/utils/FormDisplayer.java
+++ b/client/src/main/java/org/apache/sqoop/client/utils/FormDisplayer.java
@@ -22,13 +22,16 @@ import org.apache.sqoop.model.MForm;
import org.apache.sqoop.model.MFramework;
import org.apache.sqoop.model.MInput;
import org.apache.sqoop.model.MInputType;
+import org.apache.sqoop.model.MIntegerInput;
import org.apache.sqoop.model.MJobForms;
+import org.apache.sqoop.model.MMapInput;
import org.apache.sqoop.model.MStringInput;
import org.apache.sqoop.utils.StringUtils;
import org.codehaus.groovy.tools.shell.IO;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.ResourceBundle;
/**
@@ -128,12 +131,79 @@ public final class FormDisplayer {
io.out.print(bundle.getString(input.getLabelKey()));
io.out.print(": ");
if(!input.isEmpty()) {
- io.out.print(input.getUrlSafeValueString());
+ // Based on the input type, let's perform specific load
+ switch (input.getType()) {
+ case STRING:
+ displayInputString(io, (MStringInput) input);
+ break;
+ case INTEGER:
+ displayInputInteger(io, (MIntegerInput) input);
+ break;
+ case MAP:
+ displayInputMap(io, (MMapInput) input);
+ break;
+ case ENUM:
+ displayInputEnum(io, (MEnumInput) input);
+ break;
+ default:
+ io.out.println("Unsupported data type " + input.getType());
+ return;
+ }
}
io.out.println("");
}
}
+ /**
+ * Display content of String input.
+ *
+ * @param io Shell's IO object
+ * @param input String input
+ */
+ private static void displayInputString(IO io, MStringInput input) {
+ if (input.isMasked()) {
+ io.out.print("(This input is sensitive)");
+ } else {
+ io.out.print(input.getValue());
+ }
+ }
+
+ /**
+ * Display content of Integer input.
+ *
+ * @param io Shell's IO object
+ * @param input Integer input
+ */
+ private static void displayInputInteger(IO io, MIntegerInput input) {
+ io.out.print(input.getValue());
+ }
+
+ /**
+ * Display content of Map input
+ *
+ * @param io Shell's IO object
+ * @param input Map input
+ */
+ private static void displayInputMap(IO io, MMapInput input) {
+ for(Map.Entry<String, String> entry : input.getValue().entrySet()) {
+ io.out.println();
+ io.out.print(" ");
+ io.out.print(entry.getKey());
+ io.out.print(" = ");
+ io.out.print(entry.getValue());
+ }
+ }
+
+ /**
+ * Display content of Enum input
+ *
+ * @param io Shell's IO object
+ * @param input Enum input
+ */
+ private static void displayInputEnum(IO io, MEnumInput input) {
+ io.out.print(input.getValue());
+ }
+
private FormDisplayer() {
// Do not instantiate
}