You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/01/19 07:42:36 UTC

[2/2] ignite git commit: IGNITE-843 WIP reworking import domain model and rename rename metadata to domain model.

IGNITE-843 WIP reworking import domain model and rename rename metadata to domain model.


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

Branch: refs/heads/ignite-843-rc2
Commit: dd05e1b33960a81c35f4ebb3ac35f3e920a1d265
Parents: 11781de
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Jan 19 13:42:39 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jan 19 13:42:39 2016 +0700

----------------------------------------------------------------------
 .../ui-ace-pojos/ui-ace-pojos.controller.js     |  48 +--
 .../ui-ace-pojos/ui-ace-pojos.directive.js      |   4 +-
 .../js/app/filters/hasPojo/hasPojo.filter.js    |   2 +-
 .../configuration/summary/summary.controller.js |  18 +-
 .../main/js/controllers/caches-controller.js    |  46 +-
 .../main/js/controllers/clusters-controller.js  |   3 -
 .../src/main/js/controllers/common-module.js    |  36 +-
 .../main/js/controllers/domains-controller.js   | 422 +++++++++++--------
 .../src/main/js/controllers/igfs-controller.js  |   3 -
 .../src/main/js/controllers/models/caches.json  |   6 +-
 .../src/main/js/controllers/models/domains.json |   2 +-
 modules/control-center-web/src/main/js/db.js    |  14 +-
 .../main/js/helpers/generator/generator-java.js | 161 ++++---
 .../main/js/helpers/generator/generator-xml.js  | 106 +++--
 .../src/main/js/routes/admin.js                 |   2 +-
 .../src/main/js/routes/caches.js                |  18 +-
 .../src/main/js/routes/clusters.js              |   2 +-
 .../src/main/js/routes/domains.js               | 139 ++----
 .../main/js/views/configuration/domains.jade    |  12 +-
 .../main/js/views/configuration/summary.jade    |   2 +-
 20 files changed, 524 insertions(+), 522 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js b/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
