ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [1/2] incubator-ignite git commit: # IGNITE-843 Reformat
Date Tue, 23 Jun 2015 14:15:55 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 196710a6f -> b3abf11da


# IGNITE-843 Reformat


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

Branch: refs/heads/ignite-843
Commit: efeabe93567a85b7521d288ee1c0410542cd99be
Parents: 196710a
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Tue Jun 23 14:23:56 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Tue Jun 23 14:23:56 2015 +0300

----------------------------------------------------------------------
 .../webconfig/nodejs/routes/configGenerator.js  |   4 +-
 modules/webconfig/nodejs/utils/generatorJava.js | 258 +++++++++----------
 modules/webconfig/nodejs/utils/generatorXml.js  |   3 +-
 3 files changed, 132 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efeabe93/modules/webconfig/nodejs/routes/configGenerator.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/routes/configGenerator.js b/modules/webconfig/nodejs/routes/configGenerator.js
index 89034e4..06061fc 100644
--- a/modules/webconfig/nodejs/routes/configGenerator.js
+++ b/modules/webconfig/nodejs/routes/configGenerator.js
@@ -51,11 +51,11 @@ router.get('/', function(req, res) {
 
             switch (lang) {
                 case 'xml':
-                    res.send(generatorXml.generate(cluster));
+                    res.send(generatorXml.generateClusterConfiguration(cluster));
                     break;
 
                 case 'java':
-                    res.send(generatorJava.generate(cluster));
+                    res.send(generatorJava.generateClusterConfiguration(cluster));
                     break;
 
                 default:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efeabe93/modules/webconfig/nodejs/utils/generatorJava.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/utils/generatorJava.js b/modules/webconfig/nodejs/utils/generatorJava.js
index 64a742c..a9af1b5 100644
--- a/modules/webconfig/nodejs/utils/generatorJava.js
+++ b/modules/webconfig/nodejs/utils/generatorJava.js
@@ -17,124 +17,7 @@
 
 var generatorUtils = require("./generatorUtils");
 
-function toJavaCode(val, type) {
-    if (val == null)
-       return 'null';
-
-    if (type == 'f')
-        return val + 'f';
-    
-    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 addProperty(res, obj, objVariableName, propName, enumType) {
-    var val = obj[propName];
-    
-    if (val) {
-        res.emptyLineIfNeeded();
-        
-        res.line(objVariableName + '.' + getSetterName(propName) + '(' + toJavaCode(val,
enumType)  + ');');
-    }
-}
-
-function getSetterName(propName) {
-    return 'set' + propName.charAt(0).toLocaleUpperCase() + propName.slice(1);
-}
-
-function addListProperty(res, obj, objVariableName, propName, enumType) {
-    var val = obj[propName];
-    
-    if (val && val.length > 0) {
-        var setterName = getSetterName(propName);
-        
-        res.append(objVariableName + '.' + setterName + '(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, obj, objVariableName, propName, enumType) {
-    var val = obj[propName];
-    
-    if (val && val.length > 0) {
-        var setterName = getSetterName(propName);
-        
-        res.append(objVariableName + '.' + setterName + '(');
-
-        for (var i = 0; i < val.length; i++) {
-            if (i > 0)
-                res.append(', ');
-            
-            res.append(toJavaCode(val[i], enumType));
-        }
-        
-        res.line(');');
-    }
-}
-
-function addBeanWithProperties(res, bean, objVarName, beanPropName, beanVarName, beanClass,
props, alwaysCreateBean) {
-    if (!bean)
-        return;
-    
-    var hasProps = false;
-    for (var propName in props) {
-        if (props.hasOwnProperty(propName)) {
-            if (bean[propName]) {
-                hasProps = true;
-                break;
-            }
-        }
-    }
-    
-    if (hasProps) {
-        if (!res.emptyLineIfNeeded()) {
-            res.line();
-        }
-        
-        res.line(beanClass + ' ' + beanVarName + ' = new ' + beanClass + '();');
-        for (propName in props) {
-            if (props.hasOwnProperty(propName)) {
-                var val = bean[propName];
-                if (val) {
-                    var type = props[propName];
-                    
-                    if (type == 'list') {
-                        addListProperty(res, bean, beanVarName, propName);
-                    }
-                    else {
-                        addProperty(res, bean, beanVarName, propName, type);
-                    }
-                }
-            }
-        }
-        res.line(objVarName + '.' + getSetterName(beanPropName) + '(' + beanVarName + ');');
-        
-        res.needEmptyLine = true;
-    }
-    else if (alwaysCreateBean) {
-        res.emptyLineIfNeeded();
-        
-        res.line(objVarName + '.' + getSetterName(beanPropName) + '(new ' + beanClass + '());');
-    }
-}
-
-exports.generate = function(cluster) {
+exports.generateClusterConfiguration = function(cluster) {
     var res = generatorUtils.builder();
 
     res.line('IgniteConfiguration cfg = new IgniteConfiguration();');
@@ -171,7 +54,7 @@ exports.generate = function(cluster) {
                 else {
                     res.line('discovery.setIpFinder(new TcpDiscoveryS3IpFinder());');
                 }
-                
+
                 break;
 
             case 'Cloud':
@@ -204,7 +87,7 @@ exports.generate = function(cluster) {
                 res.line('ipFinder.setInitSchema(' + (d.Jdbc.initSchema != null || d.Jdbc.initSchema)
+ ');');
                 res.line('discovery.setIpFinder(ipFinder);');
                 res.needEmptyLine = true;
-                
+
                 break;
 
             case 'SharedFs':
@@ -218,9 +101,9 @@ exports.generate = function(cluster) {
         }
 
         res.emptyLineIfNeeded();
-        
+
         res.line('cfg.setDiscoverySpi(discovery);');
-        
+
         res.needEmptyLine = true;
     }
 
@@ -237,15 +120,15 @@ exports.generate = function(cluster) {
     addProperty(res, cluster, 'cfg', 'segmentCheckFrequency');
     addProperty(res, cluster, 'cfg', 'waitForSegmentOnStart');
     addProperty(res, cluster, 'cfg', 'discoveryStartupDelay');
-    
+
     res.needEmptyLine = true;
-    
+
     addProperty(res, cluster, 'cfg', 'deploymentMode', 'DeploymentMode');
 
     res.needEmptyLine = true;
 
     addListProperty(res, cluster, 'cfg', 'includeEventTypes');
-    
+
     res.needEmptyLine = true;
 
     addProperty(res, cluster, 'cfg', 'marshalLocalJobs');
@@ -287,7 +170,7 @@ exports.generate = function(cluster) {
     addProperty(res, cluster, 'cfg', 'systemThreadPoolSize');
     addProperty(res, cluster, 'cfg', 'managementThreadPoolSize');
     addProperty(res, cluster, 'cfg', 'igfsThreadPoolSize');
-    
+
     res.needEmptyLine = true;
 
     addBeanWithProperties(res, cluster.transactionConfiguration, 'cfg', 'transactionConfiguration',
@@ -301,15 +184,15 @@ exports.generate = function(cluster) {
         });
 
     res.needEmptyLine = true;
-    
+
     addProperty(res, cluster, 'cfg', 'cacheSanityCheckEnabled');
-    
+
     res.needEmptyLine = true;
 
     addProperty(res, cluster, 'cfg', 'segmentationPolicy', 'SegmentationPolicy');
     addProperty(res, cluster, 'cfg', 'segmentationResolveAttempts');
     addProperty(res, cluster, 'cfg', 'allSegmentationResolversPassRequired');
-    
+
     res.needEmptyLine = true;
 
     res.needEmptyLine = true;
@@ -318,3 +201,120 @@ exports.generate = function(cluster) {
 
     return res.join('');
 };
+
+function toJavaCode(val, type) {
+    if (val == null)
+       return 'null';
+
+    if (type == 'f')
+        return val + 'f';
+    
+    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 addProperty(res, obj, objVariableName, propName, enumType) {
+    var val = obj[propName];
+    
+    if (val) {
+        res.emptyLineIfNeeded();
+        
+        res.line(objVariableName + '.' + getSetterName(propName) + '(' + toJavaCode(val,
enumType)  + ');');
+    }
+}
+
+function getSetterName(propName) {
+    return 'set' + propName.charAt(0).toLocaleUpperCase() + propName.slice(1);
+}
+
+function addListProperty(res, obj, objVariableName, propName, enumType) {
+    var val = obj[propName];
+    
+    if (val && val.length > 0) {
+        var setterName = getSetterName(propName);
+        
+        res.append(objVariableName + '.' + setterName + '(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, obj, objVariableName, propName, enumType) {
+    var val = obj[propName];
+    
+    if (val && val.length > 0) {
+        var setterName = getSetterName(propName);
+        
+        res.append(objVariableName + '.' + setterName + '(');
+
+        for (var i = 0; i < val.length; i++) {
+            if (i > 0)
+                res.append(', ');
+            
+            res.append(toJavaCode(val[i], enumType));
+        }
+        
+        res.line(');');
+    }
+}
+
+function addBeanWithProperties(res, bean, objVarName, beanPropName, beanVarName, beanClass,
props, alwaysCreateBean) {
+    if (!bean)
+        return;
+    
+    var hasProps = false;
+    for (var propName in props) {
+        if (props.hasOwnProperty(propName)) {
+            if (bean[propName]) {
+                hasProps = true;
+                break;
+            }
+        }
+    }
+    
+    if (hasProps) {
+        if (!res.emptyLineIfNeeded()) {
+            res.line();
+        }
+        
+        res.line(beanClass + ' ' + beanVarName + ' = new ' + beanClass + '();');
+        for (propName in props) {
+            if (props.hasOwnProperty(propName)) {
+                var val = bean[propName];
+                if (val) {
+                    var type = props[propName];
+                    
+                    if (type == 'list') {
+                        addListProperty(res, bean, beanVarName, propName);
+                    }
+                    else {
+                        addProperty(res, bean, beanVarName, propName, type);
+                    }
+                }
+            }
+        }
+        res.line(objVarName + '.' + getSetterName(beanPropName) + '(' + beanVarName + ');');
+        
+        res.needEmptyLine = true;
+    }
+    else if (alwaysCreateBean) {
+        res.emptyLineIfNeeded();
+        
+        res.line(objVarName + '.' + getSetterName(beanPropName) + '(new ' + beanClass + '());');
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efeabe93/modules/webconfig/nodejs/utils/generatorXml.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/utils/generatorXml.js b/modules/webconfig/nodejs/utils/generatorXml.js
index e786612..2a07a5f 100644
--- a/modules/webconfig/nodejs/utils/generatorXml.js
+++ b/modules/webconfig/nodejs/utils/generatorXml.js
@@ -17,7 +17,7 @@
 
 var generatorUtils = require("./generatorUtils");
 
-exports.generate = function(cluster) {
+exports.generateClusterConfiguration = function(cluster) {
     var res = generatorUtils.builder();
 
     res.push('' +
@@ -224,7 +224,6 @@ exports.generate = function(cluster) {
     return res.join('');
 };
 
-
 function addProperty(res, obj, propName) {
     var val = obj[propName];
 


Mime
View raw message