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-1867 Fixed pom.xml generation and Generic datasource java code generation.
Date Tue, 17 Nov 2015 04:31:13 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc1 70a7ee654 -> 78ec2ddfb


IGNITE-1867 Fixed pom.xml generation and Generic datasource java code generation.


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

Branch: refs/heads/ignite-843-rc1
Commit: 4c1ad9f6006388f91dbd30282c3387b3c4c22473
Parents: 9e0dede
Author: vsisko <vsisko@gridgain.com>
Authored: Tue Nov 17 11:31:18 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Nov 17 11:31:18 2015 +0700

----------------------------------------------------------------------
 .../js/helpers/generator/generator-common.js    |  2 +-
 .../main/js/helpers/generator/generator-java.js | 55 +++++++++++++-------
 .../main/js/helpers/generator/generator-pom.js  |  9 ++--
 3 files changed, 42 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1ad9f6/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
b/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
index a36f519..d7699b4 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-common.js
@@ -256,7 +256,7 @@ $generatorCommon.igfsMetaCache = function(igfs) {
 
 // Pairs of supported databases and their data sources.
 $generatorCommon.DATA_SOURCES = {
-    Generic: 'com.mchange.v2.c3p0.jboss.C3P0PooledDataSource',
+    Generic: 'com.mchange.v2.c3p0.ComboPooledDataSource',
     Oracle: 'oracle.jdbc.pool.OracleDataSource',
     DB2: 'com.ibm.db2.jcc.DB2DataSource',
     SQLServer: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',

http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1ad9f6/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 169f52d..552c019 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
@@ -207,16 +207,13 @@ $generatorJava.multiparamProperty = function (res, varName, obj, propName,
dataT
     if (val && val.length > 0) {
         res.emptyLineIfNeeded();
 
-        res.append(varName + '.' + $generatorJava.setterName(propName, setterName) + '(');
+        res.startBlock(varName + '.' + $generatorJava.setterName(propName, setterName) +
'(');
 
         _.forEach(val, function(v, ix) {
-            if (ix > 0)
-                res.append(', ');
-
-            res.append($generatorJava.toJavaCode(v, dataType));
+            res.append($generatorJava.toJavaCode(v, dataType) + (ix < val.length - 1 ?
', ' : ''));
         });
 
-        res.line(');');
+        res.endBlock(');');
     }
 };
 
@@ -269,18 +266,20 @@ $generatorJava.beanProperty = function (res, varName, bean, beanPropName,
beanVa
                             var val = bean[propName];
 
                             if (val && val.length > 0) {
-                                res.line('Properties ' + descr.propVarName + ' = new Properties();');
+                                $generatorJava.declareVariable(res, descr.propVarName, 'java.util.Properties');
 
                                 _.forEach(val, function(nameAndValue) {
                                     var eqIndex = nameAndValue.indexOf('=');
 
                                     if (eqIndex >= 0) {
-                                        res.line(descr.propVarName + '.setProperty('
-                                            + nameAndValue.substring(0, eqIndex) + ', '
-                                            + nameAndValue.substr(eqIndex + 1) + ');');
+                                        res.line(descr.propVarName + '.setProperty(' +
+                                            '"' + nameAndValue.substring(0, eqIndex) + '",
' +
+                                            '"' + nameAndValue.substr(eqIndex + 1) + '");');
                                     }
                                 });
 
+                                res.needEmptyLine = true;
+
                                 res.line(beanVarName + '.' + $generatorJava.setterName(propName)
+ '(' + descr.propVarName + ');');
                             }
                             break;
@@ -816,6 +815,8 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
         });
 
         res.endBlock(');');
+
+        res.needEmptyLine = true;
     }
 
     $generatorJava.multiparamProperty(res, varName, cache, 'sqlFunctionClasses', 'class');
