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 Code cleanup and documentation.
Date Thu, 27 Aug 2015 15:37:54 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 152a42cdd -> f5bec17d5


IGNITE-843 Code cleanup and documentation.


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

Branch: refs/heads/ignite-843
Commit: f5bec17d541721aedbe3394dbb98e815c3a05f0c
Parents: 152a42c
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Aug 27 22:37:38 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Aug 27 22:37:38 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/admin-controller.js |   1 +
 .../main/js/controllers/caches-controller.js    |  14 +-
 .../main/js/controllers/clusters-controller.js  |  15 +-
 .../main/js/controllers/metadata-controller.js  |  14 +-
 .../main/js/controllers/profile-controller.js   |   1 +
 .../src/main/js/controllers/sql-controller.js   |   1 +
 .../main/js/controllers/summary-controller.js   |   1 +
 .../src/main/js/helpers/common-utils.js         |  12 +
 .../src/main/js/helpers/data-structures.js      |   5 +
 .../src/main/js/routes/admin.js                 |   3 +
 .../js/routes/generator/generator-common.js     |  25 +-
 .../js/routes/generator/generator-docker.js     |   3 +
 .../main/js/routes/generator/generator-java.js  | 667 ++++++++++---------
 .../js/routes/generator/generator-properties.js |   3 +
 .../main/js/routes/generator/generator-xml.js   |   4 +
 15 files changed, 410 insertions(+), 359 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/controllers/admin-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/admin-controller.js b/modules/control-center-web/src/main/js/controllers/admin-controller.js
