ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [1/2] ignite git commit: IGNITE-2287 WIP examples.
Date Wed, 27 Jan 2016 07:13:54 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 b9e62281a -> 46ba2c834


IGNITE-2287 WIP examples.


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

Branch: refs/heads/ignite-843-rc2
Commit: 62b6b6dae6269a3e939b09c143d059bbd9e54bd2
Parents: b9e6228
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Jan 27 14:08:46 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Jan 27 14:08:46 2016 +0700

----------------------------------------------------------------------
 .../main/js/helpers/generator/generator-java.js | 306 ++++++++++++++++++-
 .../helpers/generator/generator-properties.js   |  15 +-
 2 files changed, 301 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/62b6b6da/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
index fefc6d1..33f0d84 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-java.js
@@ -1747,13 +1747,6 @@ $generatorJava.clusterCacheUse = function (caches, igfss, res) {
         clusterCacheInvoke(cache, names);
     });
 
-    if (names.length > 0) {
-        res.line('// Set data caches.');
-        res.line('cfg.setCacheConfiguration(' + names.join(', ') + ');');
-
-        res.needEmptyLine = true;
-    }
-
     var igfsNames = [];
 
     _.forEach(igfss, function (igfs) {
@@ -1761,9 +1754,10 @@ $generatorJava.clusterCacheUse = function (caches, igfss, res) {
         clusterCacheInvoke($generatorCommon.igfsMetaCache(igfs), igfsNames);
     });
 
-    if (igfsNames.length > 0) {
-        res.line('// Set IGFS caches.');
-        res.line('cfg.setCacheConfiguration(' + igfsNames.join(', ') + ');');
+    if (names.length > 0 || igfsNames.length > 0) {
+        names.push(igfsNames);
+
+        res.line('cfg.setCacheConfiguration(' + names.join(', ') + ');');
 
         res.needEmptyLine = true;
     }
@@ -2487,6 +2481,278 @@ $generatorJava.dataSourceClassName = function (res, storeFactory)
{
     return undefined;
 };
 
+// Defined queries for demo data.
+var PREDEFINED_QUERIES = [
+    {
+        schema: 'CARS',
+        type: 'PARKING',
+        create: 'CREATE TABLE IF NOT EXISTS CARS.PARKING (\n' +
+            'ID       INTEGER     NOT NULL PRIMARY KEY,\n' +
+            'NAME     VARCHAR(50) NOT NULL,\n' +
+            'CAPACITY INTEGER NOT NULL)',
+        fill: 'DELETE FROM CARS.PARKING;\n' +
+            'INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(0, \'Parking #1\', 10);\n'
+
+            'INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(1, \'Parking #2\', 20);\n'
+
+            'INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(2, \'Parking #3\', 30)',
+        selectQuery: [
+            "SELECT * FROM PARKING WHERE CAPACITY >= 20"
+        ]
+    },
+    {
+        schema: 'CARS',
+        type: 'CAR',
+        create: 'CREATE TABLE IF NOT EXISTS CARS.CAR (\n' +
+            'ID         INTEGER NOT NULL PRIMARY KEY,\n' +
+            'PARKING_ID INTEGER NOT NULL,\n' +
+            'NAME       VARCHAR(50) NOT NULL);',
+        fill: 'DELETE FROM CARS.CAR;\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(0, 0, \'Car #1\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(1, 0, \'Car #2\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(2, 0, \'Car #3\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(3, 1, \'Car #4\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(4, 1, \'Car #5\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(5, 2, \'Car #6\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(6, 2, \'Car #7\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(7, 2, \'Car #8\');\n' +
+            'INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(8, 2, \'Car #9\')',
+        selectQuery: [
+            "SELECT * FROM CAR WHERE PARKINGID = 2"
+        ]
+    },
+    {
+        type: 'COUNTRY',
+        create: 'CREATE TABLE IF NOT EXISTS COUNTRY (\n' +
+            'ID         INTEGER NOT NULL PRIMARY KEY,\n' +
+            'NAME       VARCHAR(50),\n' +
+            'POPULATION INTEGER NOT NULL);',
+        fill: 'DELETE FROM COUNTRY;\n' +
+            'INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(0, \'Country #1\', 10000000);\n'
+
+            'INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(1, \'Country #2\', 20000000);\n'
+
+            'INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(2, \'Country #3\', 30000000);',
+        selectQuery: [
+            "SELECT * FROM COUNTRY WHERE POPULATION BETWEEN 15000000 AND 25000000"
+        ]
+    },
+    {
+        type: 'DEPARTMENT',
+        create: 'CREATE TABLE IF NOT EXISTS DEPARTMENT (\n' +
+            'ID         INTEGER NOT NULL PRIMARY KEY,\n' +
+            'COUNTRY_ID INTEGER NOT NULL,\n' +
+            'NAME       VARCHAR(50) NOT NULL);',
+        fill: 'DELETE FROM DEPARTMENT;\n' +
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(0, 0, \'Department #1\');\n'
+
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(1, 0, \'Department #2\');\n'
+
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(2, 2, \'Department #3\');\n'
+
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(3, 1, \'Department #4\');\n'
+
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(4, 1, \'Department #5\');\n'
+
+            'INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(5, 1, \'Department #6\');',
+        selectQuery: [
+            "SELECT * FROM DEPARTMENT"
+        ]
+    },
+    {
+        type: 'EMPLOYEE',
+        create: 'CREATE TABLE IF NOT EXISTS EMPLOYEE (\n' +
+            'ID            INTEGER NOT NULL PRIMARY KEY,\n' +
+            'DEPARTMENT_ID INTEGER NOT NULL,\n' +
+            'MANAGER_ID    INTEGER,\n' +
+            'FIRST_NAME    VARCHAR(50) NOT NULL,\n' +
+            'LAST_NAME     VARCHAR(50) NOT NULL,\n' +
+            'EMAIL         VARCHAR(50) NOT NULL,\n' +
+            'PHONE_NUMBER  VARCHAR(50),\n' +
+            'HIRE_DATE     DATE        NOT NULL,\n' +
+            'JOB           VARCHAR(50) NOT NULL,\n' +
+            'SALARY        DOUBLE);',
+        fill: 'DELETE FROM EMPLOYEE;\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(0, 0, \'First name manager #1\', \'Last name manager #1\',
\'Email manager #1\', \'Phone number manager #1\', \'2014-01-01\', \'Job manager #1\', 1100.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(1, 1, \'First name manager #2\', \'Last name manager #2\',
\'Email manager #2\', \'Phone number manager #2\', \'2014-01-01\', \'Job manager #2\', 2100.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(2, 2, \'First name manager #3\', \'Last name manager #3\',
\'Email manager #3\', \'Phone number manager #3\', \'2014-01-01\', \'Job manager #3\', 3100.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(3, 3, \'First name manager #4\', \'Last name manager #4\',
\'Email manager #4\', \'Phone number manager #4\', \'2014-01-01\', \'Job manager #4\', 1500.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(4, 4, \'First name manager #5\', \'Last name manager #5\',
\'Email manager #5\', \'Phone number manager #5\', \'2014-01-01\', \'Job manager #5\', 1700.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER,
HIRE_DATE, JOB, SALARY) VALUES(5, 5, \'First name manager #6\', \'Last name manager #6\',
\'Email manager #6\', \'Phone number manager #6\', \'2014-01-01\', \'Job manager #6\', 1300.00);\n'
+
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(101, 0, 0, \'First name employee #1\', \'Last
name employee #1\', \'Email employee #1\', \'Phone number employee #1\', \'2014-01-01\', \'Job
employee #1\', 600.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(102, 0, 0, \'First name employee #2\', \'Last
name employee #2\', \'Email employee #2\', \'Phone number employee #2\', \'2014-01-01\', \'Job
employee #2\', 1600.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(103, 1, 1, \'First name employee #3\', \'Last
name employee #3\', \'Email employee #3\', \'Phone number employee #3\', \'2014-01-01\', \'Job
employee #3\', 2600.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(104, 2, 2, \'First name employee #4\', \'Last
name employee #4\', \'Email employee #4\', \'Phone number employee #4\', \'2014-01-01\', \'Job
employee #4\', 1000.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(105, 2, 2, \'First name employee #5\', \'Last
name employee #5\', \'Email employee #5\', \'Phone number employee #5\', \'2014-01-01\', \'Job
employee #5\', 1200.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(106, 2, 2, \'First name employee #6\', \'Last
name employee #6\', \'Email employee #6\', \'Phone number employee #6\', \'2014-01-01\', \'Job
employee #6\', 800.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(107, 3, 3, \'First name employee #7\', \'Last
name employee #7\', \'Email employee #7\', \'Phone number employee #7\', \'2014-01-01\', \'Job
employee #7\', 1400.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(108, 4, 4, \'First name employee #8\', \'Last
name employee #8\', \'Email employee #8\', \'Phone number employee #8\', \'2014-01-01\', \'Job
employee #8\', 800.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(109, 4, 4, \'First name employee #9\', \'Last
name employee #9\', \'Email employee #9\', \'Phone number employee #9\', \'2014-01-01\', \'Job
employee #9\', 1490.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(110, 4, 4, \'First name employee #10\', \'Last
name employee #12\', \'Email employee #10\', \'Phone number employee #10\', \'2014-01-01\',
\'Job employee #10\', 1600.00);\n' +
+            'INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL,
PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(111, 5, 5, \'First name employee #11\', \'Last
name employee #11\', \'Email employee #11\', \'Phone number employee #11\', \'2014-01-01\',
\'Job employee #11\', 400.00);',
+        selectQuery: [
+            "SELECT * FROM EMPLOYEE WHERE MANAGERID IS NOT NULL"
+        ]
+    }
+];
+
+// Generate creation and execution of prepared statement.
+function _prepareStatement(res, conVar, query, select) {
+    if (query) {
+        var lines = query.split('\n');
+
+        _.forEach(lines, function (line, ix) {
+            if (ix == 0)
+                if (lines.length == 1)
+                    res.line(conVar + '.prepareStatement("' + line + '").execute' + (select
? 'Query' : 'Update') + '();');
+                else
+                    res.startBlock(conVar + '.prepareStatement("' + line + '" +');
+            else
+                res.line('"' + line + '"' + (ix === lines.length - 1 ? ').execute' + (select
? 'Query' : 'Update') + '();' : ' +'));
+        });
+
+        if (lines.length > 0)
+            res.needEmptyLine = true;
+
+        if (lines.length > 1)
+            res.endBlock();
+    }
+}
+
+// Generate creation and execution of cache query.
+function _multilineQuery(res, query, prefix, postfix) {
+    if (query) {
+        var lines = query.split('\n');
+
+        _.forEach(lines, function (line, ix) {
+            if (ix == 0)
+                if (lines.length == 1)
+                    res.line(prefix + '"' + line + '"' + postfix);
+                else
+                    res.startBlock(prefix + '"' + line + '" +');
+            else
+                res.line('"' + line + '"' + (ix === lines.length - 1 ? postfix : ' +'));
+        });
+
+        if (lines.length > 0)
+            res.needEmptyLine = true;
+
+        if (lines.length > 1)
+            res.endBlock();
+    }
+}
+
+$generatorJava.generateExample = function (cluster, res, factoryCls) {
+    var cachesWithDataSource = _.filter(cluster.caches, function (cache) {
+        if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
+            var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind];
+
+            return storeFactory.connectVia ? (storeFactory.connectVia === 'DataSource' ?
storeFactory.dialect : undefined) : storeFactory.dialect;
+        }
+
+        return false;
+    });
+
+    // Prepare array of cache and his demo domain model list. Every domain is contained only
in first cache.
+    var demoTypes = _.filter(_.map(cachesWithDataSource, function (curCache, curIx) {
+        return {
+            cache: curCache,
+            domains: _.filter(curCache.domains, function (domain) {
+                return domain.demo && $commonUtils.isDefinedAndNotEmpty(domain.valueFields)
&&
+                    !_.find(cachesWithDataSource, function(checkCache, checkIx) {
+                        return checkIx < curIx && _.find(checkCache.domains, domain);
+                    });
+            })
+        }
+    }), function (cache) {
+        return $commonUtils.isDefinedAndNotEmpty(cache.domains);
+    });
+
+    if ($commonUtils.isDefinedAndNotEmpty(demoTypes)) {
+        var typeByDs = {};
+
+        // Group domain modes by data source
+        _.forEach(demoTypes, function (type) {
+            var ds = type.cache.cacheStoreFactory[type.cache.cacheStoreFactory.kind].dataSourceBean;
+
+            if (!typeByDs[ds])
+                typeByDs[ds] = [type];
+            else
+                typeByDs[ds].push(type);
+        });
+
+        // Generation of fill database method
+        res.line('/** Fill data for domain model demo example. */');
+        res.startBlock('private static void prepareExampleData() throws ' + res.importClass('java.sql.SQLException')
+ ' {');
+
+        _.forEach(typeByDs, function (types, ds) {
+            var conVar = ds + 'Con';
+
+            res.startBlock('try (' + res.importClass('java.sql.Connection') + ' ' + conVar
+ ' = ' + factoryCls + '.DataSources.INSTANCE_' + ds + '.getConnection()) {');
+
+            _.forEach(types, function (type) {
+                _.forEach(type.domains, function (domain) {
+                    var desc = _.find(PREDEFINED_QUERIES, function (desc) {
+                        return domain.valueType.toUpperCase().endsWith(desc.type);
+                    });
+
+                    if (desc) {
+                        if (desc.schema)
+                            _prepareStatement(res, conVar, 'CREATE SCHEMA IF NOT EXISTS '
+ desc.schema);
+
+                        _prepareStatement(res, conVar, desc.create);
+                        _prepareStatement(res, conVar, desc.fill);
+
+                        res.line(conVar + '.commit();');
+
+                        res.needEmptyLine = true;
+                    }
+                });
+            });
+
+            res.endBlock('}');
+
+            res.needEmptyLine = true;
+        });
+
+        res.endBlock('}');
+
+        res.needEmptyLine = true;
+
+        // Generation of execute queries method.
+        res.line('/** Run demo examples. */');
+        res.startBlock('private static void runExamples(Ignite ignite) throws SQLException
{');
+
+        var getType = function (fullType) {
+            return fullType.substr(fullType.lastIndexOf('.') + 1);
+        };
+
+        _.forEach(typeByDs, function (types, ds) {
+            var conVar = ds + 'Con';
+
+            res.startBlock('try (Connection ' + conVar + ' = ' + factoryCls + '.DataSources.INSTANCE_'
+ ds + '.getConnection()) {');
+
+            _.forEach(types, function (type) {
+                _.forEach(type.domains, function (domain) {
+                    var desc = _.find(PREDEFINED_QUERIES, function (desc) {
+                        return domain.valueType.toUpperCase().endsWith(desc.type);
+                    });
+
+                    if (desc) {
+                        _.forEach(desc.selectQuery, function (query) {
+                            _multilineQuery(res, query, 'ignite.cache("' + type.cache.name
+ '").query(new ' + res.importClass('org.apache.ignite.cache.query.SqlQuery') +
+                                '<>("' + getType(domain.valueType) + '", ', '));');
+
+                            res.needEmptyLine = true;
+                        })
+                    }
+                });
+            });
+
+            res.endBlock('}');
+
+            res.needEmptyLine = true;
+        });
+
+        res.endBlock('}');
+
+        res.needEmptyLine = true;
+    }
+
+    return demoTypes;
+};
+
 /**
  * Function to generate java class for node startup with cluster configuration.
  *
@@ -2505,6 +2771,9 @@ $generatorJava.nodeStartup = function (cluster, pkg, cls, cfg, factoryCls,
clien
     res.line(' */');
     res.startBlock('public class ' + cls + ' {');
 
+    if (factoryCls)
+        var demoTypes = $generatorJava.generateExample(cluster, res, factoryCls);
+
     res.line('/**');
     res.line(' * Start up node with specified configuration.');
     res.line(' *');
@@ -2517,10 +2786,13 @@ $generatorJava.nodeStartup = function (cluster, pkg, cls, cfg, factoryCls,
clien
     if (factoryCls)
         res.importClass(factoryCls);
 
-    if (clientNearCfg) {
+    if (clientNearCfg || $commonUtils.isDefinedAndNotEmpty(demoTypes))
         res.line(res.importClass('org.apache.ignite.Ignite') + ' ignite = ' +
             res.importClass('org.apache.ignite.Ignition') + '.start(' + cfg + ');');
+    else
+        res.line(res.importClass('org.apache.ignite.Ignition') + '.start(' + cfg + ');');
 
+    if (clientNearCfg) {
         res.needEmptyLine = true;
 
         if ($commonUtils.isDefinedAndNotEmpty(cluster.caches)) {
@@ -2539,8 +2811,16 @@ $generatorJava.nodeStartup = function (cluster, pkg, cls, cfg, factoryCls,
clien
             res.needEmptyLine = true;
         }
     }
-    else
-        res.line(res.importClass('org.apache.ignite.Ignition') + '.start(' + cfg + ');');
+
+    if ($commonUtils.isDefinedAndNotEmpty(demoTypes)) {
+        res.needEmptyLine = true;
+
+        res.line('prepareExampleData();');
+
+        res.needEmptyLine = true;
+
+        res.line('runExamples(ignite);');
+    }
 
     res.endBlock('}');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/62b6b6da/modules/control-center-web/src/main/js/helpers/generator/generator-properties.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-properties.js
b/modules/control-center-web/src/main/js/helpers/generator/generator-properties.js
index 56dea8f..9bb68eb 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-properties.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-properties.js
@@ -54,13 +54,15 @@ $generatorProperties.dataSourcesProperties = function (cluster, res) {
 
                 var dialect = storeFactory.connectVia ? (storeFactory.connectVia === 'DataSource'
? storeFactory.dialect : undefined): storeFactory.dialect;
 
-                if (dialect) {
-                    if (!res) {
-                        res = $generatorCommon.builder();
+                var connectViaUrl = cache.cacheStoreFactory.kind === 'CacheJdbcBlobStoreFactory'
&& storeFactory.connectVia === 'URL';
 
-                        res.line('# ' + $generatorCommon.mainComment());
-                    }
+                if (!res && (dialect || connectViaUrl)) {
+                    res = $generatorCommon.builder();
+
+                    res.line('# ' + $generatorCommon.mainComment());
+                }
 
+                if (dialect) {
                     var beanId = storeFactory.dataSourceBean;
 
                     var dsClsName = $generatorCommon.dataSourceClassName(dialect);
@@ -99,9 +101,8 @@ $generatorProperties.dataSourcesProperties = function (cluster, res) {
                     }
                 }
 
-                if (cache.cacheStoreFactory.kind === 'CacheJdbcBlobStoreFactory' &&
storeFactory.connectVia === 'URL') {
+                if (connectViaUrl)
                     res.line('ds.' + storeFactory.user + '.password=YOUR_PASSWORD');
-                }
             }
         });
     }


Mime
View raw message