ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [03/25] ignite git commit: IGNITE-6229 Fixes in code generation.
Date Fri, 15 Sep 2017 08:08:32 GMT
IGNITE-6229 Fixes in code generation.


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

Branch: refs/heads/ignite-6149
Commit: d753e9005c5a86cb4adde090149d600177d87a13
Parents: 0542c76
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Wed Sep 13 17:09:03 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Sep 13 17:09:03 2017 +0700

----------------------------------------------------------------------
 .../generator/AbstractTransformer.js            |  4 +-
 .../generator/ConfigurationGenerator.js         | 70 +++++++++++---------
 .../generator/JavaTransformer.service.js        |  7 +-
 .../generator/SpringTransformer.service.js      |  2 +-
 4 files changed, 46 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index 7e89fbd..a67f7b9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -134,8 +134,8 @@ export default class AbstractTransformer {
     }
 
     // Generate memory configuration group.
-    static clusterMemory(memoryConfiguration) {
-        return this.toSection(this.generator.clusterMemory(memoryConfiguration));
+    static clusterMemory(memoryConfiguration, available) {
+        return this.toSection(this.generator.clusterMemory(memoryConfiguration, available));
     }
 
     // Generate marshaller group.

http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 24dc0d3..428a8d0 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -91,7 +91,7 @@ export default class IgniteConfigurationGenerator {
 
         // Since ignite 2.0
         if (available('2.0.0'))
-            this.clusterMemory(cluster.memoryConfiguration, cfg);
+            this.clusterMemory(cluster.memoryConfiguration, available, cfg);
 
         this.clusterMisc(cluster, available, cfg);
         this.clusterMetrics(cluster, available, cfg);
@@ -974,6 +974,35 @@ export default class IgniteConfigurationGenerator {
         return discoSpi;
     }
 
+    // Execute event filtration in accordance to generated project version.
+    static filterEvents(eventGrps, available) {
+        if (available('2.0.0')) {
+            return _.reduce(eventGrps, (acc, eventGrp) => {
+                switch (eventGrp.value) {
+                    case 'EVTS_SWAPSPACE':
+                        // Removed.
+
+                        break;
+                    case 'EVTS_CACHE':
+                        const eventGrpX2 = _.cloneDeep(eventGrp);
+
+                        eventGrpX2.events = _.filter(eventGrpX2.events, (ev) =>
+                            !_.includes(['EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED'],
ev));
+
+                        acc.push(eventGrpX2);
+
+                        break;
+                    default:
+                        acc.push(eventGrp);
+                }
+
+                return acc;
+            }, []);
+        }
+
+        return eventGrps;
+    }
+
     // Generate events group.
     static clusterEvents(cluster, available, cfg = this.igniteConfigurationBean(cluster))
{
         const eventStorage = cluster.eventStorage;
@@ -1009,33 +1038,7 @@ export default class IgniteConfigurationGenerator {
             if (_.nonEmpty(cluster.includeEventTypes)) {
                 const eventGrps = _.filter(this.eventGrps, ({value}) => _.includes(cluster.includeEventTypes,
value));
 
-                if (available('2.0.0')) {
-                    const events = _.reduce(eventGrps, (acc, eventGrp) => {
-                        switch (eventGrp.value) {
-                            case 'EVTS_SWAPSPACE':
-                                // Removed.
-
-                                break;
-                            case 'EVTS_CACHE':
-                                const eventGrpX2 = _.cloneDeep(eventGrp);
-
-                                eventGrpX2.events = _.filter(eventGrpX2.events, (ev) =>
-                                    !_.includes(['EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED'],
ev));
-
-                                acc.push(eventGrpX2);
-
-                                break;
-                            default:
-                                acc.push(eventGrp);
-                        }
-
-                        return acc;
-                    }, []);
-
-                    cfg.eventTypes('evts', 'includeEventTypes', events);
-                }
-                else
-                    cfg.eventTypes('evts', 'includeEventTypes', eventGrps);
+                cfg.eventTypes('evts', 'includeEventTypes', this.filterEvents(eventGrps,
available));
             }
         }
 
@@ -1282,8 +1285,8 @@ export default class IgniteConfigurationGenerator {
         return cfg;
     }
 
-    // Generate logger group.
-    static clusterMemory(memoryConfiguration, cfg = this.igniteConfigurationBean()) {
+    // Generate memory configuration.
+    static clusterMemory(memoryConfiguration, available, cfg = this.igniteConfigurationBean())
{
         const memoryBean = new Bean('org.apache.ignite.configuration.MemoryConfiguration',
'memoryConfiguration', memoryConfiguration, clusterDflts.memoryConfiguration);
 
         memoryBean.intProperty('pageSize')
@@ -1307,10 +1310,13 @@ export default class IgniteConfigurationGenerator {
                 .enumProperty('pageEvictionMode')
                 .doubleProperty('evictionThreshold')
                 .intProperty('emptyPagesPoolSize')
-                .intProperty('subIntervals')
-                .longProperty('rateTimeInterval')
                 .boolProperty('metricsEnabled');
 
+            if (available('2.1.0')) {
+                plcBean.intProperty('subIntervals')
+                    .longProperty('rateTimeInterval');
+            }
+
             if (plcBean.isEmpty()) return;
 
             policies.push(plcBean);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
index 8739608..64fc172 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
@@ -778,7 +778,8 @@ export default class IgniteJavaTransformer extends AbstractTransformer
{
 
                     break;
                 case 'ARRAY':
-                    imports.push(prop.typeClsName);
+                    if (!prop.varArg)
+                        imports.push(prop.typeClsName);
 
                     if (this._isBean(prop.typeClsName))
                         _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
@@ -1589,7 +1590,7 @@ export default class IgniteJavaTransformer extends AbstractTransformer
{
 
         const sb = new StringBuilder();
 
-        const imports = ['org.apache.ignite.Ignition', 'org.apache.ignite.Ignite'];
+        const imports = ['org.apache.ignite.Ignition'];
 
         if (demo) {
             imports.push('org.h2.tools.Server', 'java.sql.Connection', 'java.sql.PreparedStatement',
@@ -1650,6 +1651,8 @@ export default class IgniteJavaTransformer extends AbstractTransformer
{
         }
 
         if ((_.nonEmpty(clientNearCaches) || demo) && shortFactoryCls) {
+            imports.push('org.apache.ignite.Ignite');
+
             sb.append(`Ignite ignite = Ignition.start(${cfgRef});`);
 
             _.forEach(clientNearCaches, (cache, idx) => {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
index eda590c..f0bfdb6 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
@@ -94,7 +94,7 @@ export default class IgniteSpringTransformer extends AbstractTransformer
{
                 case 'java.lang.Class':
                     return this.javaTypes.fullClassName(item);
                 case 'long':
-                    return `${item}L`;
+                    return `${item}`;
                 case 'java.lang.String':
                 case 'PATH':
                     return this.escapeXml(item);


Mime
View raw message