AMBARI-13876. Refactor Reassign step4 controller (onechiporenko)

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

Branch: refs/heads/trunk
Commit: 99d9c26dcc949a1b622ec456cb821b664864de55
Parents: 74a563b
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Fri Nov 13 12:06:18 2015 +0200
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Fri Nov 13 12:06:18 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   5 +-
 .../main/service/reassign/step4_controller.js   | 269 +++++----
 .../app/controllers/wizard/step7_controller.js  |  14 +-
 ambari-web/app/utils.js                         |   6 +
 .../app/utils/configs/config_initializer.js     | 112 ++--
 .../utils/configs/config_initializer_class.js   | 171 +++++-
 .../configs/ha_config_initializer_class.js      |  10 +-
 .../move_component_config_initializer_class.js  | 127 ++++
 ...e_hive_component_config_initializer_class.js |  85 +++
 .../utils/configs/move_hm_config_initializer.js | 103 ++++
 .../utils/configs/move_hs_config_initializer.js |  34 ++
 .../configs/move_namenode_config_initializer.js | 102 ++++
 .../utils/configs/move_os_config_initializer.js |  33 +
 .../utils/configs/move_rm_config_initializer.js |  77 +++
 .../utils/configs/nn_ha_config_initializer.js   |  47 +-
 .../utils/configs/rm_ha_config_initializer.js   |  12 +-
 .../service/reassign/step4_controller_test.js   | 596 ++++++++-----------
 .../utils/configs/config_initializer_test.js    |   2 +-
 18 files changed, 1233 insertions(+), 572 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index 7e3c83d..57929e1 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -21,10 +21,7 @@ var App = require('app');
 require('config');
 
 require('messages');
-require('utils/base64');
-require('utils/db');
-require('utils/helper');
-require('utils/config');
+require('utils');
 require('mixins');
 require('models');
 require('controllers');

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/service/reassign/step4_controller.js 
b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index c6b828d..9258c95 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -18,6 +18,14 @@
 
 var App = require('app');
 
+/**
+ * Additional data that is used in the `Move Component Initializers`
+ *
+ * @typedef {object} reassignComponentDependencies
+ * @property {string} sourceHostName host where component was before moving
+ * @property {string} targetHostName host where component will be after moving
+ */
+
 App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
 
   name: "reassignMasterWizardStep4Controller",
@@ -579,6 +587,114 @@ App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageContro
     });
   },
 
+  /**
+   *
+   * @returns {extendedTopologyLocalDB}
+   * @private
+   * @method _prepareTopologyDB
+   */
+  _prepareTopologyDB: function () {
+    var ret = this.get('content').getProperties(['masterComponentHosts', 
'slaveComponentHosts', 'hosts']);
+    ret.installedServices = App.Service.find().mapProperty('serviceName');
+    return ret;
+  },
+
+  /**
+   * Create dependencies for Config Initializers
+   *
+   * @param {object} additionalDependencies  some additional information that 
should be added
+   * @returns {reassignComponentDependencies}
+   * @private
+   * @method _prepareDependencies
+   */
+  _prepareDependencies: function (additionalDependencies) {
+    additionalDependencies = additionalDependencies || {};
+    var ret = {};
+    ret.sourceHostName = this.get('content.reassignHosts.source');
+    ret.targetHostName = this.get('content.reassignHosts.target');
+    return Em.merge(ret, additionalDependencies);
+  },
+
+  /**
+   * Get additional dependencies-data for App.MoveRmConfigInitializer
+   *
+   * @param {object} configs
+   * @returns {object}
+   * @private
+   * @method _getRmAdditionalDependencies
+   */
+  _getRmAdditionalDependencies: function (configs) {
+    var ret = {};
+    var cfg = configs['yarn-site']['yarn.resourcemanager.hostname.rm1'];
+    if (cfg) {
+      ret.rm1 = cfg;
+    }
+    return ret;
+  },
+
+  /**
+   * Settings used to the App.MoveOSConfigInitializer setup
+   *
+   * @param {object} configs
+   * @returns {object}
+   * @private
+   * @method _getOsInitializerSettings
+   */
+  _getOsInitializerSettings: function (configs) {
+    var ret = {};
+    var cfg = configs['oozie-env']['oozie_user'];
+    if (cfg) {
+      ret.oozieUser = cfg;
+    }
+    return ret;
+  },
+
+  /**
+   * Get additional dependencies-data for App.MoveNameNodeConfigInitializer
+   *
+   * @param {object} configs
+   * @returns {object}
+   * @private
+   * @method _getNnInitializerSettings
+   */
+  _getNnInitializerSettings: function (configs) {
+    var ret = {};
+    if (App.get('isHaEnabled')) {
+      ret.namespaceId = configs['hdfs-site']['dfs.nameservices'];
+      ret.suffix = (configs['hdfs-site']['dfs.namenode.http-address.' + 
ret.namespaceId + '.nn1'] === this.get('content.reassignHosts.source') + 
':50070') ? 'nn1' : 'nn2';
+    }
+    return ret;
+  },
+
+  /**
+   * Settings used to the App.MoveHsConfigInitializer and 
App.MoveHmConfigInitializer setup
+   *
+   * @param {object} configs
+   * @returns {{hiveUser: string, webhcatUser: string}}
+   * @private
+   * @method _getHiveInitializerSettings
+   */
+  _getHiveInitializerSettings: function (configs) {
+    return {
+      hiveUser: configs['hive-env']['hive_user'],
+      webhcatUser: configs['hive-env']['webhcat_user']
+    };
+  },
+
+  /**
+   * Settings used to the App.MoveRmConfigInitializer setup
+   *
+   * @param {object} configs
+   * @returns {{suffix: string}}
+   * @private
+   * @method _getRmInitializerSettings
+   */
+  _getRmInitializerSettings: function (configs) {
+    return {
+      suffix: configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] === 
this.get('content.reassignHosts.source') ? 'rm1': 'rm2'
+    };
+  },
+
   onLoadConfigs: function (data) {
     var componentName = this.get('content.reassign.component_name');
     var targetHostName = this.get('content.reassignHosts.target');
@@ -594,17 +710,30 @@ App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageContro
 
     switch (componentName) {
       case 'NAMENODE':
-        this.setSpecificNamenodeConfigs(configs, targetHostName);
+        
App.MoveNameNodeConfigInitializer.setup(this._getNnInitializerSettings(configs));
+        configs = this.setDynamicConfigs(configs, 
App.MoveNameNodeConfigInitializer);
+        App.MoveNameNodeConfigInitializer.cleanup();
         break;
       case 'RESOURCEMANAGER':
-        this.setSpecificResourceMangerConfigs(configs, targetHostName);
+        
App.MoveRmConfigInitializer.setup(this._getRmInitializerSettings(configs));
+        var additionalDependencies = 
this._getRmAdditionalDependencies(configs);
+        configs = this.setDynamicConfigs(configs, App.MoveRmConfigInitializer, 
additionalDependencies);
+        App.MoveRmConfigInitializer.cleanup();
         break;
       case 'HIVE_METASTORE':
+        
App.MoveHmConfigInitializer.setup(this._getHiveInitializerSettings(configs));
+        configs = this.setDynamicConfigs(configs, App.MoveHmConfigInitializer);
+        App.MoveHmConfigInitializer.cleanup();
+        break;
       case 'HIVE_SERVER':
-        this.setSpecificHiveConfigs(configs, targetHostName);
+        
App.MoveHsConfigInitializer.setup(this._getHiveInitializerSettings(configs));
+        configs = this.setDynamicConfigs(configs, App.MoveHsConfigInitializer);
+        App.MoveHsConfigInitializer.cleanup();
         break;
       case 'OOZIE_SERVER':
-        this.setSpecificOozieConfigs(configs, targetHostName);
+        
App.MoveOSConfigInitializer.setup(this._getOsInitializerSettings(configs));
+        configs = this.setDynamicConfigs(configs, App.MoveOSConfigInitializer);
+        App.MoveOSConfigInitializer.cleanup();
     }
 
     this.saveClusterStatus(secureConfigs, this.getComponentDir(configs, 
componentName));
@@ -613,6 +742,33 @@ App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageContro
   },
 
   /**
+   * Set config values according to the new cluster topology
+   *
+   * @param {object} configs
+   * @param {MoveComponentConfigInitializerClass} initializer
+   * @param {object} [additionalDependencies={}]
+   * @returns {object}
+   * @method setDynamicConfigs
+   */
+  setDynamicConfigs: function (configs, initializer, additionalDependencies) {
+    additionalDependencies = additionalDependencies || {};
+    var topologyDB = this._prepareTopologyDB();
+    var dependencies = this._prepareDependencies(additionalDependencies);
+    Em.keys(configs).forEach(function (site) {
+      Em.keys(configs[site]).forEach(function (config) {
+        // temporary object for initializer
+        var cfg = {
+          name: config,
+          filename: site,
+          value: configs[site][config]
+        };
+        configs[site][config] = initializer.initialValue(cfg, topologyDB, 
dependencies).value;
+      });
+    });
+    return configs;
+  },
+
+  /**
    * make PUT call to save configs to server
    * @param configs
    */
