ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 WIP on preview.
Date Tue, 25 Aug 2015 08:47:11 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 ebca5fa00 -> 75e89abfc


IGNITE-843 WIP on preview.


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

Branch: refs/heads/ignite-843
Commit: 75e89abfc6f48aa547e4d8f3611b6cece0552502
Parents: ebca5fa
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Tue Aug 25 15:41:20 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Aug 25 15:41:20 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js  |  24 +-
 .../src/main/js/helpers/data-structures.js      |   2 +-
 .../js/routes/generator/generator-common.js     |   3 +
 .../js/routes/generator/generator-properties.js |   3 +
 .../main/js/routes/generator/generator-xml.js   | 420 ++++++++++---------
 5 files changed, 238 insertions(+), 214 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/75e89abf/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 36406c8..02e5ad3 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
@@ -97,6 +97,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                 $common.previewHeightUpdate();
             })
         });
+
         var simpleTables = {
             addresses: {msg: 'Such IP address already exists!', id: 'IpAddress'},
             regions: {msg: 'Such region already exists!', id: 'Region'},
@@ -141,9 +142,11 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
         // When landing on the page, get clusters and show them.
         $http.post('clusters/list')
             .success(function (data) {
-                $scope.caches = data.caches;
                 $scope.spaces = data.spaces;
                 $scope.clusters = data.clusters;
+                $scope.caches = _.map(data.caches, function (cache) {
+                    return {value: cache._id, label: cache.name, cache: cache};
+                });
 
                 var restoredItem = angular.fromJson(sessionStorage.clusterBackupItem);
 
@@ -190,7 +193,15 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                     if (val) {
                         sessionStorage.clusterBackupItem = angular.toJson(val);
 
-                        $scope.preview.general = $generatorXml.general(val).join('');
+                        var clusterCaches = _.reduce($scope.caches, function(memo, cache){
+                            if (_.contains(val.caches, cache.value)) {
+                                memo.push(cache.cache);
+                            }
+
+                            return memo;
+                        }, []);
+
+                        $scope.preview.general = $generatorXml.caches(clusterCaches, $generatorXml.general(val)).join('');
                         $scope.preview.atomics = $generatorXml.atomics(val).join('');
                         $scope.preview.communication = $generatorXml.communication(val).join('');
                         $scope.preview.deployment = $generatorXml.deployment(val).join('');
@@ -226,6 +237,10 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                 sessionStorage.clusterSelectedItem = angular.toJson(item);
             else
                 sessionStorage.removeItem('clusterSelectedItem');
+
+            $timeout(function () {
+                $common.previewHeightUpdate();
+            });
         };
 
         // Add new cluster.
@@ -252,9 +267,6 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                 return showPopoverMessage($scope.panels, 'general-data', 'clusterName', 'Name
should not be empty');
                     sessionStorage.removeItem('clusterSelectedItem');
 
-                $timeout(function () {
-                    $common.previewHeightUpdate();
-                })
             if (item.discovery.kind == 'Vm' && item.discovery.Vm.addresses.length
== 0)
                 return showPopoverMessage($scope.panels, 'general-data', 'addresses', 'Addresses
are not specified');
 
@@ -290,7 +302,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                     if (idx >= 0) {
                         var cache = $scope.caches[idx];
 
-                        if (cache.swapEnabled) {
+                        if (cache.cache.swapEnabled) {
                             $scope.ui.expanded = true;
 
                             return showPopoverMessage($scope.panels, 'swap-data', 'swapSpaceSpi',

http://git-wip-us.apache.org/repos/asf/ignite/blob/75e89abf/modules/control-center-web/src/main/js/helpers/data-structures.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/data-structures.js b/modules/control-center-web/src/main/js/helpers/data-structures.js
index 80c64b8..67523a6 100644
--- a/modules/control-center-web/src/main/js/helpers/data-structures.js
+++ b/modules/control-center-web/src/main/js/helpers/data-structures.js
@@ -71,7 +71,7 @@ $dataStructures.JAVA_BUILD_IN_CLASSES = [
  * @returns 'true' if given class name is a java build-in type.
  */
 $dataStructures.isJavaBuildInClass = function (clsName) {
-    if (_isDefined(clsName)) {
+    if ($commonUtils.isDefined(clsName)) {
         for (var i = 0; i < $dataStructures.JAVA_BUILD_IN_CLASSES.length; i++) {
             var jbic = $dataStructures.JAVA_BUILD_IN_CLASSES[i];
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/75e89abf/modules/control-center-web/src/main/js/routes/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-common.js b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
index 0ad761c..e645b76 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-common.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
@@ -49,8 +49,11 @@ $generatorCommon.builder = function () {
     var res = [];
 
     res.deep = 0;
+
     res.lineStart = true;
 
+    res.datasources = [];
+
     res.append = function (s) {
         if (this.lineStart) {
             for (var i = 0; i < this.deep; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/75e89abf/modules/control-center-web/src/main/js/routes/generator/generator-properties.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-properties.js
b/modules/control-center-web/src/main/js/routes/generator/generator-properties.js
index d26d971..c74fbb6 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-properties.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-properties.js
@@ -64,8 +64,11 @@ $generatorCommon.builder = function () {
     var res = [];
 
     res.deep = 0;
+
     res.lineStart = true;
 
+    res.datasources = [];
+
     res.append = function (s) {
         if (this.lineStart) {
             for (var i = 0; i < this.deep; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/75e89abf/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
index 29959a7..563b4c5 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
@@ -241,7 +241,7 @@ function _generateCacheTypeMetadataConfiguration(res, meta) {
 
     var kind = meta.kind;
 
-    var keyType = addClassNameProperty(res, meta, 'keyType');
+    var keyType = _addClassNameProperty(res, meta, 'keyType');
 
     _addProperty(res, meta, 'valueType');
 
@@ -249,193 +249,20 @@ function _generateCacheTypeMetadataConfiguration(res, meta) {
         _addProperty(res, meta, 'databaseSchema');
         _addProperty(res, meta, 'databaseTable');
 
-        if (!generatorCommon.isJavaBuildInClass(keyType))
-            addCacheTypeMetadataDatabaseFields(res, meta, 'keyFields');
+        if (!$dataStructures.isJavaBuildInClass(keyType))
+            _addCacheTypeMetadataDatabaseFields(res, meta, 'keyFields');
 
-        addCacheTypeMetadataDatabaseFields(res, meta, 'valueFields');
+        _addCacheTypeMetadataDatabaseFields(res, meta, 'valueFields');
     }
 
     if (kind != 'store') {
-        addCacheTypeMetadataQueryFields(res, meta, 'queryFields');
-        addCacheTypeMetadataQueryFields(res, meta, 'ascendingFields');
-        addCacheTypeMetadataQueryFields(res, meta, 'descendingFields');
+        _addCacheTypeMetadataQueryFields(res, meta, 'queryFields');
+        _addCacheTypeMetadataQueryFields(res, meta, 'ascendingFields');
+        _addCacheTypeMetadataQueryFields(res, meta, 'descendingFields');
 
         _addListProperty(res, meta, 'textFields');
 
-        addCacheTypeMetadataGroups(res, meta);
-    }
-
-    res.endBlock('</bean>');
-
-    return res;
-}
-
-function _generateCacheConfiguration(res, cacheCfg) {
-    if (!res)
-        res = $generatorCommon.builder();
-
-    res.startBlock('<bean class="org.apache.ignite.configuration.CacheConfiguration">');
-
-    _addProperty(res, cacheCfg, 'name');
-
-    res.needEmptyLine = true;
-
-    var cacheMode = _addProperty(res, cacheCfg, 'mode', 'cacheMode');
-
-    _addProperty(res, cacheCfg, 'atomicityMode');
-
-    if (cacheMode == 'PARTITIONED')
-        _addProperty(res, cacheCfg, 'backups');
-
-    _addProperty(res, cacheCfg, 'readFromBackup');
-
-    _addProperty(res, cacheCfg, 'startSize');
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'memoryMode');
-    _addProperty(res, cacheCfg, 'offHeapMaxMemory');
-    _addProperty(res, cacheCfg, 'swapEnabled');
-    _addProperty(res, cacheCfg, 'copyOnRead');
-
-    res.needEmptyLine = true;
-
-    _createEvictionPolicy(res, cacheCfg.evictionPolicy, 'evictionPolicy');
-
-    res.needEmptyLine = true;
-
-    if (cacheCfg.nearCacheEnabled) {
-        res.emptyLineIfNeeded();
-
-        res.startBlock('<property name="nearConfiguration">');
-        res.startBlock('<bean class="org.apache.ignite.configuration.NearCacheConfiguration">');
-
-        if (cacheCfg.nearConfiguration && cacheCfg.nearConfiguration.nearStartSize)
-            _addProperty(res, cacheCfg.nearConfiguration, 'nearStartSize');
-
-        if (cacheCfg.nearConfiguration && cacheCfg.nearConfiguration.nearEvictionPolicy.kind)
-            _createEvictionPolicy(res, cacheCfg.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
-
-        res.endBlock('</bean>');
-        res.endBlock('</property>');
-    }
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'sqlEscapeAll');
-    _addProperty(res, cacheCfg, 'sqlOnheapRowCacheSize');
-    _addProperty(res, cacheCfg, 'longQueryWarningTimeout');
-
-    if (cacheCfg.indexedTypes && cacheCfg.indexedTypes.length > 0) {
-        res.startBlock('<property name="indexedTypes">');
-        res.startBlock('<list>');
-
-        for (var i = 0; i < cacheCfg.indexedTypes.length; i++) {
-            var pair = cacheCfg.indexedTypes[i];
-
-            res.line('<value>' + $generatorCommon.javaBuildInClass(pair.keyClass) +
'</value>');
-            res.line('<value>' + $generatorCommon.javaBuildInClass(pair.valueClass)
+ '</value>');
-        }
-
-        res.endBlock('</list>');
-        res.endBlock('</property>');
-    }
-
-    _addListProperty(res, cacheCfg, 'sqlFunctionClasses', 'array');
-
-    res.needEmptyLine = true;
-
-    if (cacheMode != 'LOCAL') {
-        _addProperty(res, cacheCfg, 'rebalanceMode');
-        _addProperty(res, cacheCfg, 'rebalanceThreadPoolSize');
-        _addProperty(res, cacheCfg, 'rebalanceBatchSize');
-        _addProperty(res, cacheCfg, 'rebalanceOrder');
-        _addProperty(res, cacheCfg, 'rebalanceDelay');
-        _addProperty(res, cacheCfg, 'rebalanceTimeout');
-        _addProperty(res, cacheCfg, 'rebalanceThrottle');
-
-        res.needEmptyLine = true;
-    }
-
-    if (cacheCfg.cacheStoreFactory && cacheCfg.cacheStoreFactory.kind) {
-        var storeFactory = cacheCfg.cacheStoreFactory[cacheCfg.cacheStoreFactory.kind];
-        var data = $generatorCommon.STORE_FACTORIES[cacheCfg.cacheStoreFactory.kind];
-
-        _addBeanWithProperties(res, storeFactory, 'cacheStoreFactory', data.className, data.fields,
true);
-
-        if (storeFactory.dialect) {
-            if (_.findIndex(res.datasources, function (ds) {
-                    return ds.dataSourceBean == storeFactory.dataSourceBean;
-                }) < 0) {
-                res.datasources.push({
-                    dataSourceBean: storeFactory.dataSourceBean,
-                    className: $generatorCommon.DATA_SOURCES[storeFactory.dialect]
-                });
-            }
-        }
-    }
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'loadPreviousValue');
-    _addProperty(res, cacheCfg, 'readThrough');
-    _addProperty(res, cacheCfg, 'writeThrough');
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'invalidate');
-    _addProperty(res, cacheCfg, 'defaultLockTimeout');
-    _addProperty(res, cacheCfg, 'transactionManagerLookupClassName');
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'writeBehindEnabled');
-    _addProperty(res, cacheCfg, 'writeBehindBatchSize');
-    _addProperty(res, cacheCfg, 'writeBehindFlushSize');
-    _addProperty(res, cacheCfg, 'writeBehindFlushFrequency');
-    _addProperty(res, cacheCfg, 'writeBehindFlushThreadCount');
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'statisticsEnabled');
-    _addProperty(res, cacheCfg, 'managementEnabled');
-
-    res.needEmptyLine = true;
-
-    _addProperty(res, cacheCfg, 'maxConcurrentAsyncOperations');
-
-    // Generate cache type metadata configs.
-    if ((cacheCfg.queryMetadata && cacheCfg.queryMetadata.length > 0) ||
-        (cacheCfg.storeMetadata && cacheCfg.storeMetadata.length > 0)) {
-        res.emptyLineIfNeeded();
-
-        res.startBlock('<property name="typeMetadata">');
-        res.startBlock('<list>');
-
-        var metaNames = [];
-
-        if (cacheCfg.queryMetadata && cacheCfg.queryMetadata.length > 0) {
-            _.forEach(cacheCfg.queryMetadata, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
-
-                    _generateCacheTypeMetadataConfiguration(res, meta);
-                }
-            });
-        }
-
-        if (cacheCfg.storeMetadata && cacheCfg.storeMetadata.length > 0) {
-            _.forEach(cacheCfg.storeMetadata, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
-
-                    _generateCacheTypeMetadataConfiguration(res, meta);
-                }
-            });
-        }
-
-        res.endBlock('</list>');
-        res.endBlock('</property>');
+        _addCacheTypeMetadataGroups(res, meta);
     }
 
     res.endBlock('</bean>');
@@ -462,11 +289,11 @@ function _addElement(res, tag, attr1, val1, attr2, val2) {
 
 $generatorXml = {};
 
-$generatorXml.general = function (cluster, res) {
+// Generate discovery.
+$generatorXml.general = function (cluster, caches, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    // Generate discovery.
     if (cluster.discovery) {
         res.startBlock('<property name="discoverySpi">');
         res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">');
@@ -772,12 +599,211 @@ $generatorXml.transactions = function (cluster, res) {
     return res;
 };
 
+// Generate caches configs.
+$generatorXml.cache = function(cache, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    res.startBlock('<bean class="org.apache.ignite.configuration.CacheConfiguration">');
+
+    _addProperty(res, cache, 'name');
+
+    res.needEmptyLine = true;
+
+    var cacheMode = _addProperty(res, cache, 'mode', 'cacheMode');
+
+    _addProperty(res, cache, 'atomicityMode');
+
+    if (cacheMode == 'PARTITIONED')
+        _addProperty(res, cache, 'backups');
+
+    _addProperty(res, cache, 'readFromBackup');
+
+    _addProperty(res, cache, 'startSize');
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'memoryMode');
+    _addProperty(res, cache, 'offHeapMaxMemory');
+    _addProperty(res, cache, 'swapEnabled');
+    _addProperty(res, cache, 'copyOnRead');
+
+    res.needEmptyLine = true;
+
+    _createEvictionPolicy(res, cache.evictionPolicy, 'evictionPolicy');
+
+    res.needEmptyLine = true;
+
+    if (cache.nearCacheEnabled) {
+        res.emptyLineIfNeeded();
+
+        res.startBlock('<property name="nearConfiguration">');
+        res.startBlock('<bean class="org.apache.ignite.configuration.NearCacheConfiguration">');
+
+        if (cache.nearConfiguration && cache.nearConfiguration.nearStartSize)
+            _addProperty(res, cache.nearConfiguration, 'nearStartSize');
+
+        if (cache.nearConfiguration && cache.nearConfiguration.nearEvictionPolicy.kind)
+            _createEvictionPolicy(res, cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
+
+        res.endBlock('</bean>');
+        res.endBlock('</property>');
+    }
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'sqlEscapeAll');
+    _addProperty(res, cache, 'sqlOnheapRowCacheSize');
+    _addProperty(res, cache, 'longQueryWarningTimeout');
+
+    if (cache.indexedTypes && cache.indexedTypes.length > 0) {
+        res.startBlock('<property name="indexedTypes">');
+        res.startBlock('<list>');
+
+        for (var i = 0; i < cache.indexedTypes.length; i++) {
+            var pair = cache.indexedTypes[i];
+
+            res.line('<value>' + $generatorCommon.fullClassName(pair.keyClass) + '</value>');
+            res.line('<value>' + $generatorCommon.fullClassName(pair.valueClass) +
'</value>');
+        }
+
+        res.endBlock('</list>');
+        res.endBlock('</property>');
+    }
+
+    _addListProperty(res, cache, 'sqlFunctionClasses', 'array');
+
+    res.needEmptyLine = true;
+
+    if (cacheMode != 'LOCAL') {
+        _addProperty(res, cache, 'rebalanceMode');
+        _addProperty(res, cache, 'rebalanceThreadPoolSize');
+        _addProperty(res, cache, 'rebalanceBatchSize');
+        _addProperty(res, cache, 'rebalanceOrder');
+        _addProperty(res, cache, 'rebalanceDelay');
+        _addProperty(res, cache, 'rebalanceTimeout');
+        _addProperty(res, cache, 'rebalanceThrottle');
+
+        res.needEmptyLine = true;
+    }
+
+    if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
+        var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind];
+
+        var storeFactoryDesc = $generatorCommon.STORE_FACTORIES[cache.cacheStoreFactory.kind];
+
+        _addBeanWithProperties(res, storeFactory, 'cacheStoreFactory', storeFactoryDesc.className,
storeFactoryDesc.fields, true);
+
+        if (storeFactory.dialect) {
+            if (_.findIndex(res.datasources, function (ds) {
+                    return ds.dataSourceBean == storeFactory.dataSourceBean;
+                }) < 0) {
+                res.datasources.push({
+                    dataSourceBean: storeFactory.dataSourceBean,
+                    className: $generatorCommon.DATA_SOURCES[storeFactory.dialect]
+                });
+            }
+        }
+    }
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'loadPreviousValue');
+    _addProperty(res, cache, 'readThrough');
+    _addProperty(res, cache, 'writeThrough');
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'invalidate');
+    _addProperty(res, cache, 'defaultLockTimeout');
+    _addProperty(res, cache, 'transactionManagerLookupClassName');
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'writeBehindEnabled');
+    _addProperty(res, cache, 'writeBehindBatchSize');
+    _addProperty(res, cache, 'writeBehindFlushSize');
+    _addProperty(res, cache, 'writeBehindFlushFrequency');
+    _addProperty(res, cache, 'writeBehindFlushThreadCount');
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'statisticsEnabled');
+    _addProperty(res, cache, 'managementEnabled');
+
+    res.needEmptyLine = true;
+
+    _addProperty(res, cache, 'maxConcurrentAsyncOperations');
+
+    // Generate cache type metadata configs.
+    if ((cache.queryMetadata && cache.queryMetadata.length > 0) ||
+        (cache.storeMetadata && cache.storeMetadata.length > 0)) {
+        res.emptyLineIfNeeded();
+
+        res.startBlock('<property name="typeMetadata">');
+        res.startBlock('<list>');
+
+        var metaNames = [];
+
+        if (cache.queryMetadata && cache.queryMetadata.length > 0) {
+            _.forEach(cache.queryMetadata, function (meta) {
+                if (!_.contains(metaNames, meta.name)) {
+                    metaNames.push(meta.name);
+
+                    _generateCacheTypeMetadataConfiguration(res, meta);
+                }
+            });
+        }
+
+        if (cache.storeMetadata && cache.storeMetadata.length > 0) {
+            _.forEach(cache.storeMetadata, function (meta) {
+                if (!_.contains(metaNames, meta.name)) {
+                    metaNames.push(meta.name);
+
+                    _generateCacheTypeMetadataConfiguration(res, meta);
+                }
+            });
+        }
+
+        res.endBlock('</list>');
+        res.endBlock('</property>');
+    }
+
+    res.endBlock('</bean>');
+
+    return res;
+};
+
+// Generate caches configs.
+$generatorXml.caches = function(caches, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    if (caches && caches.length > 0) {
+        res.emptyLineIfNeeded();
+
+        res.startBlock('<property name="cacheConfiguration">');
+        res.startBlock('<list>');
+
+        for (var i = 0; i < caches.length; i++) {
+            if (i > 0)
+                res.line();
+
+            $generatorXml.cache(caches[i], res);
+        }
+
+        res.endBlock('</list>');
+        res.endBlock('</property>');
+
+        res.needEmptyLine = true;
+    }
+
+    return res;
+};
+
 $generatorXml.clusterConfiguration = function (cluster, clientNearConfiguration) {
     var res = $generatorCommon.builder();
 
-    res.datasources = [];
-    res.deep = 1;
-
     if (clientNearConfiguration) {
         res.startBlock('<bean id="nearCacheBean" class="org.apache.ignite.configuration.NearCacheConfiguration">');
 
@@ -825,27 +851,7 @@ $generatorXml.clusterConfiguration = function (cluster, clientNearConfiguration)
 
     $generatorXml.transactions(cluster, res);
 
-    // Generate caches configs.
-    if (cluster.caches && cluster.caches.length > 0) {
-        res.emptyLineIfNeeded();
-
-        res.startBlock('<property name="cacheConfiguration">');
-        res.startBlock('<list>');
-
-        for (var i = 0; i < cluster.caches.length; i++) {
-            if (i > 0)
-                res.line();
-
-            var cache = cluster.caches[i];
-
-            _generateCacheConfiguration(res, cache);
-        }
-
-        res.endBlock('</list>');
-        res.endBlock('</property>');
-
-        res.needEmptyLine = true;
-    }
+    $generatorXml.caches(cluster.caches, res);
 
     res.endBlock('</bean>');
 


Mime
View raw message