ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [1/3] ignite git commit: IGNITE-843 WIP on preview.
Date Tue, 25 Aug 2015 07:26:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 f8a5ca3c2 -> 0b72d82a6


http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/java.js b/modules/control-center-web/src/main/js/routes/generator/java.js
deleted file mode 100644
index d27fe6a..0000000
--- a/modules/control-center-web/src/main/js/routes/generator/java.js
+++ /dev/null
@@ -1,873 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var _ = require('lodash');
-
-var generatorCommon = require("./common");
-var utils = require("../utils");
-
-/**
- * Convert some name to valid java name.
- *
- * @param prefix To append to java name.
- * @param name to convert.
- * @returns {string} Valid java name.
- */
-function toJavaName(prefix, name) {
-    var javaName = name.replace(/[^A-Za-z_0-9]+/, '_');
-
-    return prefix + javaName.charAt(0).toLocaleUpperCase() + javaName.slice(1);
-}
-
-/**
- * Function to generate java code for cluster configuration.
- *
- * @param cluster Cluster to process.
- * @param javaClass If 'true' then generate factory class otherwise generate code snippet.
- * @param clientNearConfiguration Near cache configuration for client node.
- */
-exports.generateClusterConfiguration = function (cluster, javaClass, clientNearConfiguration) {
-    var res = generatorCommon.builder();
-
-    res.datasourceBeans = [];
-
-    if (javaClass) {
-        res.line('/**');
-        res.line(' * ' + generatorCommon.mainComment());
-        res.line(' */');
-        res.startBlock('public class ConfigurationFactory {');
-        res.line('/**');
-        res.line(' * Configure grid.');
-        res.line(' */');
-        res.startBlock('public IgniteConfiguration createConfiguration() {');
-    }
-
-    declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
-    res.line();
-
-    if (clientNearConfiguration) {
-        res.line('cfg.setClientMode(true);');
-        res.line();
-    }
-
-    if (cluster.discovery) {
-        var d = cluster.discovery;
-
-        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');
-
-                addBeanWithProperties(res, 'discovery', d.Multicast, 'ipFinder', 'ipFinder',
-                    'TcpDiscoveryMulticastIpFinder', {
-                        multicastGroup: null,
-                        multicastPort: null,
-                        responseWaitTime: null,
-                        addressRequestAttempts: null,
-                        localAddress: null
-                    }, true);
-
-                break;
-
-            case 'Vm':
-                res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder');
-
-                addBeanWithProperties(res, 'discovery', d.Vm, 'ipFinder', 'ipFinder', 'TcpDiscoveryVmIpFinder', {
-                    addresses: {type: 'list'}
-                }, true);
-
-                break;
-
-            case 'S3':
-                res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder');
-
-                if (d.S3)
-                    addBeanWithProperties(res, 'discovery', d.S3, 'ipFinder', 'ipFinder', 'TcpDiscoveryS3IpFinder',
-                        {bucketName: null}, true);
-                else
-                    res.line('discovery.setIpFinder(new TcpDiscoveryS3IpFinder());');
-
-                break;
-
-            case 'Cloud':
-                res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder');
-
-                addBeanWithProperties(res, 'discovery', d.Cloud, 'ipFinder', 'ipFinder', 'TcpDiscoveryCloudIpFinder', {
-                    credential: null,
-                    credentialPath: null,
-                    identity: null,
-                    provider: null,
-                    regions: {type: 'list'},
-                    zones: {type: 'list'}
-                }, true);
-
-                break;
-
-            case 'GoogleStorage':
-                res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder');
-
-                addBeanWithProperties(res, 'discovery', d.GoogleStorage, 'ipFinder', 'ipFinder',
-                    'TcpDiscoveryGoogleStorageIpFinder', {
-                        projectName: null,
-                        bucketName: null,
-                        serviceAccountP12FilePath: null,
-                        serviceAccountId: null
-                    }, true);
-
-                //if (d.GoogleStorage.addrReqAttempts) todo ????
-                //    res.line('<property name="serviceAccountP12FilePath" value="' + escapeAttr(d.GoogleStorage.addrReqAttempts) + '"/>');
-
-                break;
-
-            case 'Jdbc':
-                res.line();
-
-                declareVariable(res, true, 'ipFinder', 'org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder');
-
-                res.line('ipFinder.setInitSchema(' + (utils.isDefined(d.Jdbc.initSchema) && d.Jdbc.initSchema) + ');');
-                res.line('discovery.setIpFinder(ipFinder);');
-                res.needEmptyLine = true;
-
-                break;
-
-            case 'SharedFs':
-                res.importClass('org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder');
-
-                addBeanWithProperties(res, 'discovery', d.SharedFs, 'ipFinder', 'ipFinder',
-                    'TcpDiscoverySharedFsIpFinder', {path: null}, true);
-
-                break;
-
-            default:
-                throw "Unknown discovery kind: " + d.kind;
-        }
-
-        res.emptyLineIfNeeded();
-
-        res.line('cfg.setDiscoverySpi(discovery);');
-
-        res.needEmptyLine = true;
-    }
-
-    var caches = cluster.caches;
-
-    if (caches && caches.length > 0) {
-        res.emptyLineIfNeeded();
-
-        var names = [];
-
-        _.forEach(caches, function (cache) {
-            res.emptyLineIfNeeded();
-
-            var cacheName = toJavaName('cache', cache.name);
-
-            names.push(cacheName);
-
-            addCacheConfiguration(res, cache, cacheName);
-
-            res.needEmptyLine = true;
-        });
-
-        res.emptyLineIfNeeded();
-
-        res.append('cfg.setCacheConfiguration(');
-
-        for (var i = 0; i < names.length; i++) {
-            if (i > 0)
-                res.append(', ');
-
-            res.append(names[i]);
-        }
-
-        res.line(');');
-
-        res.needEmptyLine = true;
-    }
-
-    addBeanWithProperties(res, 'cfg', cluster.atomicConfiguration, 'atomicConfiguration', 'atomicCfg',
-        generatorCommon.atomicConfiguration.className, generatorCommon.atomicConfiguration.fields);
-
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'networkTimeout');
-    addProperty(res, 'cfg', cluster, 'networkSendRetryDelay');
-    addProperty(res, 'cfg', cluster, 'networkSendRetryCount');
-    addProperty(res, 'cfg', cluster, 'segmentCheckFrequency');
-    addProperty(res, 'cfg', cluster, 'waitForSegmentOnStart');
-    addProperty(res, 'cfg', cluster, 'discoveryStartupDelay');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'deploymentMode', 'DeploymentMode');
-
-    res.needEmptyLine = true;
-
-    if (cluster.includeEventTypes && cluster.includeEventTypes.length > 0) {
-        res.emptyLineIfNeeded();
-
-        if (cluster.includeEventTypes.length == 1) {
-            res.importClass('org.apache.ignite.events.EventType');
-
-            res.line('cfg.setIncludeEventTypes(EventType.' + cluster.includeEventTypes[0] + ');');
-        }
-        else {
-            res.append('int[] events = new int[EventType.' + cluster.includeEventTypes[0] + '.length');
-
-            for (i = 1; i < cluster.includeEventTypes.length; i++) {
-                res.line();
-
-                res.append('    + EventType.' + cluster.includeEventTypes[i] + '.length');
-            }
-
-            res.line('];');
-            res.line();
-            res.line('int k = 0;');
-
-            for (i = 0; i < cluster.includeEventTypes.length; i++) {
-                res.line();
-
-                var e = cluster.includeEventTypes[i];
-
-                res.line('System.arraycopy(EventType.' + e + ', 0, events, k, EventType.' + e + '.length);');
-                res.line('k += EventType.' + e + '.length;');
-            }
-
-            res.line();
-            res.line('cfg.setIncludeEventTypes(events);');
-        }
-
-        res.needEmptyLine = true;
-    }
-
-    res.needEmptyLine = true;
-
-    var marshaller = cluster.marshaller;
-
-    if (marshaller && marshaller.kind) {
-        var marshallerDesc = generatorCommon.marshallers[marshaller.kind];
-
-        addBeanWithProperties(res, 'cfg', marshaller[marshaller.kind], 'marshaller', 'marshaller',
-            marshallerDesc.className, marshallerDesc.fields, true);
-
-        addBeanWithProperties(res, 'marshaller', marshaller[marshaller.kind], marshallerDesc.className, marshallerDesc.fields, true);
-    }
-
-    addProperty(res, 'cfg', cluster, 'marshalLocalJobs');
-    addProperty(res, 'cfg', cluster, 'marshallerCacheKeepAliveTime');
-    addProperty(res, 'cfg', cluster, 'marshallerCacheThreadPoolSize');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'metricsExpireTime');
-    addProperty(res, 'cfg', cluster, 'metricsHistorySize');
-    addProperty(res, 'cfg', cluster, 'metricsLogFrequency');
-    addProperty(res, 'cfg', cluster, 'metricsUpdateFrequency');
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'peerClassLoadingEnabled');
-    addMultiparamProperty(res, 'cfg', cluster, 'peerClassLoadingLocalClassPathExclude');
-    addProperty(res, 'cfg', cluster, 'peerClassLoadingMissedResourcesCacheSize');
-    addProperty(res, 'cfg', cluster, 'peerClassLoadingThreadPoolSize');
-    res.needEmptyLine = true;
-
-    if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind == 'FileSwapSpaceSpi') {
-        addBeanWithProperties(res, 'cfg', cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi', 'swapSpi',
-            generatorCommon.swapSpaceSpi.className, generatorCommon.swapSpaceSpi.fields, true);
-
-        res.needEmptyLine = true;
-    }
-
-    addProperty(res, 'cfg', cluster, 'clockSyncSamples');
-    addProperty(res, 'cfg', cluster, 'clockSyncFrequency');
-    addProperty(res, 'cfg', cluster, 'timeServerPortBase');
-    addProperty(res, 'cfg', cluster, 'timeServerPortRange');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'publicThreadPoolSize');
-    addProperty(res, 'cfg', cluster, 'systemThreadPoolSize');
-    addProperty(res, 'cfg', cluster, 'managementThreadPoolSize');
-    addProperty(res, 'cfg', cluster, 'igfsThreadPoolSize');
-
-    res.needEmptyLine = true;
-
-    addBeanWithProperties(res, 'cfg', cluster.transactionConfiguration, 'transactionConfiguration',
-        'transactionConfiguration', generatorCommon.transactionConfiguration.className,
-        generatorCommon.transactionConfiguration.fields);
-
-    res.needEmptyLine = true;
-
-    addProperty(res, 'cfg', cluster, 'cacheSanityCheckEnabled');
-
-    res.needEmptyLine = true;
-
-    if (javaClass) {
-        res.line();
-        res.line('return cfg;');
-        res.endBlock('}');
-        res.endBlock('}');
-
-        return res.generateImports() + '\n\n' + res.join('')
-    }
-
-    return res.join('');
-};
-
-/**
- * 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.
- */
-function addEvictionPolicy(res, varName, evictionPolicy, propertyName) {
-    if (evictionPolicy && evictionPolicy.kind) {
-        var e = generatorCommon.evictionPolicies[evictionPolicy.kind];
-
-        var obj = evictionPolicy[evictionPolicy.kind.toUpperCase()];
-
-        addBeanWithProperties(res, varName, obj, propertyName, propertyName, e.className, e.fields, true);
-    }
-}
-
-function addCacheTypeMetadataDatabaseFields(res, meta, fieldProperty) {
-    var dbFields = meta[fieldProperty];
-
-    if (dbFields && dbFields.length > 0) {
-        res.line();
-
-        declareVariable(res, 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.' + toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
-    }
-}
-
-function addCacheTypeMetadataQueryFields(res, meta, fieldProperty) {
-    var fields = meta[fieldProperty];
-
-    if (fields && fields.length > 0) {
-        res.line();
-
-        declareVariable(res, 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.' + toJavaName('set', fieldProperty) + '(' + fieldProperty + ');');
-    }
-}
-
-function addCacheTypeMetadataGroups(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);');
-    }
-}
-
-function addCacheTypeMetadataConfiguration(res, meta) {
-    declareVariable(res, needNewVariable(res, 'typeMeta'), 'typeMeta', 'org.apache.ignite.cache.CacheTypeMetadata');
-
-    var kind = meta.kind;
-
-    var keyType = addClassProperty(res, 'typeMeta', meta, 'keyType');
-    addClassProperty(res, 'typeMeta', meta, 'valueType');
-
-    if (kind != 'query') {
-        addProperty(res, 'typeMeta', meta, 'databaseSchema');
-        addProperty(res, 'typeMeta', meta, 'databaseTable');
-
-        if (!generatorCommon.isJavaBuildInClass(keyType))
-            addCacheTypeMetadataDatabaseFields(res, meta, 'keyFields');
-
-        addCacheTypeMetadataDatabaseFields(res, meta, 'valueFields');
-    }
-
-    if (kind != 'store') {
-        addCacheTypeMetadataQueryFields(res, meta, 'queryFields');
-        addCacheTypeMetadataQueryFields(res, meta, 'ascendingFields');
-        addCacheTypeMetadataQueryFields(res, meta, 'descendingFields');
-
-        res.needEmptyLine = true;
-        addListProperty(res, 'typeMeta', meta, 'textFields');
-
-        addCacheTypeMetadataGroups(res, meta);
-    }
-
-    res.line();
-    res.line('types.add(typeMeta);');
-    res.line();
-}
-
-/**
- * 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.
- */
-function addCacheConfiguration(res, cache, varName) {
-    res.emptyLineIfNeeded();
-
-    res.importClass('org.apache.ignite.cache.CacheAtomicityMode');
-    res.importClass('org.apache.ignite.cache.CacheMode');
-
-    declareVariable(res, true, varName, 'org.apache.ignite.configuration.CacheConfiguration');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'name');
-
-    var cacheMode = addProperty(res, varName, cache, 'mode', 'CacheMode', 'cacheMode');
-
-    addProperty(res, varName, cache, 'atomicityMode', 'CacheAtomicityMode');
-
-    if (cacheMode == 'PARTITIONED')
-        addProperty(res, varName, cache, 'backups');
-
-    addProperty(res, varName, cache, 'readFromBackup');
-    addProperty(res, varName, cache, 'startSize');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'memoryMode', 'CacheMemoryMode');
-    addProperty(res, varName, cache, 'offHeapMaxMemory');
-    addProperty(res, varName, cache, 'swapEnabled');
-    addProperty(res, varName, cache, 'copyOnRead');
-
-    res.needEmptyLine = true;
-
-    addEvictionPolicy(res, varName, cache.evictionPolicy, 'evictionPolicy');
-
-    if (cacheMode == 'PARTITIONED' && cache.nearCacheEnabled) {
-        res.needEmptyLine = true;
-
-        res.importClass('org.apache.ignite.configuration.NearCacheConfiguration');
-
-        addBeanWithProperties(res, varName, cache.nearConfiguration, 'nearConfiguration', 'nearConfiguration',
-            'NearCacheConfiguration', {nearStartSize: null}, true);
-
-        if (cache.nearConfiguration && cache.nearConfiguration.nearEvictionPolicy && cache.nearConfiguration.nearEvictionPolicy.kind) {
-            addEvictionPolicy(res, 'nearConfiguration', cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
-        }
-    }
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'sqlEscapeAll');
-    addProperty(res, varName, cache, 'sqlOnheapRowCacheSize');
-    addProperty(res, varName, cache, 'longQueryWarningTimeout');
-
-    if (cache.indexedTypes && cache.indexedTypes.length > 0) {
-        res.emptyLineIfNeeded();
-
-        res.append(varName + '.setIndexedTypes(');
-
-        for (var i = 0; i < cache.indexedTypes.length; i++) {
-            if (i > 0)
-                res.append(', ');
-
-            var pair = cache.indexedTypes[i];
-
-            res.append(toJavaCode(res.importClass(pair.keyClass), 'class')).append(', ').append(toJavaCode(res.importClass(pair.valueClass), 'class'))
-        }
-
-        res.line(');');
-    }
-
-    addMultiparamProperty(res, varName, cache, 'sqlFunctionClasses', 'class');
-
-    res.needEmptyLine = true;
-
-    if (cacheMode != 'LOCAL') {
-        addProperty(res, varName, cache, 'rebalanceMode', 'CacheRebalanceMode');
-        addProperty(res, varName, cache, 'rebalanceThreadPoolSize');
-        addProperty(res, varName, cache, 'rebalanceBatchSize');
-        addProperty(res, varName, cache, 'rebalanceOrder');
-        addProperty(res, varName, cache, 'rebalanceDelay');
-        addProperty(res, varName, cache, 'rebalanceTimeout');
-        addProperty(res, varName, cache, 'rebalanceThrottle');
-
-        res.needEmptyLine = true;
-    }
-
-    if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
-        var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind];
-        var data = generatorCommon.storeFactories[cache.cacheStoreFactory.kind];
-
-        var sfVarName = toJavaName('storeFactory', cache.name);
-        var dsVarName = 'none';
-
-        if (storeFactory.dialect) {
-            var dataSourceBean = storeFactory.dataSourceBean;
-
-            dsVarName = toJavaName('dataSource', dataSourceBean);
-
-            if (!_.contains(res.datasourceBeans, dataSourceBean)) {
-                res.datasourceBeans.push(dataSourceBean);
-
-                var dataSource = generatorCommon.dataSources[storeFactory.dialect];
-
-                res.line();
-
-                declareVariable(res, true, dsVarName, dataSource);
-
-                res.line(dsVarName + '.setURL(_URL_);');
-                res.line(dsVarName + '.setUsername(_User_Name_);');
-                res.line(dsVarName + '.setPassword(_Password_);');
-            }
-        }
-
-        addBeanWithProperties(res, varName, storeFactory, 'cacheStoreFactory', sfVarName, data.className,
-            data.fields, true);
-
-        if (dsVarName != 'none')
-            res.line(sfVarName + '.setDataSource(' + dsVarName + ');');
-    }
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'loadPreviousValue');
-    addProperty(res, varName, cache, 'readThrough');
-    addProperty(res, varName, cache, 'writeThrough');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'invalidate');
-    addProperty(res, varName, cache, 'defaultLockTimeout');
-    addProperty(res, varName, cache, 'transactionManagerLookupClassName');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'writeBehindEnabled');
-    addProperty(res, varName, cache, 'writeBehindBatchSize');
-    addProperty(res, varName, cache, 'writeBehindFlushSize');
-    addProperty(res, varName, cache, 'writeBehindFlushFrequency');
-    addProperty(res, varName, cache, 'writeBehindFlushThreadCount');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'statisticsEnabled');
-    addProperty(res, varName, cache, 'managementEnabled');
-
-    res.needEmptyLine = true;
-
-    addProperty(res, varName, cache, 'maxConcurrentAsyncOperations');
-
-    res.needEmptyLine = true;
-
-    // Generate cache type metadata configs.
-    if ((cache.queryMetadata && cache.queryMetadata.length > 0) ||
-        (cache.storeMetadata && cache.storeMetadata.length > 0)) {
-        res.emptyLineIfNeeded();
-
-        declareVariable(res, needNewVariable(res, 'types'), 'types', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.CacheTypeMetadata');
-        res.line();
-
-        var metaNames = [];
-
-        if (cache.queryMetadata && cache.queryMetadata.length > 0) {
-            _.forEach(cache.queryMetadata, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
-
-                    addCacheTypeMetadataConfiguration(res, meta);
-                }
-            });
-        }
-
-        if (cache.storeMetadata && cache.storeMetadata.length > 0) {
-            _.forEach(cache.storeMetadata, function (meta) {
-                if (!_.contains(metaNames, meta.name)) {
-                    metaNames.push(meta.name);
-
-                    addCacheTypeMetadataConfiguration(res, meta);
-                }
-            });
-        }
-
-        res.line(varName + '.setTypeMetadata(types);');
-    }
-}
-
-function toJavaCode(val, type) {
-    if (val == null)
-        return 'null';
-
-    if (type == 'float')
-        return val + 'f';
-
-    if (type == 'class')
-        return val + '.class';
-
-    if (type)
-        return type + '.' + val;
-
-    if (typeof(val) == 'string')
-        return '"' + val.replace('"', '\\"') + '"';
-
-    if (typeof(val) == 'number' || typeof(val) == 'boolean')
-        return '' + val;
-
-    throw "Unknown type: " + typeof(val) + ' (' + val + ')';
-}
-
-function needNewVariable(res, varName) {
-    var needNew = !res[varName];
-
-    if (needNew)
-        res[varName] = true;
-
-    return needNew;
-}
-
-/**
- * Add variable declaration.
- *
- * @param res Resulting output with generated code.
- * @param varNew If 'true' then declare new variable otherwise reuse previously declared variable.
- * @param varName Variable name.
- * @param varFullType Variable full class name to be added to imports.
- * @param varFullActualType Variable actual full class name to be added to imports.
- * @param varFullGenericType1 Optional full class name of first generic.
- * @param varFullGenericType2 Optional full class name of second generic.
- */
-function declareVariable(res, varNew, varName, varFullType, varFullActualType, varFullGenericType1, varFullGenericType2) {
-    var varType = res.importClass(varFullType);
-
-    if (varFullActualType && varFullGenericType1) {
-        var varActualType = res.importClass(varFullActualType);
-        var varGenericType1 = res.importClass(varFullGenericType1);
-
-        if (varFullGenericType2)
-            var varGenericType2 = res.importClass(varFullGenericType2);
-
-        res.line((varNew ? (varType + '<' + varGenericType1 + (varGenericType2 ? ', ' + varGenericType2 : '') + '> ') : '') + varName + ' = new ' + varActualType + '<>();');
-    }
-    else
-        res.line((varNew ? (varType + ' ') : '') + varName + ' = new ' + varType + '();');
-}
-
-/**
- * Add property via setter / property name.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param obj Source object with data.
- * @param propName Property name to take from source object.
- * @param enumType Optional info about property datatype.
- * @param setterName Optional special setter name.
- */
-function addProperty(res, varName, obj, propName, enumType, setterName) {
-    var val = obj[propName];
-
-    if (utils.isDefined(val)) {
-        res.emptyLineIfNeeded();
-
-        res.line(varName + '.' + getSetterName(setterName ? setterName : propName)
-            + '(' + toJavaCode(val, enumType) + ');');
-    }
-
-    return val;
-}
-
-/**
- * Add property via setter assuming that it is a 'Class'.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param obj Source object with data.
- * @param propName Property name to take from source object.
- */
-function addClassProperty(res, varName, obj, propName) {
-    var val = obj[propName];
-
-    if (utils.isDefined(val)) {
-        res.emptyLineIfNeeded();
-
-        res.line(varName + '.' + getSetterName(propName) + '(' + res.importClass(val) + '.class);');
-    }
-}
-
-/**
- * @param propName Property name
- * @returns Property setter with name by java conventions.
- */
-function getSetterName(propName) {
-    return toJavaName('set', propName);
-}
-
-function addListProperty(res, varName, obj, propName, enumType, setterName) {
-    var val = obj[propName];
-
-    if (val && val.length > 0) {
-        res.emptyLineIfNeeded();
-
-        res.importClass('java.util.Arrays');
-
-        res.append(varName + '.' + getSetterName(setterName ? setterName : propName) + '(Arrays.asList(');
-
-        for (var i = 0; i < val.length; i++) {
-            if (i > 0)
-                res.append(', ');
-
-            res.append(toJavaCode(val[i], enumType));
-        }
-
-        res.line('));');
-    }
-}
-
-function addMultiparamProperty(res, varName, obj, propName, type, setterName) {
-    var val = obj[propName];
-
-    if (val && val.length > 0) {
-        res.append(varName + '.' + getSetterName(setterName ? setterName : propName) + '(');
-
-        for (var i = 0; i < val.length; i++) {
-            if (i > 0)
-                res.append(', ');
-
-            res.append(toJavaCode(val[i], type));
-        }
-
-        res.line(');');
-    }
-}
-
-function addBeanWithProperties(res, varName, bean, beanPropName, beanVarName, beanClass, props, createBeanAlthoughNoProps) {
-    if (bean && utils.hasProperty(bean, props)) {
-        if (!res.emptyLineIfNeeded()) {
-            res.line();
-        }
-
-        res.line(beanClass + ' ' + beanVarName + ' = new ' + beanClass + '();');
-
-        for (var propName in props) {
-            if (props.hasOwnProperty(propName)) {
-                var descr = props[propName];
-
-                if (descr) {
-                    switch (descr.type) {
-                        case 'list':
-                            addListProperty(res, beanVarName, bean, propName, descr.elementsType, descr.setterName);
-                            break;
-
-                        case 'enum':
-                            addProperty(res, beanVarName, bean, propName, descr.enumClass, descr.setterName);
-                            break;
-
-                        case 'float':
-                            addProperty(res, beanVarName, bean, propName, 'float', descr.setterName);
-                            break;
-
-                        case 'propertiesAsList':
-                            var val = bean[propName];
-
-                            if (val && val.length > 0) {
-                                res.line('Properties ' + descr.propVarName + ' = new Properties();');
-
-                                for (var i = 0; i < val.length; i++) {
-                                    var nameAndValue = val[i];
-
-                                    var eqIndex = nameAndValue.indexOf('=');
-                                    if (eqIndex >= 0) {
-                                        res.line(descr.propVarName + '.setProperty('
-                                            + nameAndValue.substring(0, eqIndex) + ', '
-                                            + nameAndValue.substr(eqIndex + 1) + ');');
-                                    }
-
-                                }
-
-                                res.line(beanVarName + '.' + getSetterName(propName) + '(' + descr.propVarName + ');');
-                            }
-                            break;
-
-                        case 'className':
-                            if (bean[propName]) {
-                                res.line(beanVarName + '.' + getSetterName(propName) + '(new ' + generatorCommon.knownClasses[bean[propName]].className + '());');
-                            }
-
-                            break;
-
-                        default:
-                            addProperty(res, beanVarName, bean, propName, null, descr.setterName);
-                    }
-                }
-                else {
-                    addProperty(res, beanVarName, bean, propName);
-                }
-            }
-        }
-
-        res.line(varName + '.' + getSetterName(beanPropName) + '(' + beanVarName + ');');
-
-        res.needEmptyLine = true;
-    }
-    else if (createBeanAlthoughNoProps) {
-        res.emptyLineIfNeeded();
-
-        res.line(varName + '.' + getSetterName(beanPropName) + '(new ' + beanClass + '());');
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/generator/xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/xml.js b/modules/control-center-web/src/main/js/routes/generator/xml.js
deleted file mode 100644
index 2983c07..0000000
--- a/modules/control-center-web/src/main/js/routes/generator/xml.js
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var _ = require('lodash');
-
-var generatorCommon = require("./common");
-var utils = require("../utils");
-var dataStructures = require("../../helpers/data-structures.js");
-
-exports.generateClusterConfiguration = 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">');
-
-        if (clientNearConfiguration.nearStartSize)
-            addProperty(res, clientNearConfiguration, 'nearStartSize');
-
-        if (clientNearConfiguration.nearEvictionPolicy && clientNearConfiguration.nearEvictionPolicy.kind)
-            createEvictionPolicy(res, clientNearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
-
-        res.endBlock('</bean>');
-
-        res.line();
-    }
-
-    // Generate Ignite Configuration.
-    res.startBlock('<bean class="org.apache.ignite.configuration.IgniteConfiguration">');
-
-    if (clientNearConfiguration) {
-        res.line('<property name="clientMode" value="true" />');
-
-        res.line();
-    }
-
-    // Generate discovery.
-    if (cluster.discovery) {
-        res.startBlock('<property name="discoverySpi">');
-        res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">');
-        res.startBlock('<property name="ipFinder">');
-
-        var d = cluster.discovery;
-
-        switch (d.kind) {
-            case 'Multicast':
-                res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">');
-
-                addProperty(res, d.Multicast, 'multicastGroup');
-                addProperty(res, d.Multicast, 'multicastPort');
-                addProperty(res, d.Multicast, 'responseWaitTime');
-                addProperty(res, d.Multicast, 'addressRequestAttempts');
-                addProperty(res, d.Multicast, 'localAddress');
-
-                res.endBlock('</bean>');
-
-                break;
-
-            case 'Vm':
-                if (d.Vm.addresses.length > 0) {
-                    res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">');
-
-                    addListProperty(res, d.Vm, 'addresses');
-
-                    res.endBlock('</bean>');
-                }
-                else {
-                    res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"/>');
-                }
-
-                break;
-
-            case 'S3':
-                res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">');
-
-                if (d.S3 && d.S3.bucketName)
-                    res.line('<property name="bucketName" value="' + escapeAttr(d.S3.bucketName) + '" />');
-
-                res.endBlock('</bean>');
-
-                break;
-
-            case 'Cloud':
-                res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder">');
-
-                addProperty(res, d.Cloud, 'credential');
-                addProperty(res, d.Cloud, 'credentialPath');
-                addProperty(res, d.Cloud, 'identity');
-                addProperty(res, d.Cloud, 'provider');
-                addListProperty(res, d.Cloud, 'regions');
-                addListProperty(res, d.Cloud, 'zones');
-
-                res.endBlock('</bean>');
-
-                break;
-
-            case 'GoogleStorage':
-                res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder">');
-
-                addProperty(res, d.GoogleStorage, 'projectName');
-                addProperty(res, d.GoogleStorage, 'bucketName');
-                addProperty(res, d.GoogleStorage, 'serviceAccountP12FilePath');
-                addProperty(res, d.GoogleStorage, 'serviceAccountId');
-
-                //if (d.GoogleStorage.addrReqAttempts) todo ????
-                //    res.line('<property name="serviceAccountP12FilePath" value="' + escapeAttr(d.GoogleStorage.addrReqAttempts) + '"/>');
-
-                res.endBlock('</bean>');
-
-                break;
-
-            case 'Jdbc':
-                res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder">');
-                res.line('<property name="initSchema" value="' + (utils.isDefined(d.Jdbc.initSchema) && d.Jdbc.initSchema) + '"/>');
-                res.endBlock('</bean>');
-
-                break;
-
-            case 'SharedFs':
-                if (d.SharedFs.path) {
-                    res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder">');
-                    addProperty(res, d.SharedFs, 'path');
-                    res.endBlock('</bean>');
-                }
-                else {
-                    res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder"/>');
-                }
-
-                break;
-
-            default:
-                throw "Unknown discovery kind: " + d.kind;
-        }
-
-        res.endBlock('</property>');
-        res.endBlock('</bean>');
-        res.endBlock('</property>');
-
-        res.needEmptyLine = true
-    }
-
-    // Generate atomics group.
-    addBeanWithProperties(res, cluster.atomicConfiguration, 'atomicConfiguration',
-        generatorCommon.atomicConfiguration.className, generatorCommon.atomicConfiguration.fields);
-    res.needEmptyLine = true;
-
-    // Generate communication group.
-    addProperty(res, cluster, 'networkTimeout');
-    addProperty(res, cluster, 'networkSendRetryDelay');
-    addProperty(res, cluster, 'networkSendRetryCount');
-    addProperty(res, cluster, 'segmentCheckFrequency');
-    addProperty(res, cluster, 'waitForSegmentOnStart');
-    addProperty(res, cluster, 'discoveryStartupDelay');
-    res.needEmptyLine = true;
-
-    // Generate deployment group.
-    addProperty(res, cluster, 'deploymentMode');
-    res.needEmptyLine = true;
-
-    // Generate events group.
-    if (cluster.includeEventTypes && cluster.includeEventTypes.length > 0) {
-        res.emptyLineIfNeeded();
-
-        res.startBlock('<property name="includeEventTypes">');
-
-        if (cluster.includeEventTypes.length == 1)
-            res.line('<util:constant static-field="org.apache.ignite.events.EventType.' + cluster.includeEventTypes[0] + '"/>');
-        else {
-            res.startBlock('<array>');
-
-            for (i = 0; i < cluster.includeEventTypes.length; i++) {
-                if (i > 0)
-                    res.line();
-
-                var eventGroup = cluster.includeEventTypes[i];
-
-                res.line('<!-- EventType.' + eventGroup + ' -->');
-
-                var eventList = dataStructures.eventGroups[eventGroup];
-
-                for (var k = 0; k < eventList.length; k++) {
-                    res.line('<util:constant static-field="org.apache.ignite.events.EventType.' + eventList[k] + '"/>')
-                }
-            }
-
-            res.endBlock('</array>');
-        }
-
-        res.endBlock('</property>');
-
-        res.needEmptyLine = true;
-    }
-
-    // Generate marshaller group.
-    var marshaller = cluster.marshaller;
-
-    if (marshaller && marshaller.kind) {
-        var marshallerDesc = generatorCommon.marshallers[marshaller.kind];
-
-        addBeanWithProperties(res, marshaller[marshaller.kind], 'marshaller', marshallerDesc.className, marshallerDesc.fields, true);
-        res.needEmptyLine = true;
-    }
-
-    addProperty(res, cluster, 'marshalLocalJobs');
-    addProperty(res, cluster, 'marshallerCacheKeepAliveTime');
-    addProperty(res, cluster, 'marshallerCacheThreadPoolSize');
-    res.needEmptyLine = true;
-
-    // Generate metrics group.
-    addProperty(res, cluster, 'metricsExpireTime');
-    addProperty(res, cluster, 'metricsHistorySize');
-    addProperty(res, cluster, 'metricsLogFrequency');
-    addProperty(res, cluster, 'metricsUpdateFrequency');
-    res.needEmptyLine = true;
-
-    // Generate PeerClassLoading group.
-    addProperty(res, cluster, 'peerClassLoadingEnabled');
-    addListProperty(res, cluster, 'peerClassLoadingLocalClassPathExclude');
-    addProperty(res, cluster, 'peerClassLoadingMissedResourcesCacheSize');
-    addProperty(res, cluster, 'peerClassLoadingThreadPoolSize');
-    res.needEmptyLine = true;
-
-    // Generate swap group.
-    if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind == 'FileSwapSpaceSpi') {
-        addBeanWithProperties(res, cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi',
-            generatorCommon.swapSpaceSpi.className, generatorCommon.swapSpaceSpi.fields, true);
-
-        res.needEmptyLine = true;
-    }
-
-    // Generate time group.
-    addProperty(res, cluster, 'clockSyncSamples');
-    addProperty(res, cluster, 'clockSyncFrequency');
-    addProperty(res, cluster, 'timeServerPortBase');
-    addProperty(res, cluster, 'timeServerPortRange');
-    res.needEmptyLine = true;
-
-    // Generate thread pools group.
-    addProperty(res, cluster, 'publicThreadPoolSize');
-    addProperty(res, cluster, 'systemThreadPoolSize');
-    addProperty(res, cluster, 'managementThreadPoolSize');
-    addProperty(res, cluster, 'igfsThreadPoolSize');
-    res.needEmptyLine = true;
-
-    // Generate transactions group.
-    addBeanWithProperties(res, cluster.transactionConfiguration, 'transactionConfiguration',
-        generatorCommon.transactionConfiguration.className, generatorCommon.transactionConfiguration.fields);
-    res.needEmptyLine = true;
-
-    // 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;
-    }
-
-    res.endBlock('</bean>');
-
-    // Build final XML:
-    // 1. Add header.
-    var xml = '<?xml version="1.0" encoding="UTF-8"?>\n\n';
-
-    xml += '<!-- ' + generatorCommon.mainComment() + ' -->\n';
-    xml += '<beans xmlns="http://www.springframework.org/schema/beans"\n';
-    xml += '       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n';
-    xml += '       xmlns:util="http://www.springframework.org/schema/util"\n';
-    xml += '       xsi:schemaLocation="http://www.springframework.org/schema/beans\n';
-    xml += '                           http://www.springframework.org/schema/beans/spring-beans.xsd\n';
-    xml += '                           http://www.springframework.org/schema/util\n';
-    xml += '                           http://www.springframework.org/schema/util/spring-util.xsd">\n';
-
-    // 2. Add external property file and all data sources.
-    if (res.datasources.length > 0) {
-        xml += '    <!-- Load external properties file. -->\n';
-        xml += '    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\n';
-        xml += '        <property name="location" value="classpath:secret.properties"/>\n';
-        xml += '    </bean>\n\n';
-
-        xml += '    <!-- Data source beans will be initialized from external properties file. -->\n';
-
-        _.forEach(res.datasources, function (item) {
-            var beanId = item.dataSourceBean;
-
-            xml += '    <bean id= "' + beanId + '" class="' + item.className + '">\n';
-            xml += '        <property name="URL" value="${' + beanId + '.jdbc.url}" />\n';
-            xml += '        <property name="user" value="${' + beanId + '.jdbc.username}" />\n';
-            xml += '        <property name="password" value="${' + beanId + '.jdbc.password}" />\n';
-            xml += '    </bean>\n\n';
-        });
-    }
-
-    // 3. Add main content.
-    xml += res.join('');
-
-    // 4. Add footer.
-    xml += '</beans>\n';
-
-    return xml;
-};
-
-function createEvictionPolicy(res, evictionPolicy, propertyName) {
-    if (evictionPolicy && evictionPolicy.kind) {
-        var e = generatorCommon.evictionPolicies[evictionPolicy.kind];
-
-        var obj = evictionPolicy[evictionPolicy.kind.toUpperCase()];
-
-        addBeanWithProperties(res, obj, propertyName, e.className, e.fields, true);
-    }
-}
-
-function addCacheTypeMetadataDatabaseFields(res, meta, fieldProperty) {
-    var fields = meta[fieldProperty];
-
-    if (fields && fields.length > 0) {
-        res.startBlock('<property name="' + fieldProperty + '">');
-
-        res.startBlock('<list>');
-
-        _.forEach(fields, function (field) {
-            res.startBlock('<bean class="org.apache.ignite.cache.CacheTypeFieldMetadata">');
-
-            addProperty(res, field, 'databaseName');
-
-            res.startBlock('<property name="databaseType">');
-            res.line('<util:constant static-field="java.sql.Types.' + field.databaseType + '"/>');
-            res.endBlock('</property>');
-
-            addProperty(res, field, 'javaName');
-
-            addClassNameProperty(res, field, 'javaType');
-
-            res.endBlock('</bean>');
-        });
-
-        res.endBlock('</list>');
-        res.endBlock('</property>');
-    }
-}
-
-function addCacheTypeMetadataQueryFields(res, meta, fieldProperty) {
-    var fields = meta[fieldProperty];
-
-    if (fields && fields.length > 0) {
-        res.startBlock('<property name="' + fieldProperty + '">');
-
-        res.startBlock('<map>');
-
-        _.forEach(fields, function (field) {
-            addElement(res, 'entry', 'key', field.name, 'value', generatorCommon.javaBuildInClass(field.className));
-        });
-
-        res.endBlock('</map>');
-
-        res.endBlock('</property>');
-    }
-}
-
-function addCacheTypeMetadataGroups(res, meta) {
-    var groups = meta.groups;
-
-    if (groups && groups.length > 0) {
-        res.startBlock('<property name="groups">');
-        res.startBlock('<map>');
-
-        _.forEach(groups, function (group) {
-            var fields = group.fields;
-
-            if (fields && fields.length > 0) {
-                res.startBlock('<entry key="' + group.name + '">');
-                res.startBlock('<map>');
-
-                _.forEach(fields, function (field) {
-                    res.startBlock('<entry key="' + field.name + '">');
-
-                    res.startBlock('<bean class="org.apache.ignite.lang.IgniteBiTuple">');
-                    res.line('<constructor-arg value="' + generatorCommon.javaBuildInClass(field.className) + '"/>');
-                    res.line('<constructor-arg value="' + field.direction + '"/>');
-                    res.endBlock('</bean>');
-
-                    res.endBlock('</entry>');
-                });
-
-                res.endBlock('</map>');
-                res.endBlock('</entry>');
-            }
-        });
-
-        res.endBlock('</map>');
-        res.endBlock('</property>');
-    }
-}
-
-function generateCacheTypeMetadataConfiguration(res, meta) {
-    if (!res)
-        res = generatorCommon.builder();
-
-    res.startBlock('<bean class="org.apache.ignite.cache.CacheTypeMetadata">');
-
-    var kind = meta.kind;
-
-    var keyType = addClassNameProperty(res, meta, 'keyType');
-
-    addProperty(res, meta, 'valueType');
-
-    if (kind != 'query') {
-        addProperty(res, meta, 'databaseSchema');
-        addProperty(res, meta, 'databaseTable');
-
-        if (!generatorCommon.isJavaBuildInClass(keyType))
-            addCacheTypeMetadataDatabaseFields(res, meta, 'keyFields');
-
-        addCacheTypeMetadataDatabaseFields(res, meta, 'valueFields');
-    }
-
-    if (kind != 'store') {
-        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.storeFactories[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.dataSources[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>');
-    }
-
-    res.endBlock('</bean>');
-
-    return res;
-}
-
-function addElement(res, tag, attr1, val1, attr2, val2) {
-    var elem = '<' + tag;
-
-    if (attr1) {
-        elem += ' ' + attr1 + '="' + val1 + '"'
-    }
-
-    if (attr2) {
-        elem += ' ' + attr2 + '="' + val2 + '"'
-    }
-
-    elem += '/>';
-
-    res.emptyLineIfNeeded();
-    res.line(elem);
-}
-
-function addProperty(res, obj, propName, setterName) {
-    var val = obj[propName];
-
-    if (utils.isDefined(val))
-        addElement(res, 'property', 'name', setterName ? setterName : propName, 'value', escapeAttr(val));
-
-    return val;
-}
-
-function addClassNameProperty(res, obj, propName) {
-    var val = obj[propName];
-
-    if (utils.isDefined(val))
-        addElement(res, 'property', 'name', propName, 'value', generatorCommon.javaBuildInClass(val));
-
-    return val;
-}
-
-function addBeanWithProperties(res, bean, beanPropName, beanClass, props, createBeanAlthoughNoProps) {
-    if (bean && utils.hasProperty(bean, props)) {
-        res.emptyLineIfNeeded();
-        res.startBlock('<property name="' + beanPropName + '">');
-        res.startBlock('<bean class="' + beanClass + '">');
-
-        for (var propName in props) {
-            if (props.hasOwnProperty(propName)) {
-                var descr = props[propName];
-
-                if (descr) {
-                    if (descr.type == 'list') {
-                        addListProperty(res, bean, propName, descr.setterName);
-                    }
-                    else if (descr.type == 'className') {
-                        if (bean[propName]) {
-                            res.startBlock('<property name="' + propName + '">');
-                            res.line('<bean class="' + generatorCommon.knownClasses[bean[propName]].className + '"/>');
-                            res.endBlock('</property>');
-                        }
-                    }
-                    else if (descr.type == 'propertiesAsList') {
-                        var val = bean[propName];
-
-                        if (val && val.length > 0) {
-                            res.startBlock('<property name="' + propName + '">');
-                            res.startBlock('<props>');
-
-                            for (var i = 0; i < val.length; i++) {
-                                var nameAndValue = val[i];
-
-                                var eqIndex = nameAndValue.indexOf('=');
-                                if (eqIndex >= 0) {
-                                    res.line('<prop key="' + escapeAttr(nameAndValue.substring(0, eqIndex)) + '">' +
-                                        escape(nameAndValue.substr(eqIndex + 1)) + '</prop>');
-                                }
-                            }
-
-                            res.endBlock('</props>');
-                            res.endBlock('</property>');
-                        }
-                    }
-                    else
-                        addProperty(res, bean, propName, descr.setterName);
-                }
-                else
-                    addProperty(res, bean, propName);
-            }
-        }
-
-        res.endBlock('</bean>');
-        res.endBlock('</property>');
-    }
-    else if (createBeanAlthoughNoProps) {
-        res.emptyLineIfNeeded();
-        res.line('<property name="' + beanPropName + '">');
-        res.line('    <bean class="' + beanClass + '"/>');
-        res.line('</property>');
-    }
-}
-
-function addListProperty(res, obj, propName, listType, rowFactory) {
-    var val = obj[propName];
-
-    if (val && val.length > 0) {
-        res.emptyLineIfNeeded();
-
-        if (!listType)
-            listType = 'list';
-
-        if (!rowFactory)
-            rowFactory = function (val) {
-                return '<value>' + escape(val) + '</value>'
-            };
-
-        res.startBlock('<property name="' + propName + '">');
-        res.startBlock('<' + listType + '>');
-
-        for (var i = 0; i < val.length; i++)
-            res.line(rowFactory(val[i]));
-
-        res.endBlock('</' + listType + '>');
-        res.endBlock('</property>');
-    }
-}
-
-function escapeAttr(s) {
-    if (typeof(s) != 'string')
-        return s;
-
-    return s.replace(/&/g, '&amp;').replace(/"/g, '&quot;');
-}
-
-function escape(s) {
-    if (typeof(s) != 'string')
-        return s;
-
-    return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/notebooks.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/notebooks.js b/modules/control-center-web/src/main/js/routes/notebooks.js
index df550a3..e891a1c 100644
--- a/modules/control-center-web/src/main/js/routes/notebooks.js
+++ b/modules/control-center-web/src/main/js/routes/notebooks.js
@@ -18,7 +18,7 @@
 var router = require('express').Router();
 
 var db = require('../db');
-var utils = require('./utils');
+var utils = require('./../helpers/common-utils');
 
 /**
  * Get notebooks names accessed for user account.

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/public.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/public.js b/modules/control-center-web/src/main/js/routes/public.js
index d8133b9..cd3822a 100644
--- a/modules/control-center-web/src/main/js/routes/public.js
+++ b/modules/control-center-web/src/main/js/routes/public.js
@@ -21,7 +21,7 @@ var nodemailer = require('nodemailer');
 
 var db = require('../db');
 var config = require('../helpers/configuration-loader.js');
-var utils = require('./utils');
+var utils = require('./../helpers/common-utils');
 
 // GET dropdown-menu template.
 router.get('/select', function (req, res) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/summary.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/summary.js b/modules/control-center-web/src/main/js/routes/summary.js
index d187700..cf560b3 100644
--- a/modules/control-center-web/src/main/js/routes/summary.js
+++ b/modules/control-center-web/src/main/js/routes/summary.js
@@ -19,10 +19,10 @@ var db = require('../db');
 
 var router = require('express').Router();
 
-var generatorCommon = require('./generator/common');
-var generatorXml = require('./generator/xml');
-var generatorJava = require('./generator/java');
-var generatorDocker = require('./generator/docker');
+var $generatorXml = require('./generator/generator-xml');
+var $generatorJava = require('./generator/generator-java');
+var $generatorDocker = require('./generator/generator-docker');
+var $generatorProperties = require('./generator/generator-properties');
 
 /* GET summary page. */
 router.get('/', function (req, res) {
@@ -42,15 +42,15 @@ router.post('/generator', function (req, res) {
 
         if (clientCache)
             return res.send({
-                xmlClient: generatorXml.generateClusterConfiguration(cluster, clientCache),
-                javaClient: generatorJava.generateClusterConfiguration(cluster, req.body.javaClass, clientCache)
+                xmlClient: $generatorXml.clusterConfiguration(cluster, clientCache),
+                javaClient: $generatorJava.generateClusterConfiguration(cluster, req.body.javaClass, clientCache)
             });
 
         return res.send({
-            xmlServer: generatorXml.generateClusterConfiguration(cluster),
-            javaSnippetServer: generatorJava.generateClusterConfiguration(cluster, false),
-            javaClassServer: generatorJava.generateClusterConfiguration(cluster, true),
-            docker: generatorDocker.generateClusterConfiguration(cluster, '%OS%')
+            xmlServer: $generatorXml.clusterConfiguration(cluster),
+            javaSnippetServer: $generatorJava.generateClusterConfiguration(cluster, false),
+            javaClassServer: $generatorJava.generateClusterConfiguration(cluster, true),
+            docker: $generatorDocker.generateClusterConfiguration(cluster, '%OS%')
         });
     });
 });
@@ -87,18 +87,18 @@ router.post('/download', function (req, res) {
         zip.pipe(res);
 
         if (!clientNearConfiguration) {
-            zip.append(generatorDocker.generateClusterConfiguration(cluster, req.body.os), {name: "Dockerfile"});
+            zip.append($generatorDocker.generateClusterConfiguration(cluster, req.body.os), {name: 'Dockerfile'});
 
-            var props = generatorCommon.generateProperties(cluster);
+            var props = $generatorProperties.generateProperties(cluster);
 
             if (props)
-                zip.append(props, {name: "secret.properties"});
+                zip.append(props, {name: 'secret.properties'});
         }
 
-        zip.append(generatorXml.generateClusterConfiguration(cluster, clientNearConfiguration), {name: cluster.name + ".xml"})
-            .append(generatorJava.generateClusterConfiguration(cluster, false, clientNearConfiguration),
+        zip.append($generatorXml.clusterConfiguration(cluster, clientNearConfiguration), {name: cluster.name + '.xml'})
+            .append($generatorJava.generateClusterConfiguration(cluster, false, clientNearConfiguration),
                 {name: cluster.name + '.snippet.java'})
-            .append(generatorJava.generateClusterConfiguration(cluster, true, clientNearConfiguration),
+            .append($generatorJava.generateClusterConfiguration(cluster, true, clientNearConfiguration),
                 {name: 'ConfigurationFactory.java'})
             .finalize();
     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/routes/utils.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/utils.js b/modules/control-center-web/src/main/js/routes/utils.js
deleted file mode 100644
index 154b80e..0000000
--- a/modules/control-center-web/src/main/js/routes/utils.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-exports.isDefined = function isDefined(v) {
-    return !(v === undefined || v === null);
-};
-
-exports.hasProperty = function (obj, props) {
-    for (var propName in props) {
-        if (props.hasOwnProperty(propName)) {
-            if (obj[propName])
-                return true;
-        }
-    }
-
-    return false;
-};
-
-exports.randomValueHex = function randomValueHex(len) {
-    return require('crypto').randomBytes(Math.ceil(len / 2))
-        .toString('hex') // convert to hexadecimal format
-        .slice(0, len);  // return required number of characters
-};

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
index 6957adf..0bc393f 100644
--- a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
@@ -16,6 +16,12 @@
 
 extends ../templates/layout
 
+append scripts
+    script(src='/common-utils.js')
+    script(src='/data-structures.js')
+    script(src='/generator-common.js')
+    script(src='/generator-xml.js')
+
 mixin sidebar-item(ref, num, txt)
     li
         a(ng-class='{active: isActive("#{ref}")}' href='#{ref}')

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b72d82a/modules/control-center-web/src/main/js/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade
index 192138e..14ab944 100644
--- a/modules/control-center-web/src/main/js/views/includes/controls.jade
+++ b/modules/control-center-web/src/main/js/views/includes/controls.jade
@@ -444,11 +444,11 @@ mixin groups(groups, dataSource)
                 i.tipLabel.fa.fa-question-circle.blank(ng-if='!group.tip')
         .panel-collapse(role='tabpanel' bs-collapse-target id='{{::group.id}}' number='{{::group.number}}')
             .panel-body
-                .col-sm-6
+                .col-sm-6(id='{{::group.id + "-left"}}')
                     .settings-row(ng-repeat='field in group.fields')
                         +form-row(dataSource)
                 .col-sm-6
-                    +preview('group.preview')
+                    +preview('group.preview', '{{::group.id + "-right"}}')
 
 mixin advanced-options-top
     .advanced-options
@@ -461,6 +461,6 @@ mixin advanced-options-bottom
         i.fa.fa-chevron-circle-up(ng-click='toggleExpanded()')
         a(ng-click='toggleExpanded()') {{ui.expanded ? 'Hide advanced settings...' : 'Show advanced settings...'}}
 
-mixin preview(previewModel)
+mixin preview(previewModel, id)
     .panel-details(style='margin-left: 20px; padding: 0 3px')
-        .ace-preview(ui-ace='{onLoad: previewInit, mode: "xml"}' ng-model='preview[#{previewModel}]')
+        .ace-preview(id='#{id}' ui-ace='{onLoad: previewInit, mode: "xml"}' ng-model='preview[#{previewModel}]')


Mime
View raw message