@@ -667,69 +823,6 @@ App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageContro
   },
 
   /**
-   * set specific configs which applies only to NameNode component
-   * @param configs
-   * @param targetHostName
-   */
-  setSpecificNamenodeConfigs: function (configs, targetHostName) {
-    var sourceHostName = this.get('content.reassignHosts.source');
-
-    if (App.get('isHaEnabled')) {
-      var nameServices = configs['hdfs-site']['dfs.nameservices'];
-      var suffix = (configs['hdfs-site']['dfs.namenode.http-address.' + 
nameServices + '.nn1'] === sourceHostName + ':50070') ? '.nn1' : '.nn2';
-      configs['hdfs-site']['dfs.namenode.http-address.' + nameServices + 
suffix] = targetHostName + ':50070';
-      configs['hdfs-site']['dfs.namenode.https-address.' + nameServices + 
suffix] = targetHostName + ':50470';
-      configs['hdfs-site']['dfs.namenode.rpc-address.' + nameServices + 
suffix] = targetHostName + ':8020';
-    }
-    if (!App.get('isHaEnabled') && App.Service.find('HBASE').get('isLoaded')) {
-      configs['hbase-site']['hbase.rootdir'] = 
configs['hbase-site']['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + 
targetHostName + ':8020');
-    }
-    if (!App.get('isHaEnabled') && 
App.Service.find('ACCUMULO').get('isLoaded')) {
-      // Update the Namenode's hostname in instance.volumes
-      configs['accumulo-site']['instance.volumes'] = 
configs['accumulo-site']['instance.volumes'].replace(/\/\/[^\/]*/, '//' + 
targetHostName + ':8020');
-      // Add a replacement entry from the old hostname to the new hostname
-      var target = 'hdfs://' + this.get('content.reassignHosts.target') + 
':8020' + '/apps/accumulo/data';
-      var source = 'hdfs://' + this.get('content.reassignHosts.source') + 
':8020' + '/apps/accumulo/data';
-      if (configs['accumulo-site']) {
-        configs['accumulo-site']['instance.volumes.replacements'] = source + ' 
' + target;
-      }
-    }
-  },
-
-  /**
-   * set specific configs which applies only to ResourceManager component
-   * @param configs
-   * @param targetHostName
-   */
-  setSpecificResourceMangerConfigs: function (configs, targetHostName) {
-    var sourceHostName = this.get('content.reassignHosts.source');
-
-    if (App.get('isRMHaEnabled')) {
-      if (configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] === 
sourceHostName) {
-        configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] = 
targetHostName;
-
-        var webAddressPort = this.getWebAddressPort(configs, 
'yarn.resourcemanager.webapp.address.rm1');
-        if(webAddressPort != null)
-          configs['yarn-site']['yarn.resourcemanager.webapp.address.rm1'] = 
targetHostName +":"+ webAddressPort;
-
-        var httpsWebAddressPort = this.getWebAddressPort(configs, 
'yarn.resourcemanager.webapp.https.address.rm1');
-        if(httpsWebAddressPort != null)
-          
configs['yarn-site']['yarn.resourcemanager.webapp.https.address.rm1'] = 
targetHostName +":"+ httpsWebAddressPort;
-      } else {
-        configs['yarn-site']['yarn.resourcemanager.hostname.rm2'] = 
targetHostName;
-
-        var webAddressPort = this.getWebAddressPort(configs, 
'yarn.resourcemanager.webapp.address.rm2');
-        if(webAddressPort != null)
-          configs['yarn-site']['yarn.resourcemanager.webapp.address.rm2'] = 
targetHostName +":"+ webAddressPort;
-
-        var httpsWebAddressPort = this.getWebAddressPort(configs, 
'yarn.resourcemanager.webapp.https.address.rm2');
-        if(httpsWebAddressPort != null)
-          
configs['yarn-site']['yarn.resourcemanager.webapp.https.address.rm2'] = 
targetHostName +":"+ httpsWebAddressPort;
-      }
-    }
-  },
-
-  /**
    * Get the web address port when RM HA is enabled.
    * @param configs
    * @param webAddressKey (http vs https)
@@ -752,48 +845,6 @@ App.ReassignMasterWizardStep4Controller = 
App.HighAvailabilityProgressPageContro
   },
 
   /**
-   * set specific configs which applies only to Oozie related configs
-   * @param configs
-   * @param targetHostName
-   */
-  setSpecificOozieConfigs: function (configs, targetHostName) {
-    var sourceHostName = this.get('content.reassignHosts.source'),
-      oozieServerHosts = 
App.HostComponent.find().filterProperty('componentName', 'OOZIE_SERVER')
-        
.mapProperty('hostName').removeObject(sourceHostName).addObject(targetHostName).uniq().join(','),
-      oozieUser = configs['oozie-env']['oozie_user'];
-
-    configs['core-site']['hadoop.proxyuser.' + oozieUser + '.hosts'] = 
oozieServerHosts;
-  },
-
-  /**
-   * set specific configs which applies only to Hive related configs
-   * @param configs
-   * @param targetHostName
-   */
-  setSpecificHiveConfigs: function (configs, targetHostName) {
-    var sourceHostName = this.get('content.reassignHosts.source');
-    var hiveMSHosts = App.HostComponent.find().filterProperty('componentName', 
'HIVE_METASTORE').mapProperty('hostName');
-    if (this.get('content.reassign.component_name') === 'HIVE_METASTORE') 
hiveMSHosts = 
hiveMSHosts.removeObject(sourceHostName).addObject(targetHostName);
-    var hiveServerHosts = 
App.HostComponent.find().filterProperty('componentName', 
'HIVE_SERVER').mapProperty('hostName');
-    if (this.get('content.reassign.component_name') === 'HIVE_SERVER') 
hiveServerHosts = 
hiveServerHosts.removeObject(sourceHostName).addObject(targetHostName);
-    var hiveMasterHosts = hiveMSHosts.concat(hiveServerHosts).uniq().join(',');
-    var hiveUser = configs['hive-env']['hive_user'];
-    var webhcatUser = configs['hive-env']['webhcat_user'];
-
-    var port = 
configs['hive-site']['hive.metastore.uris'].match(/:[0-9]{2,4}/);
-    port = port ? port[0].slice(1) : "9083";
-
-    for (var i = 0; i < hiveMSHosts.length; i++) {
-      hiveMSHosts[i] = "thrift://" + hiveMSHosts[i] + ":" + port;
-    }
-
-    configs['hive-site']['hive.metastore.uris'] = hiveMSHosts.join(',');
-    configs['webhcat-site']['templeton.hive.properties'] = 
configs['webhcat-site']['templeton.hive.properties'].replace(/thrift.+[0-9]{2,},/i,
 hiveMSHosts.join('\\,') + ",");
-    configs['core-site']['hadoop.proxyuser.' + hiveUser + '.hosts'] = 
hiveMasterHosts;
-    configs['core-site']['hadoop.proxyuser.' + webhcatUser + '.hosts'] = 
hiveMasterHosts;
-  },
-
-  /**
    * set secure configs for component
    * @param secureConfigs
    * @param configs

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js 
b/ambari-web/app/controllers/wizard/step7_controller.js
index 5757126..fedc56f 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -29,11 +29,17 @@ var App = require('app');
  */
 
 /**
+ * @typedef {object} masterComponentHost
+ * @property {string} component
+ * @property {string} hostName
+ * @property {boolean} isInstalled is component already installed on the this 
host or just going to be installed
+ */
+
+/**
  * @typedef {object} topologyLocalDB
- * @property {object[]} hosts
- * @property {object[]} masterComponentHosts
- * @property {object[]} slaveComponentHosts
- *
+ * @property {object[]} hosts list of hosts with information of their disks 
usage and dirs
+ * @property {masterComponentHost[]} masterComponentHosts
+ * @property {?object[]} slaveComponentHosts
  */
 
 App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, 