index c0d48c8..094e5a7 100644
--- a/modules/control-center-web/src/main/js/controllers/admin-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/admin-controller.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Admin screen.
 controlCenterModule.controller('adminController', ['$scope', '$window', '$http', '$common', '$confirm',
     function ($scope, $window, $http, $common, $confirm) {
     $scope.users = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 4ea6aef..5c5fd56 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
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Caches screen.
 controlCenterModule.controller('cachesController', [
         '$scope', '$http', '$timeout', '$common', '$focus', '$confirm', '$copy', '$table', '$preview',
         function ($scope, $http, $timeout, $common, $focus, $confirm, $copy, $table, $preview) {
@@ -93,19 +94,6 @@ controlCenterModule.controller('cachesController', [
                 $common.hidePopover();
             };
 
-            function markChanged() {
-                sessionStorage.cacheBackupItemChanged = true;
-
-                $scope.ui.inputForm.$setDirty();
-            }
-
-            function markPristine() {
-                if ($common.isDefined($scope.ui.inputForm))
-                    $scope.ui.inputForm.$setPristine();
-
-                sessionStorage.removeItem('cacheBackupItemChanged');
-            }
-
             $scope.panels = {activePanels: [0]};
 
             $scope.$watchCollection('panels.activePanels', function () {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 f8f1a19..49cf381 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
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Clusters screen.
 controlCenterModule.controller('clustersController', ['$scope', '$http', '$timeout', '$common', '$focus', '$confirm', '$copy', '$table', '$preview',
     function ($scope, $http, $timeout, $common, $focus, $confirm, $copy, $table, $preview) {
         $scope.joinTip = $common.joinTip;
@@ -42,6 +43,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$timeo
         $scope.formChanged = $common.formChanged;
 
         $scope.hidePopover = $common.hidePopover;
+
         var showPopoverMessage = $common.showPopoverMessage;
 
         $scope.template = {discovery: {kind: 'Multicast', Vm: {addresses: ['127.0.0.1:47500..47510']}, Multicast: {}}};
@@ -91,19 +93,6 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$timeo
             $common.hidePopover();
         };
 
-        function markChanged() {
-            sessionStorage.clusterBackupItemChanged = true;
-
-            $scope.ui.inputForm.$setDirty();
-        }
-
-        function markPristine() {
-            if ($common.isDefined($scope.ui.inputForm))
-                $scope.ui.inputForm.$setPristine();
-
-            sessionStorage.removeItem('clusterBackupItemChanged');
-        }
-
         $scope.panels = {activePanels: [0]};
 
         $scope.$watchCollection('panels.activePanels', function () {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 2fe7058..c81425c 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Metadata screen.
 controlCenterModule.controller('metadataController', [
         '$scope', '$controller', '$http', '$modal', '$common', '$timeout', '$focus', '$confirm', '$copy', '$table', '$preview',
         function ($scope, $controller, $http, $modal, $common, $timeout, $focus, $confirm, $copy, $table, $preview) {
@@ -165,19 +166,6 @@ controlCenterModule.controller('metadataController', [
             });
             $scope.metadatas = [];
 
-            function markChanged() {
-                sessionStorage.metadataBackupItemChanged = true;
-
-                $scope.ui.inputForm.$setDirty();
-            }
-
-            function markPristine() {
-                if ($common.isDefined($scope.ui.inputForm))
-                    $scope.ui.inputForm.$setPristine();
-
-                sessionStorage.removeItem('metadataBackupItemChanged');
-            }
-
             $scope.isJavaBuildInClass = function () {
                 var item = $scope.backupItem;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/controllers/profile-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/profile-controller.js b/modules/control-center-web/src/main/js/controllers/profile-controller.js
index 6b4c9ed..eb6b807 100644
--- a/modules/control-center-web/src/main/js/controllers/profile-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/profile-controller.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Profile screen.
 controlCenterModule.controller('profileController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
     $scope.profileUser = angular.copy($scope.user);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index 837f875..f4cd21b 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for SQL notebook screen.
 controlCenterModule.controller('sqlController', ['$scope', '$controller', '$http', '$common',
     function ($scope, $controller, $http, $common) {
     // Initialize the super class and extend it.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/controllers/summary-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/summary-controller.js b/modules/control-center-web/src/main/js/controllers/summary-controller.js
index 791a331..c07df90 100644
--- a/modules/control-center-web/src/main/js/controllers/summary-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/summary-controller.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// Controller for Summary screen.
 controlCenterModule.controller('summaryController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
     $scope.joinTip = $common.joinTip;
     $scope.getModel = $common.getModel;

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/helpers/common-utils.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/common-utils.js b/modules/control-center-web/src/main/js/helpers/common-utils.js
index 2f74afd..6fad73f 100644
--- a/modules/control-center-web/src/main/js/helpers/common-utils.js
+++ b/modules/control-center-web/src/main/js/helpers/common-utils.js
@@ -15,12 +15,22 @@
  * limitations under the License.
  */
 
+// Entry point for common utils.
 $commonUtils = {};
 
+/**
+ * @param v Value to check.
+ * @returns {boolean} 'true' if value defined.
+ */
 $commonUtils.isDefined = function isDefined(v) {
     return !(v === undefined || v === null);
 };
 
+/**
+ * @param obj Object to check.
+ * @param props Properties names.
+ * @returns {boolean} 'true' if object contains at least one from specified properties.
+ */
 $commonUtils.hasProperty = function (obj, props) {
     for (var propName in props) {
         if (props.hasOwnProperty(propName)) {
@@ -32,7 +42,9 @@ $commonUtils.hasProperty = function (obj, props) {
     return false;
 };
 
+// For server side we should export Java code generation entry point.
 if (typeof window === 'undefined') {
+    // Generate random HEX string. Server side only.
     $commonUtils.randomValueHex = function randomValueHex(len) {
         return require('crypto').randomBytes(Math.ceil(len / 2))
             .toString('hex') // convert to hexadecimal format

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 67523a6..49ec429 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
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
+// For server side we should load required libraries.
 if (typeof window === 'undefined') {
     $commonUtils = require('./common-utils');
 }
 
+// Entry point for common data structures.
 $dataStructures = {};
 
+// Ignite events groups.
 $dataStructures.EVENT_GROUPS = {
     EVTS_CHECKPOINT: ['EVT_CHECKPOINT_SAVED', 'EVT_CHECKPOINT_LOADED', 'EVT_CHECKPOINT_REMOVED'],
     EVTS_DEPLOYMENT: ['EVT_CLASS_DEPLOYED', 'EVT_CLASS_UNDEPLOYED', 'EVT_CLASS_DEPLOY_FAILED', 'EVT_TASK_DEPLOYED',
@@ -50,6 +53,7 @@ $dataStructures.EVENT_GROUPS = {
         'EVT_IGFS_META_UPDATED', 'EVT_IGFS_DIR_CREATED', 'EVT_IGFS_DIR_RENAMED', 'EVT_IGFS_DIR_DELETED']
 };
 
+// Pairs of Java build-in classes.
 $dataStructures.JAVA_BUILD_IN_CLASSES = [
     {short: 'BigDecimal', full: 'java.math.BigDecimal'},
     {short: 'Boolean', full: 'java.lang.Boolean'},
@@ -100,6 +104,7 @@ $dataStructures.fullClassName = function (clsName) {
     return clsName;
 };
 
+// For server side we should export properties generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $dataStructures;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/routes/admin.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/admin.js b/modules/control-center-web/src/main/js/routes/admin.js
index 646b812..62d4672 100644
--- a/modules/control-center-web/src/main/js/routes/admin.js
+++ b/modules/control-center-web/src/main/js/routes/admin.js
@@ -38,6 +38,7 @@ router.post('/list', function (req, res) {
     });
 });
 
+// Remove user.
 router.post('/remove', function (req, res) {
     var userId = req.body.userId;
 
@@ -87,6 +88,7 @@ router.post('/remove', function (req, res) {
     });
 });
 
+// Save user.
 router.post('/save', function (req, res) {
     var userId = req.body.userId;
     var adminFlag = req.body.adminFlag;
@@ -99,6 +101,7 @@ router.post('/save', function (req, res) {
     });
 });
 
+// Become user.
 router.get('/become', function (req, res) {
     var viewedUserId = req.query.viewedUserId;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 ae1e645..d177c08 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
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
+// For server side we should load required libraries.
 if (typeof window === 'undefined') {
     $dataStructures = require('../../helpers/data-structures');
 }
 
+// Entry point for common functions for code generation.
 $generatorCommon = {};
 
+// Add leading zero.
 $generatorCommon.addLeadingZero = function (numberStr, minSize) {
     if (typeof (numberStr) != 'string')
         numberStr = '' + numberStr;
@@ -32,6 +35,7 @@ $generatorCommon.addLeadingZero = function (numberStr, minSize) {
     return numberStr;
 };
 
+// Format date to string.
 $generatorCommon.formatDate = function (date) {
     var dd = $generatorCommon.addLeadingZero(date.getDate(), 2);
     var mm = $generatorCommon.addLeadingZero(date.getMonth() + 1, 2);
@@ -41,10 +45,12 @@ $generatorCommon.formatDate = function (date) {
     return mm + '/' + dd + '/' + yyyy + ' ' + $generatorCommon.addLeadingZero(date.getHours(), 2) + ':' + $generatorCommon.addLeadingZero(date.getMinutes(), 2);
 };
 
+// Generate comment for generated XML, Java, ... files.
 $generatorCommon.mainComment = function mainComment() {
-    return 'This configuration was generated by Ignite Control Center (' + $generatorCommon.formatDate(new Date()) + ')';
+    return 'This configuration was generated by Ignite Web Control Center (' + $generatorCommon.formatDate(new Date()) + ')';
 };
 
+// Create result holder with service functions and properties for XML and java code generation.
 $generatorCommon.builder = function () {
     var res = [];
 
@@ -114,6 +120,12 @@ $generatorCommon.builder = function () {
 
     res.imports = {};
 
+    /**
+     * Add class to imports.
+     *
+     * @param clsName Full class name.
+     * @returns {String} Short class name or full class name in case of names conflict.
+     */
     res.importClass = function (clsName) {
         var fullClassName = $dataStructures.fullClassName(clsName);
 
@@ -150,6 +162,7 @@ $generatorCommon.builder = function () {
     return res;
 };
 
+// Eviction policies code generation descriptors.
 $generatorCommon.EVICTION_POLICIES = {
     LRU: {
         className: 'org.apache.ignite.cache.eviction.lru.LruEvictionPolicy',
@@ -169,6 +182,7 @@ $generatorCommon.EVICTION_POLICIES = {
     }
 };
 
+// Marshaller code generation descriptors.
 $generatorCommon.MARSHALLERS = {
     OptimizedMarshaller: {
         className: 'org.apache.ignite.marshaller.optimized.OptimizedMarshaller',
@@ -180,6 +194,7 @@ $generatorCommon.MARSHALLERS = {
     }
 };
 
+// Pairs of supported databases and their JDBC dialects.
 $generatorCommon.JDBC_DIALECTS = {
     Oracle: 'org.apache.ignite.cache.store.jdbc.dialect.OracleDialect',
     DB2: 'org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect',
@@ -189,12 +204,14 @@ $generatorCommon.JDBC_DIALECTS = {
     H2: 'org.apache.ignite.cache.store.jdbc.dialect.H2Dialect'
 };
 
+// Return JDBC dialect full class name for specified database.
 $generatorCommon.jdbcDialectClassName = function(db) {
     var dialectClsName = $generatorCommon.JDBC_DIALECTS[db];
 
     return dialectClsName ? dialectClsName : 'Unknown database: ' + db;
 };
 
+// Pairs of supported databases and their data sources.
 $generatorCommon.DATA_SOURCES = {
     Oracle: 'oracle.jdbc.pool.OracleDataSource',
     DB2: 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource',
@@ -204,12 +221,14 @@ $generatorCommon.DATA_SOURCES = {
     H2: 'org.h2.jdbcx.JdbcDataSource'
 };
 
+// Return data source full class name for specified database.
 $generatorCommon.dataSourceClassName = function(db) {
     var dsClsName = $generatorCommon.DATA_SOURCES[db];
 
     return dsClsName ? dsClsName : 'Unknown database: ' + db;
 };
 
+// Store factories code generation descriptors.
 $generatorCommon.STORE_FACTORIES = {
     CacheJdbcPojoStoreFactory: {
         className: 'org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory',
@@ -234,6 +253,7 @@ $generatorCommon.STORE_FACTORIES = {
     }
 };
 
+// Atomic configuration code generation descriptor.
 $generatorCommon.ATOMIC_CONFIGURATION = {
     className: 'org.apache.ignite.configuration.AtomicConfiguration',
     fields: {
@@ -243,6 +263,7 @@ $generatorCommon.ATOMIC_CONFIGURATION = {
     }
 };
 
+// Swap space SPI code generation descriptor.
 $generatorCommon.SWAP_SPACE_SPI = {
     className: 'org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi',
     fields: {
@@ -254,6 +275,7 @@ $generatorCommon.SWAP_SPACE_SPI = {
     }
 };
 
+// Transaction configuration code generation descriptor.
 $generatorCommon.TRANSACTION_CONFIGURATION = {
     className: 'org.apache.ignite.configuration.TransactionConfiguration',
     fields: {
@@ -270,6 +292,7 @@ $generatorCommon.TRANSACTION_CONFIGURATION = {
     }
 };
 
+// For server side we should export Java code generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $generatorCommon;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-docker.js b/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
index e23729a..7c96bcc 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-docker.js
@@ -15,8 +15,10 @@
  * limitations under the License.
  */
 
+// Docker file generation entry point.
 $generatorDocker = {};
 
+// Generate Docker file for cluster.
 $generatorDocker.clusterDocker = function (cluster, os) {
     if (!os)
         os = 'debian:8';
@@ -58,6 +60,7 @@ $generatorDocker.clusterDocker = function (cluster, os) {
         'RUN mv /tmp/*.xml /home/$(ls)/config';
 };
 
+// For server side we should export Java code generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $generatorDocker;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/modules/control-center-web/src/main/js/routes/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-java.js b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
index 398824d..fe5864e 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// For server side we should load required libraries.
 if (typeof window === 'undefined') {
     _ = require('lodash');
 
@@ -23,6 +24,7 @@ if (typeof window === 'undefined') {
     $generatorCommon = require('./generator-common');
 }
 
+// XML generation entry point.
 $generatorJava = {};
 
 /**
@@ -32,13 +34,20 @@ $generatorJava = {};
  * @param name to convert.
  * @returns {string} Valid java name.
  */
-$generatorJava._toJavaName = function (prefix, name) {
+$generatorJava.toJavaName = function (prefix, name) {
     var javaName = name.replace(/[^A-Za-z_0-9]+/, '_');
 
     return prefix + javaName.charAt(0).toLocaleUpperCase() + javaName.slice(1);
 };
 
-$generatorJava._toJavaCode = function (val, type) {
+/**
+ * Translate some value to valid java code.
+ *
+ * @param val Value to convert.
+ * @param type Value type.
+ * @returns {*} String with value that will be valid for java.
+ */
+$generatorJava.toJavaCode = function (val, type) {
     if (val == null)
         return 'null';
 
@@ -61,103 +70,19 @@ $generatorJava._toJavaCode = function (val, type) {
 };
 
 /**
- * Add eviction policy.
- *
- * @param res Resulting output with generated code.
- * @param varName Current using variable name.
- * @param evictionPolicy Data to add.
- * @param propertyName Name in source data.
+ * @param propName Property name
+ * @returns Property setter with name by java conventions.
  */
-$generatorJava._addEvictionPolicy = function (res, varName, evictionPolicy, propertyName) {
-    if (evictionPolicy && evictionPolicy.kind) {
-        var e = $generatorCommon.EVICTION_POLICIES[evictionPolicy.kind];
-
-        var obj = evictionPolicy[evictionPolicy.kind.toUpperCase()];
-
-        $generatorJava._addBeanWithProperties(res, varName, obj, propertyName, propertyName, e.className, e.fields, true);
-    }
-};
-
-$generatorJava._addCacheTypeMetadataDatabaseFields = function (res, meta, fieldProperty) {
-    var dbFields = meta[fieldProperty];
-
-    if (dbFields && dbFields.length > 0) {
-        res.line();
-
-        $generatorJava._declareVariable(res, $generatorJava._needNewVariable(res, fieldProperty), fieldProperty, 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.CacheTypeFieldMetadata');
-
-        _.forEach(dbFields, function (field) {
-            res.line(fieldProperty + '.add(new CacheTypeFieldMetadata(' +
-                '"' + field.databaseName + '", ' +
-                'java.sql.Types.' + field.databaseType + ', ' +
-                '"' + field.javaName + '", ' +
-                field.javaType + '.class'
-                + '));');
-        });
-
-        res.line('typeMeta.' + $generatorJava._toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
-    }
+$generatorJava.setterName = function (propName) {
+    return $generatorJava.toJavaName('set', propName);
 };
 
-$generatorJava._addCacheTypeMetadataQueryFields = function (res, meta, fieldProperty) {
-    var fields = meta[fieldProperty];
-
-    if (fields && fields.length > 0) {
-        res.line();
-
-        $generatorJava._declareVariable(res, $generatorJava._needNewVariable(res, fieldProperty), fieldProperty, 'java.util.Map', 'java.util.LinkedHashMap', 'java.lang.String', 'java.lang.Class<?>');
-
-        _.forEach(fields, function (field) {
-            res.line(fieldProperty + '.put("' + field.name + '", ' + res.importClass(field.className) + '.class);');
-        });
-
-        res.line('typeMeta.' + $generatorJava._toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
-    }
-};
-
-$generatorJava._addCacheTypeMetadataGroups = function (res, meta) {
-    var groups = meta.groups;
-
-    if (groups && groups.length > 0) {
-        _.forEach(groups, function (group) {
-            var fields = group.fields;
-
-            if (fields && fields.length > 0) {
-                res.importClass('java.util.Map');
-                res.importClass('java.util.LinkedHashMap');
-                res.importClass('org.apache.ignite.lang.IgniteBiTuple');
-
-                var varNew = !res.groups;
-
-                res.line();
-                res.line((varNew ? 'Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>> ' : '') +
-                    "groups = new LinkedHashMap<>();");
-
-                if (varNew)
-                    res.groups = true;
-
-                varNew = !res.groupItems;
-
-                res.line((varNew ? 'LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>> ' : '') +
-                    'groupItems = new LinkedHashMap<>();');
-
-                if (varNew)
-                    res.groupItems = true;
-
-                _.forEach(fields, function (field) {
-                    res.line('groupItems.put("' + field.name + '", ' +
-                        'new IgniteBiTuple<Class<?>, Boolean>(' + res.importClass(field.className) + '.class, ' + field.direction + '));');
-                });
-
-                res.line('groups.put("' + group.name + '", groupItems);');
-            }
-        });
-
-        res.line('typeMeta.setGroups(groups);');
-    }
-};
-
-$generatorJava._needNewVariable = function (res, varName) {
+/**
+ * @param res Result holder.
+ * @param varName Variable name to check.
+ * @returns {boolean} 'true' if new variable required.
+ */
+$generatorJava.needNewVariable = function (res, varName) {
     var needNew = !res[varName];
 
     if (needNew)
@@ -177,7 +102,7 @@ $generatorJava._needNewVariable = function (res, varName) {
  * @param varFullGenericType1 Optional full class name of first generic.
  * @param varFullGenericType2 Optional full class name of second generic.
  */
-$generatorJava._declareVariable = function (res, varNew, varName, varFullType, varFullActualType, varFullGenericType1, varFullGenericType2) {
+$generatorJava.declareVariable = function (res, varNew, varName, varFullType, varFullActualType, varFullGenericType1, varFullGenericType2) {
     var varType = res.importClass(varFullType);
 
     if (varFullActualType && varFullGenericType1) {
@@ -203,14 +128,14 @@ $generatorJava._declareVariable = function (res, varNew, varName, varFullType, v
  * @param enumType Optional info about property datatype.
  * @param setterName Optional special setter name.
  */
-$generatorJava._addProperty = function (res, varName, obj, propName, enumType, setterName) {
+$generatorJava.property = function (res, varName, obj, propName, enumType, setterName) {
     var val = obj[propName];
 
     if ($commonUtils.isDefined(val)) {
         res.emptyLineIfNeeded();
 
-        res.line(varName + '.' + $generatorJava._setterName(setterName ? setterName : propName)
-            + '(' + $generatorJava._toJavaCode(val, enumType) + ');');
+        res.line(varName + '.' + $generatorJava.setterName(setterName ? setterName : propName)
+            + '(' + $generatorJava.toJavaCode(val, enumType) + ');');
     }
 
     return val;
@@ -224,25 +149,18 @@ $generatorJava._addProperty = function (res, varName, obj, propName, enumType, s
  * @param obj Source object with data.
  * @param propName Property name to take from source object.
  */
-$generatorJava._addClassProperty = function (res, varName, obj, propName) {
+$generatorJava.classNameProperty = function (res, varName, obj, propName) {
     var val = obj[propName];
 
     if ($commonUtils.isDefined(val)) {
         res.emptyLineIfNeeded();
 
-        res.line(varName + '.' + $generatorJava._setterName(propName) + '(' + res.importClass(val) + '.class);');
+        res.line(varName + '.' + $generatorJava.setterName(propName) + '(' + res.importClass(val) + '.class);');
     }
 };
 
-/**
- * @param propName Property name
- * @returns Property setter with name by java conventions.
- */
-$generatorJava._setterName = function (propName) {
-    return $generatorJava._toJavaName('set', propName);
-};
-
-$generatorJava._addListProperty = function (res, varName, obj, propName, enumType, setterName) {
+// Add list property.
+$generatorJava.listProperty = function (res, varName, obj, propName, enumType, setterName) {
     var val = obj[propName];
 
     if (val && val.length > 0) {
@@ -250,37 +168,38 @@ $generatorJava._addListProperty = function (res, varName, obj, propName, enumTyp
 
         res.importClass('java.util.Arrays');
 
-        res.append(varName + '.' + $generatorJava._setterName(setterName ? setterName : propName) + '(Arrays.asList(');
+        res.append(varName + '.' + $generatorJava.setterName(setterName ? setterName : propName) + '(Arrays.asList(');
 
         for (var i = 0; i < val.length; i++) {
             if (i > 0)
                 res.append(', ');
 
-            res.append($generatorJava._toJavaCode(val[i], enumType));
+            res.append($generatorJava.toJavaCode(val[i], enumType));
         }
 
         res.line('));');
     }
 };
 
-$generatorJava._addMultiparamProperty = function (res, varName, obj, propName, type, setterName) {
+// Add multi-param property (setter with several arguments).
+$generatorJava.multiparamProperty = function (res, varName, obj, propName, type, setterName) {
     var val = obj[propName];
 
     if (val && val.length > 0) {
-        res.append(varName + '.' + $generatorJava._setterName(setterName ? setterName : propName) + '(');
+        res.append(varName + '.' + $generatorJava.setterName(setterName ? setterName : propName) + '(');
 
         for (var i = 0; i < val.length; i++) {
             if (i > 0)
                 res.append(', ');
 
-            res.append($generatorJava._toJavaCode(val[i], type));
+            res.append($generatorJava.toJavaCode(val[i], type));
         }
 
         res.line(');');
     }
 };
 
-$generatorJava._addBeanWithProperties = function (res, varName, bean, beanPropName, beanVarName, beanClass, props, createBeanAlthoughNoProps) {
+$generatorJava.beanProperty = function (res, varName, bean, beanPropName, beanVarName, beanClass, props, createBeanAlthoughNoProps) {
     if (bean && $commonUtils.hasProperty(bean, props)) {
         if (!res.emptyLineIfNeeded()) {
             res.line();
@@ -297,15 +216,15 @@ $generatorJava._addBeanWithProperties = function (res, varName, bean, beanPropNa
                 if (descr) {
                     switch (descr.type) {
                         case 'list':
-                            $generatorJava._addListProperty(res, beanVarName, bean, propName, descr.elementsType, descr.setterName);
+                            $generatorJava.listProperty(res, beanVarName, bean, propName, descr.elementsType, descr.setterName);
                             break;
 
                         case 'enum':
-                            $generatorJava._addProperty(res, beanVarName, bean, propName, res.importClass(descr.enumClass), descr.setterName);
+                            $generatorJava.property(res, beanVarName, bean, propName, res.importClass(descr.enumClass), descr.setterName);
                             break;
 
                         case 'float':
-                            $generatorJava._addProperty(res, beanVarName, bean, propName, 'float', descr.setterName);
+                            $generatorJava.property(res, beanVarName, bean, propName, 'float', descr.setterName);
                             break;
 
                         case 'propertiesAsList':
@@ -326,7 +245,7 @@ $generatorJava._addBeanWithProperties = function (res, varName, bean, beanPropNa
 
                                 }
 
-                                res.line(beanVarName + '.' + $generatorJava._setterName(propName) + '(' + descr.propVarName + ');');
+                                res.line(beanVarName + '.' + $generatorJava.setterName(propName) + '(' + descr.propVarName + ');');
                             }
                             break;
 
@@ -334,29 +253,47 @@ $generatorJava._addBeanWithProperties = function (res, varName, bean, beanPropNa
                             if (bean[propName]) {
                                 var jdbcDialectClsName = res.importClass($generatorCommon.jdbcDialectClassName(bean[propName]));
 
-                                res.line(beanVarName + '.' + $generatorJava._setterName(propName) + '(new ' + jdbcDialectClsName + '());');
+                                res.line(beanVarName + '.' + $generatorJava.setterName(propName) + '(new ' + jdbcDialectClsName + '());');
                             }
 
                             break;
 
                         default:
-                            $generatorJava._addProperty(res, beanVarName, bean, propName, null, descr.setterName);
+                            $generatorJava.property(res, beanVarName, bean, propName, null, descr.setterName);
                     }
                 }
                 else {
-                    $generatorJava._addProperty(res, beanVarName, bean, propName);
+                    $generatorJava.property(res, beanVarName, bean, propName);
                 }
             }
         }
 
-        res.line(varName + '.' + $generatorJava._setterName(beanPropName) + '(' + beanVarName + ');');
+        res.line(varName + '.' + $generatorJava.setterName(beanPropName) + '(' + beanVarName + ');');
 
         res.needEmptyLine = true;
     }
     else if (createBeanAlthoughNoProps) {
         res.emptyLineIfNeeded();
 
-        res.line(varName + '.' + $generatorJava._setterName(beanPropName) + '(new ' + res.importClass(beanClass) + '());');
+        res.line(varName + '.' + $generatorJava.setterName(beanPropName) + '(new ' + res.importClass(beanClass) + '());');
+    }
+};
+
+/**
+ * Add eviction policy.
+ *
+ * @param res Resulting output with generated code.
+ * @param varName Current using variable name.
+ * @param evictionPolicy Data to add.
+ * @param propertyName Name in source data.
+ */
+$generatorJava.evictionPolicy = function (res, varName, evictionPolicy, propertyName) {
+    if (evictionPolicy && evictionPolicy.kind) {
+        var e = $generatorCommon.EVICTION_POLICIES[evictionPolicy.kind];
+
+        var obj = evictionPolicy[evictionPolicy.kind.toUpperCase()];
+
+        $generatorJava.beanProperty(res, varName, obj, propertyName, propertyName, e.className, e.fields, true);
     }
 };
 
@@ -368,14 +305,14 @@ $generatorJava.clusterGeneral = function (cluster, res) {
     if (cluster.discovery) {
         var d = cluster.discovery;
 
-        $generatorJava._declareVariable(res, true, 'discovery', 'org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi');
+        $generatorJava.declareVariable(res, true, 'discovery', 'org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi');
 
         switch (d.kind) {
             case 'Multicast':
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder');
 
                 if (d.Multicast)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.Multicast, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.Multicast, 'ipFinder', 'ipFinder',
                         'TcpDiscoveryMulticastIpFinder', {
                             multicastGroup: null,
                             multicastPort: null,
@@ -393,7 +330,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder');
 
                 if (d.Vm)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.Vm, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.Vm, 'ipFinder', 'ipFinder',
                         'TcpDiscoveryVmIpFinder', {addresses: {type: 'list'}}, true);
                 else
                     res.line('discovery.setIpFinder(new TcpDiscoveryVmIpFinder());');
@@ -404,7 +341,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder');
 
                 if (d.S3)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.S3, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.S3, 'ipFinder', 'ipFinder',
                         'TcpDiscoveryS3IpFinder', {bucketName: null}, true);
                 else
                     res.line('discovery.setIpFinder(new TcpDiscoveryS3IpFinder());');
@@ -415,7 +352,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder');
 
                 if (d.Cloud)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.Cloud, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.Cloud, 'ipFinder', 'ipFinder',
                         'TcpDiscoveryCloudIpFinder', {
                             credential: null,
                             credentialPath: null,
@@ -433,7 +370,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder');
 
                 if (d.GoogleStorage)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.GoogleStorage, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.GoogleStorage, 'ipFinder', 'ipFinder',
                         'TcpDiscoveryGoogleStorageIpFinder', {
                             projectName: null,
                             bucketName: null,
@@ -449,7 +386,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.line();
 
                 if (d.Jdbc) {
-                    $generatorJava._declareVariable(res, true, 'ipFinder', 'org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder');
+                    $generatorJava.declareVariable(res, true, 'ipFinder', 'org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder');
 
                     res.line('ipFinder.setInitSchema(' + ($commonUtils.isDefined(d.Jdbc.initSchema) && d.Jdbc.initSchema) + ');');
                     res.line('discovery.setIpFinder(ipFinder);');
@@ -463,7 +400,7 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder');
 
                 if (d.SharedFs)
-                    $generatorJava._addBeanWithProperties(res, 'discovery', d.SharedFs, 'ipFinder', 'ipFinder',
+                    $generatorJava.beanProperty(res, 'discovery', d.SharedFs, 'ipFinder', 'ipFinder',
                         'TcpDiscoverySharedFsIpFinder', {path: null}, true);
                 else
                     res.line('discovery.setIpFinder(new TcpDiscoverySharedFsIpFinder());');
@@ -491,7 +428,7 @@ $generatorJava.clusterAtomics = function (cluster, res) {
 
     var atomicCfg = $generatorCommon.ATOMIC_CONFIGURATION;
 
-    $generatorJava._addBeanWithProperties(res, 'cfg', cluster.atomicConfiguration, 'atomicConfiguration', 'atomicCfg',
+    $generatorJava.beanProperty(res, 'cfg', cluster.atomicConfiguration, 'atomicConfiguration', 'atomicCfg',
         atomicCfg.className, atomicCfg.fields);
 
     res.needEmptyLine = true;
@@ -504,29 +441,31 @@ $generatorJava.clusterCommunication = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'networkTimeout');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'networkSendRetryDelay');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'networkSendRetryCount');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'segmentCheckFrequency');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'waitForSegmentOnStart');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'discoveryStartupDelay');
+    $generatorJava.property(res, 'cfg', cluster, 'networkTimeout');
+    $generatorJava.property(res, 'cfg', cluster, 'networkSendRetryDelay');
+    $generatorJava.property(res, 'cfg', cluster, 'networkSendRetryCount');
+    $generatorJava.property(res, 'cfg', cluster, 'segmentCheckFrequency');
+    $generatorJava.property(res, 'cfg', cluster, 'waitForSegmentOnStart');
+    $generatorJava.property(res, 'cfg', cluster, 'discoveryStartupDelay');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate deployment group.
 $generatorJava.clusterDeployment = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'deploymentMode', 'DeploymentMode');
+    $generatorJava.property(res, 'cfg', cluster, 'deploymentMode', 'DeploymentMode');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate events group.
 $generatorJava.clusterEvents = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
@@ -573,6 +512,7 @@ $generatorJava.clusterEvents = function (cluster, res) {
     return res;
 };
 
+// Generate marshaller group.
 $generatorJava.clusterMarshaller = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
@@ -582,35 +522,37 @@ $generatorJava.clusterMarshaller = function (cluster, res) {
     if (marshaller && marshaller.kind) {
         var marshallerDesc = $generatorCommon.MARSHALLERS[marshaller.kind];
 
-        $generatorJava._addBeanWithProperties(res, 'cfg', marshaller[marshaller.kind], 'marshaller', 'marshaller',
+        $generatorJava.beanProperty(res, 'cfg', marshaller[marshaller.kind], 'marshaller', 'marshaller',
             marshallerDesc.className, marshallerDesc.fields, true);
 
-        $generatorJava._addBeanWithProperties(res, 'marshaller', marshaller[marshaller.kind], marshallerDesc.className, marshallerDesc.fields, true);
+        $generatorJava.beanProperty(res, 'marshaller', marshaller[marshaller.kind], marshallerDesc.className, marshallerDesc.fields, true);
     }
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'marshalLocalJobs');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'marshallerCacheKeepAliveTime');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'marshallerCacheThreadPoolSize');
+    $generatorJava.property(res, 'cfg', cluster, 'marshalLocalJobs');
+    $generatorJava.property(res, 'cfg', cluster, 'marshallerCacheKeepAliveTime');
+    $generatorJava.property(res, 'cfg', cluster, 'marshallerCacheThreadPoolSize');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate metrics group.
 $generatorJava.clusterMetrics = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'metricsExpireTime');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'metricsHistorySize');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'metricsLogFrequency');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'metricsUpdateFrequency');
+    $generatorJava.property(res, 'cfg', cluster, 'metricsExpireTime');
+    $generatorJava.property(res, 'cfg', cluster, 'metricsHistorySize');
+    $generatorJava.property(res, 'cfg', cluster, 'metricsLogFrequency');
+    $generatorJava.property(res, 'cfg', cluster, 'metricsUpdateFrequency');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate PeerClassLoading group.
 $generatorJava.clusterP2p = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
@@ -618,7 +560,7 @@ $generatorJava.clusterP2p = function (cluster, res) {
     var p2pEnabled = cluster.peerClassLoadingEnabled;
 
     if ($commonUtils.isDefined(p2pEnabled)) {
-        $generatorJava._addProperty(res, 'cfg', cluster, 'peerClassLoadingEnabled');
+        $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingEnabled');
 
         if (p2pEnabled) {
             var clsPathExclude = cluster.peerClassLoadingLocalClassPathExclude;
@@ -626,11 +568,11 @@ $generatorJava.clusterP2p = function (cluster, res) {
             if (clsPathExclude && clsPathExclude.length > 0) {
                 var clsPathExcludeWrapper = {peerClassLoadingLocalClassPathExclude: clsPathExclude.split(',')};
 
-                $generatorJava._addMultiparamProperty(res, 'cfg', clsPathExcludeWrapper, 'peerClassLoadingLocalClassPathExclude');
+                $generatorJava.multiparamProperty(res, 'cfg', clsPathExcludeWrapper, 'peerClassLoadingLocalClassPathExclude');
             }
 
-            $generatorJava._addProperty(res, 'cfg', cluster, 'peerClassLoadingMissedResourcesCacheSize');
-            $generatorJava._addProperty(res, 'cfg', cluster, 'peerClassLoadingThreadPoolSize');
+            $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingMissedResourcesCacheSize');
+            $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingThreadPoolSize');
         }
 
         res.needEmptyLine = true;
@@ -639,12 +581,13 @@ $generatorJava.clusterP2p = function (cluster, res) {
     return res;
 };
 
+// Generate swap group.
 $generatorJava.clusterSwap = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
     if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind == 'FileSwapSpaceSpi') {
-        $generatorJava._addBeanWithProperties(res, 'cfg', cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi', 'swapSpi',
+        $generatorJava.beanProperty(res, 'cfg', cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi', 'swapSpi',
             $generatorCommon.SWAP_SPACE_SPI.className, $generatorCommon.SWAP_SPACE_SPI.fields, true);
 
         res.needEmptyLine = true;
@@ -653,39 +596,42 @@ $generatorJava.clusterSwap = function (cluster, res) {
     return res;
 };
 
+// Generate time group.
 $generatorJava.clusterTime = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'clockSyncSamples');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'clockSyncFrequency');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'timeServerPortBase');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'timeServerPortRange');
+    $generatorJava.property(res, 'cfg', cluster, 'clockSyncSamples');
+    $generatorJava.property(res, 'cfg', cluster, 'clockSyncFrequency');
+    $generatorJava.property(res, 'cfg', cluster, 'timeServerPortBase');
+    $generatorJava.property(res, 'cfg', cluster, 'timeServerPortRange');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate thread pools group.
 $generatorJava.clusterPools = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, 'cfg', cluster, 'publicThreadPoolSize');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'systemThreadPoolSize');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'managementThreadPoolSize');
-    $generatorJava._addProperty(res, 'cfg', cluster, 'igfsThreadPoolSize');
+    $generatorJava.property(res, 'cfg', cluster, 'publicThreadPoolSize');
+    $generatorJava.property(res, 'cfg', cluster, 'systemThreadPoolSize');
+    $generatorJava.property(res, 'cfg', cluster, 'managementThreadPoolSize');
+    $generatorJava.property(res, 'cfg', cluster, 'igfsThreadPoolSize');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate transactions group.
 $generatorJava.clusterTransactions = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addBeanWithProperties(res, 'cfg', cluster.transactionConfiguration, 'transactionConfiguration',
+    $generatorJava.beanProperty(res, 'cfg', cluster.transactionConfiguration, 'transactionConfiguration',
         'transactionConfiguration', $generatorCommon.TRANSACTION_CONFIGURATION.className,
         $generatorCommon.TRANSACTION_CONFIGURATION.fields);
 
@@ -694,116 +640,60 @@ $generatorJava.clusterTransactions = function (cluster, res) {
     return res;
 };
 
-// Generate metadata general group.
-$generatorJava.metadataGeneral = function (meta, res) {
-    if (!res)
-        res = $generatorCommon.builder();
-
-    $generatorJava._addClassProperty(res, 'typeMeta', meta, 'keyType');
-    $generatorJava._addClassProperty(res, 'typeMeta', meta, 'valueType');
-
-    res.needEmptyLine = true;
-
-    return res;
-};
-
-// Generate metadata for query group.
-$generatorJava.metadataQuery = function (meta, res) {
-    if (!res)
-        res = $generatorCommon.builder();
-
-    $generatorJava._addCacheTypeMetadataQueryFields(res, meta, 'queryFields');
-    $generatorJava._addCacheTypeMetadataQueryFields(res, meta, 'ascendingFields');
-    $generatorJava._addCacheTypeMetadataQueryFields(res, meta, 'descendingFields');
-
-    res.needEmptyLine = true;
-
-    $generatorJava._addListProperty(res, 'typeMeta', meta, 'textFields');
-
-    $generatorJava._addCacheTypeMetadataGroups(res, meta);
-
-    res.needEmptyLine = true;
-
-    return res;
-};
-
-// Generate metadata for store group.
-$generatorJava.metadataStore = function (meta, res) {
-    if (!res)
-        res = $generatorCommon.builder();
-
-    $generatorJava._addProperty(res, 'typeMeta', meta, 'databaseSchema');
-    $generatorJava._addProperty(res, 'typeMeta', meta, 'databaseTable');
-
-    if (!$dataStructures.isJavaBuildInClass(meta.keyType))
-        $generatorJava._addCacheTypeMetadataDatabaseFields(res, meta, 'keyFields');
-
-    $generatorJava._addCacheTypeMetadataDatabaseFields(res, meta, 'valueFields');
-
-    res.needEmptyLine = true;
-
-    return res;
-};
-
-/**
- * Generate java code for cache configuration.
- *
- * @param cache Cache config.
- * @param varName Variable name.
- * @param res Result builder.
- * @returns {*} Append generated java code to builder and return it.
- */
+// Generate cache general group.
 $generatorJava.cacheGeneral = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, varName, cache, 'name');
+    $generatorJava.property(res, varName, cache, 'name');
 
     res.importClass('org.apache.ignite.cache.CacheAtomicityMode');
     res.importClass('org.apache.ignite.cache.CacheMode');
 
-    $generatorJava._addProperty(res, varName, cache, 'cacheMode', 'CacheMode');
-    $generatorJava._addProperty(res, varName, cache, 'atomicityMode', 'CacheAtomicityMode');
+    $generatorJava.property(res, varName, cache, 'cacheMode', 'CacheMode');
+    $generatorJava.property(res, varName, cache, 'atomicityMode', 'CacheAtomicityMode');
 
     if (cache.cacheMode == 'PARTITIONED')
-        $generatorJava._addProperty(res, varName, cache, 'backups');
+        $generatorJava.property(res, varName, cache, 'backups');
 
     res.needEmptyLine = true;
 
-    $generatorJava._addProperty(res, varName, cache, 'readFromBackup');
-    $generatorJava._addProperty(res, varName, cache, 'copyOnRead');
-    $generatorJava._addProperty(res, varName, cache, 'invalidate');
+    $generatorJava.property(res, varName, cache, 'readFromBackup');
+    $generatorJava.property(res, varName, cache, 'copyOnRead');
+    $generatorJava.property(res, varName, cache, 'invalidate');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate cache memory group.
 $generatorJava.cacheMemory = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, varName, cache, 'memoryMode', 'CacheMemoryMode');
-    $generatorJava._addProperty(res, varName, cache, 'offHeapMaxMemory');
+    $generatorJava.property(res, varName, cache, 'memoryMode', 'CacheMemoryMode');
+    $generatorJava.property(res, varName, cache, 'offHeapMaxMemory');
 
     res.needEmptyLine = true;
 
-    $generatorJava._addEvictionPolicy(res, varName, cache.evictionPolicy, 'evictionPolicy');
+    $generatorJava.evictionPolicy(res, varName, cache.evictionPolicy, 'evictionPolicy');
 
-    $generatorJava._addProperty(res, varName, cache, 'swapEnabled');
-    $generatorJava._addProperty(res, varName, cache, 'startSize');
+    $generatorJava.property(res, varName, cache, 'swapEnabled');
+    $generatorJava.property(res, varName, cache, 'startSize');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate cache query & indexing group.
 $generatorJava.cacheQuery = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, varName, cache, 'sqlOnheapRowCacheSize');
-    $generatorJava._addProperty(res, varName, cache, 'longQueryWarningTimeout');
+    $generatorJava.property(res, varName, cache, 'sqlOnheapRowCacheSize');
+    $generatorJava.property(res, varName, cache, 'longQueryWarningTimeout');
 
     if (cache.indexedTypes && cache.indexedTypes.length > 0) {
         res.emptyLineIfNeeded();
@@ -816,21 +706,22 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
 
             var pair = cache.indexedTypes[i];
 
-            res.append($generatorJava._toJavaCode(res.importClass(pair.keyClass), 'class')).append(', ').append($generatorJava._toJavaCode(res.importClass(pair.valueClass), 'class'))
+            res.append($generatorJava.toJavaCode(res.importClass(pair.keyClass), 'class')).append(', ').append($generatorJava.toJavaCode(res.importClass(pair.valueClass), 'class'))
         }
 
         res.line(');');
     }
 
-    $generatorJava._addMultiparamProperty(res, varName, cache, 'sqlFunctionClasses', 'class');
+    $generatorJava.multiparamProperty(res, varName, cache, 'sqlFunctionClasses', 'class');
 
-    $generatorJava._addProperty(res, varName, cache, 'sqlEscapeAll');
+    $generatorJava.property(res, varName, cache, 'sqlEscapeAll');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate cache store group.
 $generatorJava.cacheStore = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
@@ -841,13 +732,13 @@ $generatorJava.cacheStore = function (cache, varName, res) {
         if (storeFactory) {
             var storeFactoryDesc = $generatorCommon.STORE_FACTORIES[cache.cacheStoreFactory.kind];
 
-            var sfVarName = $generatorJava._toJavaName('storeFactory', cache.name);
+            var sfVarName = $generatorJava.toJavaName('storeFactory', cache.name);
             var dsVarName = 'none';
 
             if (storeFactory.dialect) {
                 var dataSourceBean = storeFactory.dataSourceBean;
 
-                dsVarName = $generatorJava._toJavaName('dataSource', dataSourceBean);
+                dsVarName = $generatorJava.toJavaName('dataSource', dataSourceBean);
 
                 if (!_.contains(res.datasources, dataSourceBean)) {
                     res.datasources.push(dataSourceBean);
@@ -856,7 +747,7 @@ $generatorJava.cacheStore = function (cache, varName, res) {
 
                     res.line();
 
-                    $generatorJava._declareVariable(res, true, dsVarName, dsClsName);
+                    $generatorJava.declareVariable(res, true, dsVarName, dsClsName);
 
                     res.line(dsVarName + '.setURL(_URL_);');
                     res.line(dsVarName + '.setUsername(_User_Name_);');
@@ -864,7 +755,7 @@ $generatorJava.cacheStore = function (cache, varName, res) {
                 }
             }
 
-            $generatorJava._addBeanWithProperties(res, varName, storeFactory, 'cacheStoreFactory', sfVarName,
+            $generatorJava.beanProperty(res, varName, storeFactory, 'cacheStoreFactory', sfVarName,
                 storeFactoryDesc.className, storeFactoryDesc.fields, true);
 
             if (dsVarName != 'none')
@@ -874,146 +765,283 @@ $generatorJava.cacheStore = function (cache, varName, res) {
         }
     }
 
-    $generatorJava._addProperty(res, varName, cache, 'loadPreviousValue');
-    $generatorJava._addProperty(res, varName, cache, 'readThrough');
-    $generatorJava._addProperty(res, varName, cache, 'writeThrough');
+    $generatorJava.property(res, varName, cache, 'loadPreviousValue');
+    $generatorJava.property(res, varName, cache, 'readThrough');
+    $generatorJava.property(res, varName, cache, 'writeThrough');
 
     res.needEmptyLine = true;
 
-    $generatorJava._addProperty(res, varName, cache, 'writeBehindEnabled');
-    $generatorJava._addProperty(res, varName, cache, 'writeBehindBatchSize');
-    $generatorJava._addProperty(res, varName, cache, 'writeBehindFlushSize');
-    $generatorJava._addProperty(res, varName, cache, 'writeBehindFlushFrequency');
-    $generatorJava._addProperty(res, varName, cache, 'writeBehindFlushThreadCount');
+    $generatorJava.property(res, varName, cache, 'writeBehindEnabled');
+    $generatorJava.property(res, varName, cache, 'writeBehindBatchSize');
+    $generatorJava.property(res, varName, cache, 'writeBehindFlushSize');
+    $generatorJava.property(res, varName, cache, 'writeBehindFlushFrequency');
+    $generatorJava.property(res, varName, cache, 'writeBehindFlushThreadCount');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
-// Generate cache type metadata config.
-$generatorJava.cacheMetadata = function(meta, res) {
-    $generatorJava._declareVariable(res, $generatorJava._needNewVariable(res, 'typeMeta'), 'typeMeta', 'org.apache.ignite.cache.CacheTypeMetadata');
+// Generate cache concurrency group.
+$generatorJava.cacheConcurrency = function (cache, varName, res) {
+    if (!res)
+        res = $generatorCommon.builder();
 
-    $generatorJava.metadataGeneral(meta, res);
-    $generatorJava.metadataQuery(meta, res);
-    $generatorJava.metadataStore(meta, res);
+    $generatorJava.property(res, varName, cache, 'maxConcurrentAsyncOperations');
+    $generatorJava.property(res, varName, cache, 'defaultLockTimeout');
+    $generatorJava.property(res, varName, cache, 'atomicWriteOrderMode');
 
-    res.line();
-    res.line('types.add(typeMeta);');
-    res.line();
+    res.needEmptyLine = true;
 
+    return res;
 };
 
-// Generate cache type metadata configs.
-$generatorJava.cacheMetadatas = function (qryMeta, storeMeta, varName, res) {
+// Generate cache rebalance group.
+$generatorJava.cacheRebalance = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    // Generate cache type metadata configs.
-    if ((qryMeta && qryMeta.length > 0) || (storeMeta && storeMeta.length > 0)) {
-        res.emptyLineIfNeeded();
+    if (cache.cacheMode != 'LOCAL') {
+        $generatorJava.property(res, varName, cache, 'rebalanceMode', 'CacheRebalanceMode');
+        $generatorJava.property(res, varName, cache, 'rebalanceThreadPoolSize');
+        $generatorJava.property(res, varName, cache, 'rebalanceBatchSize');
+        $generatorJava.property(res, varName, cache, 'rebalanceOrder');
+        $generatorJava.property(res, varName, cache, 'rebalanceDelay');
+        $generatorJava.property(res, varName, cache, 'rebalanceTimeout');
+        $generatorJava.property(res, varName, cache, 'rebalanceThrottle');
 
-        $generatorJava._declareVariable(res, $generatorJava._needNewVariable(res, 'types'), 'types', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.CacheTypeMetadata');
+        res.needEmptyLine = true;
+    }
 
-        res.line();
+    return res;
+};
 
-        var metaNames = [];
+// Generate cache server near cache group.
+$generatorJava.cacheServerNearCache = function (cache, varName, res) {
+    if (!res)
+        res = $generatorCommon.builder();
 
-        if (qryMeta && qryMeta.length > 0) {
-            _.forEach(qryMeta, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
+    if (cache.cacheMode == 'PARTITIONED' && cache.nearCacheEnabled) {
+        res.needEmptyLine = true;
 
-                    $generatorJava.cacheMetadata(meta, res);
-                }
-            });
-        }
+        res.importClass('org.apache.ignite.configuration.NearCacheConfiguration');
 
-        if (storeMeta && storeMeta.length > 0) {
-            _.forEach(storeMeta, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
+        $generatorJava.beanProperty(res, varName, cache.nearConfiguration, 'nearConfiguration', 'nearConfiguration',
+            'NearCacheConfiguration', {nearStartSize: null}, true);
 
-                    $generatorJava.cacheMetadata(meta, res);
-                }
-            });
+        if (cache.nearConfiguration && cache.nearConfiguration.nearEvictionPolicy && cache.nearConfiguration.nearEvictionPolicy.kind) {
+            $generatorJava.evictionPolicy(res, 'nearConfiguration', cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
         }
 
-        res.line(varName + '.setTypeMetadata(types);');
-
         res.needEmptyLine = true;
     }
 
     return res;
 };
 
-$generatorJava.cacheConcurrency = function (cache, varName, res) {
+// Generate cache statistics group.
+$generatorJava.cacheStatistics = function (cache, varName, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, varName, cache, 'maxConcurrentAsyncOperations');
-    $generatorJava._addProperty(res, varName, cache, 'defaultLockTimeout');
-    $generatorJava._addProperty(res, varName, cache, 'atomicWriteOrderMode');
+    $generatorJava.property(res, varName, cache, 'statisticsEnabled');
+    $generatorJava.property(res, varName, cache, 'managementEnabled');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
-$generatorJava.cacheRebalance = function (cache, varName, res) {
+// Generate metadata query fields.
+$generatorJava.metadataQueryFields = function (res, meta, fieldProperty) {
+    var fields = meta[fieldProperty];
+
+    if (fields && fields.length > 0) {
+        res.line();
+
+        $generatorJava.declareVariable(res, $generatorJava.needNewVariable(res, fieldProperty), fieldProperty, 'java.util.Map', 'java.util.LinkedHashMap', 'java.lang.String', 'java.lang.Class<?>');
+
+        _.forEach(fields, function (field) {
+            res.line(fieldProperty + '.put("' + field.name + '", ' + res.importClass(field.className) + '.class);');
+        });
+
+        res.line('typeMeta.' + $generatorJava.toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
+    }
+};
+
+// Generate metadata groups.
+$generatorJava.metadataGroups = function (res, meta) {
+    var groups = meta.groups;
+
+    if (groups && groups.length > 0) {
+        _.forEach(groups, function (group) {
+            var fields = group.fields;
+
+            if (fields && fields.length > 0) {
+                res.importClass('java.util.Map');
+                res.importClass('java.util.LinkedHashMap');
+                res.importClass('org.apache.ignite.lang.IgniteBiTuple');
+
+                var varNew = !res.groups;
+
+                res.line();
+                res.line((varNew ? 'Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>> ' : '') +
+                    "groups = new LinkedHashMap<>();");
+
+                if (varNew)
+                    res.groups = true;
+
+                varNew = !res.groupItems;
+
+                res.line((varNew ? 'LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>> ' : '') +
+                    'groupItems = new LinkedHashMap<>();');
+
+                if (varNew)
+                    res.groupItems = true;
+
+                _.forEach(fields, function (field) {
+                    res.line('groupItems.put("' + field.name + '", ' +
+                        'new IgniteBiTuple<Class<?>, Boolean>(' + res.importClass(field.className) + '.class, ' + field.direction + '));');
+                });
+
+                res.line('groups.put("' + group.name + '", groupItems);');
+            }
+        });
+
+        res.line('typeMeta.setGroups(groups);');
+    }
+};
+
+// Generate metadata db fields.
+$generatorJava.metadataDatabaseFields = function (res, meta, fieldProperty) {
+    var dbFields = meta[fieldProperty];
+
+    if (dbFields && dbFields.length > 0) {
+        res.line();
+
+        $generatorJava.declareVariable(res, $generatorJava.needNewVariable(res, fieldProperty), fieldProperty, 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.CacheTypeFieldMetadata');
+
+        _.forEach(dbFields, function (field) {
+            res.line(fieldProperty + '.add(new CacheTypeFieldMetadata(' +
+                '"' + field.databaseName + '", ' +
+                'java.sql.Types.' + field.databaseType + ', ' +
+                '"' + field.javaName + '", ' +
+                field.javaType + '.class'
+                + '));');
+        });
+
+        res.line('typeMeta.' + $generatorJava.toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
+    }
+};
+
+// Generate metadata general group.
+$generatorJava.metadataGeneral = function (meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if (cache.cacheMode != 'LOCAL') {
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceMode', 'CacheRebalanceMode');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceThreadPoolSize');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceBatchSize');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceOrder');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceDelay');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceTimeout');
-        $generatorJava._addProperty(res, varName, cache, 'rebalanceThrottle');
+    $generatorJava.classNameProperty(res, 'typeMeta', meta, 'keyType');
+    $generatorJava.classNameProperty(res, 'typeMeta', meta, 'valueType');
 
-        res.needEmptyLine = true;
-    }
+    res.needEmptyLine = true;
 
     return res;
 };
 
-$generatorJava.cacheServerNearCache = function (cache, varName, res) {
+// Generate metadata for query group.
+$generatorJava.metadataQuery = function (meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    if (cache.cacheMode == 'PARTITIONED' && cache.nearCacheEnabled) {
-        res.needEmptyLine = true;
+    $generatorJava.metadataQueryFields(res, meta, 'queryFields');
+    $generatorJava.metadataQueryFields(res, meta, 'ascendingFields');
+    $generatorJava.metadataQueryFields(res, meta, 'descendingFields');
 
-        res.importClass('org.apache.ignite.configuration.NearCacheConfiguration');
+    res.needEmptyLine = true;
 
-        $generatorJava._addBeanWithProperties(res, varName, cache.nearConfiguration, 'nearConfiguration', 'nearConfiguration',
-            'NearCacheConfiguration', {nearStartSize: null}, true);
+    $generatorJava.listProperty(res, 'typeMeta', meta, 'textFields');
 
-        if (cache.nearConfiguration && cache.nearConfiguration.nearEvictionPolicy && cache.nearConfiguration.nearEvictionPolicy.kind) {
-            $generatorJava._addEvictionPolicy(res, 'nearConfiguration', cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
-        }
+    $generatorJava.metadataGroups(res, meta);
 
-        res.needEmptyLine = true;
-    }
+    res.needEmptyLine = true;
 
     return res;
 };
 
-$generatorJava.cacheStatistics = function (cache, varName, res) {
+// Generate metadata for store group.
+$generatorJava.metadataStore = function (meta, res) {
     if (!res)
         res = $generatorCommon.builder();
 
-    $generatorJava._addProperty(res, varName, cache, 'statisticsEnabled');
-    $generatorJava._addProperty(res, varName, cache, 'managementEnabled');
+    $generatorJava.property(res, 'typeMeta', meta, 'databaseSchema');
+    $generatorJava.property(res, 'typeMeta', meta, 'databaseTable');
+
+    if (!$dataStructures.isJavaBuildInClass(meta.keyType))
+        $generatorJava.metadataDatabaseFields(res, meta, 'keyFields');
+
+    $generatorJava.metadataDatabaseFields(res, meta, 'valueFields');
 
     res.needEmptyLine = true;
 
     return res;
 };
 
+// Generate cache type metadata config.
+$generatorJava.cacheMetadata = function(meta, res) {
+    $generatorJava.declareVariable(res, $generatorJava.needNewVariable(res, 'typeMeta'), 'typeMeta', 'org.apache.ignite.cache.CacheTypeMetadata');
+
+    $generatorJava.metadataGeneral(meta, res);
+    $generatorJava.metadataQuery(meta, res);
+    $generatorJava.metadataStore(meta, res);
+
+    res.line();
+    res.line('types.add(typeMeta);');
+    res.line();
+
+};
+
+// Generate cache type metadata configs.
+$generatorJava.cacheMetadatas = function (qryMeta, storeMeta, varName, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    // Generate cache type metadata configs.
+    if ((qryMeta && qryMeta.length > 0) || (storeMeta && storeMeta.length > 0)) {
+        res.emptyLineIfNeeded();
+
+        $generatorJava.declareVariable(res, $generatorJava.needNewVariable(res, 'types'), 'types', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.CacheTypeMetadata');
+
+        res.line();
+
+        var metaNames = [];
+
+        if (qryMeta && qryMeta.length > 0) {
+            _.forEach(qryMeta, function (meta) {
+                if (!_.contains(metaNames, meta.name)) {
+                    metaNames.push(meta.name);
+
+                    $generatorJava.cacheMetadata(meta, res);
+                }
+            });
+        }
+
+        if (storeMeta && storeMeta.length > 0) {
+            _.forEach(storeMeta, function (meta) {
+                if (!_.contains(metaNames, meta.name)) {
+                    metaNames.push(meta.name);
+
+                    $generatorJava.cacheMetadata(meta, res);
+                }
+            });
+        }
+
+        res.line(varName + '.setTypeMetadata(types);');
+
+        res.needEmptyLine = true;
+    }
+
+    return res;
+};
+
 // Generate cache configs.
 $generatorJava.cache = function(cache, varName, res) {
     if (!res)
@@ -1051,9 +1079,9 @@ $generatorJava.clusterCaches = function (caches, res) {
         _.forEach(caches, function (cache) {
             res.emptyLineIfNeeded();
 
-            var cacheName = $generatorJava._toJavaName('cache', cache.name);
+            var cacheName = $generatorJava.toJavaName('cache', cache.name);
 
-            $generatorJava._declareVariable(res, true, cacheName, 'org.apache.ignite.configuration.CacheConfiguration');
+            $generatorJava.declareVariable(res, true, cacheName, 'org.apache.ignite.configuration.CacheConfiguration');
 
             $generatorJava.cache(cache, cacheName, res);
 
@@ -1102,7 +1130,7 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration)
         res.startBlock('public IgniteConfiguration createConfiguration() {');
     }
 
-    $generatorJava._declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
+    $generatorJava.declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
 
     res.line();
 
@@ -1149,6 +1177,7 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration)
     return res.join('');
 };
 
+// For server side we should export Java code generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $generatorJava;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 1be8ac3..b427c53 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
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
+// For server side we should load required libraries.
 if (typeof window === 'undefined') {
     _ = require('lodash');
 
     $generatorCommon = require('./generator-common');
 }
 
+// Properties generation entry point.
 $generatorProperties = {};
 
 /**
@@ -61,6 +63,7 @@ $generatorProperties.dataSourcesProperties = function (cluster) {
     return undefined;
 };
 
+// For server side we should export properties generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $generatorProperties;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f5bec17d/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 90d1b0e..7ce2a24 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
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// For server side we should load required libraries.
 if (typeof window === 'undefined') {
     _ = require('lodash');
 
@@ -23,6 +24,7 @@ if (typeof window === 'undefined') {
     $generatorCommon = require('./generator-common');
 }
 
+// XML generation entry point.
 $generatorXml = {};
 
 // Do XML escape.
@@ -958,6 +960,7 @@ $generatorXml.clusterCaches = function(caches, res) {
     return res;
 };
 
+// Generate cluster config.
 $generatorXml.cluster = function (cluster, clientNearCfg) {
     var res = $generatorCommon.builder();
 
@@ -1054,6 +1057,7 @@ $generatorXml.cluster = function (cluster, clientNearCfg) {
     return xml;
 };
 
+// For server side we should export XML generation entry point.
 if (typeof window === 'undefined') {
     module.exports = $generatorXml;
 }


Mime
View raw message