@@ -831,6 +832,7 @@ $generatorJava.cacheQuery = function (cache, varName, res) {
  * Generate cache store group.
  *
  * @param cache Cache descriptor.
+ * @param metadatas Metadata descriptors.
  * @param cacheVarName Cache variable name.
  * @param res Resulting output with generated code.
  * @returns {*} Java code for cache store configuration.
@@ -864,11 +866,17 @@ $generatorJava.cacheStore = function (cache, metadatas, cacheVarName,
res) {
                     $generatorJava.declareVariable(res, 'dataSource', dsClsName);
 
                     switch (storeFactory.dialect) {
+                        case 'Generic':
+                            res.line('dataSource.setJdbcUrl(props.getProperty("' + dataSourceBean
+ '.jdbc.url"));');
+
+                            break;
+
                         case 'DB2':
                             res.line('dataSource.setServerName(props.getProperty("' + dataSourceBean
+ '.jdbc.server_name"));');
                             res.line('dataSource.setPortNumber(Integer.valueOf(props.getProperty("'
+ dataSourceBean + '.jdbc.port_number")));');
                             res.line('dataSource.setDatabaseName(props.getProperty("' + dataSourceBean
+ '.jdbc.database_name"));');
                             res.line('dataSource.setDriverType(Integer.valueOf(props.getProperty("'
+ dataSourceBean + '.jdbc.driver_type")));');
+
                             break;
 
                         default:
@@ -1507,8 +1515,6 @@ $generatorJava.javaClassCode = function (meta, key, pkg, useConstructor,
include
  * @param includeKeyFields If 'true' then include key fields into value POJO.
  */
 $generatorJava.pojos = function (caches, useConstructor, includeKeyFields) {
-    var metadataNames = [];
-
     var metadatas = [];
 
     _.forEach(caches, function(cache) {
@@ -1887,8 +1893,10 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearCfg,
clientMode
             res.endBlock('}');
 
             res.needEmptyLine = true;
+        }
 
-            if (clientMode && clientNearCfg) {
+        if (clientMode && clientNearCfg) {
+            if (javaClass) {
                 res.line('/**');
                 res.line(' * Configure client near cache configuration.');
                 res.line(' *');
@@ -1898,21 +1906,28 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearCfg,
clientMode
                 res.startBlock('public static NearCacheConfiguration createNearCacheConfiguration()
throws Exception {');
 
                 $generatorJava.resetVariables(res);
+            }
 
-                $generatorJava.declareVariable(res, 'nearCfg', 'org.apache.ignite.configuration.NearCacheConfiguration');
+            $generatorJava.declareVariable(res, 'clientNearCfg', 'org.apache.ignite.configuration.NearCacheConfiguration');
 
-                if (clientNearCfg.nearStartSize)
-                    $generatorJava.property(res, 'nearCfg', clientNearCfg, 'nearStartSize');
+            if (clientNearCfg.nearStartSize) {
+                $generatorJava.property(res, 'clientNearCfg', clientNearCfg, 'nearStartSize');
 
-                if (clientNearCfg.nearEvictionPolicy && clientNearCfg.nearEvictionPolicy.kind)
-                    $generatorJava.evictionPolicy(res, 'nearCfg', clientNearCfg.nearEvictionPolicy,
'nearEvictionPolicy');
+                res.needEmptyLine = true;
+            }
 
-                res.line('return nearCfg;');
-                res.endBlock('}')
+            if (clientNearCfg.nearEvictionPolicy && clientNearCfg.nearEvictionPolicy.kind)
+                $generatorJava.evictionPolicy(res, 'clientNearCfg', clientNearCfg.nearEvictionPolicy,
'nearEvictionPolicy');
+
+            if (javaClass) {
+                res.line('return clientNearCfg;');
+                res.endBlock('}');
             }
 
             res.needEmptyLine = true;
+        }
 
+        if (javaClass) {
             res.line('/**');
             res.line(' * Sample usage of ' + javaClass + '.');
             res.line(' *');

http://git-wip-us.apache.org/repos/asf/ignite/blob/4c1ad9f6/modules/control-center-web/src/main/js/helpers/generator/generator-pom.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-pom.js b/modules/control-center-web/src/main/js/helpers/generator/generator-pom.js
index 865892a..179fb5a 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-pom.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-pom.js
@@ -110,6 +110,12 @@ $generatorPom.pom = function (cluster, igniteVersion, res) {
     addDependency('org.apache.ignite', 'ignite-indexing', igniteVersion);
     addDependency('org.apache.ignite', 'ignite-rest-http', igniteVersion);
 
+    if (_.find(cluster.igfss, function (igfs) { return igfs.secondaryFileSystemEnabled; }))
+        addDependency('org.apache.ignite', 'ignite-hadoop', igniteVersion);
+
+    if (_.find(caches, {"cacheStoreFactory" : {"kind" : "CacheHibernateBlobStoreFactory"}}))
+        addDependency('org.apache.ignite', 'ignite-hibernate', igniteVersion);
+
     if (dialect.Generic)
         addDependency('com.mchange', 'c3p0', '0.9.5.1');
 
@@ -131,9 +137,6 @@ $generatorPom.pom = function (cluster, igniteVersion, res) {
     if (dialect.SQLServer)
         addDependency('microsoft', 'jdbc', '4.1', 'sqljdbc41.jar');
 
-    if (_.findIndex(cluster.igfss, function (igfs) { return igfs.secondaryFileSystemEnabled;
}) >= 0)
-        addDependency('org.apache.ignite', 'ignite-hadoop', igniteVersion);
-
     res.endBlock('</dependencies>');
 
     res.needEmptyLine = true;


Mime
View raw message