sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-1686: Sqoop2: Fix the JSON names for config and config values
Date Thu, 06 Nov 2014 18:19:29 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 a63c9efe1 -> f9b53acf5


SQOOP-1686: Sqoop2: Fix the JSON names for config and config values

(Veena Basavaraj via Abraham Elmahrek)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/f9b53acf
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/f9b53acf
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/f9b53acf

Branch: refs/heads/sqoop2
Commit: f9b53acf5279ba230699e32768c7a14c314303a5
Parents: a63c9ef
Author: Abraham Elmahrek <abraham@elmahrek.com>
Authored: Thu Nov 6 10:18:42 2014 -0800
Committer: Abraham Elmahrek <abraham@elmahrek.com>
Committed: Thu Nov 6 10:18:42 2014 -0800

----------------------------------------------------------------------
 .../org/apache/sqoop/json/ConnectorBean.java    | 24 ++++++++++----------
 .../java/org/apache/sqoop/json/DriverBean.java  | 10 ++++----
 .../java/org/apache/sqoop/json/JobBean.java     | 18 +++++++--------
 .../java/org/apache/sqoop/json/JsonBean.java    |  2 +-
 .../java/org/apache/sqoop/json/LinkBean.java    |  6 ++---
 .../org/apache/sqoop/json/TestLinkBean.java     |  6 ++---
 6 files changed, 33 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