index 76ca6a8..177a673 100644
--- a/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
+++ b/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
@@ -23,21 +23,21 @@ export default ['$scope', 'IgniteUiAceOnLoad', 'JavaTypes', function($scope, onL
 
     // Watchers definition.
     // Watcher clean instance data if instance to cluster caches was change
-    const cleanMetadatas = () => {
+    const cleanPojos = () => {
         delete ctrl.class;
-        delete ctrl.metadatas;
+        delete ctrl.pojos;
         delete ctrl.classes;
     };
 
-    // Watcher updata metadata when changes caches and checkers useConstructor and includeKeyFields
-    const updateMetadatas = () => {
-        delete ctrl.metadatas;
+    // Watcher update pojos when changes caches and checkers useConstructor and includeKeyFields
+    const updatePojos = () => {
+        delete ctrl.pojos;
 
         if (!ctrl.cluster || !ctrl.cluster.caches)
             return;
 
         // TODO IGNITE-2054: need move $generatorJava to services.
-        ctrl.metadatas = $generatorJava.pojos(ctrl.cluster.caches, ctrl.useConstructor, ctrl.includeKeyFields);
+        ctrl.pojos = $generatorJava.pojos(ctrl.cluster.caches, ctrl.useConstructor, ctrl.includeKeyFields);
     };
 
     // Watcher update classes after
@@ -49,22 +49,22 @@ export default ['$scope', 'IgniteUiAceOnLoad', 'JavaTypes', function($scope, onL
 
         const classes = ctrl.classes = [];
 
-        _.forEach(ctrl.metadatas, (meta) => {
-            if (meta.keyType && !JavaTypes.isBuiltInClass(meta.keyType))
-                classes.push(meta.keyType);
+        _.forEach(ctrl.pojos, (pojo) => {
+            if (pojo.keyType && !JavaTypes.isBuiltInClass(pojo.keyType))
+                classes.push(pojo.keyType);
 
-            classes.push(meta.valueType);
+            classes.push(pojo.valueType);
         });
     };
 
     // Update pojos class.
     const updateClass = (value) => {
-        if (!value || !ctrl.metadatas.length)
+        if (!value || !ctrl.pojos.length)
             return;
 
-        const keyType = ctrl.metadatas[0].keyType;
+        const keyType = ctrl.pojos[0].keyType;
 
-        ctrl.class = ctrl.class || (JavaTypes.isBuiltInClass(keyType) ? null : keyType) || ctrl.metadatas[0].valueType;
+        ctrl.class = ctrl.class || (JavaTypes.isBuiltInClass(keyType) ? null : keyType) || ctrl.pojos[0].valueType;
     };
 
     // Update pojos data.
@@ -72,22 +72,22 @@ export default ['$scope', 'IgniteUiAceOnLoad', 'JavaTypes', function($scope, onL
         if (!value)
             return;
 
-        _.forEach(ctrl.metadatas, (meta) => {
-            if (meta.keyType === ctrl.class)
-                return ctrl.data = meta.keyClass;
+        _.forEach(ctrl.pojos, (pojo) => {
+            if (pojo.keyType === ctrl.class)
+                return ctrl.data = pojo.keyClass;
 
-            if (meta.valueType === ctrl.class)
-                return ctrl.data = meta.valueClass;
+            if (pojo.valueType === ctrl.class)
+                return ctrl.data = pojo.valueClass;
         });
     };
 
     // Setup watchers. Watchers order is important.
-    $scope.$watch('ctrl.cluster.caches', cleanMetadatas);
-    $scope.$watch('ctrl.cluster.caches', updateMetadatas);
+    $scope.$watch('ctrl.cluster.caches', cleanPojos);
+    $scope.$watch('ctrl.cluster.caches', updatePojos);
     $scope.$watch('ctrl.cluster.caches', updateClasses);
-    $scope.$watch('ctrl.useConstructor', updateMetadatas);
-    $scope.$watch('ctrl.includeKeyFields', updateMetadatas);
-    $scope.$watch('ctrl.metadatas', updateClass);
-    $scope.$watch('ctrl.metadatas', updatePojosData);
+    $scope.$watch('ctrl.useConstructor', updatePojos);
+    $scope.$watch('ctrl.includeKeyFields', updatePojos);
+    $scope.$watch('ctrl.pojos', updateClass);
+    $scope.$watch('ctrl.pojos', updatePojosData);
     $scope.$watch('ctrl.class', updatePojosData);
 }];

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js b/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js
index 1c2ba5e..8176752 100644
--- a/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js
+++ b/modules/control-center-web/src/main/js/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js
@@ -24,11 +24,11 @@ export default ['igniteUiAcePojos', [() => {
         restrict: 'E',
         scope: {
             cluster: '=',
-            metadatas: '=ngModel'
+            pojos: '=ngModel'
         },
         bindToController: {
             cluster: '=',
-            metadatas: '=ngModel'
+            pojos: '=ngModel'
         },
         template,
         controller,

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/app/filters/hasPojo/hasPojo.filter.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/filters/hasPojo/hasPojo.filter.js b/modules/control-center-web/src/main/js/app/filters/hasPojo/hasPojo.filter.js
index 559c433..db47585 100644
--- a/modules/control-center-web/src/main/js/app/filters/hasPojo/hasPojo.filter.js
+++ b/modules/control-center-web/src/main/js/app/filters/hasPojo/hasPojo.filter.js
@@ -17,7 +17,7 @@
 
 export default ['hasPojo', [() => {
     const filter = (cache) => {
-        return cache.metadatas && cache.metadatas.length;
+        return cache.domains && cache.domains.length;
     };
 
     return ({caches} = {}) => {

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js b/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
index 0d590ba..a2148d9 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
@@ -187,12 +187,12 @@ export default [
             javaFolder.children = [javaConfigFolder, javaStartupFolder];
 
             _.forEach(cluster.caches, (cache) => {
-                _.forEach(cache.metadatas, (metadata) => {
-                    if (!$common.isEmptyArray(metadata.keyFields)) {
-                        if (!JavaTypes.isBuiltInClass(metadata.keyType))
-                            addChildren(metadata.keyType);
+                _.forEach(cache.domains, (domain) => {
+                    if (!$common.isEmptyArray(domain.keyFields)) {
+                        if (!JavaTypes.isBuiltInClass(domain.keyType))
+                            addChildren(domain.keyType);
 
-                        addChildren(metadata.valueType);
+                        addChildren(domain.valueType);
                     }
                 });
             });
@@ -250,11 +250,11 @@ export default [
             zip.file('README.txt', $generatorReadme.readme().asString());
             zip.file('jdbc-drivers/README.txt', $generatorReadme.readmeJdbc().asString());
 
-            for (const meta of ctrl.data.metadatas) {
-                if (meta.keyClass && !JavaTypes.isBuiltInClass(meta.keyType))
-                    zip.file(srcPath + meta.keyType.replace(/\./g, '/') + '.java', meta.keyClass);
+            for (const pojo of ctrl.data.pojos) {
+                if (pojo.keyClass && !JavaTypes.isBuiltInClass(pojo.keyType))
+                    zip.file(srcPath + pojo.keyType.replace(/\./g, '/') + '.java', pojo.keyClass);
 
-                zip.file(srcPath + meta.valueType.replace(/\./g, '/') + '.java', meta.valueClass);
+                zip.file(srcPath + pojo.valueType.replace(/\./g, '/') + '.java', pojo.valueClass);
             }
 
             $generatorOptional.optionalContent(zip, cluster);

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 60fc822..e9e0fb2 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -158,7 +158,7 @@ consoleModule.controller('cachesController', [
         $scope.general = [];
         $scope.advanced = [];
         $scope.caches = [];
-        $scope.metadatas = [];
+        $scope.domains = [];
 
         $scope.preview = {
             general: {xml: '', java: '', allDefaults: true},
@@ -271,10 +271,10 @@ consoleModule.controller('cachesController', [
                 $scope.selectItem($scope.caches[0]);
         }
 
-        function cacheMetadatas(item) {
-            return _.reduce($scope.metadatas, function (memo, meta) {
-                if (item && _.contains(item.metadatas, meta.value)) {
-                    memo.push(meta.meta);
+        function cacheDomains(item) {
+            return _.reduce($scope.domains, function (memo, domain) {
+                if (item && _.contains(item.domains, domain.value)) {
+                    memo.push(domain.meta);
                 }
 
                 return memo;
@@ -296,8 +296,13 @@ consoleModule.controller('cachesController', [
 
                 $scope.caches = data.caches;
                 $scope.clusters = data.clusters;
-                $scope.metadatas = _.sortBy(_.map(validFilter(data.metadatas, true, false), function (meta) {
-                    return {value: meta._id, label: meta.valueType, kind: meta.kind, meta: meta};
+                $scope.domains = _.sortBy(_.map(validFilter(data.domains, true, false), function (domain) {
+                    return {
+                        value: domain._id,
+                        label: domain.valueType,
+                        kind: domain.kind,
+                        meta: domain
+                    };
                 }), 'label');
 
                 // Load page descriptor.
@@ -336,11 +341,11 @@ consoleModule.controller('cachesController', [
 
                                 $scope.ui.checkDirty(val, srcItem);
 
-                                var metas = cacheMetadatas(val);
+                                var domains = cacheDomains(val);
                                 var varName = $commonUtils.toJavaName('cache', val.name);
 
-                                $scope.preview.general.xml = $generatorXml.cacheMetadatas(metas, $generatorXml.cacheGeneral(val)).asString();
-                                $scope.preview.general.java = $generatorJava.cacheMetadatas(metas, varName, $generatorJava.cacheGeneral(val, varName)).asString();
+                                $scope.preview.general.xml = $generatorXml.cacheDomains(domains, $generatorXml.cacheGeneral(val)).asString();
+                                $scope.preview.general.java = $generatorJava.cacheDomains(domains, varName, $generatorJava.cacheGeneral(val, varName)).asString();
                                 $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
 
                                 $scope.preview.memory.xml = $generatorXml.cacheMemory(val).asString();
@@ -351,10 +356,10 @@ consoleModule.controller('cachesController', [
                                 $scope.preview.query.java = $generatorJava.cacheQuery(val, varName).asString();
                                 $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
 
-                                var storeFactory = $generatorXml.cacheStore(val, metas);
+                                var storeFactory = $generatorXml.cacheStore(val, domains);
 
                                 $scope.preview.store.xml = $generatorXml.generateDataSources(storeFactory.datasources).asString() + storeFactory.asString();
-                                $scope.preview.store.java = $generatorJava.cacheStore(val, metas, varName).asString();
+                                $scope.preview.store.java = $generatorJava.cacheStore(val, domains, varName).asString();
                                 $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
 
                                 $scope.preview.concurrency.xml = $generatorXml.cacheConcurrency(val).asString();
@@ -375,7 +380,7 @@ consoleModule.controller('cachesController', [
                             }
                         }, true);
 
-                        $scope.$watchCollection('backupItem.metadatas', function (val) {
+                        $scope.$watchCollection('backupItem.domains', function (val) {
                             if ($scope.selectedItemWatchGuard)
                                 $scope.selectedItemWatchGuard = false;
                             else {
@@ -386,7 +391,7 @@ consoleModule.controller('cachesController', [
                                     $common.isDefined(item.cacheStoreFactory.kind);
 
                                 if (val && !cacheStoreFactory) {
-                                    if (_.findIndex(cacheMetadatas(item), $common.metadataForStoreConfigured) >= 0) {
+                                    if (_.findIndex(cacheDomains(item), $common.domainForStoreConfigured) >= 0) {
                                         item.cacheStoreFactory.kind = 'CacheJdbcPojoStoreFactory';
 
                                         if (!item.readThrough && !item.writeThrough) {
@@ -445,9 +450,6 @@ consoleModule.controller('cachesController', [
             }
 
             $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
-
-            $scope.ui.formTitle = $common.isDefined($scope.backupItem) && $scope.backupItem._id ?
-                'Selected cache: ' + $scope.backupItem.name : 'New cache';
         };
 
         function prepareNewItem(id) {
@@ -460,7 +462,7 @@ consoleModule.controller('cachesController', [
                 clusters: id && _.find($scope.clusters, {value: id})
                     ? [id]
                     : _.map($scope.clusters, function (cluster) { return cluster.value; }),
-                metadatas: id && _.find($scope.metadatas, {value: id}) ? [id] : [],
+                domains: id && _.find($scope.domains, { value: id }) ? [id] : [],
                 cacheStoreFactory: {CacheJdbcBlobStoreFactory: {connectVia: 'DataSource'}}
             };
         }
@@ -583,11 +585,11 @@ consoleModule.controller('cachesController', [
                         'Store is configured but read/write through are not enabled!');
 
                 if (item.cacheStoreFactory.kind === 'CacheJdbcPojoStoreFactory') {
-                    if ($common.isDefined(item.metadatas)) {
-                        var metadatas = cacheMetadatas($scope.backupItem);
+                    if ($common.isDefined(item.domains)) {
+                        var domains = cacheDomains($scope.backupItem);
 
-                        if (_.findIndex(metadatas, $common.metadataForStoreConfigured) < 0)
-                            return showPopoverMessage($scope.panels, 'general', 'metadata',
+                        if (_.findIndex(domains, $common.domainForStoreConfigured) < 0)
+                            return showPopoverMessage($scope.panels, 'general', 'domains',
                                 'Cache with configured JDBC POJO store factory should be associated with at least one domain model for cache store');
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 5a8629d..295ff9a 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -415,9 +415,6 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
             }
 
             $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
-
-            $scope.ui.formTitle = $common.isDefined($scope.backupItem) && $scope.backupItem._id ?
-                'Selected cluster: ' + $scope.backupItem.name : 'New cluster';
         };
 
         function prepareNewItem(id) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index b38ed23..57ced0b 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -161,7 +161,7 @@ consoleModule.service('$common', [
         }
 
         var javaBuiltInClasses = [
-            'BigDecimal', 'Boolean', 'Byte', 'Date', 'Double', 'Float', 'Integer', 'Long', 'Short', 'String', 'Time', 'Timestamp', 'UUID'
+            'BigDecimal', 'Boolean', 'Byte', 'Date', 'Double', 'Float', 'Integer', 'Long', 'Object', 'Short', 'String', 'Time', 'Timestamp', 'UUID'
         ];
 
         var javaBuiltInTypes = [
@@ -171,8 +171,8 @@ consoleModule.service('$common', [
 
         var javaBuiltInFullNameClasses = [
             'java.math.BigDecimal', 'java.lang.Boolean', 'java.lang.Byte', 'java.sql.Date', 'java.lang.Double',
-            'java.lang.Float', 'java.lang.Integer', 'java.lang.Long', 'java.lang.Short', 'java.lang.String',
-            'java.sql.Time', 'java.sql.Timestamp', 'java.util.UUID'
+            'java.lang.Float', 'java.lang.Integer', 'java.lang.Long', 'java.lang.Object', 'java.lang.Short',
+            'java.lang.String', 'java.sql.Time', 'java.sql.Timestamp', 'java.util.UUID'
         ];
 
         function isJavaBuiltInClass(cls) {
@@ -781,18 +781,18 @@ consoleModule.service('$common', [
 
                 return true;
             },
-            metadataForQueryConfigured: function (meta) {
-                var isEmpty = !isDefined(meta) || (isEmptyArray(meta.fields) &&
-                    isEmptyArray(meta.aliases) &&
-                    isEmptyArray(meta.indexes));
+            domainForQueryConfigured: function (domain) {
+                var isEmpty = !isDefined(domain) || (isEmptyArray(domain.fields) &&
+                    isEmptyArray(domain.aliases) &&
+                    isEmptyArray(domain.indexes));
 
                 return !isEmpty;
             },
-            metadataForStoreConfigured: function (meta) {
-                var isEmpty = !isDefined(meta) || (isEmptyString(meta.databaseSchema) &&
-                    isEmptyString(meta.databaseTable) &&
-                    isEmptyArray(meta.keyFields) &&
-                    isEmptyArray(meta.valueFields));
+            domainForStoreConfigured: function (domain) {
+                var isEmpty = !isDefined(domain) || (isEmptyString(domain.databaseSchema) &&
+                    isEmptyString(domain.databaseTable) &&
+                    isEmptyArray(domain.keyFields) &&
+                    isEmptyArray(domain.valueFields));
 
                 return !isEmpty;
             },
@@ -965,7 +965,7 @@ consoleModule.service('$common', [
                     }
                 }
 
-                // Find group metadata to reset group values.
+                // Find group to reset group values.
                 for (var grpIx = 0; grpIx < groups.length; grpIx ++) {
                     if (groups[grpIx].group === group) {
                         var fields = groups[grpIx].fields;
@@ -1752,17 +1752,17 @@ consoleModule.filter('tablesSearch', function() {
 
 // Filter domain models with key fields configuration.
 consoleModule.filter('domainsValidation', ['$common', function ($common) {
-    return function(metadatas, valid, invalid) {
+    return function(domains, valid, invalid) {
         if (valid && invalid)
-            return metadatas;
+            return domains;
 
         var out = [];
 
-        _.forEach(metadatas, function (meta) {
-            var _valid = !$common.metadataForStoreConfigured(meta) || $common.isJavaBuiltInClass(meta.keyType) || !$common.isEmptyArray(meta.keyFields);
+        _.forEach(domains, function (domain) {
+            var _valid = !$common.domainForStoreConfigured(domain) || $common.isJavaBuiltInClass(domain.keyType) || !$common.isEmptyArray(domain.keyFields);
 
             if (valid && _valid || invalid && !_valid)
-                out.push(meta);
+                out.push(domain);
         });
 
         return out;

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/domains-controller.js b/modules/control-center-web/src/main/js/controllers/domains-controller.js
index ceeb860..ecf6f45 100644
--- a/modules/control-center-web/src/main/js/controllers/domains-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/domains-controller.js
@@ -17,7 +17,7 @@
 
 // Controller for Domain model screen.
 consoleModule.controller('domainsController', function ($filter, $http, $timeout, $state, $scope, $controller, $modal,
-     $common,  $focus, $confirm, $confirmBatch, $clone, $table, $preview, $loading, $unsavedChangesGuard, $agentDownload) {
+    $common, $focus, $confirm, $confirmBatch, $clone, $table, $preview, $loading, $unsavedChangesGuard, $agentDownload) {
         $unsavedChangesGuard.install($scope);
 
         // Initialize the super class and extend it.
@@ -32,18 +32,21 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         $scope.ui.generateCaches = true;
         $scope.ui.generatedCachesClusters = [];
 
-        $scope.removeDemoDropdown = [{ 'text': 'Remove generated demo data', 'click': 'removeDemoItems()'}];
+        $scope.removeDemoDropdown = [{
+            'text': 'Remove generated demo data',
+            'click': 'removeDemoItems()'
+        }];
 
         function restoreSelection() {
             var lastSelectedDomain = angular.fromJson(sessionStorage.lastSelectedDomain);
 
             if (lastSelectedDomain) {
-                var idx = _.findIndex($scope.metadatas, function (metadata) {
-                    return metadata._id === lastSelectedDomain;
+                var idx = _.findIndex($scope.domains, function (domain) {
+                    return domain._id === lastSelectedDomain;
                 });
 
                 if (idx >= 0)
-                    $scope.selectItem($scope.metadatas[idx]);
+                    $scope.selectItem($scope.domains[idx]);
                 else {
                     sessionStorage.removeItem('lastSelectedDomain');
 
@@ -54,6 +57,16 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 selectFirstItem();
         }
 
+        function _mapCaches(caches) {
+            return _.map(caches, function (cache) {
+                return {
+                    label: cache.name,
+                    value: cache._id,
+                    cache: cache
+                }
+            });
+        }
+
         $scope.removeDemoItems = function () {
             $table.tableReset();
 
@@ -67,8 +80,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                                 .success(function (data) {
                                     $scope.spaces = data.spaces;
                                     $scope.clusters = data.clusters;
-                                    $scope.caches = data.caches;
-                                    $scope.metadatas = data.metadatas;
+                                    $scope.caches = _mapCaches(data.caches);
+                                    $scope.domains = data.domains;
 
                                     $scope.ui.generatedCachesClusters = [];
 
@@ -85,9 +98,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 });
         };
 
-        $scope.hasDemoItems =  function () {
-            return _.findIndex($scope.metadatas, function (meta) {
-                    return meta.demo;
+        $scope.hasDemoItems = function () {
+            return _.findIndex($scope.domains, function (domain) {
+                    return domain.demo;
                 }) >= 0;
         };
 
@@ -182,7 +195,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         $scope.tablePairSave = $table.tablePairSave;
         $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
 
-        $scope.metadataVariants = $common.mkOptions(['Annotations', 'Configuration']);
+        $scope.queryMetadataVariants = $common.mkOptions(['Annotations', 'Configuration']);
 
         var INFO_CONNECT_TO_DB = 'Configure connection to database';
         var INFO_SELECT_SCHEMAS = 'Select schemas to load tables from';
@@ -191,7 +204,11 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         var LOADING_JDBC_DRIVERS = {text: 'Loading JDBC drivers...'};
         var LOADING_SCHEMAS = {text: 'Loading schemas...'};
         var LOADING_TABLES = {text: 'Loading tables...'};
-        var SAVING_METADATA = {text: 'Saving domain models...'};
+        var SAVING_DOMAINS = {text: 'Saving domain model...'};
+
+        $scope.ui.invalidKeyFieldsTooltip = 'Found key types without configured key fields<br/>' +
+            'It may be a result of import tables from database without primary keys<br/>' +
+            'Key field for suck key types should be configured manually';
 
         var previews = [];
 
@@ -272,12 +289,12 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             tablesOnly: true
         };
 
-    function _loadPresets () {
+        function _loadPresets() {
             try {
-               var restoredPresets =  JSON.parse(localStorage.dbPresets);
+                var restoredPresets = JSON.parse(localStorage.dbPresets);
 
                 _.forEach(restoredPresets, function (restoredPreset) {
-                    var preset = _.find(_dbPresets, { jdbcDriverClass: restoredPreset.jdbcDriverClass });
+                    var preset = _.find(_dbPresets, {jdbcDriverClass: restoredPreset.jdbcDriverClass});
 
                     if (preset) {
                         preset.jdbcUrl = restoredPreset.jdbcUrl;
@@ -292,9 +309,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
         _loadPresets();
 
-        function _savePreset (preset) {
+        function _savePreset(preset) {
             try {
-                var oldPreset = _.find(_dbPresets, { jdbcDriverClass: preset.jdbcDriverClass });
+                var oldPreset = _.find(_dbPresets, {jdbcDriverClass: preset.jdbcDriverClass});
 
                 if (oldPreset)
                     angular.extend(oldPreset, preset);
@@ -351,9 +368,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             {value: false, label: 'DESC'}
         ];
 
-        $scope.panels = { activePanels: [0, 1] };
+        $scope.panels = {activePanels: [0, 1]};
 
-        $scope.metadatas = [];
+        $scope.domains = [];
 
         $scope.isJavaBuiltInClass = function () {
             var item = $scope.backupItem;
@@ -399,12 +416,12 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         // Pre-fetch modal dialogs.
         var importDomainModal = $modal({scope: $scope, templateUrl: '/configuration/domains-import.html', show: false});
 
-        var hideimportDomain = importDomainModal.hide;
+        var hideImportDomain = importDomainModal.hide;
 
         importDomainModal.hide = function () {
             $agentDownload.stopAwaitAgent();
 
-            hideimportDomain();
+            hideImportDomain();
         };
 
         /**
@@ -552,20 +569,54 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 });
         }
 
-        function _dropDownItem(lbl, val) {
-            return {
-                label: lbl,
-                value: val
+        var DFLT_PARTITIONED_CACHE = {
+            label: 'PARTITIONED',
+            value: -1,
+            cache: {
+                name: 'PARTITIONED',
+                cacheMode: 'PARTITIONED',
+                atomicityMode: 'ATOMIC',
+                cacheStoreFactory: {
+                    kind: 'CacheJdbcPojoStoreFactory',
+                    CacheJdbcPojoStoreFactory: {
+                        dataSourceBean: 'dataSource'
+                    }
+                },
+                readThrough: true,
+                writeThrough: true
             }
-        }
+        };
+
+        var DFLT_REPLICATED_CACHE = {
+            label: 'REPLICATED',
+            value: -2,
+            cache: {
+                name: 'REPLICATED',
+                cacheMode: 'REPLICATED',
+                atomicityMode: 'ATOMIC',
+                cacheStoreFactory: {
+                    kind: 'CacheJdbcPojoStoreFactory',
+                    CacheJdbcPojoStoreFactory: {
+                        dataSourceBean: 'dataSource'
+                    }
+                },
+                readThrough: true,
+                writeThrough: true
+            }
+        };
 
-        var IMPORT_DM_NEW_CACHE = 'IMPORT_DM_NEW_CACHE';
-        var IMPORT_DM_DO_NOT_GENERATE = 'IMPORT_DM_DO_NOT_GENERATE';
-        var IMPORT_DM_DFLT_PARTITIONED_CACHE = 'IMPORT_DM_DFLT_PARTITIONED_CACHE';
-        var IMPORT_DM_DFLT_REPLICATED_CACHE = 'IMPORT_DM_DFLT_REPLICATED_CACHE';
+        var IMPORT_DM_NEW_CACHE = {
+            label: 'New cache',
+            value: -1
+        };
+
+        var IMPORT_DM_DO_NOT_GENERATE = {
+            label: 'Do not generate',
+            value: -2
+        };
 
-        $scope.ui.dfltTableCache = IMPORT_DM_NEW_CACHE;
-        $scope.ui.dfltTableTemplate = IMPORT_DM_DFLT_PARTITIONED_CACHE;
+        $scope.ui.dfltTableCache = IMPORT_DM_NEW_CACHE.value;
+        $scope.ui.dfltTableTemplate = DFLT_PARTITIONED_CACHE.value;
 
         /**
          * Load list of database tables.
@@ -586,15 +637,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
             $http.post('/api/v1/agent/tables', preset)
                 .success(function (tables) {
-                    $scope.importCaches = [
-                        _dropDownItem('New cache', IMPORT_DM_NEW_CACHE),
-                        _dropDownItem('Do not generate', IMPORT_DM_DO_NOT_GENERATE)
-                    ];
+                    $scope.importCaches = [IMPORT_DM_NEW_CACHE, IMPORT_DM_DO_NOT_GENERATE];
 
-                    $scope.importCacheTemplates = [
-                        _dropDownItem('PARTITIONED', 'IMPORT_DM_DFLT_PARTITIONED_CACHE'),
-                        _dropDownItem('REPLICATED', 'IMPORT_DM_DFLT_REPLICATED_CACHE')
-                    ];
+                    $scope.importCacheTemplates = [DFLT_PARTITIONED_CACHE, DFLT_REPLICATED_CACHE];
 
                     if (!$common.isEmptyArray($scope.caches)) {
                         $scope.importCaches.push(null);
@@ -608,8 +653,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
                     _.forEach(tables, function (tbl, idx) {
                         tbl.id = idx;
-                        tbl.cache = IMPORT_DM_NEW_CACHE;
-                        tbl.template = 'IMPORT_DM_DFLT_PARTITIONED_CACHE';
+                        tbl.cache = IMPORT_DM_NEW_CACHE.value;
+                        tbl.template = DFLT_PARTITIONED_CACHE.value;
                         tbl.label = tbl.schema + '.' + tbl.tbl;
                         tbl.editCache = false;
                         tbl.editTemplate = false;
@@ -625,16 +670,16 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 .error(function (errMsg) {
                     $common.showError(errMsg);
                 })
-                .finally(function() {
+                .finally(function () {
                     $loading.finish('importDomainFromDb');
                 });
         }
 
         $scope.dfltTableTemplateVisible = function () {
-            return $scope.ui.dfltTableCache === IMPORT_DM_NEW_CACHE;
+            return $scope.ui.dfltTableCache === IMPORT_DM_NEW_CACHE.value;
         };
 
-        $scope.applyDefaults = function() {
+        $scope.applyDefaults = function () {
             _.forEach($scope.importDomain.displayedTables, function (table) {
                 table.editCache = false;
                 table.editTemplate = false;
@@ -672,7 +717,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         };
 
         $scope.dbTableTemplate = function (tbl) {
-            if (tbl.cache === IMPORT_DM_NEW_CACHE)
+            if (tbl.cache === IMPORT_DM_NEW_CACHE.value)
                 return _.find($scope.importCacheTemplates, {value: tbl.template}).label;
 
             return '';
@@ -685,7 +730,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             $scope.importDomain.action = 'options';
             $scope.importDomain.button = 'Save';
             $scope.importDomain.info = INFO_SELECT_OPTIONS;
-            $scope.importDomain.loadingOptions = SAVING_METADATA;
+            $scope.importDomain.loadingOptions = SAVING_DOMAINS;
         }
 
         function toJavaClassName(name) {
@@ -698,7 +743,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             for (var i = 0; i < len; i++) {
                 var ch = name.charAt(i);
 
-                if (ch === ' ' ||  ch === '_')
+                if (ch === ' ' || ch === '_')
                     capitalizeNext = true;
                 else if (capitalizeNext) {
                     buf += ch.toLocaleUpperCase();
@@ -731,13 +776,13 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                             $scope.caches.push(generatedCache);
                         });
 
-                        _.forEach(savedBatch.savedMetas, function (savedItem) {
-                            var idx = _.findIndex($scope.metadatas, function (meta) {
-                                return meta._id === savedItem._id;
+                        _.forEach(savedBatch.savedDomains, function (savedItem) {
+                            var idx = _.findIndex($scope.domains, function (domain) {
+                                return domain._id === savedItem._id;
                             });
 
                             if (idx >= 0)
-                                $scope.metadatas[idx] = savedItem;
+                                $scope.domains[idx] = savedItem;
                             else
                                 newItems.push(savedItem);
 
@@ -745,11 +790,11 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                         });
 
                         _.forEach(newItems, function (item) {
-                            $scope.metadatas.push(item);
+                            $scope.domains.push(item);
                         });
 
-                        if (!lastItem && $scope.metadatas.length > 0)
-                            lastItem = $scope.metadatas[0];
+                        if (!lastItem && $scope.domains.length > 0)
+                            lastItem = $scope.domains[0];
 
                         $scope.selectItem(lastItem);
 
@@ -762,7 +807,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                     .error(function (errMsg) {
                         $common.showError(errMsg);
                     })
-                    .finally(function() {
+                    .finally(function () {
                         $loading.finish('importDomainFromDb');
 
                         importDomainModal.hide();
@@ -842,18 +887,19 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                         _.forEach(table.idxs, function (idx) {
                             var fields = Object.keys(idx.fields);
 
-                            indexes.push(
-                                {name: idx.name, indexType: 'SORTED', fields: _.map(fields, function (fieldName) {
+                            indexes.push({
+                                name: idx.name, indexType: 'SORTED', fields: _.map(fields, function (fieldName) {
                                     return {
                                         name: toJavaName(fieldName),
                                         direction: !idx.fields[fieldName]
                                     };
-                                })});
+                                })
+                            });
                         });
                     }
 
-                    var domainFound = _.find($scope.metadatas, function (meta) {
-                        return meta.valueType === valType;
+                    var domainFound = _.find($scope.domains, function (domain) {
+                        return domain.valueType === valType;
                     });
 
                     var newDomain = {
@@ -888,17 +934,30 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                         newDomain.keyType = newDomain.keyFields[0].jdbcType.javaType;
 
                     // Prepare caches for generation.
-                    if ($scope.ui.generateCaches && table.cache !== IMPORT_DM_DO_NOT_GENERATE) {
-                        newDomain.newCache = {
-                            name: typeName + 'Cache',
-                            cache: table.cache,
-                            dialect: $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db,
-                            clusters: $scope.ui.generatedCachesClusters,
-                            demo: $scope.importDomain.demo
-                        };
-
-                        if (table.cache === IMPORT_DM_NEW_CACHE)
-                            newDomain.newCache.template = table.template;
+                    if ($scope.ui.generateCaches && table.cache !== IMPORT_DM_DO_NOT_GENERATE.value) {
+                        if (table.cache === IMPORT_DM_NEW_CACHE.value) {
+                            var template = _.find($scope.importCacheTemplates, {value: table.template});
+
+                            newDomain.newCache = angular.copy(template ? template.cache : DFLT_PARTITIONED_CACHE.cache);
+
+                            delete newDomain.newCache._id;
+                            newDomain.newCache.name = typeName + 'Cache';
+                            newDomain.newCache.clusters = $scope.ui.generatedCachesClusters;
+                            newDomain.newCache.demo = $scope.importDomain.demo;
+
+                            // POJO store factory is not defined in template.
+                            if (!newDomain.newCache.cacheStoreFactory ||
+                                newDomain.newCache.cacheStoreFactory.kind !== 'CacheJdbcPojoStoreFactory')
+                                newDomain.newCache.cacheStoreFactory = {
+                                    kind: 'CacheJdbcPojoStoreFactory',
+                                    CacheJdbcPojoStoreFactory: { dataSourceBean: 'dataSource' }
+                                };
+
+                            newDomain.newCache.cacheStoreFactory.CacheJdbcPojoStoreFactory.dialect =
+                                $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db
+                        }
+                        else if (table.cache !== IMPORT_DM_DO_NOT_GENERATE._id)
+                            newDomain.caches = [table.cache];
                     }
 
                     batch.push(newDomain);
@@ -919,7 +978,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                     '</span>';
             }
 
-            var itemsToConfirm = _.filter(batch, function (item) { return item.confirm; });
+            var itemsToConfirm = _.filter(batch, function (item) {
+                return item.confirm;
+            });
 
             function checkOverwrite() {
                 if (itemsToConfirm.length > 0)
@@ -939,8 +1000,10 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 checkOverwrite();
             else
                 $confirm.confirm('Some tables have no primary key.<br/>' +
-                    'You will need to configure key type and key fields for such tables after import complete.')
-                    .then(function () { checkOverwrite(); });
+                        'You will need to configure key type and key fields for such tables after import complete.')
+                    .then(function () {
+                        checkOverwrite();
+                    });
         }
 
         $scope.importDomainNext = function () {
@@ -948,10 +1011,10 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 return;
 
             if ($scope.importDomain.action === 'connect') {
-               if ($scope.importDomain.demo && $scope.demoConnection.db !== 'H2')
-                   importDomainModal.hide();
-               else
-                   _loadSchemas();
+                if ($scope.importDomain.demo && $scope.demoConnection.db !== 'H2')
+                    importDomainModal.hide();
+                else
+                    _loadSchemas();
             }
             else if ($scope.importDomain.action === 'schemas')
                 _loadTables();
@@ -1016,11 +1079,11 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         $scope.importDomainPrev = function () {
             $scope.importDomain.button = 'Next';
 
-            if  ($scope.importDomain.action === 'options') {
+            if ($scope.importDomain.action === 'options') {
                 $scope.importDomain.action = 'tables';
                 $scope.importDomain.info = INFO_SELECT_TABLES;
             }
-            else if  ($scope.importDomain.action === 'tables' && $scope.importDomain.schemas.length > 0) {
+            else if ($scope.importDomain.action === 'tables' && $scope.importDomain.schemas.length > 0) {
                 $scope.importDomain.action = 'schemas';
                 $scope.importDomain.info = INFO_SELECT_SCHEMAS;
                 $scope.importDomain.loadingOptions = LOADING_TABLES;
@@ -1032,24 +1095,24 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             }
         };
 
-        $scope.metadataTitle = function () {
-            return $scope.ui.showValid ? 'Types domain models:' : 'Type domain models without key fields:';
+        $scope.domainModelTitle = function () {
+            return $scope.ui.showValid ? 'Domain model types:' : 'Domain model types without key fields:';
         };
 
         function selectFirstItem() {
-            if ($scope.metadatas.length > 0)
-                $scope.selectItem($scope.metadatas[0]);
+            if ($scope.domains.length > 0)
+                $scope.selectItem($scope.domains[0]);
         }
 
         // When landing on the page, get domain models and show them.
-        $loading.start('loadingMetadataScreen');
+        $loading.start('loadingDomainModelsScreen');
 
         $http.post('/api/v1/configuration/domains/list')
             .success(function (data) {
                 $scope.spaces = data.spaces;
                 $scope.clusters = data.clusters;
-                $scope.caches = data.caches;
-                $scope.metadatas = data.metadatas;
+                $scope.caches = _mapCaches(data.caches);
+                $scope.domains = data.domains;
 
                 _.forEach($scope.clusters, function (cluster) {
                     $scope.ui.generatedCachesClusters.push(cluster.value);
@@ -1059,7 +1122,6 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 $http.get('/models/domains.json')
                     .success(function (data) {
                         $scope.domainModel = data.domainModel;
-                        $scope.metadataDb = data.metadataDb;
 
                         $scope.ui.groups = data.domainModel;
 
@@ -1078,16 +1140,16 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
                                 $scope.ui.checkDirty(val, srcItem);
 
-                                $scope.preview.general.xml = $generatorXml.metadataGeneral(val).asString();
-                                $scope.preview.general.java = $generatorJava.metadataGeneral(val).asString();
+                                $scope.preview.general.xml = $generatorXml.domainModelGeneral(val).asString();
+                                $scope.preview.general.java = $generatorJava.domainModelGeneral(val).asString();
                                 $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
 
-                                $scope.preview.query.xml = $generatorXml.metadataQuery(val).asString();
-                                $scope.preview.query.java = $generatorJava.metadataQuery(val).asString();
+                                $scope.preview.query.xml = $generatorXml.domainModelQuery(val).asString();
+                                $scope.preview.query.java = $generatorJava.domainModelQuery(val).asString();
                                 $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
 
-                                $scope.preview.store.xml = $generatorXml.metadataStore(val).asString();
-                                $scope.preview.store.java = $generatorJava.metadataStore(val, false).asString();
+                                $scope.preview.store.xml = $generatorXml.domainStore(val).asString();
+                                $scope.preview.store.java = $generatorJava.domainStore(val, false).asString();
                                 $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
                             }
                         }, true);
@@ -1099,9 +1161,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             .error(function (errMsg) {
                 $common.showError(errMsg);
             })
-            .finally(function() {
+            .finally(function () {
                 $scope.ui.ready = true;
-                $loading.finish('loadingMetadataScreen');
+                $loading.finish('loadingDomainModelsScreen');
             });
 
         $scope.selectItem = function (item, backup) {
@@ -1116,9 +1178,11 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                     else
                         sessionStorage.removeItem('lastSelectedDomain');
                 }
-                catch (error) { }
+                catch (ignored) {
+                    // Ignore possible errors when read from storage.
+                }
 
-                _.forEach(previews, function(preview) {
+                _.forEach(previews, function (preview) {
                     preview.attractAttention = false;
                 });
 
@@ -1140,10 +1204,6 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             }
 
             $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
-
-            $scope.ui.formTitle = $common.isDefined($scope.backupItem) && $scope.backupItem._id ?
-                'Selected domain model: ' + $scope.backupItem.valueType
-                : 'New domain model';
         };
 
         function prepareNewItem(cacheId) {
@@ -1179,8 +1239,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             else if (!$common.isValidJavaClass('Value type', item.valueType, false, 'valueType'))
                 return false;
 
-            var str = $common.metadataForStoreConfigured(item);
-            var qry = $common.metadataForQueryConfigured(item);
+            var str = $common.domainForStoreConfigured(item);
+            var qry = $common.domainForQueryConfigured(item);
 
             if (item.queryMetadata === 'Configuration' && qry) {
                 if ($common.isEmptyArray(item.fields))
@@ -1222,8 +1282,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
         // Save domain models into database.
         function save(item) {
-            var qry = $common.metadataForQueryConfigured(item);
-            var str = $common.metadataForStoreConfigured(item);
+            var qry = $common.domainForQueryConfigured(item);
+            var str = $common.domainForStoreConfigured(item);
 
             item.kind = 'query';
 
@@ -1236,16 +1296,16 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                 .success(function (res) {
                     $scope.ui.markPristine();
 
-                    var savedMeta = res.savedMetas[0];
+                    var savedMeta = res.savedDomains[0];
 
-                    var idx = _.findIndex($scope.metadatas, function (metadata) {
-                        return metadata._id === savedMeta._id;
+                    var idx = _.findIndex($scope.domains, function (domain) {
+                        return domain._id === savedMeta._id;
                     });
 
                     if (idx >= 0)
-                        angular.extend($scope.metadatas[idx], savedMeta);
+                        angular.extend($scope.domains[idx], savedMeta);
                     else
-                        $scope.metadatas.push(savedMeta);
+                        $scope.domains.push(savedMeta);
 
                     $scope.selectItem(savedMeta);
 
@@ -1266,9 +1326,9 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             }
         };
 
-        function _metadataNames() {
-            return _.map($scope.metadatas, function (meta) {
-                return meta.valueType;
+        function _domainNames() {
+            return _.map($scope.domains, function (domain) {
+                return domain.valueType;
             });
         }
 
@@ -1276,7 +1336,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         $scope.cloneItem = function () {
             if ($scope.tableReset(true)) {
                 if (validate($scope.backupItem))
-                    $clone.confirm($scope.backupItem.valueType, _metadataNames()).then(function (newName) {
+                    $clone.confirm($scope.backupItem.valueType, _domainNames()).then(function (newName) {
                         var item = angular.copy($scope.backupItem);
 
                         delete item._id;
@@ -1296,36 +1356,36 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
             $confirm.confirm('Are you sure you want to remove domain model: "' + selectedItem.valueType + '"?')
                 .then(function () {
-                        var _id = selectedItem._id;
+                    var _id = selectedItem._id;
 
-                        $http.post('/api/v1/configuration/domains/remove', {_id: _id})
-                            .success(function () {
-                                $common.showInfo('Domain model has been removed: ' + selectedItem.valueType);
+                    $http.post('/api/v1/configuration/domains/remove', {_id: _id})
+                        .success(function () {
+                            $common.showInfo('Domain model has been removed: ' + selectedItem.valueType);
 
-                                var metadatas = $scope.metadatas;
+                            var domains = $scope.domains;
 
-                                var idx = _.findIndex(metadatas, function (metadata) {
-                                    return metadata._id === _id;
-                                });
+                            var idx = _.findIndex(domains, function (domain) {
+                                return domain._id === _id;
+                            });
 
-                                if (idx >= 0) {
-                                    metadatas.splice(idx, 1);
+                            if (idx >= 0) {
+                                domains.splice(idx, 1);
 
-                                    if (metadatas.length > 0)
-                                        $scope.selectItem(metadatas[0]);
-                                    else
-                                        $scope.selectItem(undefined, undefined);
-                                }
+                                if (domains.length > 0)
+                                    $scope.selectItem(domains[0]);
+                                else
+                                    $scope.selectItem(undefined, undefined);
+                            }
 
-                                if (!$scope.ui.showValid) {
-                                    var validFilter = $filter('domainsValidation');
+                            if (!$scope.ui.showValid) {
+                                var validFilter = $filter('domainsValidation');
 
-                                    $scope.ui.showValid = validFilter($scope.metadatas, false, true).length === 0;
-                                }
-                            })
-                            .error(function (errMsg) {
-                                $common.showError(errMsg);
-                            });
+                                $scope.ui.showValid = validFilter($scope.domains, false, true).length === 0;
+                            }
+                        })
+                        .error(function (errMsg) {
+                            $common.showError(errMsg);
+                        });
                 });
         };
 
@@ -1335,19 +1395,19 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
             $confirm.confirm('Are you sure you want to remove all domain models?')
                 .then(function () {
-                        $http.post('/api/v1/configuration/domains/remove/all')
-                            .success(function () {
-                                $common.showInfo('All domain models have been removed');
+                    $http.post('/api/v1/configuration/domains/remove/all')
+                        .success(function () {
+                            $common.showInfo('All domain models have been removed');
 
-                                $scope.metadatas = [];
+                            $scope.domains = [];
 
-                                $scope.selectItem(undefined, undefined);
+                            $scope.selectItem(undefined, undefined);
 
-                                $scope.ui.showValid = true;
-                            })
-                            .error(function (errMsg) {
-                                $common.showError(errMsg);
-                            });
+                            $scope.ui.showValid = true;
+                        })
+                        .error(function (errMsg) {
+                            $common.showError(errMsg);
+                        });
                 });
         };
 
@@ -1356,16 +1416,28 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
             var validFilter = $filter('domainsValidation');
 
-            var idx = _.findIndex(validFilter($scope.metadatas, $scope.ui.showValid, true), function (metadata) {
-                return metadata._id === $scope.selectedItem._id;
-            });
+            var idx = -1;
+
+            if ($common.isDefined($scope.selectedItem)) {
+                idx = _.findIndex(validFilter($scope.domains, $scope.ui.showValid, true), function (domain) {
+                    return domain._id === $scope.selectedItem._id;
+                });
+            }
 
             if (idx === -1)
                 $scope.selectItem(undefined, undefined);
         };
 
         var pairFields = {
-            fields: {msg: 'Query field class', id: 'QryField', idPrefix: 'Key', searchCol: 'name', valueCol: 'key', classValidation: true, dupObjName: 'name'},
+            fields: {
+                msg: 'Query field class',
+                id: 'QryField',
+                idPrefix: 'Key',
+                searchCol: 'name',
+                valueCol: 'key',
+                classValidation: true,
+                dupObjName: 'name'
+            },
             aliases: {id: 'Alias', idPrefix: 'Value', searchCol: 'alias', valueCol: 'value', dupObjName: 'alias'}
         };
 
@@ -1395,26 +1467,26 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         };
 
         function tableDbFieldValue(field, index) {
-            return (index < 0) ?
-                {
-                    databaseFieldName: field.newDatabaseFieldName,
-                    databaseFieldType: field.newDatabaseFieldType,
-                    javaFieldName: field.newJavaFieldName,
-                    javaFieldType: field.newJavaFieldType
-                }
-                : {
-                    databaseFieldName: field.curDatabaseFieldName,
-                    databaseFieldType: field.curDatabaseFieldType,
-                    javaFieldName: field.curJavaFieldName,
-                    javaFieldType: field.curJavaFieldType
-                };
+            return (index < 0) ? {
+                databaseFieldName: field.newDatabaseFieldName,
+                databaseFieldType: field.newDatabaseFieldType,
+                javaFieldName: field.newJavaFieldName,
+                javaFieldType: field.newJavaFieldType
+            } : {
+                databaseFieldName: field.curDatabaseFieldName,
+                databaseFieldType: field.curDatabaseFieldType,
+                javaFieldName: field.curJavaFieldName,
+                javaFieldType: field.curJavaFieldType
+            };
         }
 
         $scope.tableDbFieldSaveVisible = function (field, index) {
             var dbFieldValue = tableDbFieldValue(field, index);
 
-            return !$common.isEmptyString(dbFieldValue.databaseFieldName) && $common.isDefined(dbFieldValue.databaseFieldType) &&
-                !$common.isEmptyString(dbFieldValue.javaFieldName) && $common.isDefined(dbFieldValue.javaFieldType);
+            return $common.isDefined(dbFieldValue.databaseFieldType) &&
+                $common.isDefined(dbFieldValue.javaFieldType) &&
+                !$common.isEmptyString(dbFieldValue.databaseFieldName) &&
+                !$common.isEmptyString(dbFieldValue.javaFieldName);
         };
 
         var dbFieldTables = {
@@ -1586,9 +1658,13 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
         };
 
         function tableIndexItemValue(field, index) {
-            return index < 0 ?
-                {name: field.newFieldName, direction: field.newDirection}
-                : {name: field.curFieldName, direction: field.curDirection};
+            return index < 0 ? {
+                name: field.newFieldName,
+                direction: field.newDirection
+            } : {
+                name: field.curFieldName,
+                direction: field.curDirection
+            };
         }
 
         $scope.tableIndexItemStartEdit = function (field, indexIdx, curIdx) {
@@ -1670,11 +1746,11 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             $common.resetItem($scope.backupItem, resetTo, $scope.domain, group);
         };
 
-        $scope.resetAll = function() {
+        $scope.resetAll = function () {
             $table.tableReset();
 
             $confirm.confirm('Are you sure you want to undo all changes for current domain model?')
-                .then(function() {
+                .then(function () {
                     $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem();
                 });
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/igfs-controller.js b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
index a927e39..fdb40d5 100644
--- a/modules/control-center-web/src/main/js/controllers/igfs-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
@@ -276,9 +276,6 @@ consoleModule.controller('igfsController', [
                 }
 
                 $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
-
-                $scope.ui.formTitle = $common.isDefined($scope.backupItem) && $scope.backupItem._id ?
-                    'Selected IGFS: ' + $scope.backupItem.name : 'New IGFS';
             };
 
             function prepareNewItem(id) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/models/caches.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json
index e749d60..e89130a 100644
--- a/modules/control-center-web/src/main/js/controllers/models/caches.json
+++ b/modules/control-center-web/src/main/js/controllers/models/caches.json
@@ -29,12 +29,12 @@
         },
         {
           "label": "Domain models",
-          "id": "metadata",
+          "id": "domains",
           "type": "dropdown-multiple",
-          "model": "metadatas",
+          "model": "domains",
           "placeholder": "Choose domain models",
           "placeholderEmpty": "No domain models configured",
-          "items": "metadatas",
+          "items": "domains",
           "tip": [
             "Select domain models to describe types in cache"
           ],

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/controllers/models/domains.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/domains.json b/modules/control-center-web/src/main/js/controllers/models/domains.json
index 384ba0e..c6fd26a 100644
--- a/modules/control-center-web/src/main/js/controllers/models/domains.json
+++ b/modules/control-center-web/src/main/js/controllers/models/domains.json
@@ -27,7 +27,7 @@
           "id": "queryMetadata",
           "type": "dropdown",
           "model": "queryMetadata",
-          "items": "metadataVariants",
+          "items": "queryMetadataVariants",
           "required": true,
           "tip": [
             "Query metadata configured with: ",

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/db.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js
index cd2c6c9..8ecb71e 100644
--- a/modules/control-center-web/src/main/js/db.js
+++ b/modules/control-center-web/src/main/js/db.js
@@ -70,8 +70,8 @@ exports.Space = mongoose.model('Space', new Schema({
     }]
 }));
 
-// Define Cache type metadata schema.
-var CacheTypeMetadataSchema = new Schema({
+// Define Domain model schema.
+var DomainModelSchema = new Schema({
     space: {type: ObjectId, ref: 'Space'},
     caches: [{type: ObjectId, ref: 'Cache'}],
     queryMetadata: {type: String, enum: ['Annotations', 'Config']},
@@ -88,15 +88,15 @@ var CacheTypeMetadataSchema = new Schema({
     demo: Boolean
 });
 
-// Define Cache type metadata model.
-exports.CacheTypeMetadata = mongoose.model('CacheTypeMetadata', CacheTypeMetadataSchema);
+// Define model of Domain models.
+exports.DomainModel = mongoose.model('DomainModel', DomainModelSchema);
 
 // Define Cache schema.
 var CacheSchema = new Schema({
     space: {type: ObjectId, ref: 'Space'},
     name: String,
     clusters: [{type: ObjectId, ref: 'Cluster'}],
-    metadatas: [{type: ObjectId, ref: 'CacheTypeMetadata'}],
+    domains: [{type: ObjectId, ref: 'DomainModel'}],
     cacheMode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL']},
     atomicityMode: {type: String, enum: ['ATOMIC', 'TRANSACTIONAL']},
 
@@ -217,7 +217,7 @@ var CacheSchema = new Schema({
 
 // Install deep populate plugin.
 CacheSchema.plugin(deepPopulate, {
-    whitelist: ['metadatas']
+    whitelist: ['domains']
 });
 
 // Define Cache model.
@@ -457,7 +457,7 @@ var ClusterSchema = new Schema({
 ClusterSchema.plugin(deepPopulate, {
     whitelist: [
         'caches',
-        'caches.metadatas',
+        'caches.domains',
         'igfss'
     ]
 });

http://git-wip-us.apache.org/repos/asf/ignite/blob/dd05e1b3/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
index 45571e3..aae4a41 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
@@ -986,8 +986,8 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
     $generatorJava.property(res, varName, cache, 'sqlOnheapRowCacheSize');
     $generatorJava.property(res, varName, cache, 'longQueryWarningTimeout');
 
-    var indexedTypes = _.filter(cache.metadatas, function (meta) {
-        return meta.queryMetadata === 'Annotations'
+    var indexedTypes = _.filter(cache.domains, function (domain) {
+        return domain.queryMetadata === 'Annotations'
     });
 
     if ($commonUtils.isDefinedAndNotEmpty(indexedTypes)) {
@@ -997,9 +997,9 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
 
         var len = indexedTypes.length - 1;
 
-        _.forEach(indexedTypes, function(meta, ix) {
-            res.line($generatorJava.toJavaCode(res.importClass(meta.keyType), 'class') + ', ' +
-                $generatorJava.toJavaCode(res.importClass(meta.valueType), 'class') + (ix < len ? ',' : ''));
+        _.forEach(indexedTypes, function(domain, ix) {
+            res.line($generatorJava.toJavaCode(res.importClass(domain.keyType), 'class') + ', ' +
+                $generatorJava.toJavaCode(res.importClass(domain.valueType), 'class') + (ix < len ? ',' : ''));
         });
 
         res.endBlock(');');
@@ -1176,19 +1176,19 @@ $generatorJava.cacheStore = function (cache, domains, cacheVarName, res) {
 
                 res.needEmptyLine = true;
 
-                var metaConfigs = _.filter(domains, function (meta) {
-                    return $generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
-                        $commonUtils.isDefinedAndNotEmpty(meta.databaseTable);
+                var domainConfigs = _.filter(domains, function (domain) {
+                    return $generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
+                        $commonUtils.isDefinedAndNotEmpty(domain.databaseTable);
                 });
 
-                if ($commonUtils.isDefinedAndNotEmpty(metaConfigs)) {
+                if ($commonUtils.isDefinedAndNotEmpty(domainConfigs)) {
                     $generatorJava.declareVariable(res, 'jdbcTypes', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.store.jdbc.JdbcType');
 
                     res.needEmptyLine = true;
 
-                    _.forEach(metaConfigs, function (meta) {
-                        if ($commonUtils.isDefinedAndNotEmpty(meta.databaseTable))
-                            res.line('jdbcTypes.add(jdbcType' + $generatorJava.extractType(meta.valueType) + '(' + cacheVarName + '.getName()));');
+                    _.forEach(domainConfigs, function (domain) {
+                        if ($commonUtils.isDefinedAndNotEmpty(domain.databaseTable))
+                            res.line('jdbcTypes.add(jdbcType' + $generatorJava.extractType(domain.valueType) + '(' + cacheVarName + '.getName()));');
                     });
 
                     res.needEmptyLine = true;
@@ -1359,8 +1359,8 @@ $generatorJava.cacheStatistics = function (cache, varName, res) {
 };
 
 // Generate domain model query fields.
-$generatorJava.metadataQueryFields = function (res, meta) {
-    var fields = meta.fields;
+$generatorJava.domainModelQueryFields = function (res, domain) {
+    var fields = domain.fields;
 
     if (fields && fields.length > 0) {
         $generatorJava.declareVariable(res, 'fields', 'java.util.LinkedHashMap', 'java.util.LinkedHashMap', 'java.lang.String', 'java.lang.String');
@@ -1378,8 +1378,8 @@ $generatorJava.metadataQueryFields = function (res, meta) {
 };
 
 // Generate domain model query aliases.
-$generatorJava.metadataQueryAliases = function (res, meta) {
-    var aliases = meta.aliases;
+$generatorJava.domainModelQueryAliases = function (res, domain) {
+    var aliases = domain.aliases;
 
     if (aliases && aliases.length > 0) {
         $generatorJava.declareVariable(res, 'aliases', 'java.util.Map', 'java.util.HashMap', 'java.lang.String', 'java.lang.String');
@@ -1397,8 +1397,8 @@ $generatorJava.metadataQueryAliases = function (res, meta) {
 };
 
 // Generate domain model indexes.
-$generatorJava.metadataQueryIndexes = function (res, meta) {
-    var indexes = meta.indexes;
+$generatorJava.domainModelQueryIndexes = function (res, domain) {
+    var indexes = domain.indexes;
 
     if (indexes && indexes.length > 0) {
         res.needEmptyLine = true;
@@ -1452,8 +1452,8 @@ $generatorJava.metadataQueryIndexes = function (res, meta) {
 };
 
 // Generate domain model db fields.
-$generatorJava.metadataDatabaseFields = function (res, meta, fieldProperty) {
-    var dbFields = meta[fieldProperty];
+$generatorJava.domainModelDatabaseFields = function (res, domain, fieldProperty) {
+    var dbFields = domain[fieldProperty];
 
     if (dbFields && dbFields.length > 0) {
         res.needEmptyLine = true;
@@ -1479,12 +1479,12 @@ $generatorJava.metadataDatabaseFields = function (res, meta, fieldProperty) {
 };
 
 // Generate domain model general group.
-$generatorJava.metadataGeneral = function (meta, res) {
+$generatorJava.domainModelGeneral = function (domain, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava.classNameProperty(res, 'typeMeta', meta, 'keyType');
-    $generatorJava.property(res, 'typeMeta', meta, 'valueType');
+    $generatorJava.classNameProperty(res, 'typeMeta', domain, 'keyType');
+    $generatorJava.property(res, 'typeMeta', domain, 'valueType');
 
     res.needEmptyLine = true;
 
@@ -1492,16 +1492,14 @@ $generatorJava.metadataGeneral = function (meta, res) {
 };
 
 // Generate domain model for query group.
-$generatorJava.metadataQuery = function (meta, res) {
+$generatorJava.domainModelQuery = function (domain, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if ($generatorCommon.domainQueryMetadata(meta) === 'Configuration') {
-        $generatorJava.metadataQueryFields(res, meta);
-
-        $generatorJava.metadataQueryAliases(res, meta);
-
-        $generatorJava.metadataQueryIndexes(res, meta);
+    if ($generatorCommon.domainQueryMetadata(domain) === 'Configuration') {
+        $generatorJava.domainModelQueryFields(res, domain);
+        $generatorJava.domainModelQueryAliases(res, domain);
+        $generatorJava.domainModelQueryIndexes(res, domain);
 
         res.needEmptyLine = true;
     }
@@ -1510,44 +1508,43 @@ $generatorJava.metadataQuery = function (meta, res) {
 };
 
 // Generate domain model for store group.
-$generatorJava.metadataStore = function (meta, withTypes, res) {
+$generatorJava.domainStore = function (domain, withTypes, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava.property(res, 'jdbcType', meta, 'databaseSchema');
-    $generatorJava.property(res, 'jdbcType', meta, 'databaseTable');
+    $generatorJava.property(res, 'jdbcType', domain, 'databaseSchema');
+    $generatorJava.property(res, 'jdbcType', domain, 'databaseTable');
 
     if (withTypes) {
-        $generatorJava.classNameProperty(res, 'jdbcType', meta, 'keyType');
-        $generatorJava.property(res, 'jdbcType', meta, 'valueType');
+        $generatorJava.classNameProperty(res, 'jdbcType', domain, 'keyType');
+        $generatorJava.property(res, 'jdbcType', domain, 'valueType');
     }
 
-    $generatorJava.metadataDatabaseFields(res, meta, 'keyFields');
-
-    $generatorJava.metadataDatabaseFields(res, meta, 'valueFields');
+    $generatorJava.domainModelDatabaseFields(res, domain, 'keyFields');
+    $generatorJava.domainModelDatabaseFields(res, domain, 'valueFields');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
-// Generate doman model configs.
-$generatorJava.cacheMetadatas = function (metadatas, varName, res) {
+// Generate domain model configs.
+$generatorJava.cacheDomains = function (domains, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    var metaConfigs = _.filter(metadatas, function (meta) {
-        return $generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
-            $commonUtils.isDefinedAndNotEmpty(meta.fields);
+    var domainConfigs = _.filter(domains, function (domain) {
+        return $generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
+            $commonUtils.isDefinedAndNotEmpty(domain.fields);
     });
 
     // Generate domain model configs.
-    if ($commonUtils.isDefinedAndNotEmpty(metaConfigs)) {
+    if ($commonUtils.isDefinedAndNotEmpty(domainConfigs)) {
         $generatorJava.declareVariable(res, 'queryEntities', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.QueryEntity');
 
-        _.forEach(metaConfigs, function (meta) {
-            if ($commonUtils.isDefinedAndNotEmpty(meta.fields))
-                res.line('queryEntities.add(queryEntity' + $generatorJava.extractType(meta.valueType) + '());');
+        _.forEach(domainConfigs, function (domain) {
+            if ($commonUtils.isDefinedAndNotEmpty(domain.fields))
+                res.line('queryEntities.add(queryEntity' + $generatorJava.extractType(domain.valueType) + '());');
         });
 
         res.needEmptyLine = true;
@@ -1566,41 +1563,33 @@ $generatorJava.cache = function(cache, varName, res) {
         res = $generatorCommon.builder();
 
     $generatorJava.cacheGeneral(cache, varName, res);
-
     $generatorJava.cacheMemory(cache, varName, res);
-
     $generatorJava.cacheQuery(cache, varName, res);
-
-    $generatorJava.cacheStore(cache, cache.metadatas, varName, res);
-
+    $generatorJava.cacheStore(cache, cache.domains, varName, res);
     $generatorJava.cacheConcurrency(cache, varName, res);
-
     $generatorJava.cacheRebalance(cache, varName, res);
-
     $generatorJava.cacheServerNearCache(cache, varName, res);
-
     $generatorJava.cacheStatistics(cache, varName, res);
-
-    $generatorJava.cacheMetadatas(cache.metadatas, varName, res);
+    $generatorJava.cacheDomains(cache.domains, varName, res);
 };
 
 // Generation of cache domain model in separate methods.
-$generatorJava.clusterMetadatas = function (caches, res) {
-    var metadatas = [];
+$generatorJava.clusterDomains = function (caches, res) {
+    var domains = [];
 
     var typeVarName = 'jdbcType';
     var metaVarName = 'qryMeta';
 
     _.forEach(caches, function (cache) {
-        _.forEach(cache.metadatas, function (meta) {
-            if (!$commonUtils.isDefined(_.find(metadatas, function (m) {
-                    return m === meta.valueType;
+        _.forEach(cache.domains, function (domain) {
+            if (!$commonUtils.isDefined(_.find(domains, function (m) {
+                    return m === domain.valueType;
                 }))) {
                 $generatorJava.resetVariables(res);
 
-                var type = $generatorJava.extractType(meta.valueType);
+                var type = $generatorJava.extractType(domain.valueType);
 
-                if ($commonUtils.isDefinedAndNotEmpty(meta.databaseTable)) {
+                if ($commonUtils.isDefinedAndNotEmpty(domain.databaseTable)) {
                     res.line('/**');
                     res.line(' * Create JDBC type for ' + type + '.');
                     res.line(' *');
@@ -1615,7 +1604,7 @@ $generatorJava.clusterMetadatas = function (caches, res) {
 
                     res.line(typeVarName + '.setCacheName(cacheName);');
 
-                    $generatorJava.metadataStore(meta, true, res);
+                    $generatorJava.domainStore(domain, true, res);
 
                     res.needEmptyLine = true;
 
@@ -1625,8 +1614,8 @@ $generatorJava.clusterMetadatas = function (caches, res) {
                     res.needEmptyLine = true;
                 }
 
-                if ($generatorCommon.domainQueryMetadata(meta) === 'Configuration' &&
-                    $commonUtils.isDefinedAndNotEmpty(meta.fields)) {
+                if ($generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
+                    $commonUtils.isDefinedAndNotEmpty(domain.fields)) {
                     res.line('/**');
                     res.line(' * Create SQL Query descriptor for ' + type + '.');
                     res.line(' *');
@@ -1636,12 +1625,12 @@ $generatorJava.clusterMetadatas = function (caches, res) {
 
                     $generatorJava.declareVariable(res, metaVarName, 'org.apache.ignite.cache.QueryEntity');
 
-                    $generatorJava.classNameProperty(res, metaVarName, meta, 'keyType');
-                    $generatorJava.property(res, metaVarName, meta, 'valueType');
+                    $generatorJava.classNameProperty(res, metaVarName, domain, 'keyType');
+                    $generatorJava.property(res, metaVarName, domain, 'valueType');
 
                     res.needEmptyLine = true;
 
-                    $generatorJava.metadataQuery(meta, res);
+                    $generatorJava.domainModelQuery(domain, res);
 
                     res.emptyLineIfNeeded();
                     res.line('return ' + metaVarName + ';');
@@ -1651,7 +1640,7 @@ $generatorJava.clusterMetadatas = function (caches, res) {
                     res.endBlock('}');
                 }
 
-                metadatas.push(meta.valueType);
+                domains.push(domain.valueType);
             }
         });
     });
@@ -2029,33 +2018,33 @@ $generatorJava.javaClassCode = function (domain, key, pkg, useConstructor, inclu
  * @param includeKeyFields If 'true' then include key fields into value POJO.
  */
 $generatorJava.pojos = function (caches, useConstructor, includeKeyFields) {
-    var metadatas = [];
+    var pojos = [];
 
     _.forEach(caches, function(cache) {
-        _.forEach(cache.metadatas, function(meta) {
+        _.forEach(cache.domains, function(domain) {
             // Skip already generated classes.
-            if (!_.find(metadatas, {valueType: meta.valueType}) &&
+            if (!_.find(pojos, {valueType: domain.valueType}) &&
                 // Skip domain models without value fields.
-                $commonUtils.isDefinedAndNotEmpty(meta.valueFields)) {
-                var metadata = {};
+                $commonUtils.isDefinedAndNotEmpty(domain.valueFields)) {
+                var pojo = {};
 
                 // Key class generation only if key is not build in java class.
-                if ($commonUtils.isDefined(meta.keyFields) && meta.keyFields.length > 0) {
-                    metadata.keyType = meta.keyType;
-                    metadata.keyClass = $generatorJava.javaClassCode(meta, true,
-                        meta.keyType.substring(0, meta.keyType.lastIndexOf('.')), useConstructor, includeKeyFields);
+                if ($commonUtils.isDefined(domain.keyFields) && domain.keyFields.length > 0) {
+                    pojo.keyType = domain.keyType;
+                    pojo.keyClass = $generatorJava.javaClassCode(domain, true,
+                        domain.keyType.substring(0, domain.keyType.lastIndexOf('.')), useConstructor, includeKeyFields);
                 }
 
-                metadata.valueType = meta.valueType;
-                metadata.valueClass = $generatorJava.javaClassCode(meta, false,
-                    meta.valueType.substring(0, meta.valueType.lastIndexOf('.')), useConstructor, includeKeyFields);
+                pojo.valueType = domain.valueType;
+                pojo.valueClass = $generatorJava.javaClassCode(domain, false,
+                    domain.valueType.substring(0, domain.valueType.lastIndexOf('.')), useConstructor, includeKeyFields);
 
-                metadatas.push(metadata);
+                pojos.push(pojo);
             }
         });
     });
 
-    return metadatas;
+    return pojos;
 };
 
 /**
@@ -2428,7 +2417,7 @@ $generatorJava.cluster = function (cluster, pkg, javaClass, clientNearCfg) {
 
         res.needEmptyLine = true;
 
-        $generatorJava.clusterMetadatas(cluster.caches, res);
+        $generatorJava.clusterDomains(cluster.caches, res);
 
         $generatorJava.clusterCaches(cluster.caches, cluster.igfss, isSrvCfg, res);