App.EnhancedConfigsMixin, App.ToggleIsRequiredMixin, {

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils.js b/ambari-web/app/utils.js
index 812bd14..dccbe5a 100644
--- a/ambari-web/app/utils.js
+++ b/ambari-web/app/utils.js
@@ -25,3 +25,9 @@ require('utils/helper');
 require('utils/config');
 require('utils/configs/config_initializer');
 require('utils/configs/nn_ha_config_initializer');
+require('utils/configs/rm_ha_config_initializer');
+require('utils/configs/move_namenode_config_initializer');
+require('utils/configs/move_rm_config_initializer');
+require('utils/configs/move_os_config_initializer');
+require('utils/configs/move_hm_config_initializer');
+require('utils/configs/move_hs_config_initializer');

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_initializer.js 
b/ambari-web/app/utils/configs/config_initializer.js
index 05efdab..ebb9e1a 100644
--- a/ambari-web/app/utils/configs/config_initializer.js
+++ b/ambari-web/app/utils/configs/config_initializer.js
@@ -165,7 +165,8 @@ function getMultipleMountPointsConfig(components, 
winReplacer) {
 }
 
 /**
- * Helper-object used to set initial value for some configs
+ * Initializer for configs
+ * Used on the cluster install
  *
  * Usage:
  * <pre>
@@ -176,10 +177,10 @@ function getMultipleMountPointsConfig(components, 
winReplacer) {
  *    slaveComponentHosts: []
  *   };
  *   var dependencies = {};
- *   configPropertyHelper.initialValue(configProperty, localDB, dependencies);
+ *   App.ConfigInitializer.initialValue(configProperty, localDB, dependencies);
  * </pre>
  *
- * @type {Em.Object}
+ * @instance ConfigInitializer
  */
 App.ConfigInitializer = App.ConfigInitializerClass.create({
 
@@ -271,23 +272,13 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
     'hive.metastore.uris': '_initHiveMetastoreUris'
   },
 
-  initializerTypes: {
-    host_with_component: {
-      method: '_initAsHostWithComponent'
-    },
-    hosts_with_components: {
-      method: '_initAsHostsWithComponents'
-    },
-    zookeeper_based: {
-      method: '_initAsZookeeperServersList'
-    },
-    single_mountpoint: {
-      method: '_initAsSingleMountPoint'
-    },
-    multiple_mountpoints: {
-      method: '_initAsMultipleMountPoints'
-    }
-  },
+  initializerTypes: [
+    {name: 'host_with_component', method: '_initAsHostWithComponent'},
+    {name: 'hosts_with_components', method: '_initAsHostsWithComponents'},
+    {name: 'zookeeper_based', method: '_initAsZookeeperServersList'},
+    {name: 'single_mountpoint', method: '_initAsSingleMountPoint'},
+    {name: 'multiple_mountpoints', method: '_initAsMultipleMountPoints'}
+  ],
 
   /**
    * Map for methods used as value-modifiers for configProperties with values 
as mount point(s)
@@ -307,7 +298,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * Initializer for configs with value equal to hostName with needed component
    * Value example: 'hostName'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @param {object} initializer
@@ -326,7 +317,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
       this.setRecommendedValue(configProperty, initializer.modifier.regex, 
replaceWith);
     }
     else {
-      configProperty.setProperties({
+      Em.setProperties(configProperty, {
         recommendedValue: component.hostName,
         value: component.hostName
       })
@@ -341,7 +332,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * Depends on <code>initializer.asArray</code> (true - array, false - string)
    * Value example: 'hostName1,hostName2,hostName3' or ['hostName1', 
'hostName2', 'hostName3']
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @param {object} initializer
@@ -355,7 +346,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
     if (!initializer.asArray) {
       hostNames = hostNames.uniq().join(',');
     }
-    configProperty.setProperties({
+    Em.setProperties(configProperty, {
       value: hostNames,
       recommendedValue: hostNames
     });
@@ -365,17 +356,17 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hive_database</code>-config
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @returns {Object}
    * @private
    */
   _initHiveDatabaseValue: function (configProperty) {
-    var newMySQLDBOption = 
configProperty.get('options').findProperty('displayName', 'New MySQL Database');
+    var newMySQLDBOption = Em.get(configProperty, 
'options').findProperty('displayName', 'New MySQL Database');
     if (newMySQLDBOption) {
       var isNewMySQLDBOptionHidden = 
!App.get('supports.alwaysEnableManagedMySQLForHive') && 
App.get('router.currentState.name') != 'configs' &&
         !App.get('isManagedMySQLForHiveEnabled');
-      if (isNewMySQLDBOptionHidden && configProperty.get('value') == 'New 
MySQL Database') {
-        configProperty.set('value', 'Existing MySQL Database');
+      if (isNewMySQLDBOptionHidden && Em.get(configProperty, 'value') == 'New 
MySQL Database') {
+        Em.set(configProperty, 'value', 'Existing MySQL Database');
       }
       Em.set(newMySQLDBOption, 'hidden', isNewMySQLDBOptionHidden);
     }
@@ -386,7 +377,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * Initializer for configs with value equal to hostNames-list where 
ZOOKEEPER_SERVER is installed
    * Value example: 'host1:2020,host2:2020,host3:2020'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @returns {Object}
    * @private
@@ -395,7 +386,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
     var zkHosts = localDB.masterComponentHosts.filterProperty('component', 
'ZOOKEEPER_SERVER').mapProperty('hostName');
     var zkHostPort = zkHosts;
     var regex = '\\w*:(\\d+)';   //regex to fetch the port
-    var portValue = configProperty.get('recommendedValue') && 
configProperty.get('recommendedValue').match(new RegExp(regex));
+    var portValue = Em.get(configProperty, 'recommendedValue') && 
Em.get(configProperty, 'recommendedValue').match(new RegExp(regex));
     if (!portValue) {
       return configProperty;
     }
@@ -411,7 +402,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
   /**
    * Unique initializer for <code>templeton.hive.properties</code>
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @returns {Object}
@@ -419,8 +410,8 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    */
   _initTempletonHiveProperties: function (configProperty, localDB, 
dependencies) {
     var hiveMSUris = this.getHiveMetastoreUris(localDB.masterComponentHosts, 
dependencies['hive.metastore.uris']).replace(',', '\\,');
-    if (/\/\/localhost:/g.test(configProperty.get('value'))) {
-      configProperty.set('recommendedValue', configProperty.get('value') + 
',hive.metastore.execute.setugi=true');
+    if (/\/\/localhost:/g.test(Em.get(configProperty, 'value'))) {
+      Em.set(configProperty, 'recommendedValue', Em.get(configProperty, 
'value') + ',hive.metastore.execute.setugi=true');
     }
     this.setRecommendedValue(configProperty, 
"(hive\\.metastore\\.uris=)([^\\,]+)", "$1" + hiveMSUris);
     return configProperty;
@@ -429,13 +420,13 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hbase.zookeeper.quorum</code>
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @returns {Object}
    * @private
    */
   _initHBaseZookeeperQuorum: function (configProperty, localDB) {
-    if (configProperty.get('filename') == 'hbase-site.xml') {
+    if ('hbase-site.xml' === Em.get(configProperty, 'filename')) {
       var zkHosts = localDB.masterComponentHosts.filterProperty('component', 
'ZOOKEEPER_SERVER').mapProperty('hostName');
       this.setRecommendedValue(configProperty, "(.*)", zkHosts);
     }
@@ -447,7 +438,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * If RANGER_ADMIN-component isn't installed, this config becomes unneeded 
(isVisible - false, isRequired - false)
    * Value example: 'hostName'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @returns {Object}
    * @private
@@ -455,13 +446,13 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
   _initRangerHost: function (configProperty, localDB) {
     var rangerAdminHost = 
localDB.masterComponentHosts.findProperty('component', 'RANGER_ADMIN');
     if(rangerAdminHost) {
-      configProperty.setProperties({
+      Em.setProperties(configProperty, {
         value: rangerAdminHost.hostName,
         recommendedValue: rangerAdminHost.hostName
       });
     }
     else {
-      configProperty.setProperties({
+      Em.setProperties(configProperty, {
         isVisible: 'false',
         isRequired: 'false'
       });
@@ -475,7 +466,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * Port is taken from <code>dependencies.clientPort</code>
    * Value example: 'host1:111,host2:111,host3:111'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @returns {Object}
@@ -485,7 +476,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
     var value = localDB.masterComponentHosts.filterProperty('component', 
'ZOOKEEPER_SERVER').map(function (component) {
       return component.hostName + ':' + dependencies.clientPort
     }).join(',');
-    configProperty.setProperties({
+    Em.setProperties(configProperty, {
       value: value,
       recommendedValue: value
     });
@@ -495,7 +486,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hive.metastore.uris</code>
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @returns {Object}
@@ -537,17 +528,18 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
    * Set <code>value</code> and <code>recommendedValue</code> for 
<code>configProperty</code>
    * basing on <code>recommendedValue</code> with replacing <code>regex</code> 
for <code>replaceWith</code>
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {string} regex
    * @param {string} replaceWith
    * @return {Object}
    */
   setRecommendedValue: function (configProperty, regex, replaceWith) {
-    var recommendedValue = Em.isNone(configProperty.get('recommendedValue')) ? 
'' : configProperty.get('recommendedValue');
+    var recommendedValue = Em.get(configProperty, 'recommendedValue');
+    recommendedValue = Em.isNone(recommendedValue) ? '' : recommendedValue;
     var re = new RegExp(regex);
     recommendedValue = recommendedValue.replace(re, replaceWith);
-    configProperty.set('recommendedValue', recommendedValue);
-    configProperty.set('value', 
Em.isNone(configProperty.get('recommendedValue')) ? '' : 
configProperty.get('recommendedValue'));
+    Em.set(configProperty, 'recommendedValue', recommendedValue);
+    Em.set(configProperty, 'value', Em.isNone(Em.get(configProperty, 
'recommendedValue')) ? '' : recommendedValue);
     return configProperty;
   },
 
@@ -557,7 +549,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * Hosts with Windows needs additional processing (@see winReplacersMap)
    * Value example: '/', '/some/cool/dir'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @param {object} initializer
@@ -575,7 +567,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
 
     var mPoint = allMountPoints[0].mountpoint;
     if (mPoint === "/") {
-      mPoint = configProperty.get('recommendedValue');
+      mPoint = Em.get(configProperty, 'recommendedValue');
     }
     else {
       var mp = mPoint.toLowerCase();
@@ -584,10 +576,10 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
         mPoint = this[methodName].call(this, configProperty, mp);
       }
       else {
-        mPoint = mPoint + configProperty.get('recommendedValue');
+        mPoint = mPoint + Em.get(configProperty, 'recommendedValue');
       }
     }
-    configProperty.setProperties({
+    Em.setProperties(configProperty, {
       value: mPoint,
       recommendedValue: mPoint
     });
@@ -622,7 +614,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
 
     allMountPoints.forEach(function (eachDrive) {
       if (eachDrive.mountpoint === '/') {
-        mPoint += configProperty.get('recommendedValue') + "\n";
+        mPoint += Em.get(configProperty, 'recommendedValue') + "\n";
       }
       else {
         var mp = eachDrive.mountpoint.toLowerCase();
@@ -631,12 +623,12 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
           mPoint += self[methodName].call(this, configProperty, mp);
         }
         else {
-          mPoint += eachDrive.mountpoint + 
configProperty.get('recommendedValue') + "\n";
+          mPoint += eachDrive.mountpoint + Em.get(configProperty, 
'recommendedValue') + "\n";
         }
       }
     }, this);
 
-    configProperty.setProperties({
+    Em.setProperties(configProperty, {
       value: mPoint,
       recommendedValue: mPoint
     });
@@ -647,41 +639,41 @@ App.ConfigInitializer = 
App.ConfigInitializerClass.create({
   /**
    * Replace drive-based windows-path with 'file:///'
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {string} mountPoint
    * @returns {string}
    * @private
    */
   _winReplaceWithFile: function (configProperty, mountPoint) {
     var winDriveUrl = mountPoint.toLowerCase().replace(winRegex, 
'file:///$1:');
-    return winDriveUrl + configProperty.get('recommendedValue') + '\n';
+    return winDriveUrl + Em.get(configProperty, 'recommendedValue') + '\n';
   },
 
   /**
    * Replace drive-based windows-path
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {string} mountPoint
    * @returns {string}
    * @private
    */
   _defaultWinReplace: function (configProperty, mountPoint) {
     var winDrive = mountPoint.toLowerCase().replace(winRegex, '$1:');
-    var winDir = configProperty.get('recommendedValue').replace(/\//g, '\\');
+    var winDir = Em.get(configProperty, 'recommendedValue').replace(/\//g, 
'\\');
     return winDrive + winDir + '\n';
   },
 
   /**
    * Same to <code>_defaultWinReplace</code>, but with extra-slash in the end
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {string} mountPoint
    * @returns {string}
    * @private
    */
   _defaultWinReplaceWithAdditionalSlashes: function (configProperty, 
mountPoint) {
     var winDrive = mountPoint.toLowerCase().replace(winRegex, '$1:');
-    var winDir = configProperty.get('recommendedValue').replace(/\//g, '\\\\');
+    var winDir = Em.get(configProperty, 'recommendedValue').replace(/\//g, 
'\\\\');
     return winDrive + winDir + '\n';
   },
 
@@ -746,8 +738,8 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
    * @private
    */
   _getSetOfHostNames: function (localDB, initializer) {
-    var masterComponentHostsInDB = localDB.masterComponentHosts;
-    var slaveComponentHostsInDB = localDB.slaveComponentHosts;
+    var masterComponentHostsInDB = Em.getWithDefault(localDB, 
'masterComponentHosts', []);
+    var slaveComponentHostsInDB = Em.getWithDefault(localDB, 
'slaveComponentHosts', []);
     var hosts = masterComponentHostsInDB.filter(function (master) {
       return initializer.components.contains(master.component);
     }).mapProperty('hostName');

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/config_initializer_class.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_initializer_class.js 
b/ambari-web/app/utils/configs/config_initializer_class.js
index dbfc7ae..eb29702 100644
--- a/ambari-web/app/utils/configs/config_initializer_class.js
+++ b/ambari-web/app/utils/configs/config_initializer_class.js
@@ -19,6 +19,22 @@
 var App = require('app');
 
 /**
+ * @typedef {object} initializerType
+ * @property {string} name key
+ * @property {string} method function's name (prefer to start method-name with 
'_init' or '_initAs'). Each method here is called with arguments equal to 
<code>initialValue</code>-call args. Initializer-settings are added as last 
argument
+ */
+
+/**
+ * Minimal fields-list that should be in the config-object
+ * There is no way to set value without any of them
+ *
+ * @typedef {object} configProperty
+ * @property {string} name config's name
+ * @property {number|string} value current value
+ * @property {string} filename file name where this config is
+ */
+
+/**
  * Basic class for config-initializers
  * Each child should fill <code>initializers</code> or 
<code>uniqueInitializers</code> and <code>initializerTypes</code>
  * Usage:
@@ -47,11 +63,18 @@ var App = require('app');
  * var dependencies = {};
  * myCoolInitializer.initialValue(myConfig, localDB, dependencies);
  * </pre>
+ * <code>dependencies</code> - it's an object with almost any information that 
might be needed to set config's value. It
+ * shouldn't contain App.*-flags like 'isHaEnabled' or 'isHadoop2Stack'. They 
might be accessed directly from App. But something
+ * bigger data should be pulled to the <code>dependencies</code>.
+ * Information about cluster's hosts, topology of master components should be 
in the <code>localDB</code>
  *
  * @type {ConfigInitializerClass}
+ * @augments {Em.Object}
  */
 App.ConfigInitializerClass = Em.Object.extend({
 
+  concatenatedProperties: ['initializerTypes'],
+
   /**
    * Map with configurations for config initializers
    * It's used only for initializers which are common for some configs (if not 
- use <code>uniqueInitializers</code>-map)
@@ -64,15 +87,11 @@ App.ConfigInitializerClass = Em.Object.extend({
 
   /**
    * Map with initializers types
-   * Doesn't contain unique initializes, only common are included
-   * Key: id
-   * Value: object with method-name (prefer to start method-name with '_init' 
or '_initAs')
-   * Each method here is called with arguments equal to 
<code>initialValue</code>-call args
-   * Initializer-settings are added as last argument
+   * It's not overridden in the child-classes (@see Ember's 
concatenatedProperties)
    *
-   * @type {object}
+   * @type {initializerType[]}
    */
-  initializerTypes: {},
+  initializerTypes: [],
 
   /**
    * Map with initializers that are used only for one config (are unique)
@@ -88,7 +107,7 @@ App.ConfigInitializerClass = Em.Object.extend({
    * Wrapper for common initializers
    * Execute initializer if it is a function or throw an error otherwise
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @returns {Object}
@@ -104,7 +123,7 @@ App.ConfigInitializerClass = Em.Object.extend({
       initializer = Em.makeArray(initializer);
       initializer.forEach(function (init) {
         var _args = [].slice.call(args);
-        var type = initializerTypes[init.type];
+        var type = initializerTypes.findProperty('name', init.type);
         // add initializer-settings
         _args.push(init);
         var methodName = type.method;
@@ -120,10 +139,11 @@ App.ConfigInitializerClass = Em.Object.extend({
    * Before calling it, be sure that <code>initializers</code> or 
<code>uniqueInitializers</code>
    * contains record about needed configs
    *
-   * @param {Object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {object} dependencies
    * @returns {Object}
+   * @method initialValue
    */
   initialValue: function (configProperty, localDB, dependencies) {
     var configName = Em.get(configProperty, 'name');
@@ -142,6 +162,137 @@ App.ConfigInitializerClass = Em.Object.extend({
     }
 
     return configProperty;
+  },
+
+  /**
+   * Should do some preparing for initializing-process
+   * Shouldn't be redefined without needs
+   * Should be used before any <code>initialValue</code>-calls (if needed)
+   *
+   * @method setup
+   */
+  setup: Em.K,
+
+  /**
+   * Should restore Initializer's to the initial state
+   * Basically, should revert changes done in the <code>setup</code>
+   *
+   * @method cleanup
+   */
+  cleanup: Em.K,
+
+  /**
+   * Setup <code>initializers</code>
+   * There are some configs with names based on other config's values.
+   * Example: config with name 
<code>hadoop.proxyuser.{{oozieUser}}.hosts</code>
+   * Here <code>{{oozieUser}}</code> is value of the config 
<code>['oozie-env']['oozie_user']</code>.
+   * So, when <code>initializers</code> are manually set up in the 
Initializer-instance, there is no way to populate initializer
+   * for such configs. Reason: each initializer's key is a config-name which 
is compared strictly to the provided config-name.
+   * Solution: use config-names with placeholders. Example: 
<code>hadoop.proxyuser.${oozieUser}.hosts</code>
+   * In this case, before calling <code>initialValue</code> this key should be 
updated with real value. And it should be done
+   * in the common way for the all such configs.
+   * Code example:
+   * <pre>
+   *   var mySettings = {
+   *    oozieUser: 'someDude'
+   *   };
+   *
+   *   var myCoolInitializer = App.MoveComponentConfigInitializerClass.create({
+   *    initializers: {
+   *      'hadoop.proxyuser.{{oozieUser}}.hosts': {
+   *        // some setting are here
+   *      }
+   *    },
+   *
+   *    setup: function (settings) {
+   *      this._updateInitializers(settings);
+   *    },
+   *
+   *    cleanup: function () {
+   *      this._restoreInitializers();
+   *    }
+   *
+   *   });
+   *
+   *   myCoolInitializer.setup(mySettings); // after this call 
`myCoolInitializer.initializers` will contain two keys
+   *   console.log(myCoolInitializer.initializers); // 
{'hadoop.proxyuser.{{oozieUser}}.hosts': {}, 'hadoop.proxyuser.someDude.hosts': 
{}}
+   *   // it's possible to call `initialValue` now
+   *   myCoolInitializer.initialValue({name: 
'hadoop.proxyuser.someDude.hosts', value: ''}, {}, {});
+   *   myCoolInitializer.cleanup(); // after updating values for the all 
configs
+   * </pre>
+   * Additional key in the <code>initializers</code> won't cause any issues.
+   * Keep in mind replacing-rules:
+   * <ul>
+   *  <li>Each field in the <code>settings</code> should be a string or 
number</li>
+   *  <li>Substring that will be replaced should be wrapped with '{{', 
'}}'</li>
+   *  <li>Each field is searched in the each initializers-key, so try to avoid 
names-collision</li>
+   *  <li>Value for 'new' key is the same as for 'old' 
('hadoop.proxyuser.{{oozieUser}}.hosts' and 'hadoop.proxyuser.someDude.hosts' 
will have same initializer)</li>
+   * </ul>
+   * <b>Important! Be sure, that you call <code>_restoreInitializers</code> 
before calling <code>_updateInitializers</code> second time</b>
+   *
+   * @param {object} settings
+   * @method _updateInitializers
+   */
+  _updateInitializers: function (settings) {
+    settings = settings || {};
+    var originalInitializers = this.get('initializers');
+    var copyInitializers = Em.copy(originalInitializers, true);
+    this.set('__copyInitializers', copyInitializers);
+    var initializers = this._updateNames('initializers', settings);
+    this.set('initializers', initializers);
+
+    var originalUniqueInitializers = this.get('uniqueInitializers');
+    var copyUniqueInitializers = Em.copy(originalUniqueInitializers, true);
+    this.set('__copyUniqueInitializers', copyUniqueInitializers);
+    var uniqueInitializers = this._updateNames('uniqueInitializers', settings);
+    this.set('uniqueInitializers', uniqueInitializers);
+  },
+
+  /**
+   * Revert names changes done in the <code>_updateInitializers</code>
+   *
+   * @method _restoreInitializers
+   */
+  _restoreInitializers: function() {
+    var copyInitializers = this.get('__copyInitializers');
+    var copyUniqueInitializers = this.get('__copyUniqueInitializers');
+    if ('object' === Em.typeOf(copyInitializers)) {
+      this.set('initializers', Em.copy(copyInitializers, true));
+    }
+    if ('object' === Em.typeOf(copyUniqueInitializers)) {
+      this.set('uniqueInitializers', Em.copy(copyUniqueInitializers, true));
+    }
+  },
+
+  /**
+   * Replace list of <code>settings</code> in the sourceKey
+   * Example:
+   * <pre>
+   *   var sourceKey = '{{A}},{{B}},{{C}}';
+   *   var settings = {A: 'a', B: 'b', C: 'c'};
+   *   sourceKey = _updateNames(sourceKey, settings);
+   *   console.log(sourceKey); // 'a,b,c'
+   * </pre>
+   *
+   * @param {string} sourceKey
+   * @param {object} settings
+   * @returns {object}
+   * @private
+   * @method _updateNames
+   */
+  _updateNames: function (sourceKey, settings) {
+    settings = settings || {};
+    var source = this.get(sourceKey);
+    Object.keys(source).forEach(function (configName) {
+      var initializer = source[configName];
+      Object.keys(settings).forEach(function (key) {
+        var replaceWith = settings[key];
+        var toReplace = '{{' + key + '}}';
+        configName = configName.replace(toReplace, replaceWith);
+      });
+      source[configName] = initializer;
+    });
+    return source;
   }
 
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/ha_config_initializer_class.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/ha_config_initializer_class.js 
b/ambari-web/app/utils/configs/ha_config_initializer_class.js
index 0273d00..e7ade94 100644
--- a/ambari-web/app/utils/configs/ha_config_initializer_class.js
+++ b/ambari-web/app/utils/configs/ha_config_initializer_class.js
@@ -21,9 +21,15 @@ require('utils/configs/config_initializer_class');
 
 /**
  * @type {HaConfigInitializerClass}
+ * @augments {ConfigInitializerClass}
  */
 App.HaConfigInitializerClass = App.ConfigInitializerClass.extend({
 
+  initializerTypes: [
+    {name: 'host_with_port', method: '_initAsHostWithPort'},
+    {name: 'hosts_with_port', method: '_initAsHostsWithPort'}
+  ],
+
   /**
    * Initializer for configs with value equal to the hostName where some 
component exists
    * Value may be customized with prefix and suffix (see 
<code>initializer.modifier</code>)
@@ -31,7 +37,7 @@ App.HaConfigInitializerClass = 
App.ConfigInitializerClass.extend({
    * If calculated port-value is empty, it will be skipped (and ':' too)
    * Value-examples: 'SOME_COOL_PREFIXhost1:port1SOME_COOL_SUFFIX', 
'host1:port2'
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -58,7 +64,7 @@ App.HaConfigInitializerClass = 
App.ConfigInitializerClass.extend({
    * If calculated port-value is empty, it will be skipped (and ':' too)
    * Value examples: 
'SOME_COOL_PREFIXhost1:port,host2:port,host2:portSOME_COOL_SUFFIX', 
'host1:port|||host2:port|||host2:port'
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {topologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_component_config_initializer_class.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/utils/configs/move_component_config_initializer_class.js 
b/ambari-web/app/utils/configs/move_component_config_initializer_class.js
new file mode 100644
index 0000000..da2db19
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_component_config_initializer_class.js
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/config_initializer_class');
+
+/**
+ * Basic class for all Initializers used for configs which are affected by 
some component's moving from
+ * one host to the another
+ *
+ * @type {ConfigInitializerClass}
+ * @augments {ConfigInitializerClass}
+ */
+App.MoveComponentConfigInitializerClass = App.ConfigInitializerClass.extend({
+
+  initializerTypes: [
+    {name: 'hosts_with_component', method: 
'_initAsHostsWithComponentConsideringMoving'},
+    {name: 'target_host', method: '_initAsTargetHost'}
+  ],
+
+  /**
+   * @override
+   * @param {object} settings
+   */
+  setup: function (settings) {
+    this._updateInitializers(settings);
+  },
+
+  /**
+   * @override
+   */
+  cleanup: function () {
+    this._restoreInitializers();
+  },
+
+  /**
+   * Initializer for configs with vlaue equal to the hostName where component 
will be moved (with port)
+   *
+   * @param {object} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @param {object} initializer
+   * @returns {object}
+   * @private
+   * @method _initAsTargetHost
+   */
+  _initAsTargetHost: function (configProperty, localDB, dependencies, 
initializer) {
+    var hostName = dependencies.targetHostName;
+    var port = initializer.port;
+    Em.set(configProperty, 'value', hostName + ':' + port);
+    return configProperty;
+  },
+
+  /**
+   * Initializer for configs with value equal to the hosts list where needed 
component exists
+   * Value considers component-moving, so <code>targetHostName</code> will be 
added to the list
+   * and <code>sourceHostName</code> will be removed
+   * Hosts are sorted by name and linked with ','
+   * Value examples: 'host1', 'host1,host2,host3'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @param {object} initializer
+   * @returns {object}
+   * @private
+   * @method _initAsHostsWithComponentConsideringMoving
+   */
+  _initAsHostsWithComponentConsideringMoving: function (configProperty, 
localDB, dependencies, initializer) {
+    var hosts = localDB.masterComponentHosts.filterProperty('component', 
initializer.component).mapProperty('hostName');
+    hosts = hosts.without(dependencies.sourceHostName);
+    hosts.pushObject(dependencies.targetHostName);
+    Em.set(configProperty, 'value', hosts.uniq().sort().join(','));
+    return configProperty;
+  }
+
+});
+
+App.MoveComponentConfigInitializerClass.reopenClass({
+
+  /**
+   * Settings for <code>target_host</code>-initializer
+   * Used for configs with value equal to the new host where component is moved
+   * <code>port</code> is added to the end
+   *
+   * @param {number|string} port
+   * @returns {{type: string, port: (number|string)}}
+   */
+  getTargetHostConfig: function (port) {
+    port = port || '';
+    return {
+      type: 'target_host',
+      port: port
+    }
+  },
+
+  /**
+   * Settings for <code>hosts_with_component</code>-initializer
+   * Used for configs with value equal to the hosts where needed component 
exists
+   * List of hosts considers moving component (source-host with be excluded, 
and target-host will be added)
+   *
+   * @param {string} component
+   * @returns {{type: string, component: string}}
+   */
+  getHostsWithComponentConfig: function (component) {
+    return {
+      type: 'hosts_with_component',
+      component: component
+    }
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_hive_component_config_initializer_class.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/utils/configs/move_hive_component_config_initializer_class.js 
b/ambari-web/app/utils/configs/move_hive_component_config_initializer_class.js
new file mode 100644
index 0000000..2c045ea
--- /dev/null
+++ 
b/ambari-web/app/utils/configs/move_hive_component_config_initializer_class.js
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_component_config_initializer_class');
+
+/**
+ * Common class for Initializers which are used when some HIVE's component is 
moved from one host to another
+ *
+ * @type {MoveComponentConfigInitializerClass}
+ * @augments {MoveComponentConfigInitializerClass}
+ */
+App.MoveHiveComponentConfigInitializerClass = 
App.MoveComponentConfigInitializerClass.extend({
+
+  initializerTypes: [
+    {name: 'hive_hosts_with_components', method: 
'_initAsHostsWithComponentsConsideringMovedComponent'}
+  ],
+
+  /**
+   * Initializer for configs with value equal to the list of hosts where some 
components exist
+   * This list is affected by component's moving.
+   * Example: movedComponent is <code>'Component1'</code>, list of needed 
components is <code>['Component1', 'Component2']</code>
+   * So, when hosts for each needed component will be mapped, host where 
'Component1' was before moving ('host1') will be skipped
+   * and host where 'Component1' is moved will be added ('host2')
+   * But, if 'Component2' exists of the 'host1', 'host1' will be added to the 
hosts list
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @param {object} initializer
+   * @returns {object}
+   * @private
+   * @method _initAsHostsWithComponentsConsideringMovedComponent
+   */
+  _initAsHostsWithComponentsConsideringMovedComponent: function 
(configProperty, localDB, dependencies, initializer) {
+    var allHosts = [];
+    initializer.components.forEach(function(component) {
+      var hosts = localDB.masterComponentHosts.filterProperty('component', 
component).mapProperty('hostName');
+      if (component === initializer.movedComponent) {
+        hosts = hosts.without(dependencies.sourceHostName);
+        hosts.pushObject(dependencies.targetHostName);
+      }
+      allHosts = allHosts.concat(hosts);
+    });
+    Em.set(configProperty, 'value', allHosts.uniq().sort().join(','));
+    return configProperty;
+  }
+
+});
+
+App.MoveHiveComponentConfigInitializerClass.reopenClass({
+
+  /**
+   * Settings for <code>hive_hosts_with_components</code>-initializer
+   * Used for configs with value equal to the hosts list where needed 
components exist.
+   * This list is affected by component's moving
+   *
+   * @param {string|string[]} neededComponents
+   * @param {string} movedComponent
+   * @returns {{type: string, components: string[], movedComponent: string}}
+   */
+  getHostsWithComponentsConfig: function (neededComponents, movedComponent) {
+    return {
+      type: 'hive_hosts_with_components',
+      components: Em.makeArray(neededComponents),
+      movedComponent: movedComponent
+    }
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_hm_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/move_hm_config_initializer.js 
b/ambari-web/app/utils/configs/move_hm_config_initializer.js
new file mode 100644
index 0000000..e2a2362
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_hm_config_initializer.js
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_hive_component_config_initializer_class');
+
+/**
+ * Initializer for configs which should be affected when Hive Metastore is 
moved from one host to another
+ *
+ * @type {MoveHiveComponentConfigInitializerClass}
+ */
+App.MoveHmConfigInitializer = 
App.MoveHiveComponentConfigInitializerClass.create({
+
+  initializers: {
+    'hadoop.proxyuser.{{hiveUser}}.hosts': 
App.MoveHiveComponentConfigInitializerClass.getHostsWithComponentsConfig(['HIVE_SERVER',
 'HIVE_METASTORE'], 'HIVE_METASTORE'),
+    'hadoop.proxyuser.{{webhcatUser}}.hosts': 
App.MoveHiveComponentConfigInitializerClass.getHostsWithComponentsConfig(['HIVE_SERVER',
 'HIVE_METASTORE'], 'HIVE_METASTORE')
+  },
+
+  uniqueInitializers: {
+    'hive.metastore.uris': '_initHiveMetastoreUris',
+    'templeton.hive.properties': '_initTempletonHiveProperties'
+  },
+
+  /**
+   * Unique initializer for <code>hive.metastore.uris</code>-config
+   * Value example: 
'thrift://host1:1234,thrift://host2:1234,thrift://host3:1234'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initHiveMetastoreUris
+   */
+  _initHiveMetastoreUris: function (configProperty, localDB, dependencies) {
+    var hiveMSHosts = this.__getHmHostsConsideringMoved(localDB, dependencies);
+
+    var value = Em.get(configProperty, 'value');
+
+    var port = value.match(/:[0-9]{2,4}/);
+    port = port ? port[0].slice(1) : '9083';
+
+    value = hiveMSHosts.uniq().map(function (hiveMSHost) {
+      return 'thrift://' + hiveMSHost + ':' + port;
+    }).join(',');
+
+    Em.set(configProperty, 'value', value);
+    return configProperty;
+  },
+
+  /**
+   * Unique initializer for <code>templeton.hive.properties</code>-config
+   * Replace existing hosts with new
+   * Value example: 
'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initTempletonHiveProperties
+   */
+  _initTempletonHiveProperties: function (configProperty, localDB, 
dependencies) {
+    var hiveMSHosts = this.__getHmHostsConsideringMoved(localDB, dependencies);
+    var value = Em.get(configProperty, 'value');
+    value = value.replace(/thrift.+[0-9]{2,},/i, hiveMSHosts.join('\\,') + 
',');
+
+    Em.set(configProperty, 'value', value);
+    return configProperty;
+  },
+
+  /**
+   * Get list of hosts where HIVE_METASTORE exists considering component's 
moving (host where it was is removed and host
+   * where it will be is added)
+   *
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {string[]}
+   * @private
+   * @method __getHmHostsConsideringMoved
+   */
+  __getHmHostsConsideringMoved: function (localDB, dependencies) {
+    var hiveMSHosts = localDB.masterComponentHosts.filterProperty('component', 
'HIVE_METASTORE').mapProperty('hostName');
+    hiveMSHosts = 
hiveMSHosts.removeObject(dependencies.sourceHostName).addObject(dependencies.targetHostName);
+    return hiveMSHosts.uniq();
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_hs_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/move_hs_config_initializer.js 
b/ambari-web/app/utils/configs/move_hs_config_initializer.js
new file mode 100644
index 0000000..abc8745
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_hs_config_initializer.js
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_hive_component_config_initializer_class');
+
+/**
+ * Initializer for configs which should be affected when Hive Server is moved 
from one host to another
+ *
+ * @type {MoveHiveComponentConfigInitializerClass}
+ */
+App.MoveHsConfigInitializer = 
App.MoveHiveComponentConfigInitializerClass.create({
+
+  initializers: {
+    'hadoop.proxyuser.{{hiveUser}}.hosts': 
App.MoveHiveComponentConfigInitializerClass.getHostsWithComponentsConfig(['HIVE_SERVER',
 'HIVE_METASTORE'], 'HIVE_SERVER'),
+    'hadoop.proxyuser.{{webhcatUser}}.hosts': 
App.MoveHiveComponentConfigInitializerClass.getHostsWithComponentsConfig(['HIVE_SERVER',
 'HIVE_METASTORE'], 'HIVE_SERVER')
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_namenode_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/move_namenode_config_initializer.js 
b/ambari-web/app/utils/configs/move_namenode_config_initializer.js
new file mode 100644
index 0000000..160848c
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_namenode_config_initializer.js
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_component_config_initializer_class');
+
+/**
+ * Initializer for configs which should be affected when NameNode is moved 
from one host to another
+ * If NameNode HA-mode is already activated, several configs are also updated
+ *
+ * @instance MoveComponentConfigInitializerClass
+ */
+App.MoveNameNodeConfigInitializer = 
App.MoveComponentConfigInitializerClass.create({
+
+  initializers: {
+    'dfs.namenode.http-address.{{namespaceId}}.{{suffix}}': 
App.MoveComponentConfigInitializerClass.getTargetHostConfig(50070),
+    'dfs.namenode.https-address.{{namespaceId}}.{{suffix}}': 
App.MoveComponentConfigInitializerClass.getTargetHostConfig(50470),
+    'dfs.namenode.rpc-address.{{namespaceId}}.{{suffix}}': 
App.MoveComponentConfigInitializerClass.getTargetHostConfig(8020)
+  },
+
+  uniqueInitializers: {
+    'instance.volumes': '_initInstanceVolumes',
+    'instance.volumes.replacements': '_initInstanceVolumesReplacements',
+    'hbase.rootdir': '_initHbaseRootDir'
+  },
+
+  /**
+   * Unique initializer for <code>instance.volumes</code>-config
+   * Value example: 'hdfs://host1:8020/apps/accumulo/data'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initInstanceVolumes
+   */
+  _initInstanceVolumes: function (configProperty, localDB, dependencies) {
+    if (!App.get('isHaEnabled') && 
localDB.installedServices.contains('ACCUMULO')) {
+      var value = Em.get(configProperty, 'value');
+      value = value.replace(/\/\/[^\/]*/, '//' + dependencies.targetHostName + 
':8020');
+      Em.set(configProperty, 'value', value);
+    }
+    return configProperty;
+  },
+
+  /**
+   * Unique initializer for <code>instance.volumes.replacements</code>-config
+   * Value example: 'hdfs://host1:8020/apps/accumulo/data 
hdfs://host2:8020/apps/accumulo/data'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initInstanceVolumesReplacements
+   */
+  _initInstanceVolumesReplacements: function (configProperty, localDB, 
dependencies) {
+    if (!App.get('isHaEnabled') && 
localDB.installedServices.contains('ACCUMULO')) {
+      var target = 'hdfs://' + dependencies.targetHostName + ':8020' + 
'/apps/accumulo/data';
+      var source = 'hdfs://' + dependencies.sourceHostName + ':8020' + 
'/apps/accumulo/data';
+      var value = source + ' ' + target;
+      Em.set(configProperty, 'value', value);
+    }
+    return configProperty;
+  },
+
+  /**
+   * Unique initializer for <code>hbase.rootdir</code>-config (for HIVE 
service)
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @returns {object}
+   * @private
+   * @method _initHbaseRootDir
+   */
+  _initHbaseRootDir: function (configProperty, localDB, dependencies) {
+    if (!App.get('isHaEnabled') && localDB.installedServices.contains('HBASE') 
&& 'hbase-site' === configProperty.filename) {
+      var value = Em.get(configProperty, 'value');
+      value = value.replace(/\/\/[^\/]*/, '//' + dependencies.targetHostName + 
':8020');
+      Em.set(configProperty, 'value', value);
+    }
+    return configProperty;
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_os_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/move_os_config_initializer.js 
b/ambari-web/app/utils/configs/move_os_config_initializer.js
new file mode 100644
index 0000000..0ceffe8
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_os_config_initializer.js
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_component_config_initializer_class');
+
+/**
+ * Initializer for configs which should be affected when Oozie Server is moved 
from one host to another
+ *
+ * @instance MoveComponentConfigInitializerClass
+ */
+App.MoveOSConfigInitializer = App.MoveComponentConfigInitializerClass.create({
+
+  initializers: {
+    'hadoop.proxyuser.{{oozieUser}}.hosts': 
App.MoveComponentConfigInitializerClass.getHostsWithComponentConfig('OOZIE_SERVER')
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/move_rm_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/move_rm_config_initializer.js 
b/ambari-web/app/utils/configs/move_rm_config_initializer.js
new file mode 100644
index 0000000..f8800de
--- /dev/null
+++ b/ambari-web/app/utils/configs/move_rm_config_initializer.js
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('utils/configs/move_component_config_initializer_class');
+
+/**
+ * Settings for <code>rm_ha_depended</code>-initializer
+ * Used for configs with value equal to the host name (host where component is 
moved)
+ *
+ * @param {boolean} rmHaShouldBeEnabled
+ * @returns {{type: string, rmHaShouldBeEnabled: boolean}}
+ */
+function getRmHaDependedConfig(rmHaShouldBeEnabled) {
+  return {
+    type: 'rm_ha_depended',
+    rmHaShouldBeEnabled: Boolean(rmHaShouldBeEnabled)
+  };
+}
+
+/**
+ * Initializer for configs which should be affected when Resource Manager is 
moved from one host to another
+ * If Resource Manager HA-mode is already activated, several configs are also 
updated
+ *
+ * @instance MoveComponentConfigInitializerClass
+ */
+App.MoveRmConfigInitializer = App.MoveComponentConfigInitializerClass.create({
+
+  initializerTypes: [
+    {name: 'rm_ha_depended', method: '_initAsRmHaDepended'}
+  ],
+
+  initializers: {
+    'yarn.resourcemanager.hostname.{{suffix}}': getRmHaDependedConfig(true),
+    'yarn.resourcemanager.webapp.address.{{suffix}}': 
getRmHaDependedConfig(true),
+    'yarn.resourcemanager.webapp.https.address.{{suffix}}': 
getRmHaDependedConfig(true)
+  },
+
+  /**
+   * Initializer for configs with value equal to the target hostName
+   * and based on <code>App.isRMHaEnabled</code>
+   * Value example: 'host1:port1'
+   *
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
+   * @param {reassignComponentDependencies} dependencies
+   * @param {object} initializer
+   * @returns {object}
+   * @private
+   * @method _initAsRmHaDepended
+   */
+  _initAsRmHaDepended: function (configProperty, localDB, dependencies, 
initializer) {
+    if (App.get('isRMHaEnabled') === initializer.rmHaShouldBeEnabled) {
+      var value = Em.get(configProperty, 'value');
+      var parts = value.split(':');
+      parts[0] = dependencies.targetHostName;
+      Em.set(configProperty, 'value', parts.join(':'));
+    }
+    return configProperty;
+  }
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/nn_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/nn_ha_config_initializer.js 
b/ambari-web/app/utils/configs/nn_ha_config_initializer.js
index 7b7e317..9e18c0b 100644
--- a/ambari-web/app/utils/configs/nn_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/nn_ha_config_initializer.js
@@ -76,6 +76,7 @@ function getReplaceNamespaceConfig(toReplace) {
 }
 
 /**
+ * Initializer for configs that are updated when NameNode HA-mode is activated
  *
  * @class {NnHaConfigInitializer}
  */
@@ -124,30 +125,22 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
     'dfs.journalnode.edits.dir': '_initDfsJnEditsDir'
   },
 
-  initializerTypes: {
-    rename: {
-      method: '_initWithRename'
-    },
-    host_with_port: {
-      method: '_initAsHostWithPort'
-    },
-    hosts_with_port: {
-      method: '_initAsHostsWithPort'
-    },
-    namespace: {
-      method: '_initAsNamespace'
-    },
-    replace_namespace: {
-      method: '_initWithNamespace'
-    }
-  },
+  initializerTypes: [
+    {name: 'rename', method: '_initWithRename'},
+    {name: 'namespace', method: '_initAsNamespace'},
+    {name: 'replace_namespace', method: '_initWithNamespace'}
+  ],
 
   /**
    * Initializer for configs that should be renamed
    * Some part of their names should be replaced with <code>namespaceId</code> 
(user input this value on the wizard's 1st step)
    * Affects both - name and displayName
+   * <b>Important! It's not the same as <code>_updateInitializers</code>!</b>
+   * Main diff - this initializer used for configs
+   * with names that come with some "predicates" in their names. 
<code>_updateInitializers</code> is used to determine needed
+   * config name that depends on other config values or someting else
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -175,7 +168,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
    * Value may be customized with prefix and suffix (see 
<code>initializer.modifier</code>)
    * Value-examples: 'SOME_COOL_PREFIXmy_namespaceSOME_COOL_SUFFIX', 
'my_namespace'
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -198,7 +191,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
    * Initializer for configs with value that should be modified with replacing 
some substring
    * to the <code>namespaceId</code> (user input this value on the wizard's 
1st step)
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -222,7 +215,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hbase.rootdir</code>
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -245,7 +238,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hbase.rootdir</code> (HBASE-service)
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -267,7 +260,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
   /**
    * Unique initializer for <code>hbase.rootdir</code> (Ambari Metrics-service)
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -292,8 +285,8 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
   /**
    * Unique initializer for <code>instance.volumes</code>
    *
-   * @param {object} configProperty
-   * @param {topologyLocalDB} localDB
+   * @param {configProperty} configProperty
+   * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
    * @method _initInstanceVolumes
@@ -315,7 +308,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
   /**
    * Unique initializer for <code>instance.volumes.replacements</code>
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer
@@ -340,7 +333,7 @@ App.NnHaConfigInitializer = 
App.HaConfigInitializerClass.create({
    * Unique initializer for <code>dfs.journalnode.edits.dir</code>
    * Used only for Windows Stacks
    *
-   * @param {object} configProperty
+   * @param {configProperty} configProperty
    * @param {extendedTopologyLocalDB} localDB
    * @param {nnHaConfigDependencies} dependencies
    * @param {object} initializer

http://git-wip-us.apache.org/repos/asf/ambari/blob/99d9c26d/ambari-web/app/utils/configs/rm_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/rm_ha_config_initializer.js 
b/ambari-web/app/utils/configs/rm_ha_config_initializer.js
index 1b1885a..5f239c6 100644
--- a/ambari-web/app/utils/configs/rm_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/rm_ha_config_initializer.js
@@ -20,6 +20,7 @@ var App = require('app');
 require('utils/configs/config_initializer_class');
 
 /**
+ * Initializer for configs that are updated when Resource Manager HA-mode is 
activated
  *
  * @class {RmHaConfigInitializer}
  */
@@ -33,17 +34,6 @@ App.RmHaConfigInitializer = 
App.HaConfigInitializerClass.create({
     'yarn.resourcemanager.webapp.address.rm2': 
App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', false, 
'', '', 'webAddressPort', true),
     'yarn.resourcemanager.webapp.https.address.rm1': 
App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', true, '', 
'', 'httpsWebAddressPort', true),
     'yarn.resourcemanager.webapp.https.address.rm2': 
App.HaConfigInitializerClass.getHostWithPortConfig('RESOURCEMANAGER', false, 
'', '', 'httpsWebAddressPort', true)
-  },
-
-  uniqueInitializers: {},
-
-  initializerTypes: {
-    host_with_port: {
-      method: '_initAsHostWithPort'
-    },
-    hosts_with_port: {
-      method: '_initAsHostsWithPort'
-    }
   }
 
 });
\ No newline at end of file

Reply via email to