index 845cafa..d7e0cea 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
@@ -44,8 +44,8 @@ import org.json.simple.JSONObject;
 public class ConnectorBean extends ConfigurableBean {
 
   // to represent the config and inputs with values
-  public static final String CONNECTOR_LINK_CONFIG_VALUES = "link-config-values";
-  public static final String CONNECTOR_JOB_CONFIG_VALUES = "job-config-values";
+  public static final String CONNECTOR_LINK_CONFIG = "link-config";
+  public static final String CONNECTOR_JOB_CONFIG = "job-config";
   private static final String CONNECTOR = "connector";
 
   private List<MConnector> connectors;
@@ -88,28 +88,28 @@ public class ConnectorBean extends ConfigurableBean {
       connectorJsonObject.put(CLASS, connector.getClassName());
       connectorJsonObject.put(CONFIGURABLE_VERSION, connector.getVersion());
       connectorJsonObject.put(
-          CONNECTOR_LINK_CONFIG_VALUES,
+          CONNECTOR_LINK_CONFIG,
           extractConfigList(connector.getLinkConfig().getConfigs(), connector.getLinkConfig()
               .getType(), skipSensitive));
 
-      connectorJsonObject.put(CONNECTOR_JOB_CONFIG_VALUES, new JSONObject());
+      connectorJsonObject.put(CONNECTOR_JOB_CONFIG, new JSONObject());
       // add sub fields to the job config for from and to
       if (connector.getFromConfig() != null) {
-        ((JSONObject) connectorJsonObject.get(CONNECTOR_JOB_CONFIG_VALUES)).put(
+        ((JSONObject) connectorJsonObject.get(CONNECTOR_JOB_CONFIG)).put(
             Direction.FROM,
             extractConfigList(connector.getFromConfig().getConfigs(), connector.getFromConfig()
                 .getType(), skipSensitive));
       }
       if (connector.getToConfig() != null) {
-        ((JSONObject) connectorJsonObject.get(CONNECTOR_JOB_CONFIG_VALUES)).put(
+        ((JSONObject) connectorJsonObject.get(CONNECTOR_JOB_CONFIG)).put(
             Direction.TO,
             extractConfigList(connector.getToConfig().getConfigs(), connector.getToConfig()
                 .getType(), skipSensitive));
       }
       // add the config-param inside each connector
-      connectorJsonObject.put(ALL_CONFIGS, new JSONObject());
+      connectorJsonObject.put(ALL_CONFIG_RESOURCES, new JSONObject());
       if (connectorConfigBundles != null && !connectorConfigBundles.isEmpty()) {
-        connectorJsonObject.put(ALL_CONFIGS,
+        connectorJsonObject.put(ALL_CONFIG_RESOURCES,
             extractConfigParamBundle(connectorConfigBundles.get(connector.getPersistenceId())));
       }
       connectorArray.add(connectorJsonObject);
@@ -136,10 +136,10 @@ public class ConnectorBean extends ConfigurableBean {
       String version = (String) object.get(CONFIGURABLE_VERSION);
 
       List<MConfig> linkConfigs = restoreConfigList((JSONArray) object
-          .get(CONNECTOR_LINK_CONFIG_VALUES));
+          .get(CONNECTOR_LINK_CONFIG));
 
       // parent that encapsulates both the from/to configs
-      JSONObject jobConfigJson = (JSONObject) object.get(CONNECTOR_JOB_CONFIG_VALUES);
+      JSONObject jobConfigJson = (JSONObject) object.get(CONNECTOR_JOB_CONFIG);
       JSONArray fromJobConfigJson = (JSONArray) jobConfigJson.get(Direction.FROM.name());
       JSONArray toJobConfigJson = (JSONArray) jobConfigJson.get(Direction.TO.name());
 
@@ -161,9 +161,9 @@ public class ConnectorBean extends ConfigurableBean {
           toConfig);
 
       connector.setPersistenceId(connectorId);
-      if (object.containsKey(ALL_CONFIGS)) {
+      if (object.containsKey(ALL_CONFIG_RESOURCES)) {
 
-        JSONObject jsonConfigBundle = (JSONObject) object.get(ALL_CONFIGS);
+        JSONObject jsonConfigBundle = (JSONObject) object.get(ALL_CONFIG_RESOURCES);
         connectorConfigBundles.put(connectorId, restoreConfigParamBundle(jsonConfigBundle));
       }
       connectors.add(connector);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/main/java/org/apache/sqoop/json/DriverBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/DriverBean.java b/common/src/main/java/org/apache/sqoop/json/DriverBean.java
index f200268..0e3f872 100644
--- a/common/src/main/java/org/apache/sqoop/json/DriverBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/DriverBean.java
@@ -36,7 +36,7 @@ import org.json.simple.JSONObject;
 public class DriverBean extends ConfigurableBean {
 
   public static final String CURRENT_DRIVER_VERSION = "1";
-  static final String DRIVER_JOB_CONFIG_VALUES = "job-config-values";
+  static final String DRIVER_JOB_CONFIG = "job-config";
 
   private MDriver driver;
   private ResourceBundle driverConfigBundle;
@@ -68,8 +68,8 @@ public class DriverBean extends ConfigurableBean {
     JSONObject result = new JSONObject();
     result.put(ID, driver.getPersistenceId());
     result.put(CONFIGURABLE_VERSION, driver.getVersion());
-    result.put(DRIVER_JOB_CONFIG_VALUES, configs);
-    result.put(ALL_CONFIGS, extractConfigParamBundle(driverConfigBundle));
+    result.put(DRIVER_JOB_CONFIG, configs);
+    result.put(ALL_CONFIG_RESOURCES, extractConfigParamBundle(driverConfigBundle));
     return result;
   }
 
@@ -77,9 +77,9 @@ public class DriverBean extends ConfigurableBean {
   public void restore(JSONObject jsonObject) {
     long id = (Long) jsonObject.get(ID);
     String driverVersion = (String) jsonObject.get(CONFIGURABLE_VERSION);
-    List<MConfig> driverConfig = restoreConfigList((JSONArray) jsonObject.get(DRIVER_JOB_CONFIG_VALUES));
+    List<MConfig> driverConfig = restoreConfigList((JSONArray) jsonObject.get(DRIVER_JOB_CONFIG));
     driver = new MDriver(new MDriverConfig(driverConfig), driverVersion);
     driver.setPersistenceId(id);
-    driverConfigBundle = restoreConfigParamBundle((JSONObject) jsonObject.get(ALL_CONFIGS));
+    driverConfigBundle = restoreConfigParamBundle((JSONObject) jsonObject.get(ALL_CONFIG_RESOURCES));
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/main/java/org/apache/sqoop/json/JobBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JobBean.java b/common/src/main/java/org/apache/sqoop/json/JobBean.java
index efc2efc..0c258aa 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -45,9 +45,9 @@ public class JobBean implements JsonBean {
   static final String TO_LINK_ID = "to-link-id";
   static final String FROM_CONNECTOR_ID = "from-connector-id";
   static final String TO_CONNECTOR_ID = "to-connector-id";
-  static final String FROM_CONFIG = "from-config";
-  static final String TO_CONFIG = "to-config";
-  static final String DRIVER_CONFIG = "driver-config";
+  static final String FROM_CONFIG_VALUES = "from-config-values";
+  static final String TO_CONFIG_VALUES = "to-config-values";
+  static final String DRIVER_CONFIG_VALUES = "driver-config-values";
   private static final String JOB = "job";
 
   // Required
@@ -129,14 +129,14 @@ public class JobBean implements JsonBean {
       object.put(TO_LINK_ID, job.getLinkId(Direction.TO));
       // job configs
       MFromConfig fromConfigList = job.getFromJobConfig();
-      object.put(FROM_CONFIG,
+      object.put(FROM_CONFIG_VALUES,
           extractConfigList(fromConfigList.getConfigs(), fromConfigList.getType(), skipSensitive));
       MToConfig toConfigList = job.getToJobConfig();
-      object.put(TO_CONFIG,
+      object.put(TO_CONFIG_VALUES,
           extractConfigList(toConfigList.getConfigs(), toConfigList.getType(), skipSensitive));
       MDriverConfig driverConfigList = job.getDriverConfig();
       object.put(
-          DRIVER_CONFIG,
+          DRIVER_CONFIG_VALUES,
           extractConfigList(driverConfigList.getConfigs(), driverConfigList.getType(),
               skipSensitive));
 
@@ -161,9 +161,9 @@ public class JobBean implements JsonBean {
       long toConnectorId = (Long) object.get(TO_CONNECTOR_ID);
       long fromConnectionId = (Long) object.get(FROM_LINK_ID);
       long toConnectionId = (Long) object.get(TO_LINK_ID);
-      JSONArray fromConfigJson = (JSONArray) object.get(FROM_CONFIG);
-      JSONArray toConfigJson = (JSONArray) object.get(TO_CONFIG);
-      JSONArray driverConfigJson = (JSONArray) object.get(DRIVER_CONFIG);
+      JSONArray fromConfigJson = (JSONArray) object.get(FROM_CONFIG_VALUES);
+      JSONArray toConfigJson = (JSONArray) object.get(TO_CONFIG_VALUES);
+      JSONArray driverConfigJson = (JSONArray) object.get(DRIVER_CONFIG_VALUES);
 
       List<MConfig> fromConfig = restoreConfigList(fromConfigJson);
       List<MConfig> toConfig = restoreConfigList(toConfigJson);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/main/java/org/apache/sqoop/json/JsonBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JsonBean.java b/common/src/main/java/org/apache/sqoop/json/JsonBean.java
index 164b604..8797015 100644
--- a/common/src/main/java/org/apache/sqoop/json/JsonBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JsonBean.java
@@ -23,7 +23,7 @@ public interface JsonBean {
 
   // common JSON constants for the rest-api response
   static final String CONFIGURABLE_VERSION = "version";
-  static final String ALL_CONFIGS = "all-configs";
+  static final String ALL_CONFIG_RESOURCES= "all-config-resources";
 
   @Deprecated // should not be used anymore in the rest api
   static final String ALL = "all";

http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/main/java/org/apache/sqoop/json/LinkBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/LinkBean.java b/common/src/main/java/org/apache/sqoop/json/LinkBean.java
index ae3a4ff..368a56c 100644
--- a/common/src/main/java/org/apache/sqoop/json/LinkBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/LinkBean.java
@@ -42,7 +42,7 @@ import org.json.simple.JSONObject;
 public class LinkBean implements JsonBean {
 
   static final String CONNECTOR_ID = "connector-id";
-  static final String LINK_CONFIG = "link-config";
+  static final String LINK_CONFIG_VALUES = "link-config-values";
   static final String LINK = "link";
 
 
@@ -108,7 +108,7 @@ public class LinkBean implements JsonBean {
       linkJsonObject.put(UPDATE_USER, link.getLastUpdateUser());
       linkJsonObject.put(UPDATE_DATE, link.getLastUpdateDate().getTime());
       linkJsonObject.put(CONNECTOR_ID, link.getConnectorId());
-      linkJsonObject.put(LINK_CONFIG,
+      linkJsonObject.put(LINK_CONFIG_VALUES,
         extractConfigList(link.getConnectorLinkConfig().getConfigs(), link.getConnectorLinkConfig().getType(),
skipSensitive));
       linkArray.add(linkJsonObject);
     }
@@ -126,7 +126,7 @@ public class LinkBean implements JsonBean {
     for (Object obj : array) {
       JSONObject object = (JSONObject) obj;
       long connectorId = (Long) object.get(CONNECTOR_ID);
-      JSONArray connectorLinkConfig = (JSONArray) object.get(LINK_CONFIG);
+      JSONArray connectorLinkConfig = (JSONArray) object.get(LINK_CONFIG_VALUES);
       List<MConfig> linkConfig = restoreConfigList(connectorLinkConfig);
       MLink link = new MLink(connectorId, new MLinkConfig(linkConfig));
       link.setPersistenceId((Long) object.get(ID));

http://git-wip-us.apache.org/repos/asf/sqoop/blob/f9b53acf/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
index 7c3c921..7c7d2ab 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
@@ -61,7 +61,7 @@ public class TestLinkBean {
     // Check for sensitivity
     JSONArray linkArray = (JSONArray)json.get(LinkBean.LINK);
     JSONObject linkItem = (JSONObject)linkArray.get(0);
-    JSONArray connectors = (JSONArray)linkItem.get(LinkBean.LINK_CONFIG);
+    JSONArray connectors = (JSONArray)linkItem.get(LinkBean.LINK_CONFIG_VALUES);
     JSONObject connector = (JSONObject)connectors.get(0);
     JSONArray inputs = (JSONArray)connector.get(ConfigInputConstants.CONFIG_INPUTS);
     for (Object input1 : inputs) {
@@ -118,7 +118,7 @@ public class TestLinkBean {
     // Sensitive values should exist
     JSONArray all = (JSONArray)json.get(LinkBean.LINK);
     JSONObject allItem = (JSONObject)all.get(0);
-    JSONArray connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG);
+    JSONArray connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG_VALUES);
     JSONObject connector = (JSONObject)connectors.get(0);
     JSONArray inputs = (JSONArray)connector.get(ConfigInputConstants.CONFIG_INPUTS);
     assertEquals(3, inputs.size());
@@ -129,7 +129,7 @@ public class TestLinkBean {
     // Sensitive values should not exist
     all = (JSONArray)jsonFiltered.get(LinkBean.LINK);
     allItem = (JSONObject)all.get(0);
-    connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG);
+    connectors = (JSONArray)allItem.get(LinkBean.LINK_CONFIG_VALUES);
     connector = (JSONObject)connectors.get(0);
     inputs = (JSONArray)connector.get(ConfigInputConstants.CONFIG_INPUTS);
     assertEquals(3, inputs.size());


Mime
View raw message