You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/01/05 09:23:34 UTC
[01/37] ignite git commit: IGNITE-4413 .NET: Fix DateTime argument
handling in SqlQuery
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 1f743465d -> 6090ebdfc
IGNITE-4413 .NET: Fix DateTime argument handling in SqlQuery
This closes #1341
# Conflicts:
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/83d961cf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/83d961cf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/83d961cf
Branch: refs/heads/ignite-2.0
Commit: 83d961cff88cf2ead0bbc4ded3285f4faf9157fc
Parents: 8dd4ada
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Dec 12 17:52:22 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Dec 12 18:23:17 2016 +0300
----------------------------------------------------------------------
.../Query/CacheQueriesCodeConfigurationTest.cs | 24 ++++++++++++++--
.../Cache/Query/CacheQueriesTest.cs | 8 ++++++
.../Apache.Ignite.Core/Cache/Query/QueryBase.cs | 15 ++++++++--
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 29 +-------------------
4 files changed, 43 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/83d961cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
index d5f98ac..92e2891 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
@@ -52,7 +52,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Fields = new[]
{
new QueryField("Name", typeof (string)),
- new QueryField("Age", typeof (int))
+ new QueryField("Age", typeof (int)),
+ new QueryField("Birthday", typeof(DateTime)),
},
Indexes = new[]
{
@@ -71,7 +72,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
cache[1] = new QueryPerson("Arnold", 10);
cache[2] = new QueryPerson("John", 20);
- using (var cursor = cache.Query(new SqlQuery(typeof (QueryPerson), "age > 10")))
+ using (var cursor = cache.Query(new SqlQuery(typeof (QueryPerson), "age > ? and birthday < ?",
+ 10, DateTime.UtcNow)))
{
Assert.AreEqual(2, cursor.GetAll().Single().Key);
}
@@ -145,7 +147,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
cache[2] = new AttributeQueryPerson("John", 20);
- using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "age > ?", 10)))
+ using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson),
+ "age > ? and age < ? and birthday > ? and birthday < ?", 10, 30,
+ DateTime.UtcNow.AddYears(-21), DateTime.UtcNow.AddYears(-19))))
{
Assert.AreEqual(2, cursor.GetAll().Single().Key);
}
@@ -186,6 +190,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
Name = name;
Age = age;
+ Salary = age;
+ Birthday = DateTime.UtcNow.AddYears(-age);
}
/// <summary>
@@ -214,6 +220,18 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </value>
[QuerySqlField]
public AttributeQueryAddress Address { get; set; }
+
+ /// <summary>
+ /// Gets or sets the salary.
+ /// </summary>
+ [QuerySqlField]
+ public decimal? Salary { get; set; }
+
+ /// <summary>
+ /// Gets or sets the birthday.
+ /// </summary>
+ [QuerySqlField]
+ public DateTime Birthday { get; set; }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/83d961cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index a8ffe13..af79db9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Apache.Ignite.Core.Tests.Cache.Query
{
using System;
@@ -758,6 +759,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
Name = name;
Age = age;
+ Birthday = DateTime.UtcNow.AddYears(-age);
}
/// <summary>
@@ -769,6 +771,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// Age.
/// </summary>
public int Age { get; set; }
+
+ /// <summary>
+ /// Gets or sets the birthday.
+ /// </summary>
+ [QuerySqlField] // Enforce Timestamp serialization
+ public DateTime Birthday { get; set; }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/83d961cf/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
index cf1f637..d992845 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
@@ -17,6 +17,8 @@
namespace Apache.Ignite.Core.Cache.Query
{
+ using System;
+ using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
@@ -66,7 +68,7 @@ namespace Apache.Ignite.Core.Cache.Query
/// </summary>
/// <param name="writer">Writer.</param>
/// <param name="args">Arguments.</param>
- internal static void WriteQueryArgs(BinaryWriter writer, object[] args)
+ internal static void WriteQueryArgs(IBinaryRawWriter writer, object[] args)
{
if (args == null)
writer.WriteInt(0);
@@ -75,7 +77,16 @@ namespace Apache.Ignite.Core.Cache.Query
writer.WriteInt(args.Length);
foreach (var arg in args)
- writer.WriteObject(arg);
+ {
+ // Write DateTime as TimeStamp always, otherwise it does not make sense
+ // Wrapped DateTime comparison does not work in SQL
+ var dt = arg as DateTime?; // Works with DateTime also
+
+ if (dt != null)
+ writer.WriteTimestamp(dt);
+ else
+ writer.WriteObject(arg);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/83d961cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 359611d..57e70e1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -991,7 +991,7 @@ namespace Apache.Ignite.Core.Impl.Cache
writer.WriteString(qry.Sql);
writer.WriteInt(qry.PageSize);
- WriteQueryArgs(writer, qry.Arguments);
+ QueryBase.WriteQueryArgs(writer, qry.Arguments);
writer.WriteBoolean(qry.EnableDistributedJoins);
writer.WriteBoolean(qry.EnforceJoinOrder);
@@ -1010,33 +1010,6 @@ namespace Apache.Ignite.Core.Impl.Cache
return new QueryCursor<TK, TV>(cursor, Marshaller, _flagKeepBinary);
}
- /// <summary>
- /// Write query arguments.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="args">Arguments.</param>
- private static void WriteQueryArgs(BinaryWriter writer, object[] args)
- {
- if (args == null)
- writer.WriteInt(0);
- else
- {
- writer.WriteInt(args.Length);
-
- foreach (var arg in args)
- {
- // Write DateTime as TimeStamp always, otherwise it does not make sense
- // Wrapped DateTime comparison does not work in SQL
- var dt = arg as DateTime?; // Works with DateTime also
-
- if (dt != null)
- writer.WriteTimestamp(dt);
- else
- writer.WriteObject(arg);
- }
- }
- }
-
/** <inheritdoc /> */
public IContinuousQueryHandle QueryContinuous(ContinuousQuery<TK, TV> qry)
{
[34/37] ignite git commit: IGNITE-4519 updating versions for gce and
jcloud
Posted by vo...@apache.org.
IGNITE-4519 updating versions for gce and jcloud
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2774d879
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2774d879
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2774d879
Branch: refs/heads/ignite-2.0
Commit: 2774d879a72b0eeced862cc9a3fbd5d9c5ff2d72
Parents: 6c1cd16
Author: chandresh.pancholi <ch...@arvindinternet.com>
Authored: Thu Jan 5 02:31:13 2017 +0530
Committer: chandresh.pancholi <ch...@arvindinternet.com>
Committed: Thu Jan 5 02:31:13 2017 +0530
----------------------------------------------------------------------
modules/cloud/pom.xml | 6 +++---
modules/gce/pom.xml | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2774d879/modules/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cloud/pom.xml b/modules/cloud/pom.xml
index 5ac1990..8d806f4 100644
--- a/modules/cloud/pom.xml
+++ b/modules/cloud/pom.xml
@@ -33,7 +33,7 @@
<url>http://ignite.apache.org</url>
<properties>
- <jcloud.version>1.9.0</jcloud.version>
+ <jcloud.version>2.0.0</jcloud.version>
</properties>
<dependencies>
@@ -52,13 +52,13 @@
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>google-compute-engine</artifactId>
- <version>${jcloud.version}</version>
+ <version>1.9.3</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>docker</artifactId>
- <version>${jcloud.version}</version>
+ <version>1.9.3</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2774d879/modules/gce/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gce/pom.xml b/modules/gce/pom.xml
index b235d82..89f9a8b 100644
--- a/modules/gce/pom.xml
+++ b/modules/gce/pom.xml
@@ -44,13 +44,13 @@
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
- <version>1.19.1</version>
+ <version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-storage</artifactId>
- <version>v1-rev32-1.20.0</version>
+ <version>v1-rev92-1.22.0</version>
</dependency>
<dependency>
[12/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
new file mode 100644
index 0000000..2e01761
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
@@ -0,0 +1,234 @@
+/*
+ * 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.
+ */
+
+import StringBuilder from './StringBuilder';
+
+// Java built-in class names.
+import POM_DEPENDENCIES from 'app/data/pom-dependencies.json';
+
+/**
+ * Pom file generation entry point.
+ */
+export default class IgniteMavenGenerator {
+ escapeId(s) {
+ if (typeof (s) !== 'string')
+ return s;
+
+ return s.replace(/[^A-Za-z0-9_\-.]+/g, '_');
+ }
+
+ addProperty(sb, tag, val) {
+ sb.append('<' + tag + '>' + val + '</' + tag + '>');
+ }
+
+ addDependency(deps, groupId, artifactId, version, jar) {
+ if (!_.find(deps, (dep) => dep.groupId === groupId && dep.artifactId === artifactId))
+ deps.push({groupId, artifactId, version, jar});
+ }
+
+ addResource(sb, dir, exclude) {
+ sb.startBlock('<resource>');
+ if (dir)
+ this.addProperty(sb, 'directory', dir);
+
+ if (exclude) {
+ sb.startBlock('<excludes>');
+ this.addProperty(sb, 'exclude', exclude);
+ sb.endBlock('</excludes>');
+ }
+
+ sb.endBlock('</resource>');
+ }
+
+ artifact(sb, cluster, version) {
+ this.addProperty(sb, 'groupId', 'org.apache.ignite');
+ this.addProperty(sb, 'artifactId', this.escapeId(cluster.name) + '-project');
+ this.addProperty(sb, 'version', version);
+
+ sb.emptyLine();
+ }
+
+ dependencies(sb, cluster, deps) {
+ sb.startBlock('<dependencies>');
+
+ _.forEach(deps, (dep) => {
+ sb.startBlock('<dependency>');
+
+ this.addProperty(sb, 'groupId', dep.groupId);
+ this.addProperty(sb, 'artifactId', dep.artifactId);
+ this.addProperty(sb, 'version', dep.version);
+
+ if (dep.jar) {
+ this.addProperty(sb, 'scope', 'system');
+ this.addProperty(sb, 'systemPath', '${project.basedir}/jdbc-drivers/' + dep.jar);
+ }
+
+ sb.endBlock('</dependency>');
+ });
+
+ sb.endBlock('</dependencies>');
+
+ return sb;
+ }
+
+ build(sb = new StringBuilder(), cluster, excludeGroupIds) {
+ sb.startBlock('<build>');
+ sb.startBlock('<resources>');
+ this.addResource(sb, 'src/main/java', '**/*.java');
+ this.addResource(sb, 'src/main/resources');
+ sb.endBlock('</resources>');
+
+ sb.startBlock('<plugins>');
+ sb.startBlock('<plugin>');
+ this.addProperty(sb, 'artifactId', 'maven-dependency-plugin');
+ sb.startBlock('<executions>');
+ sb.startBlock('<execution>');
+ this.addProperty(sb, 'id', 'copy-libs');
+ this.addProperty(sb, 'phase', 'test-compile');
+ sb.startBlock('<goals>');
+ this.addProperty(sb, 'goal', 'copy-dependencies');
+ sb.endBlock('</goals>');
+ sb.startBlock('<configuration>');
+ this.addProperty(sb, 'excludeGroupIds', excludeGroupIds.join(','));
+ this.addProperty(sb, 'outputDirectory', 'target/libs');
+ this.addProperty(sb, 'includeScope', 'compile');
+ this.addProperty(sb, 'excludeTransitive', 'true');
+ sb.endBlock('</configuration>');
+ sb.endBlock('</execution>');
+ sb.endBlock('</executions>');
+ sb.endBlock('</plugin>');
+ sb.startBlock('<plugin>');
+ this.addProperty(sb, 'artifactId', 'maven-compiler-plugin');
+ this.addProperty(sb, 'version', '3.1');
+ sb.startBlock('<configuration>');
+ this.addProperty(sb, 'source', '1.7');
+ this.addProperty(sb, 'target', '1.7');
+ sb.endBlock('</configuration>');
+ sb.endBlock('</plugin>');
+ sb.endBlock('</plugins>');
+ sb.endBlock('</build>');
+
+ sb.endBlock('</project>');
+ }
+
+ /**
+ * Add dependency for specified store factory if not exist.
+ * @param storeDeps Already added dependencies.
+ * @param storeFactory Store factory to add dependency.
+ */
+ storeFactoryDependency(storeDeps, storeFactory) {
+ if (storeFactory.dialect && (!storeFactory.connectVia || storeFactory.connectVia === 'DataSource')) {
+ const dep = POM_DEPENDENCIES[storeFactory.dialect];
+
+ this.addDependency(storeDeps, dep.groupId, dep.artifactId, dep.version, dep.jar);
+ }
+ }
+
+ /**
+ * Generate pom.xml.
+ *
+ * @param cluster Cluster to take info about dependencies.
+ * @param version Ignite version for Ignite dependencies.
+ * @param sb Resulting output with generated pom.
+ * @returns {string} Generated content.
+ */
+ generate(cluster, version, sb = new StringBuilder()) {
+ const caches = cluster.caches;
+ const deps = [];
+ const storeDeps = [];
+ const excludeGroupIds = ['org.apache.ignite'];
+
+ const blobStoreFactory = {cacheStoreFactory: {kind: 'CacheHibernateBlobStoreFactory'}};
+
+ _.forEach(caches, (cache) => {
+ if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind)
+ this.storeFactoryDependency(storeDeps, cache.cacheStoreFactory[cache.cacheStoreFactory.kind]);
+
+ if (_.get(cache, 'nodeFilter.kind') === 'Exclude')
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', version);
+ });
+
+ sb.append('<?xml version="1.0" encoding="UTF-8"?>');
+
+ sb.emptyLine();
+
+ sb.append(`<!-- ${sb.generatedBy()} -->`);
+
+ sb.emptyLine();
+
+ sb.startBlock('<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">');
+
+ sb.append('<modelVersion>4.0.0</modelVersion>');
+
+ sb.emptyLine();
+
+ this.artifact(sb, cluster, version);
+
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-core', version);
+
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-spring', version);
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-indexing', version);
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-rest-http', version);
+
+ if (_.get(cluster, 'deploymentSpi.kind') === 'URI')
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-urideploy', version);
+
+ let dep = POM_DEPENDENCIES[cluster.discovery.kind];
+
+ if (dep)
+ this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
+
+ if (cluster.discovery.kind === 'Jdbc') {
+ const store = cluster.discovery.Jdbc;
+
+ if (store.dataSourceBean && store.dialect)
+ this.storeFactoryDependency(storeDeps, cluster.discovery.Jdbc);
+ }
+
+ _.forEach(cluster.checkpointSpi, (spi) => {
+ if (spi.kind === 'S3') {
+ dep = POM_DEPENDENCIES.S3;
+
+ if (dep)
+ this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
+ }
+ else if (spi.kind === 'JDBC')
+ this.storeFactoryDependency(storeDeps, spi.JDBC);
+ });
+
+ if (_.find(cluster.igfss, (igfs) => igfs.secondaryFileSystemEnabled))
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-hadoop', version);
+
+ if (_.find(caches, blobStoreFactory))
+ this.addDependency(deps, 'org.apache.ignite', 'ignite-hibernate', version);
+
+ if (cluster.logger && cluster.logger.kind) {
+ dep = POM_DEPENDENCIES[cluster.logger.kind];
+
+ if (dep)
+ this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
+ }
+
+ this.dependencies(sb, cluster, deps.concat(storeDeps));
+
+ sb.emptyLine();
+
+ this.build(sb, cluster, excludeGroupIds);
+
+ return sb;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Pom.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Pom.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Pom.service.js
deleted file mode 100644
index db58532..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/Pom.service.js
+++ /dev/null
@@ -1,233 +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.
- */
-
-import StringBuilder from './StringBuilder';
-
-// Java built-in class names.
-import POM_DEPENDENCIES from 'app/data/pom-dependencies.json';
-
-/**
- * Pom file generation entry point.
- */
-class GeneratorPom {
- escapeId(s) {
- if (typeof (s) !== 'string')
- return s;
-
- return s.replace(/[^A-Za-z0-9_\-.]+/g, '_');
- }
-
- addProperty(sb, tag, val) {
- sb.append('<' + tag + '>' + val + '</' + tag + '>');
- }
-
- addDependency(deps, groupId, artifactId, version, jar) {
- if (!_.find(deps, (dep) => dep.groupId === groupId && dep.artifactId === artifactId))
- deps.push({groupId, artifactId, version, jar});
- }
-
- addResource(sb, dir, exclude) {
- sb.startBlock('<resource>');
- if (dir)
- this.addProperty(sb, 'directory', dir);
-
- if (exclude) {
- sb.startBlock('<excludes>');
- this.addProperty(sb, 'exclude', exclude);
- sb.endBlock('</excludes>');
- }
-
- sb.endBlock('</resource>');
- }
-
- artifact(sb, cluster, version) {
- this.addProperty(sb, 'groupId', 'org.apache.ignite');
- this.addProperty(sb, 'artifactId', this.escapeId(cluster.name) + '-project');
- this.addProperty(sb, 'version', version);
-
- sb.emptyLine();
- }
-
- dependencies(sb, cluster, deps) {
- sb.startBlock('<dependencies>');
-
- _.forEach(deps, (dep) => {
- sb.startBlock('<dependency>');
-
- this.addProperty(sb, 'groupId', dep.groupId);
- this.addProperty(sb, 'artifactId', dep.artifactId);
- this.addProperty(sb, 'version', dep.version);
-
- if (dep.jar) {
- this.addProperty(sb, 'scope', 'system');
- this.addProperty(sb, 'systemPath', '${project.basedir}/jdbc-drivers/' + dep.jar);
- }
-
- sb.endBlock('</dependency>');
- });
-
- sb.endBlock('</dependencies>');
-
- return sb;
- }
-
- build(sb = new StringBuilder(), cluster, excludeGroupIds) {
- sb.startBlock('<build>');
- sb.startBlock('<resources>');
- this.addResource(sb, 'src/main/java', '**/*.java');
- this.addResource(sb, 'src/main/resources');
- sb.endBlock('</resources>');
-
- sb.startBlock('<plugins>');
- sb.startBlock('<plugin>');
- this.addProperty(sb, 'artifactId', 'maven-dependency-plugin');
- sb.startBlock('<executions>');
- sb.startBlock('<execution>');
- this.addProperty(sb, 'id', 'copy-libs');
- this.addProperty(sb, 'phase', 'test-compile');
- sb.startBlock('<goals>');
- this.addProperty(sb, 'goal', 'copy-dependencies');
- sb.endBlock('</goals>');
- sb.startBlock('<configuration>');
- this.addProperty(sb, 'excludeGroupIds', excludeGroupIds.join(','));
- this.addProperty(sb, 'outputDirectory', 'target/libs');
- this.addProperty(sb, 'includeScope', 'compile');
- this.addProperty(sb, 'excludeTransitive', 'true');
- sb.endBlock('</configuration>');
- sb.endBlock('</execution>');
- sb.endBlock('</executions>');
- sb.endBlock('</plugin>');
- sb.startBlock('<plugin>');
- this.addProperty(sb, 'artifactId', 'maven-compiler-plugin');
- this.addProperty(sb, 'version', '3.1');
- sb.startBlock('<configuration>');
- this.addProperty(sb, 'source', '1.7');
- this.addProperty(sb, 'target', '1.7');
- sb.endBlock('</configuration>');
- sb.endBlock('</plugin>');
- sb.endBlock('</plugins>');
- sb.endBlock('</build>');
-
- sb.endBlock('</project>');
- }
-
- /**
- * Add dependency for specified store factory if not exist.
- * @param storeDeps Already added dependencies.
- * @param storeFactory Store factory to add dependency.
- */
- storeFactoryDependency(storeDeps, storeFactory) {
- if (storeFactory.dialect && (!storeFactory.connectVia || storeFactory.connectVia === 'DataSource')) {
- const dep = POM_DEPENDENCIES[storeFactory.dialect];
-
- this.addDependency(storeDeps, dep.groupId, dep.artifactId, dep.version, dep.jar);
- }
- }
-
- /**
- * Generate pom.xml.
- *
- * @param cluster Cluster to take info about dependencies.
- * @param version Ignite version for Ignite dependencies.
- * @param sb Resulting output with generated pom.
- * @returns {string} Generated content.
- */
- generate(cluster, version, sb = new StringBuilder()) {
- const caches = cluster.caches;
- const deps = [];
- const storeDeps = [];
- const excludeGroupIds = ['org.apache.ignite'];
-
- const blobStoreFactory = {cacheStoreFactory: {kind: 'CacheHibernateBlobStoreFactory'}};
-
- _.forEach(caches, (cache) => {
- if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind)
- this.storeFactoryDependency(storeDeps, cache.cacheStoreFactory[cache.cacheStoreFactory.kind]);
-
- if (_.get(cache, 'nodeFilter.kind') === 'Exclude')
- this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', version);
- });
-
- sb.append('<?xml version="1.0" encoding="UTF-8"?>');
-
- sb.emptyLine();
-
- sb.append(`<!-- ${sb.generatedBy()} -->`);
-
- sb.emptyLine();
-
- sb.startBlock('<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">');
-
- sb.append('<modelVersion>4.0.0</modelVersion>');
-
- sb.emptyLine();
-
- this.artifact(sb, cluster, version);
-
- this.addDependency(deps, 'org.apache.ignite', 'ignite-core', version);
-
- this.addDependency(deps, 'org.apache.ignite', 'ignite-spring', version);
- this.addDependency(deps, 'org.apache.ignite', 'ignite-indexing', version);
- this.addDependency(deps, 'org.apache.ignite', 'ignite-rest-http', version);
-
- let dep = POM_DEPENDENCIES[cluster.discovery.kind];
-
- if (dep)
- this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
-
- if (cluster.discovery.kind === 'Jdbc') {
- const store = cluster.discovery.Jdbc;
-
- if (store.dataSourceBean && store.dialect)
- this.storeFactoryDependency(storeDeps, cluster.discovery.Jdbc);
- }
-
- _.forEach(cluster.checkpointSpi, (spi) => {
- if (spi.kind === 'S3') {
- dep = POM_DEPENDENCIES.S3;
-
- if (dep)
- this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
- }
- else if (spi.kind === 'JDBC')
- this.storeFactoryDependency(storeDeps, spi.JDBC);
- });
-
- if (_.find(cluster.igfss, (igfs) => igfs.secondaryFileSystemEnabled))
- this.addDependency(deps, 'org.apache.ignite', 'ignite-hadoop', version);
-
- if (_.find(caches, blobStoreFactory))
- this.addDependency(deps, 'org.apache.ignite', 'ignite-hibernate', version);
-
- if (cluster.logger && cluster.logger.kind) {
- dep = POM_DEPENDENCIES[cluster.logger.kind];
-
- if (dep)
- this.addDependency(deps, 'org.apache.ignite', dep.artifactId, version);
- }
-
- this.dependencies(sb, cluster, deps.concat(storeDeps));
-
- sb.emptyLine();
-
- this.build(sb, cluster, excludeGroupIds);
-
- return sb;
- }
-}
-
-export default ['GeneratorPom', GeneratorPom];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
index 49b4aa6..8a6a471 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Properties.service.js
@@ -20,7 +20,7 @@ import StringBuilder from './StringBuilder';
/**
* Properties generation entry point.
*/
-export default class PropertiesGenerator {
+export default class IgnitePropertiesGenerator {
_collectProperties(bean) {
const props = [];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Readme.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Readme.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Readme.service.js
index 7043807..0aa34ee 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Readme.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Readme.service.js
@@ -20,7 +20,7 @@ import StringBuilder from './StringBuilder';
/**
* Properties generation entry point.
*/
-export default class ReadmeGenerator {
+export default class IgniteReadmeGenerator {
header(sb) {
sb.append('Content of this folder was generated by Apache Ignite Web Console');
sb.append('=================================================================');
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/SharpTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/SharpTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/SharpTransformer.service.js
index 19043f6..6e6bffe 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/SharpTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/SharpTransformer.service.js
@@ -19,225 +19,238 @@ import _ from 'lodash';
import AbstractTransformer from './AbstractTransformer';
import StringBuilder from './StringBuilder';
-export default ['JavaTypes', 'IgnitePlatformGenerator', (JavaTypes, generator) => {
- return class SharpTransformer extends AbstractTransformer {
- static generator = generator;
-
- static commentBlock(sb, ...lines) {
- _.forEach(lines, (line) => sb.append(`// ${line}`));
- }
-
- static doc(sb, ...lines) {
- sb.append('/// <summary>');
- _.forEach(lines, (line) => sb.append(`/// ${line}`));
- sb.append('/// </summary>');
- }
-
- static mainComment(sb) {
- return this.doc(sb, sb.generatedBy());
- }
-
- /**
- *
- * @param {Array.<String>} sb
- * @param {Bean} bean
- */
- static _defineBean(sb, bean) {
- const shortClsName = JavaTypes.shortClassName(bean.clsName);
-
- sb.append(`var ${bean.id} = new ${shortClsName}();`);
- }
-
- /**
- * @param {StringBuilder} sb
- * @param {Bean} parent
- * @param {Bean} propertyName
- * @param {String|Bean} value
- * @private
- */
- static _setProperty(sb, parent, propertyName, value) {
- sb.append(`${parent.id}.${_.upperFirst(propertyName)} = ${value};`);
- }
-
- /**
- *
- * @param {StringBuilder} sb
- * @param {Bean} parent
- * @param {String} propertyName
- * @param {Bean} bean
- * @private
- */
- static _setBeanProperty(sb, parent, propertyName, bean) {
- sb.append(`${parent.id}.${_.upperFirst(propertyName)} = ${bean.id};`);
- }
-
- static _toObject(clsName, val) {
- const items = _.isArray(val) ? val : [val];
-
- return _.map(items, (item, idx) => {
- if (_.isNil(item))
- return 'null';
-
- const shortClsName = JavaTypes.shortClassName(clsName);
-
- switch (shortClsName) {
- // case 'byte':
- // return `(byte) ${item}`;
- // case 'Serializable':
- case 'String':
- if (items.length > 1)
- return `"${item}"${idx !== items.length - 1 ? ' +' : ''}`;
-
- return `"${item}"`;
- // case 'Path':
- // return `"${item.replace(/\\/g, '\\\\')}"`;
- // case 'Class':
- // return `${this.shortClassName(item)}.class`;
- // case 'UUID':
- // return `UUID.fromString("${item}")`;
- // case 'PropertyChar':
- // return `props.getProperty("${item}").toCharArray()`;
- // case 'Property':
- // return `props.getProperty("${item}")`;
- // case 'Bean':
- // if (item.isComplex())
- // return item.id;
+import ConfigurationGenerator from './ConfigurationGenerator';
+
+import ClusterDefaults from './defaults/Cluster.service';
+import CacheDefaults from './defaults/Cache.service';
+import IGFSDefaults from './defaults/IGFS.service';
+
+import JavaTypes from '../../../services/JavaTypes.service';
+
+const generator = new ConfigurationGenerator();
+
+const clusterDflts = new ClusterDefaults();
+const cacheDflts = new CacheDefaults();
+const igfsDflts = new IGFSDefaults();
+
+const javaTypes = new JavaTypes(clusterDflts, cacheDflts, igfsDflts);
+
+export default class SharpTransformer extends AbstractTransformer {
+ static generator = generator;
+
+ static commentBlock(sb, ...lines) {
+ _.forEach(lines, (line) => sb.append(`// ${line}`));
+ }
+
+ static doc(sb, ...lines) {
+ sb.append('/// <summary>');
+ _.forEach(lines, (line) => sb.append(`/// ${line}`));
+ sb.append('/// </summary>');
+ }
+
+ static mainComment(sb) {
+ return this.doc(sb, sb.generatedBy());
+ }
+
+ /**
+ *
+ * @param {Array.<String>} sb
+ * @param {Bean} bean
+ */
+ static _defineBean(sb, bean) {
+ const shortClsName = javaTypes.shortClassName(bean.clsName);
+
+ sb.append(`var ${bean.id} = new ${shortClsName}();`);
+ }
+
+ /**
+ * @param {StringBuilder} sb
+ * @param {Bean} parent
+ * @param {Bean} propertyName
+ * @param {String|Bean} value
+ * @private
+ */
+ static _setProperty(sb, parent, propertyName, value) {
+ sb.append(`${parent.id}.${_.upperFirst(propertyName)} = ${value};`);
+ }
+
+ /**
+ *
+ * @param {StringBuilder} sb
+ * @param {Bean} parent
+ * @param {String} propertyName
+ * @param {Bean} bean
+ * @private
+ */
+ static _setBeanProperty(sb, parent, propertyName, bean) {
+ sb.append(`${parent.id}.${_.upperFirst(propertyName)} = ${bean.id};`);
+ }
+
+ static _toObject(clsName, val) {
+ const items = _.isArray(val) ? val : [val];
+
+ return _.map(items, (item, idx) => {
+ if (_.isNil(item))
+ return 'null';
+
+ const shortClsName = javaTypes.shortClassName(clsName);
+
+ switch (shortClsName) {
+ // case 'byte':
+ // return `(byte) ${item}`;
+ // case 'Serializable':
+ case 'String':
+ if (items.length > 1)
+ return `"${item}"${idx !== items.length - 1 ? ' +' : ''}`;
+
+ return `"${item}"`;
+ // case 'Path':
+ // return `"${item.replace(/\\/g, '\\\\')}"`;
+ // case 'Class':
+ // return `${this.shortClassName(item)}.class`;
+ // case 'UUID':
+ // return `UUID.fromString("${item}")`;
+ // case 'PropertyChar':
+ // return `props.getProperty("${item}").toCharArray()`;
+ // case 'Property':
+ // return `props.getProperty("${item}")`;
+ // case 'Bean':
+ // if (item.isComplex())
+ // return item.id;
+ //
+ // return this._newBean(item);
+ default:
+ if (javaTypes.nonEnum(shortClsName))
+ return item;
+
+ return `${shortClsName}.${item}`;
+ }
+ });
+ }
+
+ /**
+ *
+ * @param {StringBuilder} sb
+ * @param {Bean} bean
+ * @returns {Array}
+ */
+ static _setProperties(sb = new StringBuilder(), bean) {
+ _.forEach(bean.properties, (prop) => {
+ switch (prop.clsName) {
+ case 'ICollection':
+ // const implClsName = JavaTypes.shortClassName(prop.implClsName);
+
+ const colTypeClsName = javaTypes.shortClassName(prop.typeClsName);
+
+ if (colTypeClsName === 'String') {
+ const items = this._toObject(colTypeClsName, prop.items);
+
+ sb.append(`${bean.id}.${_.upperFirst(prop.name)} = new {${items.join(', ')}};`);
+ }
+ // else {
+ // if (_.includes(vars, prop.id))
+ // sb.append(`${prop.id} = new ${implClsName}<>();`);
+ // else {
+ // vars.push(prop.id);
//
- // return this._newBean(item);
- default:
- if (JavaTypes.nonEnum(shortClsName))
- return item;
-
- return `${shortClsName}.${item}`;
- }
- });
- }
-
- /**
- *
- * @param {StringBuilder} sb
- * @param {Bean} bean
- * @returns {Array}
- */
- static _setProperties(sb = new StringBuilder(), bean) {
- _.forEach(bean.properties, (prop) => {
- switch (prop.clsName) {
- case 'ICollection':
- // const implClsName = JavaTypes.shortClassName(prop.implClsName);
-
- const colTypeClsName = JavaTypes.shortClassName(prop.typeClsName);
-
- if (colTypeClsName === 'String') {
- const items = this._toObject(colTypeClsName, prop.items);
-
- sb.append(`${bean.id}.${_.upperFirst(prop.name)} = new {${items.join(', ')}};`);
- }
- // else {
- // if (_.includes(vars, prop.id))
- // sb.append(`${prop.id} = new ${implClsName}<>();`);
- // else {
- // vars.push(prop.id);
- //
- // sb.append(`${clsName}<${colTypeClsName}> ${prop.id} = new ${implClsName}<>();`);
- // }
- //
- // sb.emptyLine();
- //
- // if (nonBean) {
- // const items = this._toObject(colTypeClsName, prop.items);
- //
- // _.forEach(items, (item) => {
- // sb.append(`${prop.id}.add("${item}");`);
- //
- // sb.emptyLine();
- // });
- // }
- // else {
- // _.forEach(prop.items, (item) => {
- // this.constructBean(sb, item, vars, limitLines);
- //
- // sb.append(`${prop.id}.add(${item.id});`);
- //
- // sb.emptyLine();
- // });
- //
- // this._setProperty(sb, bean.id, prop.name, prop.id);
- // }
- // }
-
- break;
-
- case 'Bean':
- const nestedBean = prop.value;
-
- this._defineBean(sb, nestedBean);
-
- sb.emptyLine();
-
- this._setProperties(sb, nestedBean);
-
- sb.emptyLine();
-
- this._setBeanProperty(sb, bean, prop.name, nestedBean);
-
- break;
- default:
- this._setProperty(sb, bean, prop.name, this._toObject(prop.clsName, prop.value));
- }
- });
-
- return sb;
- }
-
- /**
- * Build Java startup class with configuration.
- *
- * @param {Bean} cfg
- * @param pkg Package name.
- * @param clsName Class name for generate factory class otherwise generate code snippet.
- * @param clientNearCfg Optional near cache configuration for client node.
- * @returns {String}
- */
- static toClassFile(cfg, pkg, clsName) {
- const sb = new StringBuilder();
-
- sb.startBlock(`namespace ${pkg}`, '{');
-
- _.forEach(_.sortBy(cfg.collectClasses()), (cls) => sb.append(`using ${cls};`));
- sb.emptyLine();
-
-
- this.mainComment(sb);
- sb.startBlock(`public class ${clsName}`, '{');
-
- this.doc(sb, 'Configure grid.');
- sb.startBlock('public static IgniteConfiguration CreateConfiguration()', '{');
-
- this._defineBean(sb, cfg);
-
- sb.emptyLine();
-
- this._setProperties(sb, cfg);
+ // sb.append(`${clsName}<${colTypeClsName}> ${prop.id} = new ${implClsName}<>();`);
+ // }
+ //
+ // sb.emptyLine();
+ //
+ // if (nonBean) {
+ // const items = this._toObject(colTypeClsName, prop.items);
+ //
+ // _.forEach(items, (item) => {
+ // sb.append(`${prop.id}.add("${item}");`);
+ //
+ // sb.emptyLine();
+ // });
+ // }
+ // else {
+ // _.forEach(prop.items, (item) => {
+ // this.constructBean(sb, item, vars, limitLines);
+ //
+ // sb.append(`${prop.id}.add(${item.id});`);
+ //
+ // sb.emptyLine();
+ // });
+ //
+ // this._setProperty(sb, bean.id, prop.name, prop.id);
+ // }
+ // }
+
+ break;
+
+ case 'Bean':
+ const nestedBean = prop.value;
+
+ this._defineBean(sb, nestedBean);
+
+ sb.emptyLine();
+
+ this._setProperties(sb, nestedBean);
+
+ sb.emptyLine();
+
+ this._setBeanProperty(sb, bean, prop.name, nestedBean);
+
+ break;
+ default:
+ this._setProperty(sb, bean, prop.name, this._toObject(prop.clsName, prop.value));
+ }
+ });
+
+ return sb;
+ }
+
+ /**
+ * Build Java startup class with configuration.
+ *
+ * @param {Bean} cfg
+ * @param pkg Package name.
+ * @param clsName Class name for generate factory class otherwise generate code snippet.
+ * @returns {String}
+ */
+ static toClassFile(cfg, pkg, clsName) {
+ const sb = new StringBuilder();
+
+ sb.startBlock(`namespace ${pkg}`, '{');
+
+ _.forEach(_.sortBy(cfg.collectClasses()), (cls) => sb.append(`using ${cls};`));
+ sb.emptyLine();
+
+
+ this.mainComment(sb);
+ sb.startBlock(`public class ${clsName}`, '{');
+
+ this.doc(sb, 'Configure grid.');
+ sb.startBlock('public static IgniteConfiguration CreateConfiguration()', '{');
+
+ this._defineBean(sb, cfg);
+
+ sb.emptyLine();
+
+ this._setProperties(sb, cfg);
- sb.emptyLine();
+ sb.emptyLine();
- sb.append(`return ${cfg.id};`);
+ sb.append(`return ${cfg.id};`);
- sb.endBlock('}');
+ sb.endBlock('}');
- sb.endBlock('}');
+ sb.endBlock('}');
- sb.endBlock('}');
+ sb.endBlock('}');
- return sb.asString();
- }
+ return sb.asString();
+ }
- static generateSection(bean) {
- const sb = new StringBuilder();
+ static generateSection(bean) {
+ const sb = new StringBuilder();
- this._setProperties(sb, bean);
+ this._setProperties(sb, bean);
- return sb.asString();
- }
- };
-}];
+ return sb.asString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/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 73df25e..b234575 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
@@ -20,314 +20,311 @@ import _ from 'lodash';
import AbstractTransformer from './AbstractTransformer';
import StringBuilder from './StringBuilder';
-const escapeXml = (str) => {
- return str.replace(/&/g, '&')
- .replace(/"/g, '"')
- .replace(/'/g, ''')
- .replace(/>/g, '>')
- .replace(/</g, '<');
-};
-
-export default ['JavaTypes', 'igniteEventGroups', 'IgniteConfigurationGenerator', (JavaTypes, eventGroups, generator) => {
- return class SpringTransformer extends AbstractTransformer {
- static generator = generator;
-
- static commentBlock(sb, ...lines) {
- if (lines.length > 1) {
- sb.append('<!--');
-
- _.forEach(lines, (line) => sb.append(` ${line}`));
-
- sb.append('-->');
- }
- else
- sb.append(`<!-- ${_.head(lines)} -->`);
+export default class IgniteSpringTransformer extends AbstractTransformer {
+ static escapeXml(str) {
+ return str.replace(/&/g, '&')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+ .replace(/>/g, '>')
+ .replace(/</g, '<');
+ }
+
+ static commentBlock(sb, ...lines) {
+ if (lines.length > 1) {
+ sb.append('<!--');
+
+ _.forEach(lines, (line) => sb.append(` ${line}`));
+
+ sb.append('-->');
}
+ else
+ sb.append(`<!-- ${_.head(lines)} -->`);
+ }
- static appendBean(sb, bean, appendId) {
- const beanTags = [];
-
- if (appendId)
- beanTags.push(`id="${bean.id}"`);
-
- beanTags.push(`class="${bean.clsName}"`);
-
- if (bean.factoryMtd)
- beanTags.push(`factory-method="${bean.factoryMtd}"`);
-
- sb.startBlock(`<bean ${beanTags.join(' ')}>`);
-
- _.forEach(bean.arguments, (arg) => {
- if (arg.clsName === 'MAP') {
- sb.startBlock('<constructor-arg>');
- this._constructMap(sb, arg);
- sb.endBlock('</constructor-arg>');
- }
- else if (_.isNil(arg.value)) {
- sb.startBlock('<constructor-arg>');
- sb.append('<null/>');
- sb.endBlock('</constructor-arg>');
- }
- else if (arg.constant) {
- sb.startBlock('<constructor-arg>');
- sb.append(`<util:constant static-field="${arg.clsName}.${arg.value}"/>`);
- sb.endBlock('</constructor-arg>');
- }
- else if (arg.clsName === 'BEAN') {
- sb.startBlock('<constructor-arg>');
- this.appendBean(sb, arg.value);
- sb.endBlock('</constructor-arg>');
- }
- else
- sb.append(`<constructor-arg value="${this._toObject(arg.clsName, arg.value)}"/>`);
- });
+ static appendBean(sb, bean, appendId) {
+ const beanTags = [];
- this._setProperties(sb, bean);
+ if (appendId)
+ beanTags.push(`id="${bean.id}"`);
- sb.endBlock('</bean>');
- }
+ beanTags.push(`class="${bean.clsName}"`);
- static _toObject(clsName, items) {
- return _.map(_.isArray(items) ? items : [items], (item) => {
- switch (clsName) {
- case 'PROPERTY':
- case 'PROPERTY_CHAR':
- case 'PROPERTY_INT':
- return `\${${item}}`;
- case 'java.lang.Class':
- return JavaTypes.fullClassName(item);
- case 'long':
- return `${item}L`;
- case 'java.lang.String':
- return escapeXml(item);
- default:
- return item;
- }
- });
- }
+ if (bean.factoryMtd)
+ beanTags.push(`factory-method="${bean.factoryMtd}"`);
- static _isBean(clsName) {
- return JavaTypes.nonBuiltInClass(clsName) && JavaTypes.nonEnum(clsName) && _.includes(clsName, '.');
- }
+ sb.startBlock(`<bean ${beanTags.join(' ')}>`);
- static _setCollection(sb, prop) {
- sb.startBlock(`<property name="${prop.name}">`);
- sb.startBlock('<list>');
+ _.forEach(bean.arguments, (arg) => {
+ if (arg.clsName === 'MAP') {
+ sb.startBlock('<constructor-arg>');
+ this._constructMap(sb, arg);
+ sb.endBlock('</constructor-arg>');
+ }
+ else if (_.isNil(arg.value)) {
+ sb.startBlock('<constructor-arg>');
+ sb.append('<null/>');
+ sb.endBlock('</constructor-arg>');
+ }
+ else if (arg.constant) {
+ sb.startBlock('<constructor-arg>');
+ sb.append(`<util:constant static-field="${arg.clsName}.${arg.value}"/>`);
+ sb.endBlock('</constructor-arg>');
+ }
+ else if (arg.clsName === 'BEAN') {
+ sb.startBlock('<constructor-arg>');
+ this.appendBean(sb, arg.value);
+ sb.endBlock('</constructor-arg>');
+ }
+ else
+ sb.append(`<constructor-arg value="${this._toObject(arg.clsName, arg.value)}"/>`);
+ });
+
+ this._setProperties(sb, bean);
+
+ sb.endBlock('</bean>');
+ }
+
+ static _toObject(clsName, items) {
+ return _.map(_.isArray(items) ? items : [items], (item) => {
+ switch (clsName) {
+ case 'PROPERTY':
+ case 'PROPERTY_CHAR':
+ case 'PROPERTY_INT':
+ return `\${${item}}`;
+ case 'java.lang.Class':
+ return this.javaTypes.fullClassName(item);
+ case 'long':
+ return `${item}L`;
+ case 'java.lang.String':
+ case 'PATH':
+ return this.escapeXml(item);
+ default:
+ return item;
+ }
+ });
+ }
- _.forEach(prop.items, (item, idx) => {
- if (this._isBean(prop.typeClsName)) {
- if (idx !== 0)
- sb.emptyLine();
+ static _isBean(clsName) {
+ return this.javaTypes.nonBuiltInClass(clsName) && this.javaTypes.nonEnum(clsName) && _.includes(clsName, '.');
+ }
- this.appendBean(sb, item);
- }
- else
- sb.append(`<value>${item}</value>`);
- });
+ static _setCollection(sb, prop) {
+ sb.startBlock(`<property name="${prop.name}">`);
+ sb.startBlock('<list>');
- sb.endBlock('</list>');
- sb.endBlock('</property>');
- }
+ _.forEach(prop.items, (item, idx) => {
+ if (this._isBean(prop.typeClsName)) {
+ if (idx !== 0)
+ sb.emptyLine();
- static _constructMap(sb, map) {
- sb.startBlock('<map>');
+ this.appendBean(sb, item);
+ }
+ else
+ sb.append(`<value>${item}</value>`);
+ });
- _.forEach(map.entries, (entry) => {
- const key = entry[map.keyField];
- const val = entry[map.valField];
+ sb.endBlock('</list>');
+ sb.endBlock('</property>');
+ }
- const isKeyBean = this._isBean(map.keyClsName);
- const isValBean = this._isBean(map.valClsName);
+ static _constructMap(sb, map) {
+ sb.startBlock('<map>');
+ _.forEach(map.entries, (entry) => {
+ const key = entry[map.keyField];
+ const val = entry[map.valField];
- if (isKeyBean || isValBean) {
- sb.startBlock('<entry>');
+ const isKeyBean = this._isBean(map.keyClsName);
+ const isValBean = this._isBean(map.valClsName);
- sb.startBlock('<key>');
- if (isKeyBean)
- this.appendBean(sb, key);
- else
- sb.append(this._toObject(map.keyClsName, key));
- sb.endBlock('</key>');
- sb.startBlock('<value>');
- if (isValBean)
- this.appendBean(sb, val);
- else
- sb.append(this._toObject(map.valClsName, val));
- sb.endBlock('</value>');
+ if (isKeyBean || isValBean) {
+ sb.startBlock('<entry>');
- sb.endBlock('</entry>');
- }
+ sb.startBlock('<key>');
+ if (isKeyBean)
+ this.appendBean(sb, key);
else
- sb.append(`<entry key="${this._toObject(map.keyClsName, key)}" value="${this._toObject(map.valClsName, val)}"/>`);
- });
+ sb.append(this._toObject(map.keyClsName, key));
+ sb.endBlock('</key>');
- sb.endBlock('</map>');
- }
+ sb.startBlock('<value>');
+ if (isValBean)
+ this.appendBean(sb, val);
+ else
+ sb.append(this._toObject(map.valClsName, val));
+ sb.endBlock('</value>');
- /**
- *
- * @param {StringBuilder} sb
- * @param {Bean} bean
- * @returns {StringBuilder}
- */
- static _setProperties(sb, bean) {
- _.forEach(bean.properties, (prop, idx) => {
- switch (prop.clsName) {
- case 'DATA_SOURCE':
- const valAttr = prop.name === 'dataSource' ? 'ref' : 'value';
+ sb.endBlock('</entry>');
+ }
+ else
+ sb.append(`<entry key="${this._toObject(map.keyClsName, key)}" value="${this._toObject(map.valClsName, val)}"/>`);
+ });
- sb.append(`<property name="${prop.name}" ${valAttr}="${prop.id}"/>`);
+ sb.endBlock('</map>');
+ }
- break;
- case 'EVENT_TYPES':
- sb.startBlock(`<property name="${prop.name}">`);
+ /**
+ *
+ * @param {StringBuilder} sb
+ * @param {Bean} bean
+ * @returns {StringBuilder}
+ */
+ static _setProperties(sb, bean) {
+ _.forEach(bean.properties, (prop, idx) => {
+ switch (prop.clsName) {
+ case 'DATA_SOURCE':
+ const valAttr = prop.name === 'dataSource' ? 'ref' : 'value';
- if (prop.eventTypes.length === 1) {
- const evtGrp = _.find(eventGroups, {value: _.head(prop.eventTypes)});
+ sb.append(`<property name="${prop.name}" ${valAttr}="${prop.id}"/>`);
- evtGrp && sb.append(`<util:constant static-field="${evtGrp.class}.${evtGrp.value}"/>`);
- }
- else {
- sb.startBlock('<list>');
+ break;
+ case 'EVENT_TYPES':
+ sb.startBlock(`<property name="${prop.name}">`);
- _.forEach(prop.eventTypes, (item, ix) => {
- ix > 0 && sb.emptyLine();
+ if (prop.eventTypes.length === 1) {
+ const evtGrp = _.find(this.eventGroups, {value: _.head(prop.eventTypes)});
- const evtGrp = _.find(eventGroups, {value: item});
+ evtGrp && sb.append(`<util:constant static-field="${evtGrp.class}.${evtGrp.value}"/>`);
+ }
+ else {
+ sb.startBlock('<list>');
- if (evtGrp) {
- sb.append(`<!-- EventType.${item} -->`);
+ _.forEach(prop.eventTypes, (item, ix) => {
+ ix > 0 && sb.emptyLine();
- _.forEach(evtGrp.events, (event) =>
- sb.append(`<util:constant static-field="${evtGrp.class}.${event}"/>`));
- }
- });
+ const evtGrp = _.find(this.eventGroups, {value: item});
- sb.endBlock('</list>');
- }
+ if (evtGrp) {
+ sb.append(`<!-- EventType.${item} -->`);
- sb.endBlock('</property>');
+ _.forEach(evtGrp.events, (event) =>
+ sb.append(`<util:constant static-field="${evtGrp.class}.${event}"/>`));
+ }
+ });
- break;
- case 'ARRAY':
- case 'COLLECTION':
- this._setCollection(sb, prop);
+ sb.endBlock('</list>');
+ }
- break;
- case 'MAP':
- sb.startBlock(`<property name="${prop.name}">`);
+ sb.endBlock('</property>');
- this._constructMap(sb, prop);
+ break;
+ case 'ARRAY':
+ case 'COLLECTION':
+ this._setCollection(sb, prop);
- sb.endBlock('</property>');
+ break;
+ case 'MAP':
+ sb.startBlock(`<property name="${prop.name}">`);
- break;
- case 'java.util.Properties':
- sb.startBlock(`<property name="${prop.name}">`);
- sb.startBlock('<props>');
+ this._constructMap(sb, prop);
- _.forEach(prop.entries, (entry) => {
- sb.append(`<prop key="${entry.name}">${entry.value}</prop>`);
- });
+ sb.endBlock('</property>');
- sb.endBlock('</props>');
- sb.endBlock('</property>');
+ break;
+ case 'java.util.Properties':
+ sb.startBlock(`<property name="${prop.name}">`);
+ sb.startBlock('<props>');
- break;
- case 'BEAN':
- sb.startBlock(`<property name="${prop.name}">`);
+ _.forEach(prop.entries, (entry) => {
+ sb.append(`<prop key="${entry.name}">${entry.value}</prop>`);
+ });
- this.appendBean(sb, prop.value);
+ sb.endBlock('</props>');
+ sb.endBlock('</property>');
- sb.endBlock('</property>');
+ break;
+ case 'BEAN':
+ sb.startBlock(`<property name="${prop.name}">`);
- break;
- default:
- sb.append(`<property name="${prop.name}" value="${this._toObject(prop.clsName, prop.value)}"/>`);
- }
+ this.appendBean(sb, prop.value);
- this._emptyLineIfNeeded(sb, bean.properties, idx);
- });
+ sb.endBlock('</property>');
- return sb;
- }
+ break;
+ default:
+ sb.append(`<property name="${prop.name}" value="${this._toObject(prop.clsName, prop.value)}"/>`);
+ }
- /**
- * Build final XML.
- *
- * @param {Bean} cfg Ignite configuration.
- * @param {Boolean} clientNearCaches
- * @returns {StringBuilder}
- */
- static igniteConfiguration(cfg, clientNearCaches) {
- const sb = new StringBuilder();
-
- // 0. Add header.
- sb.append('<?xml version="1.0" encoding="UTF-8"?>');
- sb.emptyLine();
+ this._emptyLineIfNeeded(sb, bean.properties, idx);
+ });
+
+ return sb;
+ }
+
+ /**
+ * Build final XML.
+ *
+ * @param {Bean} cfg Ignite configuration.
+ * @param {Boolean} clientNearCaches
+ * @returns {StringBuilder}
+ */
+ static igniteConfiguration(cfg, clientNearCaches) {
+ const sb = new StringBuilder();
+
+ // 0. Add header.
+ sb.append('<?xml version="1.0" encoding="UTF-8"?>');
+ sb.emptyLine();
+
+ this.mainComment(sb);
+ sb.emptyLine();
+
+ // 1. Start beans section.
+ sb.startBlock([
+ '<beans xmlns="http://www.springframework.org/schema/beans"',
+ ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"',
+ ' xmlns:util="http://www.springframework.org/schema/util"',
+ ' xsi:schemaLocation="http://www.springframework.org/schema/beans',
+ ' http://www.springframework.org/schema/beans/spring-beans.xsd',
+ ' http://www.springframework.org/schema/util',
+ ' http://www.springframework.org/schema/util/spring-util.xsd">']);
+
+ // 2. Add external property file
+ if (this.hasProperties(cfg)) {
+ this.commentBlock(sb, 'Load external properties file.');
+
+ sb.startBlock('<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">');
+ sb.append('<property name="location" value="classpath:secret.properties"/>');
+ sb.endBlock('</bean>');
- this.mainComment(sb);
sb.emptyLine();
+ }
- // 1. Start beans section.
- sb.startBlock([
- '<beans xmlns="http://www.springframework.org/schema/beans"',
- ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"',
- ' xmlns:util="http://www.springframework.org/schema/util"',
- ' xsi:schemaLocation="http://www.springframework.org/schema/beans',
- ' http://www.springframework.org/schema/beans/spring-beans.xsd',
- ' http://www.springframework.org/schema/util',
- ' http://www.springframework.org/schema/util/spring-util.xsd">']);
+ // 3. Add data sources.
+ const dataSources = this.collectDataSources(cfg);
- // 2. Add external property file
- if (this.hasProperties(cfg)) {
- this.commentBlock(sb, 'Load external properties file.');
+ if (dataSources.length) {
+ this.commentBlock(sb, 'Data source beans will be initialized from external properties file.');
- sb.startBlock('<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">');
- sb.append('<property name="location" value="classpath:secret.properties"/>');
- sb.endBlock('</bean>');
+ _.forEach(dataSources, (ds) => {
+ this.appendBean(sb, ds, true);
sb.emptyLine();
- }
-
- // 3. Add data sources.
- const dataSources = this.collectDataSources(cfg);
-
- if (dataSources.length) {
- this.commentBlock(sb, 'Data source beans will be initialized from external properties file.');
-
- _.forEach(dataSources, (ds) => {
- this.appendBean(sb, ds, true);
-
- sb.emptyLine();
- });
- }
+ });
+ }
- _.forEach(clientNearCaches, (cache) => {
- this.commentBlock(sb, 'Configuration of near cache for cache "' + cache.name + '"');
+ _.forEach(clientNearCaches, (cache) => {
+ this.commentBlock(sb, `Configuration of near cache for cache "${cache.name}"`);
- this.appendBean(sb, generator.cacheNearClient(cache), true);
+ this.appendBean(sb, this.generator.cacheNearClient(cache), true);
- sb.emptyLine();
- });
+ sb.emptyLine();
+ });
- // 3. Add main content.
- this.appendBean(sb, cfg);
+ // 3. Add main content.
+ this.appendBean(sb, cfg);
- // 4. Close beans section.
- sb.endBlock('</beans>');
+ // 4. Close beans section.
+ sb.endBlock('</beans>');
- return sb;
- }
+ return sb;
+ }
- static cluster(cluster, client) {
- const cfg = generator.igniteConfiguration(cluster, client);
+ static cluster(cluster, client) {
+ const cfg = this.generator.igniteConfiguration(cluster, client);
- const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : [];
+ const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : [];
- return this.igniteConfiguration(cfg, clientNearCaches);
- }
- };
-}];
+ return this.igniteConfiguration(cfg, clientNearCaches);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
new file mode 100644
index 0000000..eeac3a0
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+import _ from 'lodash';
+
+const enumValueMapper = (val) => _.capitalize(val);
+
+const DFLT_CACHE = {
+ cacheMode: {
+ clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMode',
+ mapper: enumValueMapper
+ },
+ atomicityMode: {
+ clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheAtomicityMode',
+ mapper: enumValueMapper
+ },
+ memoryMode: {
+ clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMemoryMode',
+ value: 'ONHEAP_TIERED',
+ mapper: enumValueMapper
+ },
+ atomicWriteOrderMode: {
+ clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode',
+ mapper: enumValueMapper
+ },
+ writeSynchronizationMode: {
+ clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
+ value: 'PRIMARY_SYNC',
+ mapper: enumValueMapper
+ },
+ rebalanceMode: {
+ clsName: 'org.apache.ignite.cache.CacheRebalanceMode',
+ value: 'ASYNC',
+ mapper: enumValueMapper
+ }
+};
+
+export default class IgniteCachePlatformDefaults {
+ constructor() {
+ Object.assign(this, DFLT_CACHE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
new file mode 100644
index 0000000..14b315f
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+const DFLT_CACHE = {
+ cacheMode: {
+ clsName: 'org.apache.ignite.cache.CacheMode'
+ },
+ atomicityMode: {
+ clsName: 'org.apache.ignite.cache.CacheAtomicityMode'
+ },
+ memoryMode: {
+ clsName: 'org.apache.ignite.cache.CacheMemoryMode',
+ value: 'ONHEAP_TIERED'
+ },
+ offHeapMaxMemory: -1,
+ startSize: 1500000,
+ swapEnabled: false,
+ sqlOnheapRowCacheSize: 10240,
+ longQueryWarningTimeout: 3000,
+ snapshotableIndex: false,
+ sqlEscapeAll: false,
+ storeKeepBinary: false,
+ loadPreviousValue: false,
+ cacheStoreFactory: {
+ CacheJdbcPojoStoreFactory: {
+ batchSize: 512,
+ maximumWriteAttempts: 2,
+ parallelLoadCacheMinimumThreshold: 512,
+ sqlEscapeAll: false
+ }
+ },
+ readThrough: false,
+ writeThrough: false,
+ writeBehindEnabled: false,
+ writeBehindBatchSize: 512,
+ writeBehindFlushSize: 10240,
+ writeBehindFlushFrequency: 5000,
+ writeBehindFlushThreadCount: 1,
+ maxConcurrentAsyncOperations: 500,
+ defaultLockTimeout: 0,
+ atomicWriteOrderMode: {
+ clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode'
+ },
+ writeSynchronizationMode: {
+ clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
+ value: 'PRIMARY_SYNC'
+ },
+ rebalanceMode: {
+ clsName: 'org.apache.ignite.cache.CacheRebalanceMode',
+ value: 'ASYNC'
+ },
+ rebalanceThreadPoolSize: 1,
+ rebalanceBatchSize: 524288,
+ rebalanceBatchesPrefetchCount: 2,
+ rebalanceOrder: 0,
+ rebalanceDelay: 0,
+ rebalanceTimeout: 10000,
+ rebalanceThrottle: 0,
+ statisticsEnabled: false,
+ managementEnabled: false,
+ nearConfiguration: {
+ nearStartSize: 375000
+ },
+ clientNearConfiguration: {
+ nearStartSize: 375000
+ },
+ evictionPolicy: {
+ LRU: {
+ batchSize: 1,
+ maxSize: 100000
+ },
+ FIFO: {
+ batchSize: 1,
+ maxSize: 100000
+ },
+ SORTED: {
+ batchSize: 1,
+ maxSize: 100000
+ }
+ },
+ queryMetadata: 'Configuration',
+ fields: {
+ keyClsName: 'java.lang.String',
+ valClsName: 'java.lang.String',
+ valField: 'className',
+ entries: []
+ },
+ aliases: {
+ keyClsName: 'java.lang.String',
+ valClsName: 'java.lang.String',
+ keyField: 'field',
+ valField: 'alias',
+ entries: []
+ },
+ indexes: {
+ indexType: {
+ clsName: 'org.apache.ignite.cache.QueryIndexType'
+ },
+ fields: {
+ keyClsName: 'java.lang.String',
+ valClsName: 'java.lang.Boolean',
+ valField: 'direction',
+ entries: []
+ }
+ },
+ typeField: {
+ databaseFieldType: {
+ clsName: 'java.sql.Types'
+ }
+ }
+};
+
+export default class IgniteCacheDefaults {
+ constructor() {
+ Object.assign(this, DFLT_CACHE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.platform.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.platform.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.platform.service.js
new file mode 100644
index 0000000..b701951
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.platform.service.js
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+const enumValueMapper = (val) => _.capitalize(val);
+
+const DFLT_CLUSTER = {
+ atomics: {
+ cacheMode: {
+ clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMode',
+ mapper: enumValueMapper
+ }
+ },
+ transactionConfiguration: {
+ defaultTxConcurrency: {
+ clsName: 'Apache.Ignite.Core.Transactions.TransactionConcurrency',
+ mapper: enumValueMapper
+ },
+ defaultTxIsolation: {
+ clsName: 'Apache.Ignite.Core.Transactions.TransactionIsolation',
+ mapper: enumValueMapper
+ }
+ }
+};
+
+export default class IgniteClusterPlatformDefaults {
+ constructor() {
+ Object.assign(this, DFLT_CLUSTER);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
new file mode 100644
index 0000000..6333ef9
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -0,0 +1,289 @@
+/*
+ * 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.
+ */
+
+const DFLT_CLUSTER = {
+ localHost: '0.0.0.0',
+ discovery: {
+ localPort: 47500,
+ localPortRange: 100,
+ socketTimeout: 5000,
+ ackTimeout: 5000,
+ maxAckTimeout: 600000,
+ networkTimeout: 5000,
+ joinTimeout: 0,
+ threadPriority: 10,
+ heartbeatFrequency: 2000,
+ maxMissedHeartbeats: 1,
+ maxMissedClientHeartbeats: 5,
+ topHistorySize: 1000,
+ reconnectCount: 10,
+ statisticsPrintFrequency: 0,
+ ipFinderCleanFrequency: 60000,
+ forceServerMode: false,
+ clientReconnectDisabled: false,
+ Multicast: {
+ multicastGroup: '228.1.2.4',
+ multicastPort: 47400,
+ responseWaitTime: 500,
+ addressRequestAttempts: 2,
+ localAddress: '0.0.0.0'
+ },
+ Jdbc: {
+ initSchema: false
+ },
+ SharedFs: {
+ path: 'disco/tcp'
+ },
+ ZooKeeper: {
+ basePath: '/services',
+ serviceName: 'ignite',
+ allowDuplicateRegistrations: false,
+ ExponentialBackoff: {
+ baseSleepTimeMs: 1000,
+ maxRetries: 10
+ },
+ BoundedExponentialBackoffRetry: {
+ baseSleepTimeMs: 1000,
+ maxSleepTimeMs: 2147483647,
+ maxRetries: 10
+ },
+ UntilElapsed: {
+ maxElapsedTimeMs: 60000,
+ sleepMsBetweenRetries: 1000
+ },
+ RetryNTimes: {
+ n: 10,
+ sleepMsBetweenRetries: 1000
+ },
+ OneTime: {
+ sleepMsBetweenRetry: 1000
+ },
+ Forever: {
+ retryIntervalMs: 1000
+ }
+ }
+ },
+ atomics: {
+ atomicSequenceReserveSize: 1000,
+ backups: 0,
+ cacheMode: {
+ clsName: 'org.apache.ignite.cache.CacheMode',
+ value: 'PARTITIONED'
+ }
+ },
+ binary: {
+ compactFooter: true,
+ typeConfigurations: {
+ enum: false
+ }
+ },
+ collision: {
+ kind: null,
+ JobStealing: {
+ activeJobsThreshold: 95,
+ waitJobsThreshold: 0,
+ messageExpireTime: 1000,
+ maximumStealingAttempts: 5,
+ stealingEnabled: true,
+ stealingAttributes: {
+ keyClsName: 'java.lang.String',
+ valClsName: 'java.io.Serializable',
+ items: []
+ }
+ },
+ PriorityQueue: {
+ priorityAttributeKey: 'grid.task.priority',
+ jobPriorityAttributeKey: 'grid.job.priority',
+ defaultPriority: 0,
+ starvationIncrement: 1,
+ starvationPreventionEnabled: true
+ }
+ },
+ communication: {
+ localPort: 47100,
+ localPortRange: 100,
+ sharedMemoryPort: 48100,
+ directBuffer: false,
+ directSendBuffer: false,
+ idleConnectionTimeout: 30000,
+ connectTimeout: 5000,
+ maxConnectTimeout: 600000,
+ reconnectCount: 10,
+ socketSendBuffer: 32768,
+ socketReceiveBuffer: 32768,
+ messageQueueLimit: 1024,
+ tcpNoDelay: true,
+ ackSendThreshold: 16,
+ unacknowledgedMessagesBufferSize: 0,
+ socketWriteTimeout: 2000
+ },
+ networkTimeout: 5000,
+ networkSendRetryDelay: 1000,
+ networkSendRetryCount: 3,
+ discoveryStartupDelay: 60000,
+ connector: {
+ port: 11211,
+ portRange: 100,
+ idleTimeout: 7000,
+ idleQueryCursorTimeout: 600000,
+ idleQueryCursorCheckFrequency: 60000,
+ receiveBufferSize: 32768,
+ sendBufferSize: 32768,
+ sendQueueLimit: 0,
+ directBuffer: false,
+ noDelay: true,
+ sslEnabled: false,
+ sslClientAuth: false
+ },
+ deploymentMode: {
+ clsName: 'org.apache.ignite.configuration.DeploymentMode',
+ value: 'SHARED'
+ },
+ peerClassLoadingEnabled: false,
+ peerClassLoadingMissedResourcesCacheSize: 100,
+ peerClassLoadingThreadPoolSize: 2,
+ failoverSpi: {
+ JobStealing: {
+ maximumFailoverAttempts: 5
+ },
+ Always: {
+ maximumFailoverAttempts: 5
+ }
+ },
+ logger: {
+ Log4j: {
+ level: {
+ clsName: 'org.apache.log4j.Level'
+ }
+ },
+ Log4j2: {
+ level: {
+ clsName: 'org.apache.logging.log4j.Level'
+ }
+ }
+ },
+ marshalLocalJobs: false,
+ marshallerCacheKeepAliveTime: 10000,
+ metricsHistorySize: 10000,
+ metricsLogFrequency: 60000,
+ metricsUpdateFrequency: 2000,
+ clockSyncSamples: 8,
+ clockSyncFrequency: 120000,
+ timeServerPortBase: 31100,
+ timeServerPortRange: 100,
+ transactionConfiguration: {
+ defaultTxConcurrency: {
+ clsName: 'org.apache.ignite.transactions.TransactionConcurrency',
+ value: 'PESSIMISTIC'
+ },
+ defaultTxIsolation: {
+ clsName: 'org.apache.ignite.transactions.TransactionIsolation',
+ value: 'REPEATABLE_READ'
+ },
+ defaultTxTimeout: 0,
+ pessimisticTxLogLinger: 10000
+ },
+ attributes: {
+ keyClsName: 'java.lang.String',
+ valClsName: 'java.lang.String',
+ items: []
+ },
+ odbcConfiguration: {
+ endpointAddress: '0.0.0.0:10800..10810',
+ maxOpenCursors: 128
+ },
+ eventStorage: {
+ Memory: {
+ expireCount: 10000
+ }
+ },
+ checkpointSpi: {
+ S3: {
+ bucketNameSuffix: 'default-bucket',
+ clientConfiguration: {
+ protocol: {
+ clsName: 'com.amazonaws.Protocol',
+ value: 'HTTPS'
+ },
+ maxConnections: 50,
+ retryPolicy: {
+ retryCondition: {
+ clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
+ },
+ backoffStrategy: {
+ clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
+ },
+ maxErrorRetry: {
+ clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
+ }
+ },
+ maxErrorRetry: -1,
+ socketTimeout: 50000,
+ connectionTimeout: 50000,
+ requestTimeout: 0,
+ socketSendBufferSizeHints: 0,
+ connectionTTL: -1,
+ connectionMaxIdleMillis: 60000,
+ responseMetadataCacheSize: 50,
+ useReaper: true,
+ useGzip: false,
+ preemptiveBasicProxyAuth: false,
+ useTcpKeepAlive: false
+ }
+ },
+ JDBC: {
+ checkpointTableName: 'CHECKPOINTS',
+ keyFieldName: 'NAME',
+ keyFieldType: 'VARCHAR',
+ valueFieldName: 'VALUE',
+ valueFieldType: 'BLOB',
+ expireDateFieldName: 'EXPIRE_DATE',
+ expireDateFieldType: 'DATETIME',
+ numberOfRetries: 2
+ }
+ },
+ loadBalancingSpi: {
+ RoundRobin: {
+ perTask: false
+ },
+ Adaptive: {
+ loadProbe: {
+ Job: {
+ useAverage: true
+ },
+ CPU: {
+ useAverage: true,
+ useProcessors: true,
+ processorCoefficient: 1
+ },
+ ProcessingTime: {
+ useAverage: true
+ }
+ }
+ },
+ WeightedRandom: {
+ nodeWeight: 10,
+ useWeights: false
+ }
+ }
+};
+
+export default class IgniteClusterDefaults {
+ constructor() {
+ Object.assign(this, DFLT_CLUSTER);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/Event-groups.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Event-groups.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Event-groups.service.js
new file mode 100644
index 0000000..315da1f
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Event-groups.service.js
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+import _ from 'lodash';
+
+// Events groups.
+import EVENT_GROUPS from 'app/data/event-groups.json';
+
+export default class IgniteEventGroups {
+ constructor() {
+ return _.clone(EVENT_GROUPS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
new file mode 100644
index 0000000..985a56e
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+const DFLT_IGFS = {
+ defaultMode: {
+ clsName: 'org.apache.ignite.igfs.IgfsMode',
+ value: 'DUAL_ASYNC'
+ },
+ secondaryFileSystem: {
+
+ },
+ ipcEndpointConfiguration: {
+ type: {
+ clsName: 'org.apache.ignite.igfs.IgfsIpcEndpointType'
+ },
+ host: '127.0.0.1',
+ port: 10500,
+ memorySize: 262144,
+ tokenDirectoryPath: 'ipc/shmem'
+ },
+ fragmentizerConcurrentFiles: 0,
+ fragmentizerThrottlingBlockLength: 16777216,
+ fragmentizerThrottlingDelay: 200,
+ dualModeMaxPendingPutsSize: 0,
+ dualModePutExecutorServiceShutdown: false,
+ blockSize: 65536,
+ streamBufferSize: 65536,
+ maxSpaceSize: 0,
+ maximumTaskRangeLength: 0,
+ managementPort: 11400,
+ perNodeBatchSize: 100,
+ perNodeParallelBatchCount: 8,
+ prefetchBlocks: 0,
+ sequentialReadsBeforePrefetch: 0,
+ trashPurgeTimeout: 1000,
+ colocateMetadata: true,
+ relaxedConsistency: true,
+ pathModes: {
+ keyClsName: 'java.lang.String',
+ keyField: 'path',
+ valClsName: 'org.apache.ignite.igfs.IgfsMode',
+ valField: 'mode'
+ }
+};
+
+export default class IgniteIGFSDefaults {
+ constructor() {
+ Object.assign(this, DFLT_IGFS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.platform.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.platform.provider.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.platform.provider.js
deleted file mode 100644
index f06e11b..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.platform.provider.js
+++ /dev/null
@@ -1,60 +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.
- */
-
-import _ from 'lodash';
-
-const enumValueMapper = (val) => _.capitalize(val);
-
-const DFLT_CACHE = {
- cacheMode: {
- clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMode',
- mapper: enumValueMapper
- },
- atomicityMode: {
- clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheAtomicityMode',
- mapper: enumValueMapper
- },
- memoryMode: {
- clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMemoryMode',
- value: 'ONHEAP_TIERED',
- mapper: enumValueMapper
- },
- atomicWriteOrderMode: {
- clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode',
- mapper: enumValueMapper
- },
- writeSynchronizationMode: {
- clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
- value: 'PRIMARY_SYNC',
- mapper: enumValueMapper
- },
- rebalanceMode: {
- clsName: 'org.apache.ignite.cache.CacheRebalanceMode',
- value: 'ASYNC',
- mapper: enumValueMapper
- }
-};
-
-export default function() {
- this.append = (dflts) => {
- _.merge(DFLT_CACHE, dflts);
- };
-
- this.$get = ['igniteCacheDefaults', (cacheDefaults) => {
- return _.merge({}, cacheDefaults, DFLT_CACHE);
- }];
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.provider.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.provider.js
deleted file mode 100644
index f50e493..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cache.provider.js
+++ /dev/null
@@ -1,137 +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.
- */
-
-import _ from 'lodash';
-
-const DFLT_CACHE = {
- cacheMode: {
- clsName: 'org.apache.ignite.cache.CacheMode'
- },
- atomicityMode: {
- clsName: 'org.apache.ignite.cache.CacheAtomicityMode'
- },
- memoryMode: {
- clsName: 'org.apache.ignite.cache.CacheMemoryMode',
- value: 'ONHEAP_TIERED'
- },
- offHeapMaxMemory: -1,
- startSize: 1500000,
- swapEnabled: false,
- sqlOnheapRowCacheSize: 10240,
- longQueryWarningTimeout: 3000,
- snapshotableIndex: false,
- sqlEscapeAll: false,
- storeKeepBinary: false,
- loadPreviousValue: false,
- cacheStoreFactory: {
- CacheJdbcPojoStoreFactory: {
- batchSize: 512,
- maximumWriteAttempts: 2,
- parallelLoadCacheMinimumThreshold: 512,
- sqlEscapeAll: false
- }
- },
- readThrough: false,
- writeThrough: false,
- writeBehindEnabled: false,
- writeBehindBatchSize: 512,
- writeBehindFlushSize: 10240,
- writeBehindFlushFrequency: 5000,
- writeBehindFlushThreadCount: 1,
- maxConcurrentAsyncOperations: 500,
- defaultLockTimeout: 0,
- atomicWriteOrderMode: {
- clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode'
- },
- writeSynchronizationMode: {
- clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
- value: 'PRIMARY_SYNC'
- },
- rebalanceMode: {
- clsName: 'org.apache.ignite.cache.CacheRebalanceMode',
- value: 'ASYNC'
- },
- rebalanceThreadPoolSize: 1,
- rebalanceBatchSize: 524288,
- rebalanceBatchesPrefetchCount: 2,
- rebalanceOrder: 0,
- rebalanceDelay: 0,
- rebalanceTimeout: 10000,
- rebalanceThrottle: 0,
- statisticsEnabled: false,
- managementEnabled: false,
- nearConfiguration: {
- nearStartSize: 375000
- },
- clientNearConfiguration: {
- nearStartSize: 375000
- },
- evictionPolicy: {
- LRU: {
- batchSize: 1,
- maxSize: 100000
- },
- FIFO: {
- batchSize: 1,
- maxSize: 100000
- },
- SORTED: {
- batchSize: 1,
- maxSize: 100000
- }
- },
- queryMetadata: 'Configuration',
- fields: {
- keyClsName: 'java.lang.String',
- valClsName: 'java.lang.String',
- valField: 'className',
- entries: []
- },
- aliases: {
- keyClsName: 'java.lang.String',
- valClsName: 'java.lang.String',
- keyField: 'field',
- valField: 'alias',
- entries: []
- },
- indexes: {
- indexType: {
- clsName: 'org.apache.ignite.cache.QueryIndexType'
- },
- fields: {
- keyClsName: 'java.lang.String',
- valClsName: 'java.lang.Boolean',
- valField: 'direction',
- entries: []
- }
- },
- typeField: {
- databaseFieldType: {
- clsName: 'java.sql.Types'
- }
- }
-};
-
-export default function() {
- this.append = (dflts) => {
- _.merge(DFLT_CACHE, dflts);
- };
-
- this.$get = [() => {
- return DFLT_CACHE;
- }];
-}
[24/37] ignite git commit: 1.8.0-SNAPSHOT
Posted by vo...@apache.org.
1.8.0-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5494dfb8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5494dfb8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5494dfb8
Branch: refs/heads/ignite-2.0
Commit: 5494dfb8dd222bf7aee8214b6bb201d3ae8a1ec5
Parents: 5769f44
Author: Ignite Teamcity <ig...@apache.org>
Authored: Tue Dec 27 14:50:58 2016 +0300
Committer: Ignite Teamcity <ig...@apache.org>
Committed: Tue Dec 27 14:50:58 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/configure.ac | 2 +-
modules/platforms/cpp/configure.acrel | 2 +-
modules/platforms/cpp/examples/configure.ac | 2 +-
modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs | 2 +-
modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs | 2 +-
.../dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs | 4 ++--
.../Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs | 4 ++--
.../Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs | 4 ++--
.../dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs | 4 ++--
.../platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs | 4 ++--
.../examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs | 4 ++--
.../Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs | 4 ++--
18 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/cpp/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/configure.ac b/modules/platforms/cpp/configure.ac
index 9dc9f52..500bdbf 100644
--- a/modules/platforms/cpp/configure.ac
+++ b/modules/platforms/cpp/configure.ac
@@ -19,7 +19,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([Apache Ignite C++], [1.8.0.14218], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
+AC_INIT([Apache Ignite C++], [1.8.0.16695], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/cpp/configure.acrel
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/configure.acrel b/modules/platforms/cpp/configure.acrel
index 036f124..984aa38 100644
--- a/modules/platforms/cpp/configure.acrel
+++ b/modules/platforms/cpp/configure.acrel
@@ -19,7 +19,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([Apache Ignite C++], [1.6.0.8653], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
+AC_INIT([Apache Ignite C++], [1.8.0.16695], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/cpp/examples/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/configure.ac b/modules/platforms/cpp/examples/configure.ac
index 82a3727..6f08490 100644
--- a/modules/platforms/cpp/examples/configure.ac
+++ b/modules/platforms/cpp/examples/configure.ac
@@ -19,7 +19,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([Apache Ignite C++ Examples], [1.8.0.14218], [dev@ignite.apache.org], [ignite-examples], [ignite.apache.org])
+AC_INIT([Apache Ignite C++ Examples], [1.8.0.16695], [dev@ignite.apache.org], [ignite-examples], [ignite.apache.org])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs b/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
index cb6ab54..2c12d9a 100644
--- a/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
+++ b/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
@@ -21,7 +21,7 @@
<Product Name='Apache Ignite ODBC 64-bit Driver' Manufacturer='The Apache Software Foundation'
Id='F3E308E4-910C-4AF5-82DE-2ACF4D64830E'
UpgradeCode='1D7AEFDF-6CD2-4FB5-88F2-811A89832D6D'
- Language='1033' Codepage='1252' Version='1.6.7.0'>
+ Language='1033' Codepage='1252' Version='1.8.0.16695'>
<Package Id='*' Keywords='Installer' Description="Apache Ignite ODBC 64-bit Driver Installer"
Comments='Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.'
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs b/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
index 6ee1cdf..9e77e2a 100644
--- a/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
+++ b/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
@@ -21,7 +21,7 @@
<Product Name='Apache Ignite ODBC 32-bit Driver' Manufacturer='The Apache Software Foundation'
Id='D39CBABA-1E21-4701-AA5C-91EDA07B383B'
UpgradeCode='743902A4-365C-424E-B226-5B2898A3941E'
- Language='1033' Codepage='1252' Version='1.6.7.0'>
+ Language='1033' Codepage='1252' Version='1.8.0.16695'>
<Package Id='*' Keywords='Installer' Description="Apache Ignite ODBC 32-bit Driver Installer"
Comments='Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.'
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
index afaa6f0..d6cb3df 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
@@ -35,8 +35,8 @@ using System.Runtime.InteropServices;
[assembly: Guid("18ea4c71-a11d-4ab1-8042-418f7559d84f")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
index 2a7da67..9bd5c47 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
@@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
[assembly: Guid("13ea96fc-cc83-4164-a7c0-4f30ed797460")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
index 85af146..91f79bd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
[assembly: Guid("8fae8395-7e91-411a-a78f-44d6d3fed0fc")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
index 34fca37..ad0e915 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
@@ -30,6 +30,6 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("134707f6-155d-47f6-9eb2-c67abbf3c009")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
index 4aa03f1..a8c4305 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
@@ -45,6 +45,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
index 9eb2e24..7bf322f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
[assembly: Guid("de8dd5cc-7c7f-4a09-80d5-7086d9416a7b")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
index 9fcbeb0..240f273 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
@@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
[assembly: Guid("97db45a8-f922-456a-a819-7b3c6e5e03ba")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
index d47bef9..76596da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
@@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5b571661-17f4-4f29-8c7d-0edb38ca9b55")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
index bb8e830..824252e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
@@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6f82d669-382e-4435-8092-68c4440146d8")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
index 50220d2..f28278c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
@@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6b58e4a-a2e9-4554-ad02-68ce6da5cfb7")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[assembly: CLSCompliant(true)]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
index 82e27b1..8503026 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
[assembly: Guid("0f9702ec-da7d-4ce5-b4b7-73310c885355")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
index 4f55039..5834c57 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@
[assembly: Guid("41a0cb95-3435-4c78-b867-900b28e2c9ee")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5494dfb8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
index 471e7e9..230e9d8 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@ using System.Reflection;
[assembly: Guid("ce65ec7c-d3cf-41ad-8f45-f90d5af68d77")]
-[assembly: AssemblyVersion("1.8.0.14218")]
-[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyVersion("1.8.0.16695")]
+[assembly: AssemblyFileVersion("1.8.0.16695")]
[assembly: AssemblyInformationalVersion("1.8.0")]
[07/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/services/Messages.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Messages.service.js b/modules/web-console/frontend/app/services/Messages.service.js
index e679488..fefdae9 100644
--- a/modules/web-console/frontend/app/services/Messages.service.js
+++ b/modules/web-console/frontend/app/services/Messages.service.js
@@ -24,6 +24,9 @@ export default ['IgniteMessages', ['$alert', ($alert) => {
prefix = prefix || '';
if (err) {
+ if (err.hasOwnProperty('data'))
+ err = err.data;
+
if (err.hasOwnProperty('message'))
return prefix + err.message;
@@ -38,26 +41,26 @@ export default ['IgniteMessages', ['$alert', ($alert) => {
msgModal.hide();
};
- const _showMessage = (err, type, duration, icon) => {
+ const _showMessage = (message, err, type, duration) => {
hideAlert();
- const title = errorMessage(null, err);
+ const title = err ? errorMessage(message, err) : errorMessage(null, message);
msgModal = $alert({type, title, duration});
- msgModal.$scope.icon = icon;
+ msgModal.$scope.icon = `icon-${type}`;
};
return {
errorMessage,
hideAlert,
- showError(err) {
- _showMessage(err, 'danger', 10, 'fa-exclamation-triangle');
+ showError(message, err) {
+ _showMessage(message, err, 'danger', 10);
return false;
},
- showInfo(err) {
- _showMessage(err, 'success', 3, 'fa-check-circle-o');
+ showInfo(message) {
+ _showMessage(message, null, 'success', 3);
}
};
}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/admin-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/admin-controller.js b/modules/web-console/frontend/controllers/admin-controller.js
index 7004301..cf7fd71 100644
--- a/modules/web-console/frontend/controllers/admin-controller.js
+++ b/modules/web-console/frontend/controllers/admin-controller.js
@@ -15,79 +15,220 @@
* limitations under the License.
*/
+const ICON_SORT = '<span ui-grid-one-bind-id-grid="col.uid + \'-sortdir-text\'" ui-grid-visible="col.sort.direction" aria-label="Sort Descending"><i ng-class="{ \'ui-grid-icon-up-dir\': col.sort.direction == asc, \'ui-grid-icon-down-dir\': col.sort.direction == desc, \'ui-grid-icon-blank\': !col.sort.direction }" title="" aria-hidden="true"></i></span>';
+
+const CLUSTER_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-sitemap'></i>${ICON_SORT}</div>`;
+const MODEL_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-object-group'></i>${ICON_SORT}</div>`;
+const CACHE_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-database'></i>${ICON_SORT}</div>`;
+const IGFS_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-folder-o'></i>${ICON_SORT}</div>`;
+
+const ACTIONS_TEMPLATE = `
+<div class='text-center ui-grid-cell-actions'>
+ <a class='btn btn-default dropdown-toggle' bs-dropdown='' ng-show='row.entity._id != $root.user._id' data-placement='bottom-right' data-container='.panel'>
+ <i class='fa fa-gear'></i>
+ <span class='caret'></span>
+ </a>
+ <ul class='dropdown-menu' role='menu'>
+ <li>
+ <a ng-click='grid.api.becomeUser(row.entity)'>Become this user</a>
+ </li>
+ <li>
+ <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='row.entity.admin && row.entity._id !== $root.user._id'>Revoke admin</a>
+ <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='!row.entity.admin && row.entity._id !== $root.user._id'>Grant admin</a>
+ </li>
+ <li>
+ <a ng-click='grid.api.removeUser(row.entity)'>Remove user</a>
+ </li>
+</div>`;
+
+const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
+
// Controller for Admin screen.
export default ['adminController', [
- '$rootScope', '$scope', '$http', '$q', '$state', 'IgniteMessages', 'IgniteConfirm', 'User', 'IgniteNotebookData', 'IgniteCountries',
- ($rootScope, $scope, $http, $q, $state, Messages, Confirm, User, Notebook, Countries) => {
+ '$rootScope', '$scope', '$http', '$q', '$state', '$filter', 'uiGridConstants', 'IgniteMessages', 'IgniteConfirm', 'User', 'IgniteNotebookData', 'IgniteCountries',
+ ($rootScope, $scope, $http, $q, $state, $filter, uiGridConstants, Messages, Confirm, User, Notebook, Countries) => {
$scope.users = null;
- const _reloadUsers = () => {
- $http.post('/api/v1/admin/list')
- .success((users) => {
- $scope.users = users;
+ const companySelectOptions = [];
+ const countrySelectOptions = [];
- _.forEach($scope.users, (user) => {
- user.userName = user.firstName + ' ' + user.lastName;
- user.countryCode = Countries.getByName(user.country).code;
- user.label = user.userName + ' ' + user.email + ' ' +
- (user.company || '') + ' ' + (user.countryCode || '');
- });
- })
- .error(Messages.showError);
- };
+ const COLUMNS_DEFS = [
+ {displayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'test', minWidth: 80, width: 80, enableFiltering: false, enableSorting: false},
+ {displayName: 'User', field: 'userName', minWidth: 65, enableFiltering: true, filter: { placeholder: 'Filter by name...' }},
+ {displayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
+ {displayName: 'Company', field: 'company', minWidth: 160, filter: {
+ selectOptions: companySelectOptions, type: uiGridConstants.filter.SELECT, condition: uiGridConstants.filter.EXACT }
+ },
+ {displayName: 'Country', field: 'countryCode', minWidth: 80, filter: {
+ selectOptions: countrySelectOptions, type: uiGridConstants.filter.SELECT, condition: uiGridConstants.filter.EXACT }
+ },
+ {displayName: 'Last login', field: 'lastLogin', cellFilter: 'date:"medium"', minWidth: 175, width: 175, enableFiltering: false, sort: { direction: 'desc', priority: 0 }},
+ {displayName: 'Clusters count', headerCellTemplate: CLUSTER_HEADER_TEMPLATE, field: '_clusters', type: 'number', headerTooltip: 'Clusters count', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Models count', headerCellTemplate: MODEL_HEADER_TEMPLATE, field: '_models', type: 'number', headerTooltip: 'Models count', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Caches count', headerCellTemplate: CACHE_HEADER_TEMPLATE, field: '_caches', type: 'number', headerTooltip: 'Caches count', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'IGFS count', headerCellTemplate: IGFS_HEADER_TEMPLATE, field: '_igfs', type: 'number', headerTooltip: 'IGFS count', minWidth: 50, width: 50, enableFiltering: false}
+ ];
- _reloadUsers();
+ const ctrl = $scope.ctrl = {};
- $scope.becomeUser = function(user) {
+ const becomeUser = function(user) {
$http.get('/api/v1/admin/become', { params: {viewedUserId: user._id}})
- .catch(({data}) => Promise.reject(data))
.then(() => User.load())
- .then((becomeUser) => {
- $rootScope.$broadcast('user', becomeUser);
-
- $state.go('base.configuration.clusters');
- })
+ .then(() => $state.go('base.configuration.clusters'))
.then(() => Notebook.load())
.catch(Messages.showError);
};
- $scope.removeUser = (user) => {
- Confirm.confirm('Are you sure you want to remove user: "' + user.userName + '"?')
+ const removeUser = (user) => {
+ Confirm.confirm(`Are you sure you want to remove user: "${user.userName}"?`)
.then(() => {
$http.post('/api/v1/admin/remove', {userId: user._id})
- .success(() => {
+ .then(() => {
const i = _.findIndex($scope.users, (u) => u._id === user._id);
if (i >= 0)
$scope.users.splice(i, 1);
- Messages.showInfo('User has been removed: "' + user.userName + '"');
+ Messages.showInfo(`User has been removed: "${user.userName}"`);
})
- .error((err, status) => {
+ .catch(({data, status}) => {
if (status === 503)
- Messages.showInfo(err);
+ Messages.showInfo(data);
else
- Messages.showError(Messages.errorMessage('Failed to remove user: ', err));
+ Messages.showError('Failed to remove user: ', data);
});
});
};
- $scope.toggleAdmin = (user) => {
+ const toggleAdmin = (user) => {
if (user.adminChanging)
return;
user.adminChanging = true;
$http.post('/api/v1/admin/save', {userId: user._id, adminFlag: !user.admin})
- .success(() => {
+ .then(() => {
user.admin = !user.admin;
- Messages.showInfo('Admin right was successfully toggled for user: "' + user.userName + '"');
+ Messages.showInfo(`Admin right was successfully toggled for user: "${user.userName}"`);
})
- .error((err) => {
- Messages.showError(Messages.errorMessage('Failed to toggle admin right for user: ', err));
+ .catch((res) => {
+ Messages.showError('Failed to toggle admin right for user: ', res);
})
.finally(() => user.adminChanging = false);
};
+
+
+ ctrl.gridOptions = {
+ data: [],
+ columnVirtualizationThreshold: 30,
+ columnDefs: COLUMNS_DEFS,
+ categories: [
+ {name: 'Actions', visible: true, selectable: true},
+ {name: 'User', visible: true, selectable: true},
+ {name: 'Email', visible: true, selectable: true},
+ {name: 'Company', visible: true, selectable: true},
+ {name: 'Country', visible: true, selectable: true},
+ {name: 'Last login', visible: true, selectable: true},
+
+ {name: 'Clusters count', visible: true, selectable: true},
+ {name: 'Models count', visible: true, selectable: true},
+ {name: 'Caches count', visible: true, selectable: true},
+ {name: 'IGFS count', visible: true, selectable: true}
+ ],
+ enableFiltering: true,
+ enableRowSelection: false,
+ enableRowHeaderSelection: false,
+ enableColumnMenus: false,
+ multiSelect: false,
+ modifierKeysToMultiSelect: true,
+ noUnselect: true,
+ flatEntityAccess: true,
+ fastWatch: true,
+ onRegisterApi: (api) => {
+ ctrl.gridApi = api;
+
+ api.becomeUser = becomeUser;
+ api.removeUser = removeUser;
+ api.toggleAdmin = toggleAdmin;
+ }
+ };
+
+ /**
+ * Set grid height.
+ *
+ * @param {Number} rows Rows count.
+ * @private
+ */
+ const adjustHeight = (rows) => {
+ const height = Math.min(rows, 20) * 30 + 75;
+
+ // Remove header height.
+ ctrl.gridApi.grid.element.css('height', height + 'px');
+
+ ctrl.gridApi.core.handleWindowResize();
+ };
+
+ const usersToFilterOptions = (column) => {
+ return _.sortBy(
+ _.map(
+ _.groupBy($scope.users, (usr) => {
+ const fld = usr[column];
+
+ return _.isNil(fld) ? fld : fld.toUpperCase();
+ }),
+ (arr, value) => ({label: `${_.head(arr)[column] || 'Not set'} (${arr.length})`, value})
+ ),
+ 'value');
+ };
+
+ const _reloadUsers = () => {
+ $http.post('/api/v1/admin/list')
+ .then(({ data }) => {
+ $scope.users = data;
+
+ companySelectOptions.length = 0;
+ countrySelectOptions.length = 0;
+
+ _.forEach($scope.users, (user) => {
+ user.userName = user.firstName + ' ' + user.lastName;
+ user.countryCode = Countries.getByName(user.country).code;
+
+ user._clusters = user.counters.clusters;
+ user._models = user.counters.models;
+ user._caches = user.counters.caches;
+ user._igfs = user.counters.igfs;
+ });
+
+ companySelectOptions.push(...usersToFilterOptions('company'));
+ countrySelectOptions.push(...usersToFilterOptions('countryCode'));
+
+ $scope.ctrl.gridOptions.data = data;
+
+ adjustHeight(data.length);
+ })
+ .catch(Messages.showError);
+ };
+
+ _reloadUsers();
+
+ const _enableColumns = (categories, visible) => {
+ _.forEach(categories, (cat) => {
+ cat.visible = visible;
+
+ _.forEach(ctrl.gridOptions.columnDefs, (col) => {
+ if (col.displayName === cat.name)
+ col.visible = visible;
+ });
+ });
+
+ ctrl.gridApi.grid.refresh();
+ };
+
+ const _selectableColumns = () => _.filter(ctrl.gridOptions.categories, (cat) => cat.selectable);
+
+ ctrl.toggleColumns = (category, visible) => _enableColumns([category], visible);
+ ctrl.selectAllColumns = () => _enableColumns(_selectableColumns(), true);
+ ctrl.clearAllColumns = () => _enableColumns(_selectableColumns(), false);
}
]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/caches-controller.js b/modules/web-console/frontend/controllers/caches-controller.js
index 8c01173..e7521b5 100644
--- a/modules/web-console/frontend/controllers/caches-controller.js
+++ b/modules/web-console/frontend/controllers/caches-controller.js
@@ -467,14 +467,14 @@ export default ['cachesController', [
// Save cache in database.
function save(item) {
$http.post('/api/v1/configuration/caches/save', item)
- .success(function(_id) {
+ .then(({data}) => {
+ const _id = data;
+
item.label = _cacheLbl(item);
$scope.ui.inputForm.$setPristine();
- const idx = _.findIndex($scope.caches, function(cache) {
- return cache._id === _id;
- });
+ const idx = _.findIndex($scope.caches, {_id});
if (idx >= 0)
_.assign($scope.caches[idx], item);
@@ -487,21 +487,21 @@ export default ['cachesController', [
if (_.includes(item.clusters, cluster.value))
cluster.caches = _.union(cluster.caches, [_id]);
else
- _.remove(cluster.caches, (id) => id === _id);
+ _.pull(cluster.caches, _id);
});
_.forEach($scope.domains, (domain) => {
if (_.includes(item.domains, domain.value))
domain.meta.caches = _.union(domain.meta.caches, [_id]);
else
- _.remove(domain.meta.caches, (id) => id === _id);
+ _.pull(domain.meta.caches, _id);
});
$scope.selectItem(item);
Messages.showInfo('Cache "' + item.name + '" saved.');
})
- .error(Messages.showError);
+ .catch(Messages.showError);
}
// Save cache.
@@ -559,7 +559,7 @@ export default ['cachesController', [
const _id = selectedItem._id;
$http.post('/api/v1/configuration/caches/remove', {_id})
- .success(function() {
+ .then(() => {
Messages.showInfo('Cache has been removed: ' + selectedItem.name);
const caches = $scope.caches;
@@ -582,7 +582,7 @@ export default ['cachesController', [
_.forEach($scope.domains, (domain) => _.remove(domain.meta.caches, (id) => id === _id));
}
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
@@ -591,7 +591,7 @@ export default ['cachesController', [
Confirm.confirm('Are you sure you want to remove all caches?')
.then(function() {
$http.post('/api/v1/configuration/caches/remove/all')
- .success(function() {
+ .then(() => {
Messages.showInfo('All caches have been removed');
$scope.caches = [];
@@ -603,7 +603,7 @@ export default ['cachesController', [
$scope.ui.inputForm.$error = {};
$scope.ui.inputForm.$setPristine();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index f92a2f1..7f90b90 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -17,7 +17,7 @@
// Controller for Clusters screen.
export default ['clustersController', [
- '$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'igniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
+ '$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable, Resource, ErrorPopover, FormUtils) {
UnsavedChangesGuard.install($scope);
@@ -31,6 +31,12 @@ export default ['clustersController', [
cacheKeyConfiguration: [],
communication: {},
connector: {},
+ deploymentSpi: {
+ URI: {
+ uriList: [],
+ scanners: []
+ }
+ },
discovery: {
Cloud: {
regions: [],
@@ -38,6 +44,7 @@ export default ['clustersController', [
}
},
marshaller: {},
+ peerClassLoadingLocalClassPathExclude: [],
sslContextFactory: {
trustManagers: []
},
@@ -276,6 +283,16 @@ export default ['clustersController', [
if (!cluster.eventStorage)
cluster.eventStorage = { kind: 'Memory' };
+
+ if (!cluster.peerClassLoadingLocalClassPathExclude)
+ cluster.peerClassLoadingLocalClassPathExclude = [];
+
+ if (!cluster.deploymentSpi) {
+ cluster.deploymentSpi = {URI: {
+ uriList: [],
+ scanners: []
+ }};
+ }
});
if ($state.params.linkId)
@@ -699,17 +716,20 @@ export default ['clustersController', [
// Save cluster in database.
function save(item) {
$http.post('/api/v1/configuration/clusters/save', item)
- .success(function(_id) {
+ .then(({data}) => {
+ const _id = data;
+
item.label = _clusterLbl(item);
$scope.ui.inputForm.$setPristine();
- const idx = _.findIndex($scope.clusters, (cluster) => cluster._id === _id);
+ const idx = _.findIndex($scope.clusters, {_id});
if (idx >= 0)
_.assign($scope.clusters[idx], item);
else {
item._id = _id;
+
$scope.clusters.push(item);
}
@@ -717,21 +737,21 @@ export default ['clustersController', [
if (_.includes(item.caches, cache.value))
cache.cache.clusters = _.union(cache.cache.clusters, [_id]);
else
- _.remove(cache.cache.clusters, (id) => id === _id);
+ _.pull(cache.cache.clusters, _id);
});
_.forEach($scope.igfss, (igfs) => {
if (_.includes(item.igfss, igfs.value))
igfs.igfs.clusters = _.union(igfs.igfs.clusters, [_id]);
else
- _.remove(igfs.igfs.clusters, (id) => id === _id);
+ _.pull(igfs.igfs.clusters, _id);
});
$scope.selectItem(item);
- Messages.showInfo('Cluster "' + item.name + '" saved.');
+ Messages.showInfo(`Cluster "${item.name}" saved.`);
})
- .error(Messages.showError);
+ .catch(Messages.showError);
}
// Save cluster.
@@ -774,7 +794,7 @@ export default ['clustersController', [
const _id = selectedItem._id;
$http.post('/api/v1/configuration/clusters/remove', {_id})
- .success(function() {
+ .then(() => {
Messages.showInfo('Cluster has been removed: ' + selectedItem.name);
const clusters = $scope.clusters;
@@ -795,7 +815,7 @@ export default ['clustersController', [
_.forEach($scope.igfss, (igfs) => _.remove(igfs.igfs.clusters, (id) => id === _id));
}
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
@@ -804,7 +824,7 @@ export default ['clustersController', [
Confirm.confirm('Are you sure you want to remove all clusters?')
.then(function() {
$http.post('/api/v1/configuration/clusters/remove/all')
- .success(() => {
+ .then(() => {
Messages.showInfo('All clusters have been removed');
$scope.clusters = [];
@@ -816,7 +836,7 @@ export default ['clustersController', [
$scope.ui.inputForm.$error = {};
$scope.ui.inputForm.$setPristine();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 2d7b875..303110e 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -756,15 +756,15 @@ export default ['domainsController', [
Loading.start('importDomainFromDb');
$http.post('/api/v1/configuration/domains/save/batch', batch)
- .success(function(savedBatch) {
+ .then(({data}) => {
let lastItem;
const newItems = [];
- _.forEach(_mapCaches(savedBatch.generatedCaches), function(cache) {
+ _.forEach(_mapCaches(data.generatedCaches), function(cache) {
$scope.caches.push(cache);
});
- _.forEach(savedBatch.savedDomains, function(savedItem) {
+ _.forEach(data.savedDomains, function(savedItem) {
const idx = _.findIndex($scope.domains, function(domain) {
return domain._id === savedItem._id;
});
@@ -792,7 +792,7 @@ export default ['domainsController', [
$scope.ui.showValid = true;
})
- .error(Messages.showError)
+ .catch(Messages.showError)
.finally(() => {
Loading.finish('importDomainFromDb');
@@ -1382,10 +1382,10 @@ export default ['domainsController', [
item.kind = 'store';
$http.post('/api/v1/configuration/domains/save', item)
- .success(function(res) {
+ .then(({data}) => {
$scope.ui.inputForm.$setPristine();
- const savedMeta = res.savedDomains[0];
+ const savedMeta = data.savedDomains[0];
const idx = _.findIndex($scope.domains, function(domain) {
return domain._id === savedMeta._id;
@@ -1400,16 +1400,16 @@ export default ['domainsController', [
if (_.includes(item.caches, cache.value))
cache.cache.domains = _.union(cache.cache.domains, [savedMeta._id]);
else
- _.remove(cache.cache.domains, (id) => id === savedMeta._id);
+ _.pull(cache.cache.domains, savedMeta._id);
});
$scope.selectItem(savedMeta);
- Messages.showInfo('Domain model "' + item.valueType + '" saved.');
+ Messages.showInfo(`Domain model "${item.valueType}" saved.`);
_checkShowValidPresentation();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
}
// Save domain model.
@@ -1469,14 +1469,12 @@ export default ['domainsController', [
const _id = selectedItem._id;
$http.post('/api/v1/configuration/domains/remove', {_id})
- .success(function() {
+ .then(() => {
Messages.showInfo('Domain model has been removed: ' + selectedItem.valueType);
const domains = $scope.domains;
- const idx = _.findIndex(domains, function(domain) {
- return domain._id === _id;
- });
+ const idx = _.findIndex(domains, {_id});
if (idx >= 0) {
domains.splice(idx, 1);
@@ -1488,12 +1486,12 @@ export default ['domainsController', [
else
$scope.backupItem = emptyDomain;
- _.forEach($scope.caches, (cache) => _.remove(cache.cache.domains, (id) => id === _id));
+ _.forEach($scope.caches, (cache) => _.pull(cache.cache.domains, _id));
}
_checkShowValidPresentation();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
@@ -1504,7 +1502,7 @@ export default ['domainsController', [
Confirm.confirm('Are you sure you want to remove all domain models?')
.then(function() {
$http.post('/api/v1/configuration/domains/remove/all')
- .success(function() {
+ .then(() => {
Messages.showInfo('All domain models have been removed');
$scope.domains = [];
@@ -1516,7 +1514,7 @@ export default ['domainsController', [
$scope.ui.inputForm.$error = {};
$scope.ui.inputForm.$setPristine();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/igfs-controller.js b/modules/web-console/frontend/controllers/igfs-controller.js
index e505f1c..b3c6043 100644
--- a/modules/web-console/frontend/controllers/igfs-controller.js
+++ b/modules/web-console/frontend/controllers/igfs-controller.js
@@ -296,12 +296,12 @@ export default ['igfsController', [
// Save IGFS in database.
function save(item) {
$http.post('/api/v1/configuration/igfs/save', item)
- .success(function(_id) {
+ .then(({data}) => {
+ const _id = data;
+
$scope.ui.inputForm.$setPristine();
- const idx = _.findIndex($scope.igfss, function(igfs) {
- return igfs._id === _id;
- });
+ const idx = _.findIndex($scope.igfss, {_id});
if (idx >= 0)
_.assign($scope.igfss[idx], item);
@@ -312,9 +312,9 @@ export default ['igfsController', [
$scope.selectItem(item);
- Messages.showInfo('IGFS "' + item.name + '" saved.');
+ Messages.showInfo(`IGFS "${item.name}" saved.`);
})
- .error(Messages.showError);
+ .catch(Messages.showError);
}
// Save IGFS.
@@ -359,7 +359,7 @@ export default ['igfsController', [
const _id = selectedItem._id;
$http.post('/api/v1/configuration/igfs/remove', {_id})
- .success(function() {
+ .then(() => {
Messages.showInfo('IGFS has been removed: ' + selectedItem.name);
const igfss = $scope.igfss;
@@ -379,7 +379,7 @@ export default ['igfsController', [
$scope.backupItem = emptyIgfs;
}
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
@@ -390,7 +390,7 @@ export default ['igfsController', [
Confirm.confirm('Are you sure you want to remove all IGFS?')
.then(function() {
$http.post('/api/v1/configuration/igfs/remove/all')
- .success(function() {
+ .then(() => {
Messages.showInfo('All IGFS have been removed');
$scope.igfss = [];
@@ -398,7 +398,7 @@ export default ['igfsController', [
$scope.ui.inputForm.$error = {};
$scope.ui.inputForm.$setPristine();
})
- .error(Messages.showError);
+ .catch(Messages.showError);
});
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/controllers/profile-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/profile-controller.js b/modules/web-console/frontend/controllers/profile-controller.js
index fd595d9..87a8805 100644
--- a/modules/web-console/frontend/controllers/profile-controller.js
+++ b/modules/web-console/frontend/controllers/profile-controller.js
@@ -74,7 +74,6 @@ export default ['profileController', [
$scope.saveUser = () => {
$http.post('/api/v1/profile/save', $scope.user)
- .catch(({data}) => Promise.reject(data))
.then(User.load)
.then(() => {
if ($scope.expandedPassword)
@@ -89,7 +88,7 @@ export default ['profileController', [
$root.$broadcast('user', $scope.user);
})
- .catch((err) => Messages.showError(Messages.errorMessage('Failed to save profile: ', err)));
+ .catch((res) => Messages.showError('Failed to save profile: ', res));
};
}
]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
index 2463d24..7360ac4 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/webpack/common.js
@@ -20,7 +20,7 @@ import fs from 'fs';
import webpack from 'webpack';
import autoprefixer from 'autoprefixer-core';
import jade from 'jade';
-import progressPlugin from './plugins/progress';
+import ProgressBarPlugin from 'progress-bar-webpack-plugin';
import eslintFormatter from 'eslint-friendly-formatter';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
@@ -61,7 +61,6 @@ export default () => {
// Output system.
output: {
path: destDir,
- publicPath: './',
filename: '[name].js'
},
@@ -111,8 +110,10 @@ export default () => {
loader: 'babel-loader',
query: {
cacheDirectory: true,
- plugins: ['transform-runtime',
- 'add-module-exports'],
+ plugins: [
+ 'transform-runtime',
+ 'add-module-exports'
+ ],
presets: ['angular']
}
@@ -126,10 +127,8 @@ export default () => {
loader: development ? `style-loader!${stylesLoader}` : ExtractTextPlugin.extract('style-loader', stylesLoader)
},
{
- test: /\.(woff2|woff|ttf|eot|svg)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
- loaders: [
- `${assetsLoader}?name=assets/fonts/[name].[ext]`
- ]
+ test: /\.(ttf|eot|svg|woff(2)?)(\?v=[\d.]+)?(\?[a-z0-9#-]+)?$/,
+ loaders: [`${assetsLoader}?name=assets/fonts/[name].[ext]`]
},
{
test: /\.(jpe?g|png|gif)$/i,
@@ -186,7 +185,7 @@ export default () => {
},
favicon
}),
- progressPlugin
+ new ProgressBarPlugin()
]
};
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
index cad9133..34e1f6a 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
@@ -20,9 +20,8 @@ import webpack from 'webpack';
import {destDir, rootDir, srcDir} from '../../paths';
-const devServerHost = 'localhost';
+const backendPort = 3000;
const devServerPort = 9000;
-const devServerUrl = `http://${devServerHost}:${devServerPort}/`;
export default () => {
const plugins = [
@@ -31,11 +30,10 @@ export default () => {
return {
entry: {
- webpack: `webpack-dev-server/client?${devServerUrl}`,
app: [path.join(srcDir, 'app.js'), 'webpack/hot/only-dev-server']
},
output: {
- publicPath: devServerUrl
+ publicPath: `http://localhost:${devServerPort}/`
},
context: rootDir,
debug: true,
@@ -44,24 +42,22 @@ export default () => {
devServer: {
compress: true,
historyApiFallback: true,
- publicPath: '/',
contentBase: destDir,
- info: true,
hot: true,
inline: true,
proxy: {
'/socket.io': {
- target: 'http://localhost:3000',
+ target: `http://localhost:${backendPort}`,
changeOrigin: true,
ws: true
},
'/agents': {
- target: 'http://localhost:3000',
+ target: `http://localhost:${backendPort}`,
changeOrigin: true,
ws: true
},
'/api/v1/*': {
- target: 'http://localhost:3000',
+ target: `http://localhost:${backendPort}`,
changeOrigin: true,
pathRewrite: {
'^/api/v1': ''
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
index db66720..1194568 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/production.js
@@ -37,8 +37,7 @@ export default () => {
devtool: 'cheap-source-map',
output: {
publicPath: '/',
- filename: '[name].[chunkhash].js',
- path: destDir
+ filename: '[name].[chunkhash].js'
},
plugins
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/gulpfile.babel.js/webpack/plugins/progress.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/plugins/progress.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/plugins/progress.js
deleted file mode 100644
index 5f753c7..0000000
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/plugins/progress.js
+++ /dev/null
@@ -1,82 +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.
- */
-
-import ProgressPlugin from 'webpack/lib/ProgressPlugin';
-
-let chars = 0;
-let lastState = 0;
-let lastStateTime = 0;
-
-const outputStream = process.stdout;
-
-const _goToLineStart = (nextMessage) => {
- let str = '';
-
- for (; chars > nextMessage.length; chars--)
- str += '\b \b';
-
- chars = nextMessage.length;
-
- for (let i = 0; i < chars; i++)
- str += '\b';
-
- if (str)
- outputStream.write(str);
-};
-
-export default new ProgressPlugin((percentage, msg) => {
- let state = msg;
-
- if (percentage < 1) {
- percentage = Math.floor(percentage * 100);
-
- msg = percentage + '% ' + msg;
-
- if (percentage < 100)
- msg = ' ' + msg;
-
- if (percentage < 10)
- msg = ' ' + msg;
- }
-
- state = state.replace(/^\d+\/\d+\s+/, '');
-
- if (percentage === 0) {
- lastState = null;
- lastStateTime = (new Date()).getTime();
- }
- else if (state !== lastState || percentage === 1) {
- const now = (new Date()).getTime();
-
- if (lastState) {
- const stateMsg = (now - lastStateTime) + 'ms ' + lastState;
-
- _goToLineStart(stateMsg);
-
- outputStream.write(stateMsg + '\n');
-
- chars = 0;
- }
-
- lastState = state;
- lastStateTime = now;
- }
-
- _goToLineStart(msg);
-
- outputStream.write(msg);
-});
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index b511ca1..fd50d5b 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -29,97 +29,99 @@
"win32"
],
"dependencies": {
- "angular": "^1.5.5",
- "angular-acl": "^0.1.7",
- "angular-animate": "^1.5.5",
- "angular-aria": "^1.5.5",
- "angular-cookies": "^1.5.5",
- "angular-drag-and-drop-lists": "^1.4.0",
- "angular-gridster": "^0.13.3",
- "angular-motion": "^0.4.4",
- "angular-nvd3": "^1.0.7",
- "angular-retina": "^0.3.13",
- "angular-sanitize": "^1.5.5",
- "angular-smart-table": "^2.1.8",
- "angular-socket-io": "^0.7.0",
- "angular-strap": "^2.3.8",
- "angular-touch": "^1.5.5",
- "angular-tree-control": "^0.2.26",
- "angular-ui-grid": "^3.1.1",
- "angular-ui-router": "^0.3.1",
- "bootstrap-sass": "^3.3.6",
- "brace": "^0.8.0",
- "es6-promise": "^3.0.2",
- "file-saver": "^1.3.2",
- "font-awesome": "^4.6.3",
- "glob": "^7.0.3",
- "jquery": "^3.0.0",
- "jszip": "^3.0.0",
- "lodash": "^4.8.2",
- "nvd3": "^1.8.3",
- "raleway-webfont": "^3.0.1",
- "roboto-font": "^0.1.0",
- "socket.io-client": "^1.4.6",
- "ui-router-metatags": "^1.0.3"
+ "angular": "~1.5.9",
+ "angular-acl": "~0.1.7",
+ "angular-animate": "~1.5.9",
+ "angular-aria": "~1.5.9",
+ "angular-cookies": "~1.5.9",
+ "angular-drag-and-drop-lists": "~1.4.0",
+ "angular-gridster": "~0.13.3",
+ "angular-motion": "~0.4.4",
+ "angular-nvd3": "~1.0.9",
+ "angular-retina": "~0.3.13",
+ "angular-sanitize": "~1.5.9",
+ "angular-smart-table": "~2.1.8",
+ "angular-socket-io": "~0.7.0",
+ "angular-strap": "~2.3.8",
+ "angular-touch": "~1.5.9",
+ "angular-tree-control": "~0.2.26",
+ "angular-ui-grid": "~3.2.9",
+ "angular-ui-router": "~0.3.1",
+ "bootstrap-sass": "~3.3.6",
+ "brace": "~0.8.0",
+ "es6-promise": "~3.3.1",
+ "file-saver": "~1.3.2",
+ "font-awesome": "~4.7.0",
+ "glob": "~7.1.1",
+ "jquery": "~3.1.1",
+ "jszip": "~3.1.3",
+ "lodash": "~4.17.2",
+ "nvd3": "1.8.4",
+ "raleway-webfont": "~3.0.1",
+ "roboto-font": "~0.1.0",
+ "socket.io-client": "~1.7.2",
+ "ui-router-metatags": "~1.0.3"
},
"devDependencies": {
- "assets-webpack-plugin": "^3.2.0",
- "autoprefixer-core": "^6.0.1",
- "babel-core": "^6.7.6",
- "babel-eslint": "^7.0.0",
- "babel-loader": "^6.2.4",
- "babel-plugin-add-module-exports": "^0.2.1",
- "babel-plugin-transform-builtin-extend": "^1.1.0",
- "babel-plugin-transform-runtime": "^6.7.5",
- "babel-polyfill": "^6.7.4",
- "babel-preset-angular": "^6.0.15",
- "babel-preset-es2015": "^6.9.0",
- "babel-runtime": "^6.6.1",
- "chai": "^3.5.0",
- "cross-env": "^1.0.7",
- "css-loader": "^0.23.0",
- "eslint": "^3.0.0",
- "eslint-friendly-formatter": "^2.0.5",
- "eslint-loader": "^1.0.0",
- "expose-loader": "^0.7.1",
- "extract-text-webpack-plugin": "^1.0.1",
- "file-loader": "^0.9.0",
- "gulp": "^3.9.1",
- "gulp-eslint": "^3.0.0",
- "gulp-inject": "^4.0.0",
- "gulp-jade": "^1.1.0",
- "gulp-ll": "^1.0.4",
- "gulp-rimraf": "^0.2.0",
- "gulp-sequence": "^0.4.1",
- "gulp-util": "^3.0.7",
- "html-loader": "^0.4.3",
- "html-webpack-plugin": "^2.21.0",
- "jade": "^1.11.0",
+ "assets-webpack-plugin": "~3.5.0",
+ "autoprefixer-core": "~6.0.1",
+ "babel-core": "~6.20.0",
+ "babel-eslint": "~7.0.0",
+ "babel-loader": "~6.2.4",
+ "babel-plugin-add-module-exports": "~0.2.1",
+ "babel-plugin-transform-builtin-extend": "~1.1.0",
+ "babel-plugin-transform-runtime": "~6.15.0",
+ "babel-polyfill": "~6.20.0",
+ "babel-preset-angular": "~6.0.15",
+ "babel-preset-es2015": "~6.18.0",
+ "babel-runtime": "~6.20.0",
+ "chai": "~3.5.0",
+ "cross-env": "~1.0.7",
+ "css-loader": "~0.23.0",
+ "eslint": "~3.12.2",
+ "eslint-friendly-formatter": "~2.0.5",
+ "eslint-loader": "~1.6.1",
+ "expose-loader": "~0.7.1",
+ "extract-text-webpack-plugin": "~1.0.1",
+ "file-loader": "~0.9.0",
+ "gulp": "~3.9.1",
+ "gulp-eslint": "~3.0.0",
+ "gulp-inject": "~4.1.0",
+ "gulp-jade": "~1.1.0",
+ "gulp-ll": "~1.0.4",
+ "gulp-rimraf": "~0.2.0",
+ "gulp-sequence": "~0.4.1",
+ "gulp-util": "~3.0.7",
+ "html-loader": "~0.4.3",
+ "html-webpack-plugin": "~2.24.1",
+ "jade": "~1.11.0",
"jade-html-loader": "git://github.com/courcelan/jade-html-loader",
- "jasmine-core": "^2.4.1",
- "json-loader": "^0.5.4",
- "karma": "^0.13.22",
- "karma-babel-preprocessor": "^6.0.1",
- "karma-jasmine": "^1.0.2",
- "karma-mocha": "^1.0.1",
- "karma-mocha-reporter": "^2.2.0",
- "karma-phantomjs-launcher": "^1.0.0",
- "karma-teamcity-reporter": "^1.0.0",
- "karma-webpack": "^1.7.0",
+ "jasmine-core": "~2.5.2",
+ "json-loader": "~0.5.4",
+ "karma": "~0.13.22",
+ "karma-babel-preprocessor": "~6.0.1",
+ "karma-jasmine": "~1.1.0",
+ "karma-mocha": "~1.3.0",
+ "karma-mocha-reporter": "~2.2.0",
+ "karma-phantomjs-launcher": "~1.0.0",
+ "karma-teamcity-reporter": "~1.0.0",
+ "karma-webpack": "~1.8.0",
"mocha": "~2.5.3",
- "mocha-teamcity-reporter": "^1.0.0",
- "morgan": "^1.7.0",
- "ngtemplate-loader": "^1.3.1",
- "node-sass": "^3.4.2",
- "phantomjs-prebuilt": "^2.1.7",
- "postcss-loader": "^0.9.1",
- "require-dir": "^0.3.0",
- "resolve-url-loader": "^1.4.3",
- "sass-loader": "^3.1.1",
- "style-loader": "^0.13.1",
- "url": "^0.11.0",
- "url-loader": "^0.5.6",
- "webpack": "^1.13.1",
- "webpack-dev-server": "^1.15.0"
+ "mocha-teamcity-reporter": "~1.1.1",
+ "morgan": "~1.7.0",
+ "ngtemplate-loader": "~1.3.1",
+ "node-sass": "~3.13.1",
+ "phantomjs-prebuilt": "~2.1.7",
+ "postcss-loader": "~0.9.1",
+ "progress-bar-webpack-plugin": "~1.9.0",
+ "require-dir": "~0.3.0",
+ "resolve-url-loader": "~1.6.1",
+ "sass-loader": "~3.1.1",
+ "style-loader": "~0.13.1",
+ "url": "~0.11.0",
+ "url-loader": "~0.5.6",
+ "webpack": "~1.14.0",
+ "webpack-dev-server": "~1.16.2",
+ "worker-loader": "~0.7.1"
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/cache.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/cache.png b/modules/web-console/frontend/public/images/cache.png
index 83fd987..3ff3103 100644
Binary files a/modules/web-console/frontend/public/images/cache.png and b/modules/web-console/frontend/public/images/cache.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/domains.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/domains.png b/modules/web-console/frontend/public/images/domains.png
index 39abfcb..41c0470 100644
Binary files a/modules/web-console/frontend/public/images/domains.png and b/modules/web-console/frontend/public/images/domains.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/igfs.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/igfs.png b/modules/web-console/frontend/public/images/igfs.png
index 47c659e..b62c27b 100644
Binary files a/modules/web-console/frontend/public/images/igfs.png and b/modules/web-console/frontend/public/images/igfs.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/query-chart.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/query-chart.png b/modules/web-console/frontend/public/images/query-chart.png
index c6e4cce..1b7ef41 100644
Binary files a/modules/web-console/frontend/public/images/query-chart.png and b/modules/web-console/frontend/public/images/query-chart.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/query-metadata.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/query-metadata.png b/modules/web-console/frontend/public/images/query-metadata.png
index 698cd6e..1b6c73c 100644
Binary files a/modules/web-console/frontend/public/images/query-metadata.png and b/modules/web-console/frontend/public/images/query-metadata.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/query-table.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/query-table.png b/modules/web-console/frontend/public/images/query-table.png
index 53becda..4d63a68 100644
Binary files a/modules/web-console/frontend/public/images/query-table.png and b/modules/web-console/frontend/public/images/query-table.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/images/summary.png
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/summary.png b/modules/web-console/frontend/public/images/summary.png
index ff88438..fda0abf 100644
Binary files a/modules/web-console/frontend/public/images/summary.png and b/modules/web-console/frontend/public/images/summary.png differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss b/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
index 15ee60c..bfa6c6c 100644
--- a/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
+++ b/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
@@ -47,4 +47,25 @@ $fa-font-path: '~font-awesome/fonts';
@extend .fa-question-circle-o;
cursor: default;
-}
\ No newline at end of file
+}
+
+.icon-note {
+ @extend .fa;
+ @extend .fa-info-circle;
+
+ cursor: default;
+}
+
+.icon-danger {
+ @extend .fa;
+ @extend .fa-exclamation-triangle;
+
+ cursor: default;
+}
+
+.icon-success {
+ @extend .fa;
+ @extend .fa-check-circle-o;
+
+ cursor: default;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/stylesheets/form-field.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/form-field.scss b/modules/web-console/frontend/public/stylesheets/form-field.scss
index f126786..ae33d75 100644
--- a/modules/web-console/frontend/public/stylesheets/form-field.scss
+++ b/modules/web-console/frontend/public/stylesheets/form-field.scss
@@ -106,3 +106,40 @@
@include make-lg-column(8);
}
}
+
+.ignite-form-field {
+ &__btn {
+ overflow: hidden;
+
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+
+ &.btn {
+ float: right;
+ margin-right: 0;
+
+ line-height: 20px;
+ }
+
+ input {
+ position: absolute;
+ left: 100px;
+ }
+
+ input:checked + span {
+ color: $brand-info;
+ }
+ }
+
+ &__btn ~ &__btn {
+ border-right: 0;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ &__btn ~ .input-tip input {
+ border-right: 0;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 172abf4..4318fc2 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -227,7 +227,7 @@ ul.navbar-nav, .sidebar-nav {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-
+
&:hover,
&:focus {
text-decoration: none;
@@ -601,6 +601,10 @@ button.form-control {
.theme-line .notebook-header {
border-color: $gray-lighter;
+ button:last-child {
+ margin-right: 0;
+ }
+
h1 {
padding: 0;
margin: 0;
@@ -611,7 +615,7 @@ button.form-control {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
- margin-top: 5px;
+ height: 24px;
}
.btn-group {
@@ -637,7 +641,7 @@ button.form-control {
}
.theme-line .paragraphs {
- .panel-group .panel + .panel {
+ .panel-group .panel-paragraph + .panel-paragraph {
margin-top: 30px;
}
@@ -679,8 +683,14 @@ button.form-control {
line-height: 55px;
}
- .sql-controls {
+ .panel-collapse {
border-top: 1px solid $ignite-border-color;
+ }
+
+ .sql-controls {
+ position: relative;
+ top: -1px;
+ border-top: 1px solid #ddd;
padding: 10px 10px;
@@ -690,9 +700,50 @@ button.form-control {
}
label {
- line-height: 20px !important;
+ line-height: 28px;
vertical-align: middle;
}
+
+ .btn {
+ line-height: 20px;
+ }
+
+ .ignite-form-field {
+ margin-right: 10px;
+
+ .ignite-form-field__label {
+ float: left;
+ width: auto;
+ margin-right: 5px;
+ line-height: 28px;
+ }
+
+ .ignite-form-field__label + div {
+ display: block;
+ float: none;
+ width: auto;
+ }
+ }
+
+ .tipLabel .btn {
+ float: right;
+ }
+
+ .pull-right {
+ margin-left: 10px;
+
+ .ignite-form-field {
+ margin-right: -24px;
+
+ label {
+ margin-left: 5px;
+ }
+ }
+ }
+
+ .col-sm-3 + .tipLabel {
+ margin-left: 0;
+ }
}
.sql-result {
@@ -1243,6 +1294,17 @@ button.form-control {
.clickable { cursor: pointer; }
}
+
+.theme-line .summary {
+ .actions-note {
+ i {
+ margin-right: 5px;
+ }
+
+ margin: 15px 0;
+ }
+}
+
.theme-line .popover.summary-project-structure {
@extend .popover.settings;
@@ -1693,6 +1755,7 @@ th[st-sort] {
}
.chart-settings-link {
+ margin-top: -2px;
padding-left: 10px;
line-height: $input-height;
@@ -1991,6 +2054,10 @@ treecontrol.tree-classic {
margin-right: 0
}
+ .ui-grid-cell-actions {
+ line-height: 28px;
+ }
+
.no-rows {
.center-container {
background: white;
@@ -2226,3 +2293,37 @@ html,body,.splash-screen {
animation: none 0s;
}
}
+
+.admin-page {
+ .panel-heading {
+ border-bottom: 0;
+ padding-bottom: 0;
+
+ cursor: default;
+
+ i {
+ margin-right: 10px;
+ }
+
+ label {
+ cursor: default;
+ line-height: 24px;
+ }
+
+ sub {
+ bottom: 0;
+ }
+ }
+
+ .ui-grid-header-cell input {
+ font-weight: normal;
+ }
+
+ .ui-grid-header-cell input {
+ font-weight: normal;
+ }
+
+ .ui-grid-filter-select {
+ width: calc(100% - 10px);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/test/unit/JavaTypes.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/unit/JavaTypes.test.js b/modules/web-console/frontend/test/unit/JavaTypes.test.js
index 2df8c6a..49e78cc 100644
--- a/modules/web-console/frontend/test/unit/JavaTypes.test.js
+++ b/modules/web-console/frontend/test/unit/JavaTypes.test.js
@@ -17,11 +17,11 @@
import JavaTypes from '../../app/services/JavaTypes.service.js';
-import ClusterDflts from '../../app/modules/configuration/generator/defaults/cluster.provider';
-import CacheDflts from '../../app/modules/configuration/generator/defaults/cache.provider';
-import IgfsDflts from '../../app/modules/configuration/generator/defaults/igfs.provider';
+import ClusterDflts from '../../app/modules/configuration/generator/defaults/Cluster.service';
+import CacheDflts from '../../app/modules/configuration/generator/defaults/Cache.service';
+import IgfsDflts from '../../app/modules/configuration/generator/defaults/IGFS.service';
-const INSTANCE = new JavaTypes((new ClusterDflts()).$get[0](), (new CacheDflts()).$get[0](), (new IgfsDflts()).$get[0]());
+const INSTANCE = new JavaTypes(new ClusterDflts(), new CacheDflts(), new IgfsDflts());
import { assert } from 'chai';
@@ -58,9 +58,14 @@ suite('JavaTypesTestsSuite', () => {
test('shortClassName', () => {
assert.equal(INSTANCE.shortClassName('java.math.BigDecimal'), 'BigDecimal');
+ assert.equal(INSTANCE.shortClassName('BigDecimal'), 'BigDecimal');
assert.equal(INSTANCE.shortClassName('int'), 'int');
assert.equal(INSTANCE.shortClassName('java.lang.Integer'), 'Integer');
+ assert.equal(INSTANCE.shortClassName('Integer'), 'Integer');
assert.equal(INSTANCE.shortClassName('java.util.UUID'), 'UUID');
+ assert.equal(INSTANCE.shortClassName('java.sql.Date'), 'Date');
+ assert.equal(INSTANCE.shortClassName('Date'), 'Date');
+ assert.equal(INSTANCE.shortClassName('com.my.Abstract'), 'Abstract');
assert.equal(INSTANCE.shortClassName('Abstract'), 'Abstract');
});
@@ -113,8 +118,8 @@ suite('JavaTypesTestsSuite', () => {
assert.equal(INSTANCE.isKeyword(' '), false);
});
- test('isJavaPrimitive', () => {
- assert.equal(INSTANCE.isJavaPrimitive('boolean'), true);
+ test('isPrimitive', () => {
+ assert.equal(INSTANCE.isPrimitive('boolean'), true);
});
test('validUUID', () => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/test/unit/Version.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/unit/Version.test.js b/modules/web-console/frontend/test/unit/Version.test.js
index a67fde8..2d75ab5 100644
--- a/modules/web-console/frontend/test/unit/Version.test.js
+++ b/modules/web-console/frontend/test/unit/Version.test.js
@@ -39,7 +39,13 @@ suite('VersionServiceTestsSuite', () => {
});
test('Version a = b', () => {
- assert.equal(INSTANCE.compare('1.7.0', '1.7.0'), 0);
+ assert.equal(INSTANCE.compare('1.0.0', '1.0.0'), 0);
+ assert.equal(INSTANCE.compare('1.2.0', '1.2.0'), 0);
+ assert.equal(INSTANCE.compare('1.2.3', '1.2.3'), 0);
+
+ assert.equal(INSTANCE.compare('1.0.0-1', '1.0.0-1'), 0);
+ assert.equal(INSTANCE.compare('1.2.0-1', '1.2.0-1'), 0);
+ assert.equal(INSTANCE.compare('1.2.3-1', '1.2.3-1'), 0);
});
test('Version a < b', () => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/configuration/domains-import.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.jade b/modules/web-console/frontend/views/configuration/domains-import.jade
index e4f95bc..bbcb391 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.jade
+++ b/modules/web-console/frontend/views/configuration/domains-import.jade
@@ -62,7 +62,10 @@ mixin td-ellipses-lbl(w, lbl)
+ignite-form-field-dropdown('Driver JAR:', 'ui.selectedJdbcDriverJar', '"jdbcDriverJar"', false, true, false,
'Choose JDBC driver', '', 'jdbcDriverJars',
'Select appropriate JAR with JDBC driver<br> To add another driver you need to place it into "/jdbc-drivers" folder of Ignite Web Agent<br> Refer to Ignite Web Agent README.txt for for more information'
- )(data-container='.modal-domain-import')
+ )(
+ data-container='.modal-domain-import'
+ data-ignite-form-field-input-autofocus='true'
+ )
.settings-row.settings-row_small-label
+java-class('JDBC driver:', 'selectedPreset.jdbcDriverClass', '"jdbcDriverClass"', true, true, 'Fully qualified class name of JDBC driver that will be used to connect to database')
.settings-row.settings-row_small-label
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/configuration/summary.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/summary.jade b/modules/web-console/frontend/views/configuration/summary.jade
index 9a6e553..a04f0db 100644
--- a/modules/web-console/frontend/views/configuration/summary.jade
+++ b/modules/web-console/frontend/views/configuration/summary.jade
@@ -21,7 +21,7 @@ mixin hard-link(ref, txt)
.docs-header
h1 Configurations Summary
-.docs-body
+.docs-body.summary
ignite-information
ul
li Preview XML configurations for #[a(href='https://apacheignite.readme.io/docs/clients-vs-servers' target='_blank') server and client] nodes
@@ -29,7 +29,6 @@ mixin hard-link(ref, txt)
li Preview #[a(href='https://apacheignite.readme.io/docs/docker-deployment' target='_blank') Docker file]
li Preview POM dependencies
li Download ready-to-use Maven project
-
hr
.padding-dflt(ng-if='ui.ready && (!clusters || clusters.length == 0)')
| You have no clusters configured. Please configure them #[a(ui-sref='base.configuration.clusters') here].
@@ -37,13 +36,21 @@ mixin hard-link(ref, txt)
div(ng-show='clusters && clusters.length > 0' ignite-loading='summaryPage' ignite-loading-text='Loading summary screen...' ignite-loading-position='top')
+main-table('clusters', 'clustersView', 'clusterName', 'selectItem(row)', '{{$index + 1}}) {{row.name}}', 'name')
div(ng-show='selectedItem && contentVisible(displayedRows, selectedItem)')
- .padding-top-dflt(bs-affix)
- button.btn.btn-primary(id='download' ng-click='downloadConfiguration()' bs-tooltip='' data-title='Download project' data-placement='bottom') Download project
- .btn.btn-primary(bs-tooltip='' data-title='Preview generated project structure' data-placement='bottom')
- div(bs-popover data-template-url='/configuration/summary-project-structure.html', data-placement='bottom', data-trigger='click' data-auto-close='true')
- i.fa.fa-sitemap
- label.tipLabel Project structure
- button.btn.btn-primary(id='proprietary-jdbc-drivers' ng-if='downloadJdbcDriversVisible()' ng-click='downloadJdbcDrivers()' bs-tooltip='' data-title='Open proprietary JDBC drivers download pages' data-placement='bottom') Download JDBC drivers
+ .actions.padding-top-dflt(bs-affix)
+ div
+ button.btn.btn-primary(id='download' ng-click='downloadConfiguration()' bs-tooltip='' data-title='Download project' data-placement='bottom' ng-disabled='isPrepareDownloading')
+ div
+ i.fa.fa-fw.fa-download(ng-hide='isPrepareDownloading')
+ i.fa.fa-fw.fa-refresh.fa-spin(ng-show='isPrepareDownloading')
+ span.tipLabel Download project
+ button.btn.btn-primary(bs-tooltip='' data-title='Preview generated project structure' data-placement='bottom')
+ div(bs-popover data-template-url='/configuration/summary-project-structure.html', data-placement='bottom', data-trigger='click' data-auto-close='true')
+ i.fa.fa-sitemap
+ label.tipLabel Project structure
+ button.btn.btn-primary(id='proprietary-jdbc-drivers' ng-if='downloadJdbcDriversVisible()' ng-click='downloadJdbcDrivers()' bs-tooltip='' data-title='Open proprietary JDBC drivers download pages' data-placement='bottom') Download JDBC drivers
+ .actions-note(ng-show='ui.isSafari')
+ i.icon-note
+ label "Download project" is not fully supported in Safari. Please rename downloaded file from "Unknown" to "<project-name>.zip"
hr
.bs-affix-fix
.panel-group(bs-collapse ng-init='ui.activePanels=[0,1]' ng-model='ui.activePanels' data-allow-multiple='true')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/settings/admin.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/settings/admin.jade b/modules/web-console/frontend/views/settings/admin.jade
index 862d959..c985826 100644
--- a/modules/web-console/frontend/views/settings/admin.jade
+++ b/modules/web-console/frontend/views/settings/admin.jade
@@ -14,63 +14,38 @@
See the License for the specific language governing permissions and
limitations under the License.
-.row(ng-controller='adminController')
+mixin grid-settings()
+ i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
+ ul.select.dropdown-menu(role='menu')
+ li(ng-repeat='item in ctrl.gridOptions.categories|filter:{selectable:true}')
+ a(ng-click='ctrl.toggleColumns(item, !item.visible)')
+ i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
+ i.fa.fa-square-o.pull-left(ng-if='!item.visible')
+ span {{::item.name}}
+ li.divider
+ li
+ a(ng-click='ctrl.selectAllColumns()') Select all
+ li
+ a(ng-click='ctrl.clearAllColumns()') Clear all
+ li.divider
+ li
+ a(ng-click='$hide()') Close
+
+.admin-page.row(ng-controller='adminController')
.docs-content.greedy
.docs-header
h1 List of registered users
hr
.docs-body
- .col-xs-12
- table.table.table-striped.table-vertical-middle.admin(st-table='displayedUsers' st-safe-src='users')
- thead
- tr
- th.header(colspan='10')
- .col-xs-3
- input.form-control(type='text' st-search='label' placeholder='Filter users...')
- .col-xs-9.admin-summary.text-right(colspan='10')
- strong Total users: {{ users.length }}
- .col-xs-offset-6.col-xs-6.text-right
- div(st-pagination st-items-by-page='15' st-displayed-pages='5' st-template='../templates/pagination.html')
- tr
- th(st-sort='userName') User
- th(st-sort='email') Email
- th(st-sort='company') Company
- th(st-sort='country') Country
- th.col-xs-2(st-sort='lastLogin' st-sort-default='reverse') Last login
- th.text-nowrap(st-sort='counters.clusters' st-descending-first bs-tooltip='"Clusters count"' data-placement='top')
- i.fa.fa-sitemap()
- th.text-nowrap(st-sort='counters.models' st-descending-first bs-tooltip='"Models count"' data-placement='top')
- i.fa.fa-object-group()
- th.text-nowrap(st-sort='counters.caches' st-descending-first bs-tooltip='"Caches count"' data-placement='top')
- i.fa.fa-database()
- th.text-nowrap(st-sort='counters.igfs' st-descending-first bs-tooltip='"IGFS count"' data-placement='top')
- i.fa.fa-folder-o()
- th(width='1%') Actions
- tbody
- tr(ng-repeat='row in displayedUsers track by row._id')
- td {{::row.userName}}
- td
- a(ng-href='mailto:{{::row.email}}') {{::row.email}}
- td {{::row.company}}
- td {{::row.countryCode}}
- td {{::row.lastLogin | date:'medium'}}
- td {{::row.counters.clusters}}
- td {{::row.counters.models}}
- td {{::row.counters.caches}}
- td {{::row.counters.igfs}}
- td.text-center
- a.btn.btn-default.dropdown-toggle(bs-dropdown='' ng-show='row._id != user._id' data-placement='bottom-right')
- i.fa.fa-gear
- span.caret
- ul.dropdown-menu(role='menu')
- li
- a(ng-click='becomeUser(row)') Become this user
- li
- a(ng-click='toggleAdmin(row)' ng-if='row.admin && row._id !== user._id') Revoke admin
- a(ng-click='toggleAdmin(row)' ng-if='!row.admin && row._id !== user._id') Grant admin
- li
- a(ng-click='removeUser(row)') Remove user
- tfoot
- tr
- td.text-right(colspan='10')
- div(st-pagination st-items-by-page='15' st-displayed-pages='5' st-template='../templates/pagination.html')
+ .row
+ .col-xs-12
+ .panel.panel-default
+ .panel-heading.ui-grid-settings
+ +grid-settings
+ label Total users:
+ strong {{ users.length }}
+ label Showing users:
+ strong {{ ctrl.gridApi.grid.getVisibleRows().length }}
+ sub(ng-show='users.length === ctrl.gridApi.grid.getVisibleRows().length') all
+ .panel-collapse
+ .grid(ui-grid='ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-pinning)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/sql/notebook-new.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/notebook-new.jade b/modules/web-console/frontend/views/sql/notebook-new.jade
index 8d9e8c4..9585e92 100644
--- a/modules/web-console/frontend/views/sql/notebook-new.jade
+++ b/modules/web-console/frontend/views/sql/notebook-new.jade
@@ -21,7 +21,7 @@
button.close(ng-click='$hide()') ×
h4.modal-title
i.fa.fa-file-o
- | New SQL notebook
+ | New query notebook
form.form-horizontal.modal-body.row(name='ui.inputForm' novalidate)
div
.col-sm-2
[19/37] ignite git commit: Fixed broken links.
Posted by vo...@apache.org.
Fixed broken links.
(cherry picked from commit 6ca8670)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2da2816f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2da2816f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2da2816f
Branch: refs/heads/ignite-2.0
Commit: 2da2816fd74b17590f45781268337da5205c44fa
Parents: fb81910
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Fri Dec 23 18:58:47 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Dec 23 19:13:36 2016 +0700
----------------------------------------------------------------------
modules/core/src/main/java/org/apache/ignite/IgniteLogger.java | 6 +++---
.../main/java/org/apache/ignite/logger/java/JavaLogger.java | 4 ++--
.../testframework/junits/logger/GridTestLog4jLogger.java | 4 ++--
.../main/java/org/apache/ignite/logger/log4j/Log4JLogger.java | 4 ++--
.../org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2da2816f/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java b/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
index 8d814fd..b1433a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.Nullable;
/**
* This interface defines basic logging functionality used throughout the system. We had to
* abstract it out so that we can use whatever logging is used by the hosting environment.
- * Currently, <a target=_new href="http://logging.apache.org/log4j/docs/">log4j</a>,
- * <a target=_new href="http://www.jboss.org/developers/guides/logging">JBoss</a>,
+ * Currently, <a target=_new href="http://logging.apache.org/log4j/1.2/">log4j</a>,
+ * <a target=_new href="http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging">JBoss</a>,
* <a target=_new href="http://jakarta.apache.org/commons/logging/">JCL</a> and
* console logging are provided as supported implementations.
* <p>
@@ -158,4 +158,4 @@ public interface IgniteLogger {
* @return Name of the file being logged to if one is configured or {@code null} otherwise.
*/
public String fileName();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2da2816f/modules/core/src/main/java/org/apache/ignite/logger/java/JavaLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/logger/java/JavaLogger.java b/modules/core/src/main/java/org/apache/ignite/logger/java/JavaLogger.java
index d5ff5e3..6aa7d38 100644
--- a/modules/core/src/main/java/org/apache/ignite/logger/java/JavaLogger.java
+++ b/modules/core/src/main/java/org/apache/ignite/logger/java/JavaLogger.java
@@ -86,7 +86,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
* ...
* cfg.setGridLogger(log);
* </pre>
- * Please take a look at <a target=_new href="http://java.sun.com/j2se/1.4.2/docs/api20/java/util/logging/Logger.html">Logger javadoc</a>
+ * Please take a look at <a target=_new href="http://docs.oracle.com/javase/7/docs/api/java/util/logging/Logger.html">Logger javadoc</a>
* for additional information.
* <p>
* It's recommended to use Ignite logger injection instead of using/instantiating
@@ -406,4 +406,4 @@ public class JavaLogger implements IgniteLogger, LoggerNodeIdAware {
return null;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2da2816f/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
index 74f5160..6a46c7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
@@ -50,7 +50,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
/**
* Log4j-based implementation for logging. This logger should be used
- * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/docs/">log4j</a>-based logging.
+ * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/1.2/">log4j</a>-based logging.
* <p>
* Here is a typical example of configuring log4j logger in Ignite configuration file:
* <pre name="code" class="xml">
@@ -521,4 +521,4 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
@Override public String toString() {
return S.toString(GridTestLog4jLogger.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2da2816f/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
index eaae2d4..d5b0f02 100644
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -50,7 +50,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
/**
* Log4j-based implementation for logging. This logger should be used
- * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/docs/">log4j</a>-based logging.
+ * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/1.2/">log4j</a>-based logging.
* <p>
* Here is a typical example of configuring log4j logger in Ignite configuration file:
* <pre name="code" class="xml">
@@ -532,4 +532,4 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAw
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2da2816f/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
index 22d42db..30940e4 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
@@ -111,7 +111,7 @@ import org.jetbrains.annotations.Nullable;
* {@code META-INF/} entry may contain {@code ignite.xml} file which is a
* task descriptor file. The purpose of task descriptor XML file is to specify
* all tasks to be deployed. This file is a regular
- * <a href="http://www.springframework.org/documentation">Spring</a> XML
+ * <a href="https://spring.io/docs">Spring</a> XML
* definition file. {@code META-INF/} entry may also contain any other file
* specified by JAR format.
* </li>
[05/37] ignite git commit: AttributeNodeFilter: added
serialVersionUID.
Posted by vo...@apache.org.
AttributeNodeFilter: added serialVersionUID.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/babfc2f0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/babfc2f0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/babfc2f0
Branch: refs/heads/ignite-2.0
Commit: babfc2f051f8471f541bd054650a47cceb3cc09e
Parents: 6e71ef2
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 23 12:02:24 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Dec 23 12:02:24 2016 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/util/AttributeNodeFilter.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/babfc2f0/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java b/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
index e2b972b..fed0d43 100644
--- a/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
@@ -65,6 +65,9 @@ import org.jetbrains.annotations.Nullable;
* {@code cpu-group} and {@code memory-group} attributes set to value {@code high}.
*/
public class AttributeNodeFilter implements IgnitePredicate<ClusterNode> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** Attributes. */
private final Map<String, Object> attrs;
[14/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Custom.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Custom.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Custom.service.js
new file mode 100644
index 0000000..a185485
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Custom.service.js
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+// Optional content generation entry point.
+export default class IgniteCustomGenerator {
+ optionalContent(zip, cluster) { // eslint-disable-line no-unused-vars
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js
index f9776a2..bcfa2e2 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Docker.service.js
@@ -18,7 +18,7 @@
/**
* Docker file generation entry point.
*/
-class GeneratorDocker {
+export default class IgniteDockerGenerator {
/**
* Generate from section.
*
@@ -74,5 +74,3 @@ class GeneratorDocker {
].join('\n');
}
}
-
-export default ['GeneratorDocker', GeneratorDocker];
[03/37] ignite git commit: IGNITE-4408: Allow BinaryObjects pass to
IndexingSpi. This closes #1353.
Posted by vo...@apache.org.
IGNITE-4408: Allow BinaryObjects pass to IndexingSpi. This closes #1353.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/708cc8c6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/708cc8c6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/708cc8c6
Branch: refs/heads/ignite-2.0
Commit: 708cc8c6849b21063a555895671f6f820d92184a
Parents: c103ac3
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Thu Dec 22 12:48:58 2016 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu Dec 22 12:48:58 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 8 +
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 2 +-
.../processors/query/GridQueryProcessor.java | 36 +++-
.../apache/ignite/spi/indexing/IndexingSpi.java | 3 +
.../cache/query/IndexingSpiQuerySelfTest.java | 199 ++++++++++++++++++-
6 files changed, 229 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index de6cbed..fe78d88 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -500,6 +500,14 @@ public final class IgniteSystemProperties {
public static final String IGNITE_UNALIGNED_MEMORY_ACCESS = "IGNITE_UNALIGNED_MEMORY_ACCESS";
/**
+ * When set to {@code true} BinaryObject will be unwrapped before passing to IndexingSpi to preserve
+ * old behavior query processor with IndexingSpi.
+ * <p>
+ * @deprecated Should be removed in Apache Ignite 2.0.
+ */
+ public static final String IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI = "IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI";
+
+ /**
* Enforces singleton.
*/
private IgniteSystemProperties() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index f87fa1d..b9737c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -848,7 +848,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
*/
private void validate(Query qry) {
if (!GridQueryProcessor.isEnabled(ctx.config()) && !(qry instanceof ScanQuery) &&
- !(qry instanceof ContinuousQuery))
+ !(qry instanceof ContinuousQuery) && !(qry instanceof SpiQuery))
throw new CacheException("Indexing is disabled for cache: " + ctx.cache().name() +
". Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 2355591..b29e5e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -430,7 +430,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
* @throws IgniteCheckedException If query is invalid.
*/
public void validate() throws IgniteCheckedException {
- if ((type != SCAN && type != SET) && !GridQueryProcessor.isEnabled(cctx.config()))
+ if ((type != SCAN && type != SET && type != SPI) && !GridQueryProcessor.isEnabled(cctx.config()))
throw new IgniteCheckedException("Indexing is disabled for cache: " + cctx.cache().name());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 8befa0e..6c093ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -44,7 +44,7 @@ import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryType;
@@ -160,6 +160,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** */
private static final ThreadLocal<AffinityTopologyVersion> requestTopVer = new ThreadLocal<>();
+ /** Default is @{true} */
+ private final boolean isIndexingSpiAllowsBinary = !IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI);
+
/**
* @param ctx Kernal context.
*/
@@ -680,7 +683,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (ctx.indexing().enabled()) {
coctx = cacheObjectContext(space);
- ctx.indexing().store(space, key.value(coctx, false), val.value(coctx, false), expirationTime);
+ Object key0 = unwrap(key, coctx);
+
+ Object val0 = unwrap(val, coctx);
+
+ ctx.indexing().store(space, key0, val0, expirationTime);
}
if (idx == null)
@@ -736,6 +743,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * Unwrap CacheObject if needed.
+ */
+ private Object unwrap(CacheObject obj, CacheObjectContext coctx) {
+ return isIndexingSpiAllowsBinary && ctx.cacheObjects().isBinaryObject(obj) ? obj : obj.value(coctx, false);
+ }
+
+ /**
* @throws IgniteCheckedException If failed.
*/
private void checkEnabled() throws IgniteCheckedException {
@@ -1025,7 +1039,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (ctx.indexing().enabled()) {
CacheObjectContext coctx = cacheObjectContext(space);
- ctx.indexing().remove(space, key.value(coctx, false));
+ Object key0 = unwrap(key, coctx);
+
+ ctx.indexing().remove(space, key0);
}
if (idx == null)
@@ -1168,11 +1184,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (ctx.indexing().enabled()) {
CacheObjectContext coctx = cacheObjectContext(spaceName);
- ctx.indexing().onSwap(
- spaceName,
- key.value(
- coctx,
- false));
+ Object key0 = unwrap(key, coctx);
+
+ ctx.indexing().onSwap(spaceName, key0);
}
if (idx == null)
@@ -1207,7 +1221,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (ctx.indexing().enabled()) {
CacheObjectContext coctx = cacheObjectContext(spaceName);
- ctx.indexing().onUnswap(spaceName, key.value(coctx, false), val.value(coctx, false));
+ Object key0 = unwrap(key, coctx);
+
+ Object val0 = unwrap(val, coctx);
+
+ ctx.indexing().onUnswap(spaceName, key0, val0);
}
if (idx == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
index a3ea33e..bbe27c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java
@@ -35,6 +35,9 @@ import org.jetbrains.annotations.Nullable;
* methods. Note again that calling methods from this interface on the obtained instance can lead
* to undefined behavior and explicitly not supported.
*
+ * <b>NOTE:</b> Key and value arguments of IgniteSpi methods can be {@link org.apache.ignite.binary.BinaryObject} instances.
+ * BinaryObjects can be deserialized manually if original objects needed.
+ *
* Here is a Java example on how to configure SPI.
* <pre name="code" class="java">
* IndexingSpi spi = new MyIndexingSpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/708cc8c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
index 94b0c8a..f66b99e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
@@ -17,11 +17,22 @@
package org.apache.ignite.internal.processors.cache.query;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.Callable;
+import javax.cache.Cache;
import junit.framework.TestCase;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SpiQuery;
@@ -40,17 +51,9 @@ import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import org.apache.ignite.transactions.TransactionState;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.Callable;
-import javax.cache.Cache;
-
/**
* Indexing Spi query test
*/
@@ -88,6 +91,94 @@ public class IndexingSpiQuerySelfTest extends TestCase {
/**
* @throws Exception If failed.
*/
+ public void testIndexingSpiWithDisabledQueryProcessor() throws Exception {
+ IgniteConfiguration cfg = configuration();
+
+ cfg.setIndexingSpi(new MyIndexingSpi());
+
+ Ignite ignite = Ignition.start(cfg);
+
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>("test-cache");
+
+ IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);
+
+ for (int i = 0; i < 10; i++)
+ cache.put(i, i);
+
+ QueryCursor<Cache.Entry<Integer, Integer>> cursor = cache.query(new SpiQuery<Integer, Integer>().setArgs(2, 5));
+
+ for (Cache.Entry<Integer, Integer> entry : cursor)
+ System.out.println(entry);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBinaryIndexingSpi() throws Exception {
+ IgniteConfiguration cfg = configuration();
+
+ cfg.setIndexingSpi(new MyBinaryIndexingSpi());
+
+ Ignite ignite = Ignition.start(cfg);
+
+ CacheConfiguration<PersonKey, Person> ccfg = new CacheConfiguration<>("test-binary-cache");
+
+ ccfg.setIndexedTypes(PersonKey.class, Person.class);
+
+ IgniteCache<PersonKey, Person> cache = ignite.createCache(ccfg);
+
+ for (int i = 0; i < 10; i++) {
+ PersonKey key = new PersonKey(i);
+
+ cache.put(key, new Person("John Doe " + i));
+ }
+
+ QueryCursor<Cache.Entry<PersonKey, Person>> cursor = cache.query(
+ new SpiQuery<PersonKey, Person>().setArgs(new PersonKey(2), new PersonKey(5)));
+
+ for (Cache.Entry<PersonKey, Person> entry : cursor)
+ System.out.println(entry);
+
+ cache.remove(new PersonKey(9));
+ }
+
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNonBinaryIndexingSpi() throws Exception {
+ System.setProperty(IgniteSystemProperties.IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI, "true");
+
+ IgniteConfiguration cfg = configuration();
+
+ cfg.setIndexingSpi(new MyIndexingSpi());
+
+ Ignite ignite = Ignition.start(cfg);
+
+ CacheConfiguration<PersonKey, Person> ccfg = new CacheConfiguration<>("test-binary-cache");
+
+ ccfg.setIndexedTypes(PersonKey.class, Person.class);
+
+ IgniteCache<PersonKey, Person> cache = ignite.createCache(ccfg);
+
+ for (int i = 0; i < 10; i++) {
+ PersonKey key = new PersonKey(i);
+
+ cache.put(key, new Person("John Doe " + i));
+ }
+
+ QueryCursor<Cache.Entry<PersonKey, Person>> cursor = cache.query(
+ new SpiQuery<PersonKey, Person>().setArgs(new PersonKey(2), new PersonKey(5)));
+
+ for (Cache.Entry<PersonKey, Person> entry : cursor)
+ System.out.println(entry);
+
+ cache.remove(new PersonKey(9));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void testIndexingSpiFailure() throws Exception {
IgniteConfiguration cfg = configuration();
@@ -173,6 +264,9 @@ public class IndexingSpiQuerySelfTest extends TestCase {
Object from = paramsIt.next();
Object to = paramsIt.next();
+ from = from instanceof BinaryObject ? ((BinaryObject)from).deserialize() : from;
+ to = to instanceof BinaryObject ? ((BinaryObject)to).deserialize() : to;
+
SortedMap<Object, Object> map = idx.subMap(from, to);
Collection<Cache.Entry<?, ?>> res = new ArrayList<>(map.size());
@@ -186,6 +280,9 @@ public class IndexingSpiQuerySelfTest extends TestCase {
/** {@inheritDoc} */
@Override public void store(@Nullable String spaceName, Object key, Object val, long expirationTime)
throws IgniteSpiException {
+ assertFalse(key instanceof BinaryObject);
+ assertFalse(val instanceof BinaryObject);
+
idx.put(key, val);
}
@@ -206,13 +303,95 @@ public class IndexingSpiQuerySelfTest extends TestCase {
}
/**
+ * Indexing Spi implementation for test. Accepts binary objects only
+ */
+ private static class MyBinaryIndexingSpi extends MyIndexingSpi {
+
+ /** {@inheritDoc} */
+ @Override public void store(@Nullable String spaceName, Object key, Object val,
+ long expirationTime) throws IgniteSpiException {
+ assertTrue(key instanceof BinaryObject);
+
+ assertTrue(val instanceof BinaryObject);
+
+ super.store(spaceName, ((BinaryObject)key).deserialize(), ((BinaryObject)val).deserialize(), expirationTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException {
+ assertTrue(key instanceof BinaryObject);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException {
+ assertTrue(key instanceof BinaryObject);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException {
+ assertTrue(key instanceof BinaryObject);
+
+ assertTrue(val instanceof BinaryObject);
+ }
+ }
+
+ /**
* Broken Indexing Spi implementation for test
*/
- private class MyBrokenIndexingSpi extends MyIndexingSpi {
+ private static class MyBrokenIndexingSpi extends MyIndexingSpi {
/** {@inheritDoc} */
@Override public void store(@Nullable String spaceName, Object key, Object val,
long expirationTime) throws IgniteSpiException {
throw new IgniteSpiException("Test exception");
}
}
+
+ /**
+ *
+ */
+ private static class PersonKey implements Serializable, Comparable<PersonKey> {
+ /** */
+ private int id;
+
+ /** */
+ public PersonKey(int id) {
+ this.id = id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int compareTo(@NotNull PersonKey o) {
+ return Integer.compare(id, o.id);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ PersonKey key = (PersonKey)o;
+
+ return id == key.id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class Person implements Serializable {
+ /** */
+ private String name;
+
+ /** */
+ Person(String name) {
+ this.name = name;
+ }
+ }
}
\ No newline at end of file
[22/37] ignite git commit: ignite-4167 Do not log cache key/values
Posted by vo...@apache.org.
ignite-4167 Do not log cache key/values
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9273e51c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9273e51c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9273e51c
Branch: refs/heads/ignite-2.0
Commit: 9273e51cd039049a4aae73f9dcafc02915bc6153
Parents: 2ccae40
Author: Alexandr Kuramshin <ak...@gridgain.com>
Authored: Mon Dec 26 13:23:28 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Dec 26 13:23:28 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 5 +
.../ignite/cache/affinity/AffinityKey.java | 4 +-
.../org/apache/ignite/events/CacheEvent.java | 6 +-
.../ignite/events/CacheQueryReadEvent.java | 8 +-
.../internal/binary/BinaryEnumObjectImpl.java | 10 +-
.../ignite/internal/binary/BinaryMetadata.java | 5 +-
.../internal/binary/BinaryObjectExImpl.java | 8 +-
.../cache/CacheInvokeDirectResult.java | 2 +-
.../processors/cache/CacheInvokeResult.java | 2 +-
.../processors/cache/CacheLazyEntry.java | 4 +-
.../processors/cache/CacheObjectAdapter.java | 7 +-
.../processors/cache/GridCacheAdapter.java | 5 +-
.../cache/GridCacheMvccCandidate.java | 9 +-
.../processors/cache/GridCacheReturn.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 2 +-
.../distributed/near/GridNearLockFuture.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 2 +
.../cache/query/GridCacheQueryManager.java | 13 +-
.../cache/query/GridCacheQueryRequest.java | 2 +
.../cache/query/GridCacheSqlQuery.java | 4 +-
.../continuous/CacheContinuousQueryEvent.java | 8 +-
.../continuous/CacheContinuousQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 30 +-
.../cache/store/GridCacheWriteBehindStore.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 11 +-
.../GridCacheVersionConflictContext.java | 2 +-
.../closure/GridClosureProcessor.java | 4 +-
.../continuous/GridContinuousMessage.java | 2 +-
.../datastructures/CollocatedSetItemKey.java | 2 +-
.../GridCacheAtomicLongValue.java | 2 +
.../GridCacheAtomicSequenceImpl.java | 2 +
.../GridCacheAtomicSequenceValue.java | 2 +
.../GridCacheCountDownLatchValue.java | 3 +
.../datastructures/GridCacheSetItemKey.java | 2 +-
.../internal/processors/job/GridJobWorker.java | 7 +-
.../odbc/OdbcQueryExecuteRequest.java | 6 +-
.../platform/PlatformNativeException.java | 3 +-
.../processors/rest/GridRestResponse.java | 2 +-
.../internal/util/future/GridFutureAdapter.java | 2 +-
.../util/lang/GridMetadataAwareAdapter.java | 2 +-
.../util/tostring/GridToStringBuilder.java | 642 +++++++++++++++++--
.../util/tostring/GridToStringInclude.java | 12 +-
.../util/tostring/GridToStringThreadLocal.java | 12 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 7 +-
.../tostring/GridToStringBuilderSelfTest.java | 33 +-
45 files changed, 776 insertions(+), 130 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index fe78d88..0da0f49 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -133,6 +133,11 @@ public final class IgniteSystemProperties {
public static final String IGNITE_QUIET = "IGNITE_QUIET";
/**
+ * Setting to {@code true} enables writing sensitive information in {@code toString()} output.
+ */
+ public static final String IGNITE_TO_STRING_INCLUDE_SENSITIVE = "IGNITE_TO_STRING_INCLUDE_SENSITIVE";
+
+ /**
* If this property is set to {@code true} (default) and Ignite is launched
* in verbose mode (see {@link #IGNITE_QUIET}) and no console appenders can be found
* in configuration, then default console appender will be added.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKey.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKey.java
index c745ed8..4215b05 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKey.java
@@ -60,12 +60,12 @@ public class AffinityKey<K> implements Externalizable {
private static final long serialVersionUID = 0L;
/** Key. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private K key;
/** Affinity key. */
@AffinityKeyMapped
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object affKey;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java b/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java
index 29aeb3d..30f4b37 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/CacheEvent.java
@@ -90,7 +90,7 @@ public class CacheEvent extends EventAdapter {
private int part;
/** Cache entry. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object key;
/** Event ID. */
@@ -102,11 +102,11 @@ public class CacheEvent extends EventAdapter {
private final Object lockId;
/** New value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final Object newVal;
/** Old value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final Object oldVal;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java b/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java
index 40c5dae..f63ed0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java
@@ -96,19 +96,19 @@ public class CacheQueryReadEvent<K, V> extends EventAdapter {
private final String taskName;
/** Key. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final K key;
/** Value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final V val;
/** Old value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final V oldVal;
/** Result row. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private final Object row;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 69de3f2..9fd6bc1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
@@ -195,6 +196,9 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
/** {@inheritDoc} */
@Override public String toString() {
+ if (!S.INCLUDE_SENSITIVE)
+ return ord >= 0 ? "BinaryEnum" : "null";
+
// 1. Try deserializing the object.
try {
Object val = deserialize();
@@ -216,12 +220,12 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
}
if (type != null)
- return type.typeName() + "[ordinal=" + ord + ']';
+ return S.toString(type.typeName(), "ordinal", ord, true);
else {
if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID)
- return "BinaryEnum[clsName=" + clsName + ", ordinal=" + ord + ']';
+ return S.toString("BinaryEnum", "clsName", clsName, true, "ordinal", ord, true);
else
- return "BinaryEnum[typeId=" + typeId + ", ordinal=" + ord + ']';
+ return S.toString("BinaryEnum", "typeId", typeId, true, "ordinal", ord, true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
index 0911d46..ec92b08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadata.java
@@ -42,16 +42,19 @@ public class BinaryMetadata implements Externalizable {
private static final long serialVersionUID = 0L;
/** Type ID. */
+ @GridToStringInclude(sensitive = true)
private int typeId;
/** Type name. */
+ @GridToStringInclude(sensitive = true)
private String typeName;
/** Recorded object fields. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Map<String, Integer> fields;
/** Affinity key field name. */
+ @GridToStringInclude(sensitive = true)
private String affKeyFieldName;
/** Schemas associated with type. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
index e15e770..5f1e3e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
@@ -29,6 +29,7 @@ import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -220,8 +221,11 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
meta = null;
}
- if (meta == null)
- return BinaryObject.class.getSimpleName() + " [idHash=" + idHash + ", hash=" + hash + ", typeId=" + typeId() + ']';
+ if (meta == null || !S.INCLUDE_SENSITIVE)
+ return S.toString(S.INCLUDE_SENSITIVE ? BinaryObject.class.getSimpleName() : "BinaryObject",
+ "idHash", idHash, false,
+ "hash", hash, false,
+ "typeId", typeId(), true);
handles.put(this, idHash);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
index 0d519f7..cc453f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeDirectResult.java
@@ -45,7 +45,7 @@ public class CacheInvokeDirectResult implements Message {
private CacheObject res;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
@GridDirectTransient
private Exception err;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
index 48dabb9..b51c136 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
@@ -36,7 +36,7 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externaliz
private static final long serialVersionUID = 0L;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private T res;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
index 02cccc7..be6019e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
@@ -36,11 +36,11 @@ public class CacheLazyEntry<K, V> extends CacheInterceptorEntry<K, V> {
protected CacheObject valObj;
/** Key. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
protected K key;
/** Value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
protected V val;
/** Keep binary flag. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
index 70f5ea6..09a5524 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
import java.nio.ByteBuffer;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -36,7 +37,7 @@ public abstract class CacheObjectAdapter implements CacheObject, Externalizable
private static final long serialVersionUID = 2006765505127197251L;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
@GridDirectTransient
protected Object val;
@@ -119,6 +120,8 @@ public abstract class CacheObjectAdapter implements CacheObject, Externalizable
/** {@inheritDoc} */
public String toString() {
- return getClass().getSimpleName() + " [val=" + val + ", hasValBytes=" + (valBytes != null) + ']';
+ return S.toString(S.INCLUDE_SENSITIVE ? getClass().getSimpleName() : "CacheObject",
+ "val", val, true,
+ "hasValBytes", valBytes != null, false);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 4d59d50..965c6d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -2571,7 +2571,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
@Override public String toString() {
- return "putxAsync [key=" + key + ", val=" + val + ", filter=" + filter + ']';
+ return S.toString("putxAsync",
+ "key", key, true,
+ "val", val, true,
+ "filter", filter, false);
}
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
index e9dd455..c60d6c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
@@ -36,7 +36,6 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.DHT_LOCAL;
@@ -665,10 +664,10 @@ public class GridCacheMvccCandidate implements Externalizable,
GridCacheMvccCandidate next = next();
return S.toString(GridCacheMvccCandidate.class, this,
- "key", parent == null ? null : parent.key(),
- "masks", Mask.toString(flags()),
- "prevVer", (prev == null ? null : prev.version()),
- "nextVer", (next == null ? null : next.version()));
+ "key", parent == null ? null : parent.key(), true,
+ "masks", Mask.toString(flags()), false,
+ "prevVer", prev == null ? null : prev.version(), false,
+ "nextVer", next == null ? null : next.version(), false);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index 29e74db..02c882c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -49,7 +49,7 @@ public class GridCacheReturn implements Externalizable, Message {
private static final long serialVersionUID = 0L;
/** Value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
@GridDirectTransient
private volatile Object v;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 35e6267..b2fb7b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -1166,7 +1166,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(PartitionEntrySet.class, this, "super", super.toString());
+ return S.toString(PartitionEntrySet.class, this, "super", super.toString(), true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index 2431379..7c98602 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1487,7 +1487,7 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
private ClusterNode node;
/** Keys. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Collection<KeyCacheObject> keys;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index b29e5e7..1fe263d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
import org.apache.ignite.internal.util.typedef.T2;
@@ -82,6 +83,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
private final String clsName;
/** */
+ @GridToStringInclude(sensitive = true)
private final String clause;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 1165157..85c01d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -1539,16 +1539,17 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
if (log.isDebugEnabled()) {
ClusterNode primaryNode = CU.primaryNode(cctx, key);
- log.debug("Record [key=" + key +
- ", val=" + val +
- ", incBackups=" + incBackups +
- ", priNode=" + (primaryNode != null ? U.id8(primaryNode.id()) : null) +
- ", node=" + U.id8(cctx.localNode().id()) + ']');
+ log.debug(S.toString("Record",
+ "key", key, true,
+ "val", val, true,
+ "incBackups", incBackups, false,
+ "priNode", primaryNode != null ? U.id8(primaryNode.id()) : null, false,
+ "node", U.id8(cctx.localNode().id()), false));
}
if (val == null) {
if (log.isDebugEnabled())
- log.debug("Unsuitable record value: " + val);
+ log.debug(S.toString("Unsuitable record value", "val", val, true));
continue;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index 60c4662..ed876a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -63,6 +64,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implements GridCache
private boolean fields;
/** */
+ @GridToStringInclude(sensitive = true)
private String clause;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index bb769c9..8256270 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -47,11 +47,11 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
public static final Object[] EMPTY_PARAMS = {};
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private String qry;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
@GridDirectTransient
private Object[] params;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
index db70e2e..eddf302 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEvent.java
@@ -99,9 +99,9 @@ class CacheContinuousQueryEvent<K, V> extends CacheQueryEntryEvent<K, V> {
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheContinuousQueryEvent.class, this,
- "evtType", getEventType(),
- "key", getKey(),
- "newVal", getValue(),
- "oldVal", getOldValue());
+ "evtType", getEventType(), false,
+ "key", getKey(), true,
+ "newVal", getValue(), true,
+ "oldVal", getOldValue(), true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index e2fbf52..91c1991 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -1209,11 +1209,11 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
private static final long serialVersionUID = 0L;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object key;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object val;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 024375e..11d9816 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -314,7 +314,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
Object storeKey = cctx.unwrapBinaryIfNeeded(key, !convertBinary());
if (log.isDebugEnabled())
- log.debug("Loading value from store for key: " + storeKey);
+ log.debug(S.toString("Loading value from store for key",
+ "key", storeKey, true));
sessionInit0(tx);
@@ -564,8 +565,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
key = cctx.unwrapBinaryIfNeeded(key, !convertBinary());
val = cctx.unwrapBinaryIfNeeded(val, !convertBinary());
- if (log.isDebugEnabled())
- log.debug("Storing value in cache store [key=" + key + ", val=" + val + ']');
+ if (log.isDebugEnabled()) {
+ log.debug(S.toString("Storing value in cache store",
+ "key", key, true,
+ "val", val, true));
+ }
sessionInit0(tx);
@@ -589,8 +593,11 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
sessionEnd0(tx, threwEx);
}
- if (log.isDebugEnabled())
- log.debug("Stored value in cache store [key=" + key + ", val=" + val + ']');
+ if (log.isDebugEnabled()) {
+ log.debug(S.toString("Stored value in cache store",
+ "key", key, true,
+ "val", val, true));
+ }
return true;
}
@@ -667,7 +674,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
key = cctx.unwrapBinaryIfNeeded(key, !convertBinary());
if (log.isDebugEnabled())
- log.debug("Removing value from cache store [key=" + key + ']');
+ log.debug(S.toString("Removing value from cache store", "key", key, true));
sessionInit0(tx);
@@ -692,7 +699,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
}
if (log.isDebugEnabled())
- log.debug("Removed value from cache store [key=" + key + ']');
+ log.debug(S.toString("Removed value from cache store", "key", key, true));
return true;
}
@@ -715,7 +722,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
Collection<Object> keys0 = cctx.unwrapBinariesIfNeeded(keys, !convertBinary());
if (log.isDebugEnabled())
- log.debug("Removing values from cache store [keys=" + keys0 + ']');
+ log.debug(S.toString("Removing values from cache store",
+ "keys", keys0, true));
sessionInit0(tx);
@@ -743,7 +751,8 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
}
if (log.isDebugEnabled())
- log.debug("Removed values from cache store [keys=" + keys0 + ']');
+ log.debug(S.toString("Removed values from cache store",
+ "keys", keys0, true));
return true;
}
@@ -1261,6 +1270,9 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
/** {@inheritDoc} */
public String toString() {
+ if (!S.INCLUDE_SENSITIVE)
+ return "[size=" + size() + "]";
+
Iterator<Cache.Entry<?, ?>> it = iterator();
if (!it.hasNext())
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
index 858d9a7..7e98793 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
@@ -908,7 +908,7 @@ public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, Lifecy
private static final long serialVersionUID = 0L;
/** Value. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Entry<? extends K, ? extends V> val;
/** Store operation. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 6d21dcf..e2f8438 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -83,6 +83,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiClosure;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -3331,10 +3332,12 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
assert keys0 != null;
- if (log.isDebugEnabled()) {
- log.debug("Called removeAllAsync(...) [tx=" + this + ", keys=" + keys0 + ", implicit=" + implicit +
- ", retval=" + retval + "]");
- }
+ if (log.isDebugEnabled())
+ log.debug(S.toString("Called removeAllAsync(...)",
+ "tx", this, false,
+ "keys", keys0, true,
+ "implicit", implicit, false,
+ "retval", retval, false));
try {
checkValid();
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
index 3849bf5..fa40206 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
@@ -178,7 +178,7 @@ public class GridCacheVersionConflictContext<K, V> {
/** {@inheritDoc} */
@Override public String toString() {
return state == State.MERGE ?
- S.toString(GridCacheVersionConflictContext.class, this, "mergeValue", mergeVal) :
+ S.toString(GridCacheVersionConflictContext.class, this, "mergeValue", mergeVal, true) :
S.toString(GridCacheVersionConflictContext.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index a07dbf8..20fb6a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1778,7 +1778,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
protected IgniteClosure<T, R> job;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private T arg;
/**
@@ -1843,7 +1843,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
protected IgniteClosure<T, R> job;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
protected T arg;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
index 0b629dd..91918c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
@@ -48,7 +48,7 @@ public class GridContinuousMessage implements Message {
private UUID routineId;
/** Optional message data. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
@GridDirectTransient
private Object data;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
index 94cffd4..5f38114 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
@@ -30,7 +30,7 @@ public class CollocatedSetItemKey implements SetItemKey {
private IgniteUuid setId;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object item;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongValue.java
index 42e43b6..5042672 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongValue.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -32,6 +33,7 @@ public final class GridCacheAtomicLongValue implements GridCacheInternal, Extern
private static final long serialVersionUID = 0L;
/** Value. */
+ @GridToStringInclude(sensitive = true)
private long val;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 7474f46..4f660b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -85,6 +86,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
private volatile GridCacheContext ctx;
/** Local value of sequence. */
+ @GridToStringInclude(sensitive = true)
private long locVal;
/** Upper bound of local counter. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceValue.java
index dd1a1d5..ee540d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceValue.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -32,6 +33,7 @@ public final class GridCacheAtomicSequenceValue implements GridCacheInternal, Ex
private static final long serialVersionUID = 0L;
/** Counter. */
+ @GridToStringInclude(sensitive = true)
private long val;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchValue.java
index 17a11af..ec996ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchValue.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -32,9 +33,11 @@ public final class GridCacheCountDownLatchValue implements GridCacheInternal, Ex
private static final long serialVersionUID = 0L;
/** Count. */
+ @GridToStringInclude(sensitive = true)
private int cnt;
/** Initial count. */
+ @GridToStringInclude(sensitive = true)
private int initCnt;
/** Auto delete flag. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
index 8b47b3d..4280891 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
@@ -37,7 +37,7 @@ public class GridCacheSetItemKey implements SetItemKey, Externalizable {
private IgniteUuid setId;
/** */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object item;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
index 9bee849..6a00d96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
@@ -566,8 +566,11 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
}
});
- if (log.isDebugEnabled())
- log.debug("Job execution has successfully finished [job=" + job + ", res=" + res + ']');
+ if (log.isDebugEnabled()) {
+ log.debug(S.toString("Job execution has successfully finished",
+ "job", job, false,
+ "res", res, true));
+ }
}
}
catch (IgniteException e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
index 1bcd41f..c0d1c60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
@@ -18,11 +18,10 @@
package org.apache.ignite.internal.processors.odbc;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
-import java.util.Arrays;
-
/**
* ODBC query execute request.
*/
@@ -31,6 +30,7 @@ public class OdbcQueryExecuteRequest extends OdbcRequest {
private final String cacheName;
/** Sql query. */
+ @GridToStringInclude(sensitive = true)
private final String sqlQry;
/** Sql query arguments. */
@@ -73,6 +73,6 @@ public class OdbcQueryExecuteRequest extends OdbcRequest {
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(OdbcQueryExecuteRequest.class, this, "args", Arrays.toString(args));
+ return S.toString(OdbcQueryExecuteRequest.class, this, "args", args, true);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNativeException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNativeException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNativeException.java
index a99664a..5c77cf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNativeException.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNativeException.java
@@ -72,6 +72,7 @@ public class PlatformNativeException extends PlatformException implements Extern
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(PlatformNativeException.class, this, "cause", cause);
+ return S.toString(PlatformNativeException.class, this,
+ "cause", S.INCLUDE_SENSITIVE ? cause : (cause == null ? "null" : cause.getClass().getSimpleName()));
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestResponse.java
index ecbc6c8..18d1ddf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestResponse.java
@@ -59,7 +59,7 @@ public class GridRestResponse implements Externalizable {
private String err;
/** Response object. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object obj;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
index 2cd534e..08c39c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
@@ -61,7 +61,7 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements
private byte resFlag;
/** Result. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object res;
/** Future start time. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMetadataAwareAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMetadataAwareAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMetadataAwareAdapter.java
index decc244..1983ea3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMetadataAwareAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMetadataAwareAdapter.java
@@ -67,7 +67,7 @@ public class GridMetadataAwareAdapter {
}
/** Attributes. */
- @GridToStringInclude
+ @GridToStringInclude(sensitive = true)
private Object[] data = null;
/**
[30/37] ignite git commit: For communication spi disabled
pairedConnections by default,
implemented NIO sessions balancing for this mode.
Posted by vo...@apache.org.
For communication spi disabled pairedConnections by default, implemented NIO sessions balancing for this mode.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/da5b68cc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/da5b68cc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/da5b68cc
Branch: refs/heads/ignite-2.0
Commit: da5b68cc89ba6eeff25beb66e3a4d8c2b9871ab3
Parents: 864a95e
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 29 15:46:59 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 29 15:46:59 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/util/nio/GridNioServer.java | 159 ++++++++++++++++---
.../communication/tcp/TcpCommunicationSpi.java | 20 +--
.../tcp/TcpCommunicationSpiMBean.java | 5 +-
...mmunicationBalancePairedConnectionsTest.java | 28 ++++
.../IgniteCommunicationBalanceTest.java | 25 ++-
...cMessageRecoveryNoPairedConnectionsTest.java | 47 ------
...micMessageRecoveryPairedConnectionsTest.java | 47 ++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 6 +-
8 files changed, 250 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index bc1f173..a59adba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -227,6 +227,9 @@ public class GridNioServer<T> {
/** */
private final IgniteRunnable balancer;
+ /** */
+ private final boolean readWriteSelectorsAssign;
+
/**
* @param addr Address.
* @param port Port.
@@ -250,7 +253,7 @@ public class GridNioServer<T> {
* @param writerFactory Writer factory.
* @param skipRecoveryPred Skip recovery predicate.
* @param msgQueueLsnr Message queue size listener.
- * @param balancing NIO sessions balancing flag.
+ * @param readWriteSelectorsAssign If {@code true} then in/out connections are assigned to even/odd workers.
* @param filters Filters for this server.
* @throws IgniteCheckedException If failed.
*/
@@ -275,7 +278,7 @@ public class GridNioServer<T> {
GridNioMessageWriterFactory writerFactory,
IgnitePredicate<Message> skipRecoveryPred,
IgniteBiInClosure<GridNioSession, Integer> msgQueueLsnr,
- boolean balancing,
+ boolean readWriteSelectorsAssign,
GridNioFilter... filters
) throws IgniteCheckedException {
if (port != -1)
@@ -300,6 +303,7 @@ public class GridNioServer<T> {
this.sndQueueLimit = sndQueueLimit;
this.msgQueueLsnr = msgQueueLsnr;
this.selectorSpins = selectorSpins;
+ this.readWriteSelectorsAssign = readWriteSelectorsAssign;
filterChain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
@@ -359,10 +363,16 @@ public class GridNioServer<T> {
IgniteRunnable balancer0 = null;
- if (balancing && balancePeriod > 0) {
+ if (balancePeriod > 0) {
boolean rndBalance = IgniteSystemProperties.getBoolean(IGNITE_IO_BALANCE_RANDOM_BALANCE, false);
- balancer0 = rndBalance ? new RandomBalancer() : new SizeBasedBalancer(balancePeriod);
+ if (rndBalance)
+ balancer0 = new RandomBalancer();
+ else {
+ balancer0 = readWriteSelectorsAssign ?
+ new ReadWriteSizeBasedBalancer(balancePeriod) :
+ new SizeBasedBalancer(balancePeriod);
+ }
}
this.balancer = balancer0;
@@ -823,21 +833,31 @@ public class GridNioServer<T> {
int balanceIdx;
if (workers > 1) {
- if (req.accepted()) {
- balanceIdx = readBalanceIdx;
+ if (readWriteSelectorsAssign) {
+ if (req.accepted()) {
+ balanceIdx = readBalanceIdx;
- readBalanceIdx += 2;
+ readBalanceIdx += 2;
- if (readBalanceIdx >= workers)
- readBalanceIdx = 0;
+ if (readBalanceIdx >= workers)
+ readBalanceIdx = 0;
+ }
+ else {
+ balanceIdx = writeBalanceIdx;
+
+ writeBalanceIdx += 2;
+
+ if (writeBalanceIdx >= workers)
+ writeBalanceIdx = 1;
+ }
}
else {
- balanceIdx = writeBalanceIdx;
+ balanceIdx = readBalanceIdx;
- writeBalanceIdx += 2;
+ readBalanceIdx++;
- if (writeBalanceIdx >= workers)
- writeBalanceIdx = 1;
+ if (readBalanceIdx >= workers)
+ readBalanceIdx = 0;
}
}
else
@@ -3124,8 +3144,8 @@ public class GridNioServer<T> {
/** */
private long selectorSpins;
- /** NIO sessions balancing flag. */
- private boolean balancing;
+ /** */
+ private boolean readWriteSelectorsAssign;
/**
* Finishes building the instance.
@@ -3155,7 +3175,7 @@ public class GridNioServer<T> {
writerFactory,
skipRecoveryPred,
msgQueueLsnr,
- balancing,
+ readWriteSelectorsAssign,
filters != null ? Arrays.copyOf(filters, filters.length) : EMPTY_FILTERS
);
@@ -3169,11 +3189,11 @@ public class GridNioServer<T> {
}
/**
- * @param balancing NIO sessions balancing flag.
+ * @param readWriteSelectorsAssign {@code True} to assign in/out connections even/odd workers.
* @return This for chaining.
*/
- public Builder<T> balancing(boolean balancing) {
- this.balancing = balancing;
+ public Builder<T> readWriteSelectorsAssign(boolean readWriteSelectorsAssign) {
+ this.readWriteSelectorsAssign = readWriteSelectorsAssign;
return this;
}
@@ -3415,7 +3435,7 @@ public class GridNioServer<T> {
/**
*
*/
- private class SizeBasedBalancer implements IgniteRunnable {
+ private class ReadWriteSizeBasedBalancer implements IgniteRunnable {
/** */
private static final long serialVersionUID = 0L;
@@ -3428,7 +3448,7 @@ public class GridNioServer<T> {
/**
* @param balancePeriod Period.
*/
- SizeBasedBalancer(long balancePeriod) {
+ ReadWriteSizeBasedBalancer(long balancePeriod) {
this.balancePeriod = balancePeriod;
}
@@ -3559,6 +3579,100 @@ public class GridNioServer<T> {
}
/**
+ *
+ */
+ private class SizeBasedBalancer implements IgniteRunnable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long lastBalance;
+
+ /** */
+ private final long balancePeriod;
+
+ /**
+ * @param balancePeriod Period.
+ */
+ SizeBasedBalancer(long balancePeriod) {
+ this.balancePeriod = balancePeriod;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ long now = U.currentTimeMillis();
+
+ if (lastBalance + balancePeriod < now) {
+ lastBalance = now;
+
+ long maxBytes0 = -1, minBytes0 = -1;
+ int maxBytesIdx = -1, minBytesIdx = -1;
+
+ for (int i = 0; i < clientWorkers.size(); i++) {
+ GridNioServer.AbstractNioClientWorker worker = clientWorkers.get(i);
+
+ int sesCnt = worker.workerSessions.size();
+
+ long bytes0 = worker.bytesRcvd0 + worker.bytesSent0;
+
+ if ((maxBytes0 == -1 || bytes0 > maxBytes0) && bytes0 > 0 && sesCnt > 1) {
+ maxBytes0 = bytes0;
+ maxBytesIdx = i;
+ }
+
+ if (minBytes0 == -1 || bytes0 < minBytes0) {
+ minBytes0 = bytes0;
+ minBytesIdx = i;
+ }
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Balancing data [min0=" + minBytes0 + ", minIdx=" + minBytesIdx +
+ ", max0=" + maxBytes0 + ", maxIdx=" + maxBytesIdx + ']');
+
+ if (maxBytes0 != -1 && minBytes0 != -1) {
+ GridSelectorNioSessionImpl ses = null;
+
+ long bytesDiff = maxBytes0 - minBytes0;
+ long delta = bytesDiff;
+ double threshold = bytesDiff * 0.9;
+
+ GridConcurrentHashSet<GridSelectorNioSessionImpl> sessions =
+ clientWorkers.get(maxBytesIdx).workerSessions;
+
+ for (GridSelectorNioSessionImpl ses0 : sessions) {
+ long bytesSent0 = ses0.bytesSent0();
+
+ if (bytesSent0 < threshold &&
+ (ses == null || delta > U.safeAbs(bytesSent0 - bytesDiff / 2))) {
+ ses = ses0;
+ delta = U.safeAbs(bytesSent0 - bytesDiff / 2);
+ }
+ }
+
+ if (ses != null) {
+ if (log.isDebugEnabled())
+ log.debug("Will move session to less loaded worker [ses=" + ses +
+ ", from=" + maxBytesIdx + ", to=" + minBytesIdx + ']');
+
+ moveSession(ses, maxBytesIdx, minBytesIdx);
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Unable to find session to move.");
+ }
+ }
+
+ for (int i = 0; i < clientWorkers.size(); i++) {
+ GridNioServer.AbstractNioClientWorker worker = clientWorkers.get(i);
+
+ worker.reset0();
+ }
+ }
+ }
+ }
+
+ /**
* For tests only.
*/
@SuppressWarnings("unchecked")
@@ -3625,6 +3739,9 @@ public class GridNioServer<T> {
*
*/
interface SessionChangeRequest {
+ /**
+ * @return Session.
+ */
GridNioSession session();
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index c35b5ef..ae0e6f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -293,7 +293,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/**
* Default count of selectors for TCP server equals to
- * {@code "Math.min(8, Runtime.getRuntime().availableProcessors())"}.
+ * {@code "Math.max(4, Runtime.getRuntime().availableProcessors() / 2)"}.
*/
public static final int DFLT_SELECTORS_CNT = Math.max(4, Runtime.getRuntime().availableProcessors() / 2);
@@ -979,7 +979,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
private IpcSharedMemoryServerEndpoint shmemSrv;
/** */
- private boolean usePairedConnections = true;
+ private boolean usePairedConnections;
/** */
private int connectionsPerNode = DFLT_CONN_PER_NODE;
@@ -1193,10 +1193,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
* Set this to {@code false} if each connection of {@link #getConnectionsPerNode()}
* should be used for outgoing and incoming messages. In this case total number
* of connections between local and each remote node is {@link #getConnectionsPerNode()}.
- * In this case load NIO selectors load
- * balancing of {@link GridNioServer} will be disabled.
* <p>
- * Default is {@code true}.
+ * Default is {@code false}.
*
* @param usePairedConnections {@code true} to use paired connections and {@code false} otherwise.
* @see #getConnectionsPerNode()
@@ -2057,16 +2055,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
.writerFactory(writerFactory)
.skipRecoveryPredicate(skipRecoveryPred)
.messageQueueSizeListener(queueSizeMonitor)
- .balancing(usePairedConnections) // Current balancing logic assumes separate in/out connections.
+ .readWriteSelectorsAssign(usePairedConnections)
.build();
boundTcpPort = port;
// Ack Port the TCP server was bound to.
- if (log.isInfoEnabled())
+ if (log.isInfoEnabled()) {
log.info("Successfully bound communication NIO server to TCP port " +
- "[port=" + boundTcpPort + ", locHost=" + locHost + ", selectorsCnt=" + selectorsCnt +
- ", selectorSpins=" + srvr.selectorSpins() + ']');
+ "[port=" + boundTcpPort +
+ ", locHost=" + locHost +
+ ", selectorsCnt=" + selectorsCnt +
+ ", selectorSpins=" + srvr.selectorSpins() +
+ ", pairedConn=" + usePairedConnections + ']');
+ }
srvr.idleTimeout(idleConnTimeout);
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
index c7a1a53..c56e18c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
@@ -51,10 +51,9 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
* is {@link #getConnectionsPerNode()} * 2.
* <p>
* Returns {@code false} if each connection of {@link #getConnectionsPerNode()}
- * should be used for outgoing and incoming messages. In this case load NIO selectors load
- * balancing of {@link GridNioServer} will be disabled.
+ * should be used for outgoing and incoming messages.
* <p>
- * Default is {@code true}.
+ * Default is {@code false}.
*
* @return {@code true} to use paired connections and {@code false} otherwise.
* @see #getConnectionsPerNode()
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalancePairedConnectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalancePairedConnectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalancePairedConnectionsTest.java
new file mode 100644
index 0000000..4544030
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalancePairedConnectionsTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.managers.communication;
+
+/**
+ *
+ */
+public class IgniteCommunicationBalancePairedConnectionsTest extends IgniteCommunicationBalanceTest {
+ /** {@inheritDoc} */
+ @Override protected boolean usePairedConnections() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceTest.java
index e142aef..4271417 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceTest.java
@@ -63,6 +63,7 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
commSpi.setSharedMemoryPort(-1);
commSpi.setConnectionsPerNode(connectionsPerNode());
+ commSpi.setUsePairedConnections(usePairedConnections());
if (selectors > 0)
commSpi.setSelectorsCount(selectors);
@@ -75,6 +76,13 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
}
/**
+ * @return Value for {@link TcpCommunicationSpi#setUsePairedConnections(boolean)}.
+ */
+ protected boolean usePairedConnections() {
+ return false;
+ }
+
+ /**
* @return Connections per node.
*/
protected int connectionsPerNode() {
@@ -97,7 +105,7 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
try {
selectors = 4;
- final int SRVS = 4;
+ final int SRVS = 6;
startGridsMultiThreaded(SRVS);
@@ -105,7 +113,7 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
final Ignite client = startGrid(SRVS);
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < SRVS; i++) {
ClusterNode node = client.cluster().node(ignite(i).cluster().localNode().id());
client.compute(client.cluster().forNode(node)).call(new DummyCallable(null));
@@ -151,7 +159,10 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
}
}
- return srv.readerMoveCount() > readMoveCnt && srv.writerMoveCount() > writeMoveCnt;
+ if (usePairedConnections())
+ return srv.readerMoveCount() > readMoveCnt && srv.writerMoveCount() > writeMoveCnt;
+ else
+ return srv.readerMoveCount() > readMoveCnt || srv.writerMoveCount() > writeMoveCnt;
}
}, 30_000);
@@ -165,8 +176,12 @@ public class IgniteCommunicationBalanceTest extends GridCommonAbstractTest {
", rc2=" + readMoveCnt2 +
", wc2=" + writeMoveCnt2 + ']');
- assertTrue(readMoveCnt2 > readMoveCnt1);
- assertTrue(writeMoveCnt2 > writeMoveCnt1);
+ if (usePairedConnections()) {
+ assertTrue(readMoveCnt2 > readMoveCnt1);
+ assertTrue(writeMoveCnt2 > writeMoveCnt1);
+ }
+ else
+ assertTrue(readMoveCnt2 > readMoveCnt1 || writeMoveCnt2 > writeMoveCnt1);
readMoveCnt1 = readMoveCnt2;
writeMoveCnt1 = writeMoveCnt2;
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest.java
deleted file mode 100644
index 71772ef..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest.java
+++ /dev/null
@@ -1,47 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- *
- */
-public class IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest extends IgniteCacheAtomicMessageRecoveryTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpCommunicationSpi commSpi = (TcpCommunicationSpi)cfg.getCommunicationSpi();
-
- assertTrue(commSpi.isUsePairedConnections());
-
- commSpi.setUsePairedConnections(false);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return ATOMIC;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.java
new file mode 100644
index 0000000..dffb966
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicMessageRecoveryPairedConnectionsTest extends IgniteCacheAtomicMessageRecoveryTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpCommunicationSpi commSpi = (TcpCommunicationSpi)cfg.getCommunicationSpi();
+
+ assertFalse(commSpi.isUsePairedConnections());
+
+ commSpi.setUsePairedConnections(true);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return ATOMIC;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/da5b68cc/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 1e73e79..092d95e 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -40,6 +40,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreTest;
import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreMultithreadedSelfTest;
import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreSelfTest;
import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceMultipleConnectionsTest;
+import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalancePairedConnectionsTest;
import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceTest;
import org.apache.ignite.internal.managers.communication.IgniteIoTestMessagesTest;
import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest;
@@ -134,7 +135,7 @@ import org.apache.ignite.internal.processors.cache.distributed.CacheAtomicNearUp
import org.apache.ignite.internal.processors.cache.distributed.CacheTxNearUpdateTopologyChangeTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCacheEntrySetIterationPreloadingSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecovery10ConnectionsTest;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryPairedConnectionsTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheConnectionRecovery10ConnectionsTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheConnectionRecoveryTest;
@@ -301,7 +302,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(GridCacheEntrySetIterationPreloadingSelfTest.class);
suite.addTestSuite(GridCacheMixedPartitionExchangeSelfTest.class);
suite.addTestSuite(IgniteCacheAtomicMessageRecoveryTest.class);
- suite.addTestSuite(IgniteCacheAtomicMessageRecoveryNoPairedConnectionsTest.class);
+ suite.addTestSuite(IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.class);
suite.addTestSuite(IgniteCacheAtomicMessageRecovery10ConnectionsTest.class);
suite.addTestSuite(IgniteCacheTxMessageRecoveryTest.class);
suite.addTestSuite(IgniteCacheMessageWriteTimeoutTest.class);
@@ -339,6 +340,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(IgniteVariousConnectionNumberTest.class);
suite.addTestSuite(IgniteCommunicationBalanceTest.class);
+ suite.addTestSuite(IgniteCommunicationBalancePairedConnectionsTest.class);
suite.addTestSuite(IgniteCommunicationBalanceMultipleConnectionsTest.class);
suite.addTestSuite(IgniteIoTestMessagesTest.class);
[27/37] ignite git commit: IGNITE-4442 Implemented cache affinity
configuration.
Posted by vo...@apache.org.
IGNITE-4442 Implemented cache affinity configuration.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f4a1e6ca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f4a1e6ca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f4a1e6ca
Branch: refs/heads/ignite-2.0
Commit: f4a1e6ca86bcc6054ca6066107ad58b6b19d665a
Parents: 828b9b6
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu Dec 29 14:48:45 2016 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Dec 29 14:48:45 2016 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/mongo.js | 19 +++++
.../generator/AbstractTransformer.js | 5 ++
.../modules/configuration/generator/Beans.js | 4 +
.../generator/ConfigurationGenerator.js | 36 +++++++++
.../states/configuration/caches/affinity.jade | 82 ++++++++++++++++++++
.../states/configuration/caches/memory.jade | 4 +-
.../frontend/views/configuration/caches.jade | 1 +
7 files changed, 149 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 58ab119..dd71f3a 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -140,6 +140,25 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
cacheMode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL']},
atomicityMode: {type: String, enum: ['ATOMIC', 'TRANSACTIONAL']},
+ affinity: {
+ kind: {type: String, enum: ['Default', 'Rendezvous', 'Fair', 'Custom']},
+ Rendezvous: {
+ affinityBackupFilter: String,
+ partitions: Number,
+ excludeNeighbors: Boolean
+ },
+ Fair: {
+ affinityBackupFilter: String,
+ partitions: Number,
+ excludeNeighbors: Boolean
+ },
+ Custom: {
+ className: String
+ }
+ },
+
+ affinityMapper: String,
+
nodeFilter: {
kind: {type: String, enum: ['Default', 'Exclude', 'IGFS', 'OnNodes', 'Custom']},
Exclude: {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/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 f5afe59..40d937e 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -211,6 +211,11 @@ export default class AbstractTransformer {
}
// Generate cache memory group.
+ static cacheAffinity(cache) {
+ return this.toSection(this.generator.cacheAffinity(cache));
+ }
+
+ // Generate cache memory group.
static cacheMemory(cache) {
return this.toSection(this.generator.cacheMemory(cache));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Beans.js b/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
index ca19342..0972eac 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
@@ -116,6 +116,10 @@ export class Bean extends EmptyBean {
return this._property(this.arguments, 'int', model, null, _.nonNil);
}
+ boolConstructorArgument(model) {
+ return this._property(this.arguments, 'boolean', model, null, _.nonNil);
+ }
+
classConstructorArgument(model) {
return this._property(this.arguments, 'java.lang.Class', model, null, _.nonEmpty);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/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 8770bf6..de2b750 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1453,6 +1453,41 @@ export default class IgniteConfigurationGenerator {
return ccfg;
}
+ // Generation of constructor for affinity function.
+ static cacheAffinityFunction(cls, func) {
+ const affBean = new Bean(cls, 'affinityFunction', func);
+
+ affBean.boolConstructorArgument('excludeNeighbors')
+ .intProperty('partitions')
+ .emptyBeanProperty('affinityBackupFilter');
+
+ return affBean;
+ }
+
+ // Generate cache memory group.
+ static cacheAffinity(cache, ccfg = this.cacheConfigurationBean(cache)) {
+ switch (_.get(cache, 'affinity.kind')) {
+ case 'Rendezvous':
+ ccfg.beanProperty('affinity', this.cacheAffinityFunction('org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction', cache.affinity.Rendezvous));
+
+ break;
+ case 'Fair':
+ ccfg.beanProperty('affinity', this.cacheAffinityFunction('org.apache.ignite.cache.affinity.fair.FairAffinityFunction', cache.affinity.Fair));
+
+ break;
+ case 'Custom':
+ ccfg.emptyBeanProperty('affinity.Custom.className', 'affinity');
+
+ break;
+ default:
+ // No-op.
+ }
+
+ ccfg.emptyBeanProperty('affinityMapper');
+
+ return ccfg;
+ }
+
// Generate cache memory group.
static cacheMemory(cache, ccfg = this.cacheConfigurationBean(cache)) {
ccfg.enumProperty('memoryMode');
@@ -1728,6 +1763,7 @@ export default class IgniteConfigurationGenerator {
static cacheConfiguration(cache, ccfg = this.cacheConfigurationBean(cache)) {
this.cacheGeneral(cache, ccfg);
+ this.cacheAffinity(cache, ccfg);
this.cacheMemory(cache, ccfg);
this.cacheQuery(cache, cache.domains, ccfg);
this.cacheStore(cache, cache.domains, ccfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.jade b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.jade
new file mode 100644
index 0000000..3c4746b
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.jade
@@ -0,0 +1,82 @@
+//-
+ 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.
+
+include /app/helpers/jade/mixins.jade
+
+-var form = 'affinity'
+-var model = 'backupItem'
+-var affModel = model + '.affinity'
+-var affMapModel = model + '.affinityMapper'
+-var rendezvousAff = affModel + '.kind === "Rendezvous"'
+-var fairAff = affModel + '.kind === "Fair"'
+-var customAff = affModel + '.kind === "Custom"'
+-var customAffMapper = affMapModel + '.kind === "Custom"'
+-var rendPartitionsRequired = rendezvousAff + ' && ' + affModel + '.Rendezvous.affinityBackupFilter'
+-var fairPartitionsRequired = fairAff + ' && ' + affModel + '.Fair.affinityBackupFilter'
+
+.panel.panel-default(ng-form=form novalidate)
+ .panel-heading(bs-collapse-toggle='' ng-click='ui.loadPanel("#{form}")')
+ ignite-form-panel-chevron
+ label Affinity Collocation
+ ignite-form-field-tooltip.tipLabel
+ | Collocate data with data to improve performance and scalability of your application#[br]
+ | #[a(href="http://apacheignite.gridgain.org/docs/affinity-collocation" target="_blank") More info]
+ ignite-form-revert
+ .panel-collapse(role='tabpanel' bs-collapse-target id=form)
+ .panel-body(ng-if='ui.isPanelLoaded("#{form}")')
+ .col-sm-6
+ .settings-row
+ +dropdown('Function:', affModel + '.kind', '"AffinityKind"', 'true', 'Default',
+ '[\
+ {value: "Rendezvous", label: "Rendezvous"},\
+ {value: "Fair", label: "Fair"},\
+ {value: "Custom", label: "Custom"},\
+ {value: undefined, label: "Default"}\
+ ]',
+ 'Key topology resolver to provide mapping from keys to nodes\
+ <ul>\
+ <li>Rendezvous - Based on Highest Random Weight algorithm<br/></li>\
+ <li>Fair - Tries to ensure that all nodes get equal number of partitions with minimum amount of reassignments between existing nodes<br/></li>\
+ <li>Custom - Custom implementation of key affinity fynction<br/></li>\
+ <li>Default - By default rendezvous affinity function with 1024 partitions is used<br/></li>\
+ </ul>')
+ .panel-details(ng-if=rendezvousAff)
+ .details-row
+ +number-required('Partitions', affModel + '.Rendezvous.partitions', '"RendPartitions"', 'true', rendPartitionsRequired, '1024', '1', 'Number of partitions')
+ .details-row
+ +java-class('Backup filter', affModel + '.Rendezvous.affinityBackupFilter', '"RendAffinityBackupFilter"', 'true', 'false',
+ 'Backups will be selected from all nodes that pass this filter')
+ .details-row
+ +checkbox('Exclude neighbors', affModel + '.Rendezvous.excludeNeighbors', '"RendExcludeNeighbors"',
+ 'Exclude same - host - neighbors from being backups of each other and specified number of backups')
+ .panel-details(ng-if=fairAff)
+ .details-row
+ +number-required('Partitions', affModel + '.Fair.partitions', '"FairPartitions"', 'true', fairPartitionsRequired, '256', '1', 'Number of partitions')
+ .details-row
+ +java-class('Backup filter', affModel + '.Fair.affinityBackupFilter', '"FairAffinityBackupFilter"', 'true', 'false',
+ 'Backups will be selected from all nodes that pass this filter')
+ .details-row
+ +checkbox('Exclude neighbors', affModel + '.Fair.excludeNeighbors', '"FairExcludeNeighbors"',
+ 'Exclude same - host - neighbors from being backups of each other and specified number of backups')
+ .panel-details(ng-if=customAff)
+ .details-row
+ +java-class('Class name:', affModel + '.Custom.className', '"AffCustomClassName"', 'true', customAff,
+ 'Custom key affinity function implementation class name')
+ .settings-row
+ +java-class('Mapper:', model + '.affinityMapper', '"AffMapCustomClassName"', 'true', 'false',
+ 'Provide custom affinity key for any given key')
+ .col-sm-6
+ +preview-xml-java(model, 'cacheAffinity')
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/modules/web-console/frontend/app/modules/states/configuration/caches/memory.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/memory.jade b/modules/web-console/frontend/app/modules/states/configuration/caches/memory.jade
index f2d3e2b..e8dfb3a 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/memory.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/memory.jade
@@ -61,7 +61,7 @@ include /app/helpers/jade/mixins.jade
Note that in this mode entries can be evicted only to swap\
</li>\
</ul>')
- .settings-row(data-ng-show=model + '.memoryMode !== "OFFHEAP_VALUES"')
+ .settings-row(ng-show=model + '.memoryMode !== "OFFHEAP_VALUES"')
+dropdown-required('Off-heap memory:', model + '.offHeapMode', '"offHeapMode"', 'true',
model + '.memoryMode === "OFFHEAP_TIERED"',
'Disabled',
@@ -76,7 +76,7 @@ include /app/helpers/jade/mixins.jade
<li>Limited - Off-heap storage has limited size</li>\
<li>Unlimited - Off-heap storage grow infinitely (it is up to user to properly add and remove entries from cache to ensure that off-heap storage does not grow infinitely)</li>\
</ul>')
- .settings-row(data-ng-if=model + '.offHeapMode === 1 && ' + model + '.memoryMode !== "OFFHEAP_VALUES"')
+ .settings-row(ng-if=model + '.offHeapMode === 1 && ' + model + '.memoryMode !== "OFFHEAP_VALUES"')
+number-required('Off-heap memory max size:', model + '.offHeapMaxMemory', '"offHeapMaxMemory"', 'true',
model + '.offHeapMode === 1', 'Enter off-heap memory size', '1',
'Maximum amount of memory available to off-heap storage in bytes')
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4a1e6ca/modules/web-console/frontend/views/configuration/caches.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/caches.jade b/modules/web-console/frontend/views/configuration/caches.jade
index 4a4cf2e..73a6309 100644
--- a/modules/web-console/frontend/views/configuration/caches.jade
+++ b/modules/web-console/frontend/views/configuration/caches.jade
@@ -44,6 +44,7 @@ include /app/helpers/jade/mixins.jade
+advanced-options-toggle-default
div(ng-show='ui.expanded')
+ include /app/modules/states/configuration/caches/affinity.jade
include /app/modules/states/configuration/caches/concurrency.jade
include /app/modules/states/configuration/caches/near-cache-client.jade
include /app/modules/states/configuration/caches/near-cache-server.jade
[36/37] ignite git commit: Merge branch 'ignite-1.7.5'
Posted by vo...@apache.org.
Merge branch 'ignite-1.7.5'
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
# modules/core/src/main/resources/META-INF/classnames.properties
# modules/platforms/cpp/configure.ac
# modules/platforms/cpp/configure.acrel
# modules/platforms/cpp/examples/configure.ac
# modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
# modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
# modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
# modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
# modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/beb242bc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/beb242bc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/beb242bc
Branch: refs/heads/ignite-2.0
Commit: beb242bc22aa7ca6c068fd59a09965fa5967177e
Parents: d62542b 6c38eb2
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jan 5 11:44:55 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jan 5 11:44:55 2017 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteLogger.java | 4 +-
.../apache/ignite/IgniteSystemProperties.java | 13 +
.../ignite/cache/affinity/AffinityKey.java | 4 +-
.../org/apache/ignite/events/CacheEvent.java | 6 +-
.../ignite/events/CacheQueryReadEvent.java | 8 +-
.../ignite/internal/binary/BinaryContext.java | 4 +-
.../internal/binary/BinaryEnumObjectImpl.java | 10 +-
.../ignite/internal/binary/BinaryMetadata.java | 5 +-
.../internal/binary/BinaryObjectExImpl.java | 8 +-
.../ignite/internal/binary/BinaryTypeProxy.java | 15 +-
.../ignite/internal/binary/BinaryUtils.java | 4 +-
.../cache/CacheInvokeDirectResult.java | 2 +-
.../processors/cache/CacheInvokeResult.java | 2 +-
.../processors/cache/CacheLazyEntry.java | 4 +-
.../processors/cache/CacheObjectAdapter.java | 7 +-
.../processors/cache/GridCacheAdapter.java | 5 +-
.../cache/GridCacheMvccCandidate.java | 9 +-
.../processors/cache/GridCacheReturn.java | 2 +-
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 2 +-
.../distributed/near/GridNearLockFuture.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 4 +-
.../cache/query/GridCacheQueryManager.java | 13 +-
.../cache/query/GridCacheQueryRequest.java | 2 +
.../cache/query/GridCacheSqlQuery.java | 4 +-
.../continuous/CacheContinuousQueryEvent.java | 8 +-
.../continuous/CacheContinuousQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 30 +-
.../cache/store/GridCacheWriteBehindStore.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 11 +-
.../GridCacheVersionConflictContext.java | 2 +-
.../closure/GridClosureProcessor.java | 4 +-
.../continuous/GridContinuousMessage.java | 2 +-
.../datastructures/CollocatedSetItemKey.java | 2 +-
.../GridCacheAtomicLongValue.java | 2 +
.../GridCacheAtomicSequenceImpl.java | 2 +
.../GridCacheAtomicSequenceValue.java | 2 +
.../GridCacheCountDownLatchValue.java | 3 +
.../datastructures/GridCacheSetItemKey.java | 2 +-
.../internal/processors/job/GridJobWorker.java | 7 +-
.../odbc/OdbcQueryExecuteRequest.java | 6 +-
.../platform/PlatformNativeException.java | 3 +-
.../processors/query/GridQueryProcessor.java | 35 +-
.../processors/rest/GridRestResponse.java | 2 +-
.../internal/util/future/GridFutureAdapter.java | 2 +-
.../util/lang/GridMetadataAwareAdapter.java | 2 +-
.../util/tostring/GridToStringBuilder.java | 656 +++++++++++++++++--
.../util/tostring/GridToStringInclude.java | 12 +-
.../util/tostring/GridToStringThreadLocal.java | 12 +-
.../query/VisorQueryScanSubstringFilter.java | 5 +-
.../internal/visor/query/VisorQueryUtils.java | 60 ++
.../apache/ignite/spi/indexing/IndexingSpi.java | 3 +
.../resources/META-INF/classnames.properties | 1 +
.../internal/binary/BinaryEnumsSelfTest.java | 18 +
.../GridCacheBinaryObjectsAbstractSelfTest.java | 7 +-
.../cache/query/IndexingSpiQuerySelfTest.java | 199 +++++-
.../tostring/GridToStringBuilderSelfTest.java | 33 +-
.../hadoop/impl/igfs/HadoopIgfsJclLogger.java | 9 +-
.../org/apache/ignite/logger/jcl/JclLogger.java | 9 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Query/CacheQueriesCodeConfigurationTest.cs | 4 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../apache/ignite/logger/slf4j/Slf4jLogger.java | 11 +-
64 files changed, 1145 insertions(+), 174 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 4d85c54,0da0f49..083bb72
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@@ -500,17 -502,17 +505,25 @@@ public final class IgniteSystemProperti
* <p>
* Defaults to {@code} false, meaning that unaligned access will be performed only on x86 architecture.
*/
- public static final String IGNITE_UNALIGNED_MEMORY_ACCESS = "IGNITE_UNALIGNED_MEMORY_ACCESS";
+ public static final String IGNITE_MEMORY_UNALIGNED_ACCESS = "IGNITE_MEMORY_UNALIGNED_ACCESS";
+
+ /**
+ * When unsafe memory copy if performed below this threshold, Ignite will do it on per-byte basis instead of
+ * calling to Unsafe.copyMemory().
+ * <p>
+ * Defaults to 0, meaning that threshold is disabled.
+ */
+ public static final String IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD = "IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD";
/**
+ * When set to {@code true} BinaryObject will be unwrapped before passing to IndexingSpi to preserve
+ * old behavior query processor with IndexingSpi.
+ * <p>
+ * @deprecated Should be removed in Apache Ignite 2.0.
+ */
+ public static final String IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI = "IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI";
+
+ /**
* Enforces singleton.
*/
private IgniteSystemProperties() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
index b80f573,5f1e3e9..5b5aeba
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
@@@ -27,9 -26,10 +27,10 @@@ import org.apache.ignite.binary.BinaryA
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryIdentityResolver;
import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
-import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
+ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 1594cee,6c093ee..58f94f4
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@@ -44,9 -44,9 +44,10 @@@ import javax.cache.Cache
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.cache.CacheTypeMetadata;
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --cc modules/core/src/main/resources/META-INF/classnames.properties
index 4d0b931,8a6dc66..212e94a
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@@ -724,11 -719,9 +724,12 @@@ org.apache.ignite.internal.processors.c
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3
+ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 2a177ff,bf72782..c9f50d1
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@@ -65,10 -58,9 +65,11 @@@ import org.apache.ignite.binary.BinaryF
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.MapCacheStoreStrategy;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P2;
import org.apache.ignite.internal.util.typedef.internal.CU;
+ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
index 1bca0e8,d6cb3df..f5fa618
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
@@@ -1,4 -1,4 +1,4 @@@
--\ufeff/*
++\ufeff\ufeff/*
* 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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
index 0926a46,9bd5c47..d72c9db
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
@@@ -1,4 -1,4 +1,4 @@@
--\ufeff/*
++\ufeff\ufeff/*
* 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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/beb242bc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
index 1fc6c59,7bf322f..cc833ea
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
@@@ -1,19 -1,19 +1,19 @@@
- \ufeff/*
-\ufeff\ufeff\ufeff\ufeff/*
- * 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.
- */
++\ufeff\ufeff/*
+* 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.
+*/
using System.Reflection;
using System.Runtime.InteropServices;
[13/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/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 b123ab5..9590779 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
@@ -158,7 +158,7 @@ const PREDEFINED_QUERIES = [
];
// Var name generator function.
-const beenNameSeed = () => {
+const beanNameSeed = () => {
let idx = '';
const names = [];
@@ -174,1551 +174,1577 @@ const beenNameSeed = () => {
};
};
-export default ['JavaTypes', 'igniteEventGroups', 'IgniteConfigurationGenerator', (JavaTypes, eventGroups, generator) => {
- class JavaTransformer extends AbstractTransformer {
- static generator = generator;
-
- // Mapping for objects to method call.
- static METHOD_MAPPING = {
- 'org.apache.ignite.configuration.CacheConfiguration': {
- id: (ccfg) => JavaTypes.toJavaName('cache', ccfg.findProperty('name').value),
- args: '',
- generator: (sb, id, ccfg) => {
- const cacheName = ccfg.findProperty('name').value;
- const dataSources = JavaTransformer.collectDataSources(ccfg);
-
- const javadoc = [
- `Create configuration for cache "${cacheName}".`,
- '',
- '@return Configured cache.'
- ];
+export default class IgniteJavaTransformer extends AbstractTransformer {
+ // Mapping for objects to method call.
+ static METHOD_MAPPING = {
+ 'org.apache.ignite.configuration.CacheConfiguration': {
+ prefix: 'cache',
+ name: 'name',
+ args: '',
+ generator: (sb, id, ccfg) => {
+ const cacheName = ccfg.findProperty('name').value;
+ const dataSources = IgniteJavaTransformer.collectDataSources(ccfg);
+
+ const javadoc = [
+ `Create configuration for cache "${cacheName}".`,
+ '',
+ '@return Configured cache.'
+ ];
- if (dataSources.length)
- javadoc.push('@throws Exception if failed to create cache configuration.');
+ if (dataSources.length)
+ javadoc.push('@throws Exception if failed to create cache configuration.');
- JavaTransformer.commentBlock(sb, ...javadoc);
- sb.startBlock(`public static CacheConfiguration ${id}()${dataSources.length ? ' throws Exception' : ''} {`);
+ IgniteJavaTransformer.commentBlock(sb, ...javadoc);
+ sb.startBlock(`public static CacheConfiguration ${id}()${dataSources.length ? ' throws Exception' : ''} {`);
- JavaTransformer.constructBean(sb, ccfg, [], true);
+ IgniteJavaTransformer.constructBean(sb, ccfg, [], true);
- sb.emptyLine();
- sb.append(`return ${ccfg.id};`);
+ sb.emptyLine();
+ sb.append(`return ${ccfg.id};`);
- sb.endBlock('}');
+ sb.endBlock('}');
- return sb;
- }
- },
- 'org.apache.ignite.cache.store.jdbc.JdbcType': {
- id: (type) => JavaTypes.toJavaName('jdbcType', JavaTypes.shortClassName(type.findProperty('valueType').value)),
- args: 'ccfg.getName()',
- generator: (sb, name, jdbcType) => {
- const javadoc = [
- `Create JDBC type for "${name}".`,
- '',
- '@param cacheName Cache name.',
- '@return Configured JDBC type.'
- ];
+ return sb;
+ }
+ },
+ 'org.apache.ignite.cache.store.jdbc.JdbcType': {
+ prefix: 'jdbcType',
+ name: 'valueType',
+ args: 'ccfg.getName()',
+ generator: (sb, name, jdbcType) => {
+ const javadoc = [
+ `Create JDBC type for "${name}".`,
+ '',
+ '@param cacheName Cache name.',
+ '@return Configured JDBC type.'
+ ];
- JavaTransformer.commentBlock(sb, ...javadoc);
- sb.startBlock(`private static JdbcType ${name}(String cacheName) {`);
+ IgniteJavaTransformer.commentBlock(sb, ...javadoc);
+ sb.startBlock(`private static JdbcType ${name}(String cacheName) {`);
- const cacheName = jdbcType.findProperty('cacheName');
+ const cacheName = jdbcType.findProperty('cacheName');
- cacheName.clsName = 'var';
- cacheName.value = 'cacheName';
+ cacheName.clsName = 'var';
+ cacheName.value = 'cacheName';
- JavaTransformer.constructBean(sb, jdbcType);
+ IgniteJavaTransformer.constructBean(sb, jdbcType);
- sb.emptyLine();
- sb.append(`return ${jdbcType.id};`);
+ sb.emptyLine();
+ sb.append(`return ${jdbcType.id};`);
- sb.endBlock('}');
+ sb.endBlock('}');
- return sb;
- }
+ return sb;
}
- };
-
- // Append comment line.
- static comment(sb, ...lines) {
- _.forEach(lines, (line) => sb.append(`// ${line}`));
}
+ };
- // Append comment block.
- static commentBlock(sb, ...lines) {
- if (lines.length === 1)
- sb.append(`/** ${_.head(lines)} **/`);
- else {
- sb.append('/**');
+ // Append comment line.
+ static comment(sb, ...lines) {
+ _.forEach(lines, (line) => sb.append(`// ${line}`));
+ }
- _.forEach(lines, (line) => sb.append(` * ${line}`));
+ // Append comment block.
+ static commentBlock(sb, ...lines) {
+ if (lines.length === 1)
+ sb.append(`/** ${_.head(lines)} **/`);
+ else {
+ sb.append('/**');
- sb.append(' **/');
- }
+ _.forEach(lines, (line) => sb.append(` * ${line}`));
+
+ sb.append(' **/');
}
+ }
- /**
- * @param {Bean} bean
- */
- static _newBean(bean) {
- const shortClsName = JavaTypes.shortClassName(bean.clsName);
-
- if (_.isEmpty(bean.arguments))
- return `new ${shortClsName}()`;
-
- const args = _.map(bean.arguments, (arg) => {
- switch (arg.clsName) {
- case 'MAP':
- return arg.id;
- case 'BEAN':
- return this._newBean(arg.value);
- default:
- return this._toObject(arg.clsName, arg.value);
- }
- });
+ /**
+ * @param {Bean} bean
+ */
+ static _newBean(bean) {
+ const shortClsName = this.javaTypes.shortClassName(bean.clsName);
+
+ if (_.isEmpty(bean.arguments))
+ return `new ${shortClsName}()`;
+
+ const args = _.map(bean.arguments, (arg) => {
+ switch (arg.clsName) {
+ case 'MAP':
+ return arg.id;
+ case 'BEAN':
+ return this._newBean(arg.value);
+ default:
+ return this._toObject(arg.clsName, arg.value);
+ }
+ });
- if (bean.factoryMtd)
- return `${shortClsName}.${bean.factoryMtd}(${args.join(', ')})`;
+ if (bean.factoryMtd)
+ return `${shortClsName}.${bean.factoryMtd}(${args.join(', ')})`;
- return `new ${shortClsName}(${args.join(', ')})`;
- }
+ return `new ${shortClsName}(${args.join(', ')})`;
+ }
- /**
- * @param {StringBuilder} sb
- * @param {String} parentId
- * @param {String} propertyName
- * @param {String} value
- * @private
- */
- static _setProperty(sb, parentId, propertyName, value) {
- sb.append(`${parentId}.set${_.upperFirst(propertyName)}(${value});`);
- }
+ /**
+ * @param {StringBuilder} sb
+ * @param {String} parentId
+ * @param {String} propertyName
+ * @param {String} value
+ * @private
+ */
+ static _setProperty(sb, parentId, propertyName, value) {
+ sb.append(`${parentId}.set${_.upperFirst(propertyName)}(${value});`);
+ }
- /**
- * @param {StringBuilder} sb
- * @param {Array.<String>} vars
- * @param {Boolean} limitLines
- * @param {Bean} bean
- * @param {String} id
-
- * @private
- */
- static constructBean(sb, bean, vars = [], limitLines = false, id = bean.id) {
- _.forEach(bean.arguments, (arg) => {
- switch (arg.clsName) {
- case 'MAP':
- this._constructMap(sb, arg, vars);
+ /**
+ * @param {StringBuilder} sb
+ * @param {Array.<String>} vars
+ * @param {Boolean} limitLines
+ * @param {Bean} bean
+ * @param {String} id
+
+ * @private
+ */
+ static constructBean(sb, bean, vars = [], limitLines = false, id = bean.id) {
+ _.forEach(bean.arguments, (arg) => {
+ switch (arg.clsName) {
+ case 'MAP':
+ this._constructMap(sb, arg, vars);
- sb.emptyLine();
+ sb.emptyLine();
- break;
- default:
- if (this._isBean(arg.clsName) && arg.value.isComplex()) {
- this.constructBean(sb, arg.value, vars, limitLines);
+ break;
+ default:
+ if (this._isBean(arg.clsName) && arg.value.isComplex()) {
+ this.constructBean(sb, arg.value, vars, limitLines);
- sb.emptyLine();
- }
- }
- });
+ sb.emptyLine();
+ }
+ }
+ });
- const clsName = JavaTypes.shortClassName(bean.clsName);
+ const clsName = this.javaTypes.shortClassName(bean.clsName);
- sb.append(`${this.varInit(clsName, id, vars)} = ${this._newBean(bean)};`);
+ sb.append(`${this.varInit(clsName, id, vars)} = ${this._newBean(bean)};`);
- if (_.nonEmpty(bean.properties)) {
- sb.emptyLine();
+ if (_.nonEmpty(bean.properties)) {
+ sb.emptyLine();
- this._setProperties(sb, bean, vars, limitLines, id);
- }
+ this._setProperties(sb, bean, vars, limitLines, id);
}
+ }
- /**
- * @param {StringBuilder} sb
- * @param {Bean} bean
- * @param {Array.<String>} vars
- * @param {Boolean} limitLines
- * @private
- */
- static constructStoreFactory(sb, bean, vars, limitLines = false) {
- const shortClsName = JavaTypes.shortClassName(bean.clsName);
-
- if (_.includes(vars, bean.id))
- sb.append(`${bean.id} = ${this._newBean(bean)};`);
- else {
- vars.push(bean.id);
-
- sb.append(`${shortClsName} ${bean.id} = ${this._newBean(bean)};`);
- }
-
- sb.emptyLine();
+ /**
+ * @param {StringBuilder} sb
+ * @param {Bean} bean
+ * @param {Array.<String>} vars
+ * @param {Boolean} limitLines
+ * @private
+ */
+ static constructStoreFactory(sb, bean, vars, limitLines = false) {
+ const shortClsName = this.javaTypes.shortClassName(bean.clsName);
+
+ if (_.includes(vars, bean.id))
+ sb.append(`${bean.id} = ${this._newBean(bean)};`);
+ else {
+ vars.push(bean.id);
+
+ sb.append(`${shortClsName} ${bean.id} = ${this._newBean(bean)};`);
+ }
- sb.startBlock(`${bean.id}.setDataSourceFactory(new Factory<DataSource>() {`);
- this.commentBlock(sb, '{@inheritDoc}');
- sb.startBlock('@Override public DataSource create() {');
+ sb.emptyLine();
- sb.append(`return DataSources.INSTANCE_${bean.findProperty('dataSourceBean').id};`);
+ sb.startBlock(`${bean.id}.setDataSourceFactory(new Factory<DataSource>() {`);
+ this.commentBlock(sb, '{@inheritDoc}');
+ sb.startBlock('@Override public DataSource create() {');
- sb.endBlock('};');
- sb.endBlock('});');
+ sb.append(`return DataSources.INSTANCE_${bean.findProperty('dataSourceBean').id};`);
- const storeFactory = _.cloneDeep(bean);
+ sb.endBlock('};');
+ sb.endBlock('});');
- _.remove(storeFactory.properties, (p) => _.includes(['dataSourceBean'], p.name));
+ const storeFactory = _.cloneDeep(bean);
- if (storeFactory.properties.length) {
- sb.emptyLine();
+ _.remove(storeFactory.properties, (p) => _.includes(['dataSourceBean'], p.name));
- this._setProperties(sb, storeFactory, vars, limitLines);
- }
- }
+ if (storeFactory.properties.length) {
+ sb.emptyLine();
- static _isBean(clsName) {
- return JavaTypes.nonBuiltInClass(clsName) && JavaTypes.nonEnum(clsName) && _.includes(clsName, '.');
+ this._setProperties(sb, storeFactory, vars, limitLines);
}
+ }
- static _toObject(clsName, val) {
- const items = _.isArray(val) ? val : [val];
+ static _isBean(clsName) {
+ return this.javaTypes.nonBuiltInClass(clsName) && this.javaTypes.nonEnum(clsName) && _.includes(clsName, '.');
+ }
- return _.map(items, (item) => {
- if (_.isNil(item))
- return 'null';
+ static _toObject(clsName, val) {
+ const items = _.isArray(val) ? val : [val];
+
+ return _.map(items, (item) => {
+ if (_.isNil(item))
+ return 'null';
+
+ switch (clsName) {
+ case 'var':
+ return item;
+ case 'byte':
+ return `(byte) ${item}`;
+ case 'float':
+ return `${item}f`;
+ case 'long':
+ return `${item}L`;
+ case 'java.io.Serializable':
+ case 'java.lang.String':
+ return `"${item.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
+ case 'PATH':
+ return `"${item.replace(/\\/g, '\\\\')}"`;
+ case 'java.lang.Class':
+ return `${this.javaTypes.shortClassName(item)}.class`;
+ case 'java.util.UUID':
+ return `UUID.fromString("${item}")`;
+ case 'PROPERTY':
+ return `props.getProperty("${item}")`;
+ case 'PROPERTY_CHAR':
+ return `props.getProperty("${item}").toCharArray()`;
+ case 'PROPERTY_INT':
+ return `Integer.parseInt(props.getProperty("${item}"))`;
+ default:
+ if (this._isBean(clsName)) {
+ if (item.isComplex())
+ return item.id;
+
+ return this._newBean(item);
+ }
- switch (clsName) {
- case 'var':
+ if (this.javaTypes.nonEnum(clsName))
return item;
- case 'byte':
- return `(byte) ${item}`;
- case 'float':
- return `${item}f`;
- case 'long':
- return `${item}L`;
- case 'java.io.Serializable':
- case 'java.lang.String':
- return `"${item.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
- case 'PATH':
- return `"${item.replace(/\\/g, '\\\\')}"`;
- case 'java.lang.Class':
- return `${JavaTypes.shortClassName(item)}.class`;
- case 'java.util.UUID':
- return `UUID.fromString("${item}")`;
- case 'PROPERTY':
- return `props.getProperty("${item}")`;
- case 'PROPERTY_CHAR':
- return `props.getProperty("${item}").toCharArray()`;
- case 'PROPERTY_INT':
- return `Integer.parseInt(props.getProperty("${item}"))`;
- default:
- if (this._isBean(clsName)) {
- if (item.isComplex())
- return item.id;
-
- return this._newBean(item);
- }
- if (JavaTypes.nonEnum(clsName))
- return item;
-
- return `${JavaTypes.shortClassName(clsName)}.${item}`;
- }
- });
- }
+ return `${this.javaTypes.shortClassName(clsName)}.${item}`;
+ }
+ });
+ }
- static _constructBeans(sb, type, items, vars, limitLines) {
- if (this._isBean(type)) {
- // Construct objects inline for preview or simple objects.
- const mapper = this.METHOD_MAPPING[type];
+ static _mapperId(mapper) {
+ return (item) => this.javaTypes.toJavaName(mapper.prefix, item.findProperty(mapper.name).value);
+ }
- const nextId = mapper ? mapper.id : beenNameSeed();
+ static _constructBeans(sb, type, items, vars, limitLines) {
+ if (this._isBean(type)) {
+ // Construct objects inline for preview or simple objects.
+ const mapper = this.METHOD_MAPPING[type];
- // Prepare objects refs.
- return _.map(items, (item) => {
- if (limitLines && mapper)
- return mapper.id(item) + (limitLines ? `(${mapper.args})` : '');
+ const nextId = mapper ? this._mapperId(mapper) : beanNameSeed();
- if (item.isComplex()) {
- const id = nextId(item);
+ // Prepare objects refs.
+ return _.map(items, (item) => {
+ if (limitLines && mapper)
+ return nextId(item) + (limitLines ? `(${mapper.args})` : '');
- this.constructBean(sb, item, vars, limitLines, id);
+ if (item.isComplex()) {
+ const id = nextId(item);
- sb.emptyLine();
+ this.constructBean(sb, item, vars, limitLines, id);
- return id;
- }
+ sb.emptyLine();
- return this._newBean(item);
- });
- }
+ return id;
+ }
- return this._toObject(type, items);
+ return this._newBean(item);
+ });
}
- /**
- *
- * @param sb
- * @param parentId
- * @param arrProp
- * @param vars
- * @param limitLines
- * @private
- */
- static _setVarArg(sb, parentId, arrProp, vars, limitLines) {
- const refs = this._constructBeans(sb, arrProp.typeClsName, arrProp.items, vars, limitLines);
-
- // Set refs to property.
- if (refs.length === 1)
- this._setProperty(sb, parentId, arrProp.name, _.head(refs));
- else {
- sb.startBlock(`${parentId}.set${_.upperFirst(arrProp.name)}(`);
-
- const lastIdx = refs.length - 1;
-
- _.forEach(refs, (ref, idx) => {
- sb.append(ref + (lastIdx !== idx ? ',' : ''));
- });
+ return this._toObject(type, items);
+ }
- sb.endBlock(');');
- }
+ /**
+ *
+ * @param sb
+ * @param parentId
+ * @param arrProp
+ * @param vars
+ * @param limitLines
+ * @private
+ */
+ static _setVarArg(sb, parentId, arrProp, vars, limitLines) {
+ const refs = this._constructBeans(sb, arrProp.typeClsName, arrProp.items, vars, limitLines);
+
+ // Set refs to property.
+ if (refs.length === 1)
+ this._setProperty(sb, parentId, arrProp.name, _.head(refs));
+ else {
+ sb.startBlock(`${parentId}.set${_.upperFirst(arrProp.name)}(`);
+
+ const lastIdx = refs.length - 1;
+
+ _.forEach(refs, (ref, idx) => {
+ sb.append(ref + (lastIdx !== idx ? ',' : ''));
+ });
+
+ sb.endBlock(');');
}
+ }
- /**
- *
- * @param sb
- * @param parentId
- * @param arrProp
- * @param vars
- * @param limitLines
- * @private
- */
- static _setArray(sb, parentId, arrProp, vars, limitLines) {
- const refs = this._constructBeans(sb, arrProp.typeClsName, arrProp.items, vars, limitLines);
+ /**
+ *
+ * @param sb
+ * @param parentId
+ * @param arrProp
+ * @param vars
+ * @param limitLines
+ * @private
+ */
+ static _setArray(sb, parentId, arrProp, vars, limitLines) {
+ const refs = this._constructBeans(sb, arrProp.typeClsName, arrProp.items, vars, limitLines);
- const arrType = JavaTypes.shortClassName(arrProp.typeClsName);
+ const arrType = this.javaTypes.shortClassName(arrProp.typeClsName);
- // Set refs to property.
- sb.startBlock(`${parentId}.set${_.upperFirst(arrProp.name)}(new ${arrType}[] {`);
+ // Set refs to property.
+ sb.startBlock(`${parentId}.set${_.upperFirst(arrProp.name)}(new ${arrType}[] {`);
- const lastIdx = refs.length - 1;
+ const lastIdx = refs.length - 1;
- _.forEach(refs, (ref, idx) => sb.append(ref + (lastIdx !== idx ? ',' : '')));
+ _.forEach(refs, (ref, idx) => sb.append(ref + (lastIdx !== idx ? ',' : '')));
- sb.endBlock('});');
- }
+ sb.endBlock('});');
+ }
- static _constructMap(sb, map, vars = []) {
- const keyClsName = JavaTypes.shortClassName(map.keyClsName);
- const valClsName = JavaTypes.shortClassName(map.valClsName);
+ static _constructMap(sb, map, vars = []) {
+ const keyClsName = this.javaTypes.shortClassName(map.keyClsName);
+ const valClsName = this.javaTypes.shortClassName(map.valClsName);
- const mapClsName = map.ordered ? 'LinkedHashMap' : 'HashMap';
+ const mapClsName = map.ordered ? 'LinkedHashMap' : 'HashMap';
- const type = `${mapClsName}<${keyClsName}, ${valClsName}>`;
+ const type = `${mapClsName}<${keyClsName}, ${valClsName}>`;
- sb.append(`${this.varInit(type, map.id, vars)} = new ${mapClsName}<>();`);
+ sb.append(`${this.varInit(type, map.id, vars)} = new ${mapClsName}<>();`);
- sb.emptyLine();
+ sb.emptyLine();
- _.forEach(map.entries, (entry) => {
- const key = this._toObject(map.keyClsName, entry[map.keyField]);
- const val = entry[map.valField];
+ _.forEach(map.entries, (entry) => {
+ const key = this._toObject(map.keyClsName, entry[map.keyField]);
+ const val = entry[map.valField];
- if (_.isArray(val) && map.valClsName === 'java.lang.String') {
- if (val.length > 1) {
- sb.startBlock(`${map.id}.put(${key},`);
+ if (_.isArray(val) && map.valClsName === 'java.lang.String') {
+ if (val.length > 1) {
+ sb.startBlock(`${map.id}.put(${key},`);
- _.forEach(val, (line, idx) => {
- sb.append(`"${line}"${idx !== val.length - 1 ? ' +' : ''}`);
- });
+ _.forEach(val, (line, idx) => {
+ sb.append(`"${line}"${idx !== val.length - 1 ? ' +' : ''}`);
+ });
- sb.endBlock(');');
- }
- else
- sb.append(`${map.id}.put(${key}, ${this._toObject(map.valClsName, _.head(val))});`);
+ sb.endBlock(');');
}
else
- sb.append(`${map.id}.put(${key}, ${this._toObject(map.valClsName, val)});`);
- });
- }
+ sb.append(`${map.id}.put(${key}, ${this._toObject(map.valClsName, _.head(val))});`);
+ }
+ else
+ sb.append(`${map.id}.put(${key}, ${this._toObject(map.valClsName, val)});`);
+ });
+ }
- static varInit(type, id, vars) {
- if (_.includes(vars, id))
- return id;
+ static varInit(type, id, vars) {
+ if (_.includes(vars, id))
+ return id;
- vars.push(id);
+ vars.push(id);
- return `${type} ${id}`;
- }
+ return `${type} ${id}`;
+ }
- /**
- *
- * @param {StringBuilder} sb
- * @param {Bean} bean
- * @param {String} id
- * @param {Array.<String>} vars
- * @param {Boolean} limitLines
- * @returns {StringBuilder}
- */
- static _setProperties(sb = new StringBuilder(), bean, vars = [], limitLines = false, id = bean.id) {
- _.forEach(bean.properties, (prop, idx) => {
- switch (prop.clsName) {
- case 'DATA_SOURCE':
- this._setProperty(sb, id, 'dataSource', `DataSources.INSTANCE_${prop.id}`);
-
- break;
- case 'EVENT_TYPES':
- if (prop.eventTypes.length === 1)
- this._setProperty(sb, id, prop.name, _.head(prop.eventTypes));
- else {
- sb.append(`int[] ${prop.id} = new int[${_.head(prop.eventTypes)}.length`);
+ /**
+ *
+ * @param {StringBuilder} sb
+ * @param {Bean} bean
+ * @param {String} id
+ * @param {Array.<String>} vars
+ * @param {Boolean} limitLines
+ * @returns {StringBuilder}
+ */
+ static _setProperties(sb = new StringBuilder(), bean, vars = [], limitLines = false, id = bean.id) {
+ _.forEach(bean.properties, (prop, idx) => {
+ switch (prop.clsName) {
+ case 'DATA_SOURCE':
+ this._setProperty(sb, id, 'dataSource', `DataSources.INSTANCE_${prop.id}`);
+
+ break;
+ case 'EVENT_TYPES':
+ if (prop.eventTypes.length === 1)
+ this._setProperty(sb, id, prop.name, _.head(prop.eventTypes));
+ else {
+ sb.append(`int[] ${prop.id} = new int[${_.head(prop.eventTypes)}.length`);
+
+ _.forEach(_.tail(prop.eventTypes), (evtGrp) => {
+ sb.append(` + ${evtGrp}.length`);
+ });
- _.forEach(_.tail(prop.eventTypes), (evtGrp) => {
- sb.append(` + ${evtGrp}.length`);
- });
+ sb.append('];');
- sb.append('];');
+ sb.emptyLine();
+ sb.append('int k = 0;');
+
+ _.forEach(prop.eventTypes, (evtGrp, evtIdx) => {
sb.emptyLine();
- sb.append('int k = 0;');
+ sb.append(`System.arraycopy(${evtGrp}, 0, ${prop.id}, k, ${evtGrp}.length);`);
- _.forEach(prop.eventTypes, (evtGrp, evtIdx) => {
- sb.emptyLine();
+ if (evtIdx < prop.eventTypes.length - 1)
+ sb.append(`k += ${evtGrp}.length;`);
+ });
- sb.append(`System.arraycopy(${evtGrp}, 0, ${prop.id}, k, ${evtGrp}.length);`);
+ sb.emptyLine();
- if (evtIdx < prop.eventTypes.length - 1)
- sb.append(`k += ${evtGrp}.length;`);
- });
+ sb.append(`cfg.setIncludeEventTypes(${prop.id});`);
+ }
- sb.emptyLine();
+ break;
+ case 'ARRAY':
+ if (prop.varArg)
+ this._setVarArg(sb, id, prop, vars, limitLines);
+ else
+ this._setArray(sb, id, prop, vars, limitLines);
- sb.append(`cfg.setIncludeEventTypes(${prop.id});`);
- }
+ break;
+ case 'COLLECTION':
+ const nonBean = !this._isBean(prop.typeClsName);
- break;
- case 'ARRAY':
- if (prop.varArg)
- this._setVarArg(sb, id, prop, vars, limitLines);
- else
- this._setArray(sb, id, prop, vars, limitLines);
+ if (nonBean && prop.implClsName === 'java.util.ArrayList') {
+ const items = _.map(prop.items, (item) => this._toObject(prop.typeClsName, item));
- break;
- case 'COLLECTION':
- const nonBean = !this._isBean(prop.typeClsName);
+ if (items.length > 1) {
+ sb.startBlock(`${id}.set${_.upperFirst(prop.name)}(Arrays.asList(`);
- if (nonBean && prop.implClsName === 'java.util.ArrayList') {
- const items = _.map(prop.items, (item) => this._toObject(prop.typeClsName, item));
+ _.forEach(items, (item, i) => sb.append(item + (i !== items.length - 1 ? ',' : '')));
- if (items.length > 1) {
- sb.startBlock(`${id}.set${_.upperFirst(prop.name)}(Arrays.asList(`);
+ sb.endBlock('));');
+ }
+ else
+ this._setProperty(sb, id, prop.name, `Arrays.asList(${items})`);
+ }
+ else {
+ const colTypeClsName = this.javaTypes.shortClassName(prop.typeClsName);
+ const implClsName = this.javaTypes.shortClassName(prop.implClsName);
- _.forEach(items, (item, i) => sb.append(item + (i !== items.length - 1 ? ',' : '')));
+ sb.append(`${this.varInit(`${implClsName}<${colTypeClsName}>`, prop.id, vars)} = new ${implClsName}<>();`);
- sb.endBlock('));');
- }
- else
- this._setProperty(sb, id, prop.name, `Arrays.asList(${items})`);
+ sb.emptyLine();
+
+ if (nonBean) {
+ _.forEach(this._toObject(colTypeClsName, prop.items), (item) => {
+ sb.append(`${prop.id}.add("${item}");`);
+
+ sb.emptyLine();
+ });
}
else {
- const colTypeClsName = JavaTypes.shortClassName(prop.typeClsName);
- const implClsName = JavaTypes.shortClassName(prop.implClsName);
+ _.forEach(prop.items, (item) => {
+ this.constructBean(sb, item, vars, limitLines);
- sb.append(`${this.varInit(`${implClsName}<${colTypeClsName}>`, prop.id, vars)} = new ${implClsName}<>();`);
+ sb.append(`${prop.id}.add(${item.id});`);
- sb.emptyLine();
+ sb.emptyLine();
+ });
+ }
- if (nonBean) {
- _.forEach(this._toObject(colTypeClsName, prop.items), (item) => {
- sb.append(`${prop.id}.add("${item}");`);
+ this._setProperty(sb, id, prop.name, prop.id);
+ }
- sb.emptyLine();
- });
- }
- else {
- _.forEach(prop.items, (item) => {
- this.constructBean(sb, item, vars, limitLines);
+ break;
+ case 'MAP':
+ this._constructMap(sb, prop, vars);
- sb.append(`${prop.id}.add(${item.id});`);
+ if (_.nonEmpty(prop.entries))
+ sb.emptyLine();
- sb.emptyLine();
- });
- }
+ this._setProperty(sb, id, prop.name, prop.id);
- this._setProperty(sb, id, prop.name, prop.id);
- }
+ break;
+ case 'java.util.Properties':
+ sb.append(`${this.varInit('Properties', prop.id, vars)} = new Properties();`);
- break;
- case 'MAP':
- this._constructMap(sb, prop, vars);
+ if (_.nonEmpty(prop.entries))
+ sb.emptyLine();
- if (_.nonEmpty(prop.entries))
- sb.emptyLine();
+ _.forEach(prop.entries, (entry) => {
+ const key = this._toObject('java.lang.String', entry.name);
+ const val = this._toObject('java.lang.String', entry.value);
- this._setProperty(sb, id, prop.name, prop.id);
+ sb.append(`${prop.id}.setProperty(${key}, ${val});`);
+ });
- break;
- case 'java.util.Properties':
- sb.append(`${this.varInit('Properties', prop.id, vars)} = new Properties();`);
+ sb.emptyLine();
- if (_.nonEmpty(prop.entries))
- sb.emptyLine();
+ this._setProperty(sb, id, prop.name, prop.id);
- _.forEach(prop.entries, (entry) => {
- const key = this._toObject('java.lang.String', entry.name);
- const val = this._toObject('java.lang.String', entry.value);
+ break;
+ case 'BEAN':
+ const embedded = prop.value;
- sb.append(`${prop.id}.setProperty(${key}, ${val});`);
- });
+ if (_.includes(STORE_FACTORY, embedded.clsName)) {
+ this.constructStoreFactory(sb, embedded, vars, limitLines);
sb.emptyLine();
- this._setProperty(sb, id, prop.name, prop.id);
+ this._setProperty(sb, id, prop.name, embedded.id);
+ }
+ else if (embedded.isComplex()) {
+ this.constructBean(sb, embedded, vars, limitLines);
- break;
- case 'BEAN':
- const embedded = prop.value;
+ sb.emptyLine();
- if (_.includes(STORE_FACTORY, embedded.clsName)) {
- this.constructStoreFactory(sb, embedded, vars, limitLines);
+ this._setProperty(sb, id, prop.name, embedded.id);
+ }
+ else
+ this._setProperty(sb, id, prop.name, this._newBean(embedded));
- sb.emptyLine();
+ break;
+ default:
+ this._setProperty(sb, id, prop.name, this._toObject(prop.clsName, prop.value));
+ }
- this._setProperty(sb, id, prop.name, embedded.id);
- }
- else if (embedded.isComplex()) {
- this.constructBean(sb, embedded, vars, limitLines);
+ this._emptyLineIfNeeded(sb, bean.properties, idx);
+ });
- sb.emptyLine();
+ return sb;
+ }
- this._setProperty(sb, id, prop.name, embedded.id);
- }
- else
- this._setProperty(sb, id, prop.name, this._newBean(embedded));
+ static _collectMapImports(prop) {
+ const imports = [];
- break;
- default:
- this._setProperty(sb, id, prop.name, this._toObject(prop.clsName, prop.value));
- }
+ imports.push(prop.ordered ? 'java.util.LinkedHashMap' : 'java.util.HashMap');
+ imports.push(prop.keyClsName);
+ imports.push(prop.valClsName);
- this._emptyLineIfNeeded(sb, bean.properties, idx);
- });
+ return imports;
+ }
- return sb;
- }
+ static collectBeanImports(bean) {
+ const imports = [bean.clsName];
- static collectBeanImports(bean) {
- const imports = [bean.clsName];
+ _.forEach(bean.arguments, (arg) => {
+ switch (arg.clsName) {
+ case 'BEAN':
+ imports.push(...this.collectPropertiesImports(arg.value.properties));
- _.forEach(bean.arguments, (arg) => {
- switch (arg.clsName) {
- case 'BEAN':
- imports.push(...this.collectPropertiesImports(arg.value.properties));
+ break;
+ case 'java.lang.Class':
+ imports.push(this.javaTypes.fullClassName(arg.value));
- break;
- case 'java.lang.Class':
- imports.push(JavaTypes.fullClassName(arg.value));
+ break;
- break;
- default:
- imports.push(arg.clsName);
- }
- });
+ case 'MAP':
+ imports.push(...this._collectMapImports(arg));
- imports.push(...this.collectPropertiesImports(bean.properties));
+ break;
+ default:
+ imports.push(arg.clsName);
+ }
+ });
- if (_.includes(STORE_FACTORY, bean.clsName))
- imports.push('javax.sql.DataSource', 'javax.cache.configuration.Factory');
+ imports.push(...this.collectPropertiesImports(bean.properties));
- return imports;
- }
+ if (_.includes(STORE_FACTORY, bean.clsName))
+ imports.push('javax.sql.DataSource', 'javax.cache.configuration.Factory');
- /**
- * @param {Array.<Object>} props
- * @returns {Array.<String>}
- */
- static collectPropertiesImports(props) {
- const imports = [];
+ return imports;
+ }
- _.forEach(props, (prop) => {
- switch (prop.clsName) {
- case 'DATA_SOURCE':
- imports.push(prop.value.clsName);
+ /**
+ * @param {Array.<Object>} props
+ * @returns {Array.<String>}
+ */
+ static collectPropertiesImports(props) {
+ const imports = [];
- break;
- case 'PROPERTY':
- case 'PROPERTY_CHAR':
- case 'PROPERTY_INT':
- imports.push('java.io.InputStream', 'java.util.Properties');
+ _.forEach(props, (prop) => {
+ switch (prop.clsName) {
+ case 'DATA_SOURCE':
+ imports.push(prop.value.clsName);
- break;
- case 'BEAN':
- imports.push(...this.collectBeanImports(prop.value));
+ break;
+ case 'PROPERTY':
+ case 'PROPERTY_CHAR':
+ case 'PROPERTY_INT':
+ imports.push('java.io.InputStream', 'java.util.Properties');
- break;
- case 'ARRAY':
- imports.push(prop.typeClsName);
+ break;
+ case 'BEAN':
+ imports.push(...this.collectBeanImports(prop.value));
- if (this._isBean(prop.typeClsName))
- _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
+ break;
+ case 'ARRAY':
+ imports.push(prop.typeClsName);
- break;
- case 'COLLECTION':
- imports.push(prop.typeClsName);
+ if (this._isBean(prop.typeClsName))
+ _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
- if (this._isBean(prop.typeClsName)) {
- _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
+ break;
+ case 'COLLECTION':
+ imports.push(prop.typeClsName);
- imports.push(prop.implClsName);
- }
- else if (prop.implClsName === 'java.util.ArrayList')
- imports.push('java.util.Arrays');
- else
- imports.push(prop.implClsName);
-
- break;
- case 'MAP':
- imports.push(prop.ordered ? 'java.util.LinkedHashMap' : 'java.util.HashMap');
- imports.push(prop.keyClsName);
- imports.push(prop.valClsName);
-
- break;
- default:
- if (!JavaTypes.nonEnum(prop.clsName))
- imports.push(prop.clsName);
- }
- });
+ if (this._isBean(prop.typeClsName)) {
+ _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
- return imports;
- }
+ imports.push(prop.implClsName);
+ }
+ else if (prop.implClsName === 'java.util.ArrayList')
+ imports.push('java.util.Arrays');
+ else
+ imports.push(prop.implClsName);
- static _prepareImports(imports) {
- return _.sortedUniq(_.sortBy(_.filter(imports, (cls) => !cls.startsWith('java.lang.') && _.includes(cls, '.'))));
- }
+ break;
+ case 'MAP':
+ imports.push(...this._collectMapImports(prop));
- /**
- * @param {Bean} bean
- * @returns {Array.<String>}
- */
- static collectStaticImports(bean) {
- const imports = [];
+ break;
+ default:
+ if (!this.javaTypes.nonEnum(prop.clsName))
+ imports.push(prop.clsName);
+ }
+ });
- _.forEach(bean.properties, (prop) => {
- switch (prop.clsName) {
- case 'EVENT_TYPES':
- _.forEach(prop.eventTypes, (value) => {
- const evtGrp = _.find(eventGroups, {value});
+ return imports;
+ }
- imports.push(`${evtGrp.class}.${evtGrp.value}`);
- });
+ static _prepareImports(imports) {
+ return _.sortedUniq(_.sortBy(_.filter(imports, (cls) => !cls.startsWith('java.lang.') && _.includes(cls, '.'))));
+ }
- break;
- default:
- // No-op.
- }
- });
+ /**
+ * @param {Bean} bean
+ * @returns {Array.<String>}
+ */
+ static collectStaticImports(bean) {
+ const imports = [];
- return imports;
- }
+ _.forEach(bean.properties, (prop) => {
+ switch (prop.clsName) {
+ case 'EVENT_TYPES':
+ _.forEach(prop.eventTypes, (value) => {
+ const evtGrp = _.find(this.eventGroups, {value});
- /**
- * @param {Bean} bean
- * @returns {Object}
- */
- static collectBeansWithMapping(bean) {
- const beans = {};
+ imports.push(`${evtGrp.class}.${evtGrp.value}`);
+ });
- _.forEach(bean.properties, (prop) => {
- switch (prop.clsName) {
- case 'BEAN':
- _.merge(beans, this.collectBeansWithMapping(prop.value));
+ break;
+ default:
+ // No-op.
+ }
+ });
- break;
- case 'ARRAY':
- if (this._isBean(prop.typeClsName)) {
- const mapping = this.METHOD_MAPPING[prop.typeClsName];
+ return imports;
+ }
- _.reduce(prop.items, (acc, item) => {
- if (mapping) {
- acc[mapping.id(item)] = item;
+ /**
+ * @param {Bean} bean
+ * @returns {Object}
+ */
+ static collectBeansWithMapping(bean) {
+ const beans = {};
- _.merge(acc, this.collectBeansWithMapping(item));
- }
- return acc;
- }, beans);
- }
+ _.forEach(bean.properties, (prop) => {
+ switch (prop.clsName) {
+ case 'BEAN':
+ _.merge(beans, this.collectBeansWithMapping(prop.value));
- break;
- default:
- // No-op.
- }
- });
+ break;
+ case 'ARRAY':
+ if (this._isBean(prop.typeClsName)) {
+ const mapper = this.METHOD_MAPPING[prop.typeClsName];
- return beans;
- }
+ const mapperId = mapper ? this._mapperId(mapper) : null;
- /**
- * Build Java startup class with configuration.
- *
- * @param {Bean} cfg
- * @param pkg Package name.
- * @param {String} clsName Class name for generate factory class otherwise generate code snippet.
- * @param {Array.<Object>} clientNearCaches Is client node.
- * @returns {StringBuilder}
- */
- static igniteConfiguration(cfg, pkg, clsName, clientNearCaches) {
- const sb = new StringBuilder();
-
- sb.append(`package ${pkg};`);
- sb.emptyLine();
+ _.reduce(prop.items, (acc, item) => {
+ if (mapperId)
+ acc[mapperId(item)] = item;
- const imports = this.collectBeanImports(cfg);
+ _.merge(acc, this.collectBeansWithMapping(item));
- if (_.nonEmpty(clientNearCaches))
- imports.push('org.apache.ignite.configuration.NearCacheConfiguration');
+ return acc;
+ }, beans);
+ }
- if (_.includes(imports, 'oracle.jdbc.pool.OracleDataSource'))
- imports.push('java.sql.SQLException');
+ break;
+ default:
+ // No-op.
+ }
+ });
- const hasProps = this.hasProperties(cfg);
+ return beans;
+ }
- if (hasProps)
- imports.push('java.util.Properties', 'java.io.InputStream');
+ /**
+ * Build Java startup class with configuration.
+ *
+ * @param {Bean} cfg
+ * @param pkg Package name.
+ * @param {String} clsName Class name for generate factory class otherwise generate code snippet.
+ * @param {Array.<Object>} clientNearCaches Is client node.
+ * @returns {StringBuilder}
+ */
+ static igniteConfiguration(cfg, pkg, clsName, clientNearCaches) {
+ const sb = new StringBuilder();
- _.forEach(this._prepareImports(imports), (cls) => sb.append(`import ${cls};`));
+ sb.append(`package ${pkg};`);
+ sb.emptyLine();
- sb.emptyLine();
+ const imports = this.collectBeanImports(cfg);
- const staticImports = this._prepareImports(this.collectStaticImports(cfg));
+ const nearCacheBeans = [];
- if (staticImports.length) {
- _.forEach(this._prepareImports(staticImports), (cls) => sb.append(`import static ${cls};`));
+ if (_.nonEmpty(clientNearCaches)) {
+ imports.push('org.apache.ignite.configuration.NearCacheConfiguration');
- sb.emptyLine();
- }
+ _.forEach(clientNearCaches, (cache) => {
+ const nearCacheBean = this.generator.cacheNearClient(cache);
- this.mainComment(sb);
- sb.startBlock(`public class ${clsName} {`);
+ nearCacheBean.cacheName = cache.name;
- // 2. Add external property file
- if (hasProps) {
- this.commentBlock(sb, 'Secret properties loading.');
- sb.append('private static final Properties props = new Properties();');
- sb.emptyLine();
- sb.startBlock('static {');
- sb.startBlock('try (InputStream in = IgniteConfiguration.class.getClassLoader().getResourceAsStream("secret.properties")) {');
- sb.append('props.load(in);');
- sb.endBlock('}');
- sb.startBlock('catch (Exception ignored) {');
- sb.append('// No-op.');
- sb.endBlock('}');
- sb.endBlock('}');
- sb.emptyLine();
- }
+ imports.push(...this.collectBeanImports(nearCacheBean));
- // 3. Add data sources.
- const dataSources = this.collectDataSources(cfg);
+ nearCacheBeans.push(nearCacheBean);
+ });
+ }
- if (dataSources.length) {
- this.commentBlock(sb, 'Helper class for datasource creation.');
- sb.startBlock('public static class DataSources {');
+ if (_.includes(imports, 'oracle.jdbc.pool.OracleDataSource'))
+ imports.push('java.sql.SQLException');
- _.forEach(dataSources, (ds, idx) => {
- const dsClsName = JavaTypes.shortClassName(ds.clsName);
+ const hasProps = this.hasProperties(cfg);
- if (idx !== 0)
- sb.emptyLine();
+ if (hasProps)
+ imports.push('java.util.Properties', 'java.io.InputStream');
- sb.append(`public static final ${dsClsName} INSTANCE_${ds.id} = create${ds.id}();`);
- sb.emptyLine();
+ _.forEach(this._prepareImports(imports), (cls) => sb.append(`import ${cls};`));
- sb.startBlock(`private static ${dsClsName} create${ds.id}() {`);
+ sb.emptyLine();
- if (dsClsName === 'OracleDataSource')
- sb.startBlock('try {');
+ const staticImports = this._prepareImports(this.collectStaticImports(cfg));
- this.constructBean(sb, ds);
+ if (staticImports.length) {
+ _.forEach(this._prepareImports(staticImports), (cls) => sb.append(`import static ${cls};`));
- sb.emptyLine();
- sb.append(`return ${ds.id};`);
+ sb.emptyLine();
+ }
- if (dsClsName === 'OracleDataSource') {
- sb.endBlock('}');
- sb.startBlock('catch (SQLException ex) {');
- sb.append('throw new Error(ex);');
- sb.endBlock('}');
- }
+ this.mainComment(sb);
+ sb.startBlock(`public class ${clsName} {`);
- sb.endBlock('}');
- });
+ // 2. Add external property file
+ if (hasProps) {
+ this.commentBlock(sb, 'Secret properties loading.');
+ sb.append('private static final Properties props = new Properties();');
+ sb.emptyLine();
+ sb.startBlock('static {');
+ sb.startBlock('try (InputStream in = IgniteConfiguration.class.getClassLoader().getResourceAsStream("secret.properties")) {');
+ sb.append('props.load(in);');
+ sb.endBlock('}');
+ sb.startBlock('catch (Exception ignored) {');
+ sb.append('// No-op.');
+ sb.endBlock('}');
+ sb.endBlock('}');
+ sb.emptyLine();
+ }
- sb.endBlock('}');
+ // 3. Add data sources.
+ const dataSources = this.collectDataSources(cfg);
+
+ if (dataSources.length) {
+ this.commentBlock(sb, 'Helper class for datasource creation.');
+ sb.startBlock('public static class DataSources {');
+
+ _.forEach(dataSources, (ds, idx) => {
+ const dsClsName = this.javaTypes.shortClassName(ds.clsName);
+ if (idx !== 0)
+ sb.emptyLine();
+
+ sb.append(`public static final ${dsClsName} INSTANCE_${ds.id} = create${ds.id}();`);
sb.emptyLine();
- }
- _.forEach(clientNearCaches, (cache) => {
- this.commentBlock(sb, `Configuration of near cache for cache: ${cache.name}.`,
- '',
- '@return Near cache configuration.',
- '@throws Exception If failed to construct near cache configuration instance.'
- );
+ sb.startBlock(`private static ${dsClsName} create${ds.id}() {`);
- const nearCacheBean = generator.cacheNearClient(cache);
+ if (dsClsName === 'OracleDataSource')
+ sb.startBlock('try {');
- sb.startBlock(`public static NearCacheConfiguration ${nearCacheBean.id}() throws Exception {`);
+ this.constructBean(sb, ds);
- this.constructBean(sb, nearCacheBean);
sb.emptyLine();
+ sb.append(`return ${ds.id};`);
- sb.append(`return ${nearCacheBean.id};`);
- sb.endBlock('}');
+ if (dsClsName === 'OracleDataSource') {
+ sb.endBlock('}');
+ sb.startBlock('catch (SQLException ex) {');
+ sb.append('throw new Error(ex);');
+ sb.endBlock('}');
+ }
- sb.emptyLine();
+ sb.endBlock('}');
});
- this.commentBlock(sb, 'Configure grid.',
+ sb.endBlock('}');
+
+ sb.emptyLine();
+ }
+
+ _.forEach(nearCacheBeans, (nearCacheBean) => {
+ this.commentBlock(sb, `Configuration of near cache for cache: ${nearCacheBean.cacheName}.`,
'',
- '@return Ignite configuration.',
- '@throws Exception If failed to construct Ignite configuration instance.'
+ '@return Near cache configuration.',
+ '@throws Exception If failed to construct near cache configuration instance.'
);
- sb.startBlock('public static IgniteConfiguration createConfiguration() throws Exception {');
- this.constructBean(sb, cfg, [], true);
+ sb.startBlock(`public static NearCacheConfiguration ${nearCacheBean.id}() throws Exception {`);
+ this.constructBean(sb, nearCacheBean);
sb.emptyLine();
- sb.append(`return ${cfg.id};`);
-
+ sb.append(`return ${nearCacheBean.id};`);
sb.endBlock('}');
- const beans = this.collectBeansWithMapping(cfg);
+ sb.emptyLine();
+ });
- _.forEach(beans, (bean, id) => {
- sb.emptyLine();
+ this.commentBlock(sb, 'Configure grid.',
+ '',
+ '@return Ignite configuration.',
+ '@throws Exception If failed to construct Ignite configuration instance.'
+ );
+ sb.startBlock('public static IgniteConfiguration createConfiguration() throws Exception {');
- this.METHOD_MAPPING[bean.clsName].generator(sb, id, bean);
- });
+ this.constructBean(sb, cfg, [], true);
- sb.endBlock('}');
+ sb.emptyLine();
- return sb;
- }
+ sb.append(`return ${cfg.id};`);
- static cluster(cluster, pkg, clsName, client) {
- const cfg = this.generator.igniteConfiguration(cluster, client);
+ sb.endBlock('}');
- const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : [];
+ const beans = this.collectBeansWithMapping(cfg);
- return this.igniteConfiguration(cfg, pkg, clsName, clientNearCaches);
- }
-
- /**
- * Generate source code for type by its domain model.
- *
- * @param fullClsName Full class name.
- * @param fields Fields.
- * @param addConstructor If 'true' then empty and full constructors should be generated.
- * @returns {StringBuilder}
- */
- static pojo(fullClsName, fields, addConstructor) {
- const dotIdx = fullClsName.lastIndexOf('.');
+ _.forEach(beans, (bean, id) => {
+ sb.emptyLine();
- const pkg = fullClsName.substring(0, dotIdx);
- const clsName = fullClsName.substring(dotIdx + 1);
+ this.METHOD_MAPPING[bean.clsName].generator(sb, id, bean);
+ });
- const sb = new StringBuilder();
+ sb.endBlock('}');
- sb.append(`package ${pkg};`);
- sb.emptyLine();
-
- const imports = ['java.io.Serializable'];
+ return sb;
+ }
- _.forEach(fields, (field) => imports.push(JavaTypes.fullClassName(field.javaFieldType)));
+ static cluster(cluster, pkg, clsName, client) {
+ const cfg = this.generator.igniteConfiguration(cluster, client);
- _.forEach(this._prepareImports(imports), (cls) => sb.append(`import ${cls};`));
+ const clientNearCaches = client ? _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled')) : [];
- sb.emptyLine();
+ return this.igniteConfiguration(cfg, pkg, clsName, clientNearCaches);
+ }
- this.mainComment(sb,
- `${clsName} definition.`,
- ''
- );
- sb.startBlock(`public class ${clsName} implements Serializable {`);
- sb.append('/** */');
- sb.append('private static final long serialVersionUID = 0L;');
- sb.emptyLine();
+ /**
+ * Generate source code for type by its domain model.
+ *
+ * @param fullClsName Full class name.
+ * @param fields Fields.
+ * @param addConstructor If 'true' then empty and full constructors should be generated.
+ * @returns {StringBuilder}
+ */
+ static pojo(fullClsName, fields, addConstructor) {
+ const dotIdx = fullClsName.lastIndexOf('.');
- // Generate fields declaration.
- _.forEach(fields, (field) => {
- const fldName = field.javaFieldName;
- const fldType = JavaTypes.shortClassName(field.javaFieldType);
+ const pkg = fullClsName.substring(0, dotIdx);
+ const clsName = fullClsName.substring(dotIdx + 1);
- sb.append(`/** Value for ${fldName}. */`);
- sb.append(`private ${fldType} ${fldName};`);
+ const sb = new StringBuilder();
- sb.emptyLine();
- });
+ sb.append(`package ${pkg};`);
+ sb.emptyLine();
- // Generate constructors.
- if (addConstructor) {
- this.commentBlock(sb, 'Empty constructor.');
- sb.startBlock(`public ${clsName}() {`);
- this.comment(sb, 'No-op.');
- sb.endBlock('}');
+ const imports = ['java.io.Serializable'];
- sb.emptyLine();
+ _.forEach(fields, (field) => imports.push(this.javaTypes.fullClassName(field.javaFieldType)));
- this.commentBlock(sb, 'Full constructor.');
+ _.forEach(this._prepareImports(imports), (cls) => sb.append(`import ${cls};`));
- const arg = (field) => {
- const fldType = JavaTypes.shortClassName(field.javaFieldType);
+ sb.emptyLine();
- return `${fldType} ${field.javaFieldName}`;
- };
+ this.mainComment(sb,
+ `${clsName} definition.`,
+ ''
+ );
+ sb.startBlock(`public class ${clsName} implements Serializable {`);
+ sb.append('/** */');
+ sb.append('private static final long serialVersionUID = 0L;');
+ sb.emptyLine();
- sb.startBlock(`public ${clsName}(${arg(_.head(fields))}${fields.length === 1 ? ') {' : ','}`);
+ // Generate fields declaration.
+ _.forEach(fields, (field) => {
+ const fldName = field.javaFieldName;
+ const fldType = this.javaTypes.shortClassName(field.javaFieldType);
- _.forEach(_.tail(fields), (field, idx) => {
- sb.append(`${arg(field)}${idx !== fields.length - 2 ? ',' : ') {'}`);
- });
+ sb.append(`/** Value for ${fldName}. */`);
+ sb.append(`private ${fldType} ${fldName};`);
- _.forEach(fields, (field) => sb.append(`this.${field.javaFieldName} = ${field.javaFieldName};`));
+ sb.emptyLine();
+ });
- sb.endBlock('}');
+ // Generate constructors.
+ if (addConstructor) {
+ this.commentBlock(sb, 'Empty constructor.');
+ sb.startBlock(`public ${clsName}() {`);
+ this.comment(sb, 'No-op.');
+ sb.endBlock('}');
- sb.emptyLine();
- }
+ sb.emptyLine();
- // Generate getters and setters methods.
- _.forEach(fields, (field) => {
- const fldType = JavaTypes.shortClassName(field.javaFieldType);
- const fldName = field.javaFieldName;
+ this.commentBlock(sb, 'Full constructor.');
- this.commentBlock(sb,
- `Gets ${fldName}`,
- '',
- `@return Value for ${fldName}.`
- );
- sb.startBlock(`public ${fldType} ${JavaTypes.toJavaName('get', fldName)}() {`);
- sb.append('return ' + fldName + ';');
- sb.endBlock('}');
+ const arg = (field) => {
+ const fldType = this.javaTypes.shortClassName(field.javaFieldType);
- sb.emptyLine();
+ return `${fldType} ${field.javaFieldName}`;
+ };
- this.commentBlock(sb,
- `Sets ${fldName}`,
- '',
- `@param ${fldName} New value for ${fldName}.`
- );
- sb.startBlock(`public void ${JavaTypes.toJavaName('set', fldName)}(${fldType} ${fldName}) {`);
- sb.append(`this.${fldName} = ${fldName};`);
- sb.endBlock('}');
+ sb.startBlock(`public ${clsName}(${arg(_.head(fields))}${fields.length === 1 ? ') {' : ','}`);
- sb.emptyLine();
+ _.forEach(_.tail(fields), (field, idx) => {
+ sb.append(`${arg(field)}${idx !== fields.length - 2 ? ',' : ') {'}`);
});
- // Generate equals() method.
- this.commentBlock(sb, '{@inheritDoc}');
- sb.startBlock('@Override public boolean equals(Object o) {');
- sb.startBlock('if (this == o)');
- sb.append('return true;');
+ _.forEach(fields, (field) => sb.append(`this.${field.javaFieldName} = ${field.javaFieldName};`));
- sb.endBlock('');
+ sb.endBlock('}');
- sb.startBlock(`if (!(o instanceof ${clsName}))`);
- sb.append('return false;');
+ sb.emptyLine();
+ }
- sb.endBlock('');
+ // Generate getters and setters methods.
+ _.forEach(fields, (field) => {
+ const fldType = this.javaTypes.shortClassName(field.javaFieldType);
+ const fldName = field.javaFieldName;
- sb.append(`${clsName} that = (${clsName})o;`);
+ this.commentBlock(sb,
+ `Gets ${fldName}`,
+ '',
+ `@return Value for ${fldName}.`
+ );
+ sb.startBlock(`public ${fldType} ${this.javaTypes.toJavaName('get', fldName)}() {`);
+ sb.append('return ' + fldName + ';');
+ sb.endBlock('}');
- _.forEach(fields, (field) => {
- sb.emptyLine();
+ sb.emptyLine();
- const javaName = field.javaFieldName;
- const javaType = field.javaFieldType;
+ this.commentBlock(sb,
+ `Sets ${fldName}`,
+ '',
+ `@param ${fldName} New value for ${fldName}.`
+ );
+ sb.startBlock(`public void ${this.javaTypes.toJavaName('set', fldName)}(${fldType} ${fldName}) {`);
+ sb.append(`this.${fldName} = ${fldName};`);
+ sb.endBlock('}');
- switch (javaType) {
- case 'float':
- sb.startBlock(`if (Float.compare(${javaName}, that.${javaName}) != 0)`);
+ sb.emptyLine();
+ });
- break;
- case 'double':
- sb.startBlock(`if (Double.compare(${javaName}, that.${javaName}) != 0)`);
+ // Generate equals() method.
+ this.commentBlock(sb, '{@inheritDoc}');
+ sb.startBlock('@Override public boolean equals(Object o) {');
+ sb.startBlock('if (this == o)');
+ sb.append('return true;');
- break;
- default:
- if (JavaTypes.isJavaPrimitive(javaType))
- sb.startBlock('if (' + javaName + ' != that.' + javaName + ')');
- else
- sb.startBlock('if (' + javaName + ' != null ? !' + javaName + '.equals(that.' + javaName + ') : that.' + javaName + ' != null)');
- }
+ sb.endBlock('');
- sb.append('return false;');
+ sb.startBlock(`if (!(o instanceof ${clsName}))`);
+ sb.append('return false;');
- sb.endBlock('');
- });
+ sb.endBlock('');
- sb.append('return true;');
- sb.endBlock('}');
+ sb.append(`${clsName} that = (${clsName})o;`);
+ _.forEach(fields, (field) => {
sb.emptyLine();
- // Generate hashCode() method.
- this.commentBlock(sb, '{@inheritDoc}');
- sb.startBlock('@Override public int hashCode() {');
+ const javaName = field.javaFieldName;
+ const javaType = field.javaFieldType;
- let first = true;
- let tempVar = false;
+ switch (javaType) {
+ case 'float':
+ sb.startBlock(`if (Float.compare(${javaName}, that.${javaName}) != 0)`);
- _.forEach(fields, (field) => {
- const javaName = field.javaFieldName;
- const javaType = field.javaFieldType;
+ break;
+ case 'double':
+ sb.startBlock(`if (Double.compare(${javaName}, that.${javaName}) != 0)`);
- let fldHashCode;
+ break;
+ default:
+ if (this.javaTypes.isPrimitive(javaType))
+ sb.startBlock('if (' + javaName + ' != that.' + javaName + ')');
+ else
+ sb.startBlock('if (' + javaName + ' != null ? !' + javaName + '.equals(that.' + javaName + ') : that.' + javaName + ' != null)');
+ }
- switch (javaType) {
- case 'boolean':
- fldHashCode = `${javaName} ? 1 : 0`;
+ sb.append('return false;');
- break;
- case 'byte':
- case 'short':
- fldHashCode = `(int)${javaName}`;
+ sb.endBlock('');
+ });
- break;
- case 'int':
- fldHashCode = `${javaName}`;
+ sb.append('return true;');
+ sb.endBlock('}');
- break;
- case 'long':
- fldHashCode = `(int)(${javaName} ^ (${javaName} >>> 32))`;
+ sb.emptyLine();
- break;
- case 'float':
- fldHashCode = `${javaName} != +0.0f ? Float.floatToIntBits(${javaName}) : 0`;
+ // Generate hashCode() method.
+ this.commentBlock(sb, '{@inheritDoc}');
+ sb.startBlock('@Override public int hashCode() {');
- break;
- case 'double':
- sb.append(`${tempVar ? 'ig_hash_temp' : 'long ig_hash_temp'} = Double.doubleToLongBits(${javaName});`);
+ let first = true;
+ let tempVar = false;
- tempVar = true;
+ _.forEach(fields, (field) => {
+ const javaName = field.javaFieldName;
+ const javaType = field.javaFieldType;
- fldHashCode = `${javaName} != +0.0f ? Float.floatToIntBits(${javaName}) : 0`;
+ let fldHashCode;
- break;
- default:
- fldHashCode = `${javaName} != null ? ${javaName}.hashCode() : 0`;
- }
+ switch (javaType) {
+ case 'boolean':
+ fldHashCode = `${javaName} ? 1 : 0`;
- sb.append(first ? `int res = ${fldHashCode};` : `res = 31 * res + ${fldHashCode.startsWith('(') ? fldHashCode : `(${fldHashCode})`};`);
+ break;
+ case 'byte':
+ case 'short':
+ fldHashCode = `(int)${javaName}`;
- first = false;
+ break;
+ case 'int':
+ fldHashCode = `${javaName}`;
- sb.emptyLine();
- });
+ break;
+ case 'long':
+ fldHashCode = `(int)(${javaName} ^ (${javaName} >>> 32))`;
- sb.append('return res;');
- sb.endBlock('}');
+ break;
+ case 'float':
+ fldHashCode = `${javaName} != +0.0f ? Float.floatToIntBits(${javaName}) : 0`;
- sb.emptyLine();
+ break;
+ case 'double':
+ sb.append(`${tempVar ? 'ig_hash_temp' : 'long ig_hash_temp'} = Double.doubleToLongBits(${javaName});`);
- this.commentBlock(sb, '{@inheritDoc}');
- sb.startBlock('@Override public String toString() {');
- sb.startBlock(`return "${clsName} [" + `);
+ tempVar = true;
- _.forEach(fields, (field, idx) => {
- sb.append(`"${field.javaFieldName}=" + ${field.javaFieldName}${idx < fields.length - 1 ? ' + ", " + ' : ' +'}`);
- });
+ fldHashCode = `${javaName} != +0.0f ? Float.floatToIntBits(${javaName}) : 0`;
- sb.endBlock('"]";');
- sb.endBlock('}');
+ break;
+ default:
+ fldHashCode = `${javaName} != null ? ${javaName}.hashCode() : 0`;
+ }
- sb.endBlock('}');
+ sb.append(first ? `int res = ${fldHashCode};` : `res = 31 * res + ${fldHashCode.startsWith('(') ? fldHashCode : `(${fldHashCode})`};`);
- return sb.asString();
- }
+ first = false;
- /**
- * Generate source code for type by its domain models.
- *
- * @param caches List of caches to generate POJOs for.
- * @param addConstructor If 'true' then generate constructors.
- * @param includeKeyFields If 'true' then include key fields into value POJO.
- */
- static pojos(caches, addConstructor, includeKeyFields) {
- const pojos = [];
-
- _.forEach(caches, (cache) => {
- _.forEach(cache.domains, (domain) => {
- // Process only domains with 'generatePojo' flag and skip already generated classes.
- if (domain.generatePojo && !_.find(pojos, {valueType: domain.valueType}) &&
- // Skip domain models without value fields.
- _.nonEmpty(domain.valueFields)) {
- const pojo = {};
-
- // Key class generation only if key is not build in java class.
- if (_.nonNil(domain.keyFields) && domain.keyFields.length > 0) {
- pojo.keyType = domain.keyType;
- pojo.keyClass = this.pojo(domain.keyType, domain.keyFields, addConstructor);
- }
+ sb.emptyLine();
+ });
- const valueFields = _.clone(domain.valueFields);
+ sb.append('return res;');
+ sb.endBlock('}');
- if (includeKeyFields) {
- _.forEach(domain.keyFields, (fld) => {
- if (!_.find(valueFields, {javaFieldName: fld.javaFieldName}))
- valueFields.push(fld);
- });
- }
+ sb.emptyLine();
- pojo.valueType = domain.valueType;
- pojo.valueClass = this.pojo(domain.valueType, valueFields, addConstructor);
+ this.commentBlock(sb, '{@inheritDoc}');
+ sb.startBlock('@Override public String toString() {');
+ sb.startBlock(`return "${clsName} [" + `);
- pojos.push(pojo);
- }
- });
- });
+ _.forEach(fields, (field, idx) => {
+ sb.append(`"${field.javaFieldName}=" + ${field.javaFieldName}${idx < fields.length - 1 ? ' + ", " + ' : ' +'}`);
+ });
- return pojos;
- }
+ sb.endBlock('"]";');
+ sb.endBlock('}');
- // Generate creation and execution of cache query.
- static _multilineQuery(sb, query, prefix, postfix) {
- if (_.isEmpty(query))
- return;
+ sb.endBlock('}');
- _.forEach(query, (line, ix) => {
- if (ix === 0) {
- if (query.length === 1)
- sb.append(`${prefix}"${line}"${postfix}`);
- else
- sb.startBlock(`${prefix}"${line}" +`);
+ return sb.asString();
+ }
+
+ /**
+ * Generate source code for type by its domain models.
+ *
+ * @param caches List of caches to generate POJOs for.
+ * @param addConstructor If 'true' then generate constructors.
+ * @param includeKeyFields If 'true' then include key fields into value POJO.
+ */
+ static pojos(caches, addConstructor, includeKeyFields) {
+ const pojos = [];
+
+ _.forEach(caches, (cache) => {
+ _.forEach(cache.domains, (domain) => {
+ // Process only domains with 'generatePojo' flag and skip already generated classes.
+ if (domain.generatePojo && !_.find(pojos, {valueType: domain.valueType}) &&
+ // Skip domain models without value fields.
+ _.nonEmpty(domain.valueFields)) {
+ const pojo = {
+ keyType: domain.keyType,
+ valueType: domain.valueType
+ };
+
+ // Key class generation only if key is not build in java class.
+ if (this.javaTypes.nonBuiltInClass(domain.keyType) && _.nonEmpty(domain.keyFields))
+ pojo.keyClass = this.pojo(domain.keyType, domain.keyFields, addConstructor);
+
+ const valueFields = _.clone(domain.valueFields);
+
+ if (includeKeyFields) {
+ _.forEach(domain.keyFields, (fld) => {
+ if (!_.find(valueFields, {javaFieldName: fld.javaFieldName}))
+ valueFields.push(fld);
+ });
+ }
+
+ pojo.valueClass = this.pojo(domain.valueType, valueFields, addConstructor);
+
+ pojos.push(pojo);
}
- else
- sb.append(`"${line}"${ix === query.length - 1 ? postfix : ' +'}`);
});
+ });
- if (query.length > 1)
- sb.endBlock('');
- else
- sb.emptyLine();
- }
+ return pojos;
+ }
- // Generate creation and execution of prepared statement.
- static _prepareStatement(sb, conVar, query) {
- this._multilineQuery(sb, query, `${conVar}.prepareStatement(`, ').executeUpdate();');
- }
+ // Generate creation and execution of cache query.
+ static _multilineQuery(sb, query, prefix, postfix) {
+ if (_.isEmpty(query))
+ return;
- static demoStartup(sb, cluster, shortFactoryCls) {
- const cachesWithDataSource = _.filter(cluster.caches, (cache) => {
- const kind = _.get(cache, 'cacheStoreFactory.kind');
+ _.forEach(query, (line, ix) => {
+ if (ix === 0) {
+ if (query.length === 1)
+ sb.append(`${prefix}"${line}"${postfix}`);
+ else
+ sb.startBlock(`${prefix}"${line}" +`);
+ }
+ else
+ sb.append(`"${line}"${ix === query.length - 1 ? postfix : ' +'}`);
+ });
- if (kind) {
- const store = cache.cacheStoreFactory[kind];
+ if (query.length > 1)
+ sb.endBlock('');
+ else
+ sb.emptyLine();
+ }
- return (store.connectVia === 'DataSource' || _.isNil(store.connectVia)) && store.dialect;
- }
+ // Generate creation and execution of prepared statement.
+ static _prepareStatement(sb, conVar, query) {
+ this._multilineQuery(sb, query, `${conVar}.prepareStatement(`, ').executeUpdate();');
+ }
- return false;
- });
+ static demoStartup(sb, cluster, shortFactoryCls) {
+ const cachesWithDataSource = _.filter(cluster.caches, (cache) => {
+ const kind = _.get(cache, 'cacheStoreFactory.kind');
- const uniqDomains = [];
+ if (kind) {
+ const store = cache.cacheStoreFactory[kind];
- // Prepare array of cache and his demo domain model list. Every domain is contained only in first cache.
- const demoTypes = _.reduce(cachesWithDataSource, (acc, cache) => {
- const domains = _.filter(cache.domains, (domain) => _.nonEmpty(domain.valueFields) &&
- !_.includes(uniqDomains, domain));
+ return (store.connectVia === 'DataSource' || _.isNil(store.connectVia)) && store.dialect;
+ }
- if (_.nonEmpty(domains)) {
- uniqDomains.push(...domains);
+ return false;
+ });
- acc.push({
- cache,
- domains
- });
- }
+ const uniqDomains = [];
- return acc;
- }, []);
+ // Prepare array of cache and his demo domain model list. Every domain is contained only in first cache.
+ const demoTypes = _.reduce(cachesWithDataSource, (acc, cache) => {
+ const domains = _.filter(cache.domains, (domain) => _.nonEmpty(domain.valueFields) &&
+ !_.includes(uniqDomains, domain));
- if (_.nonEmpty(demoTypes)) {
- // Group domain modes by data source
- const typeByDs = _.groupBy(demoTypes, ({cache}) => cache.cacheStoreFactory[cache.cacheStoreFactory.kind].dataSourceBean);
+ if (_.nonEmpty(domains)) {
+ uniqDomains.push(...domains);
- let rndNonDefined = true;
+ acc.push({
+ cache,
+ domains
+ });
+ }
- const generatedConsts = [];
+ return acc;
+ }, []);
- _.forEach(typeByDs, (types) => {
- _.forEach(types, (type) => {
- _.forEach(type.domains, (domain) => {
- const valType = domain.valueType.toUpperCase();
+ if (_.nonEmpty(demoTypes)) {
+ // Group domain modes by data source
+ const typeByDs = _.groupBy(demoTypes, ({cache}) => cache.cacheStoreFactory[cache.cacheStoreFactory.kind].dataSourceBean);
- const desc = _.find(PREDEFINED_QUERIES, (qry) => valType.endsWith(qry.type));
+ let rndNonDefined = true;
- if (desc) {
- if (rndNonDefined && desc.rndRequired) {
- this.commentBlock(sb, 'Random generator for demo data.');
- sb.append('private static final Random rnd = new Random();');
+ const generatedConsts = [];
- sb.emptyLine();
+ _.forEach(typeByDs, (types) => {
+ _.forEach(types, (type) => {
+ _.forEach(type.domains, (domain) => {
+ const valType = domain.valueType.toUpperCase();
- rndNonDefined = false;
- }
+ const desc = _.find(PREDEFINED_QUERIES, (qry) => valType.endsWith(qry.type));
- _.forEach(desc.insertCntConsts, (cnt) => {
- if (!_.includes(generatedConsts, cnt.name)) {
- this.commentBlock(sb, cnt.comment);
- sb.append(`private static final int ${cnt.name} = ${cnt.val};`);
+ if (desc) {
+ if (rndNonDefined && desc.rndRequired) {
+ this.commentBlock(sb, 'Random generator for demo data.');
+ sb.append('private static final Random rnd = new Random();');
- sb.emptyLine();
+ sb.emptyLine();
- generatedConsts.push(cnt.name);
- }
- });
+ rndNonDefined = false;
}
- });
- });
- });
- // Generation of fill database method
- this.commentBlock(sb, 'Fill data for Demo.');
- sb.startBlock('private static void prepareDemoData() throws SQLException {');
+ _.forEach(desc.insertCntConsts, (cnt) => {
+ if (!_.includes(generatedConsts, cnt.name)) {
+ this.commentBlock(sb, cnt.comment);
+ sb.append(`private static final int ${cnt.name} = ${cnt.val};`);
- let firstDs = true;
+ sb.emptyLine();
- _.forEach(typeByDs, (types, ds) => {
- const conVar = ds + 'Con';
+ generatedConsts.push(cnt.name);
+ }
+ });
+ }
+ });
+ });
+ });
- if (firstDs)
- firstDs = false;
- else
- sb.emptyLine();
+ // Generation of fill database method
+ this.commentBlock(sb, 'Fill data for Demo.');
+ sb.startBlock('private static void prepareDemoData() throws SQLException {');
- sb.startBlock(`try (Connection ${conVar} = ${shortFactoryCls}.DataSources.INSTANCE_${ds}.getConnection()) {`);
+ let firstDs = true;
- let first = true;
- let stmtFirst = true;
+ _.forEach(typeByDs, (types, ds) => {
+ const conVar = ds + 'Con';
- _.forEach(types, (type) => {
- _.forEach(type.domains, (domain) => {
- const valType = domain.valueType.toUpperCase();
+ if (firstDs)
+ firstDs = false;
+ else
+ sb.emptyLine();
- const desc = _.find(PREDEFINED_QUERIES, (qry) => valType.endsWith(qry.type));
+ sb.startBlock(`try (Connection ${conVar} = ${shortFactoryCls}.DataSources.INSTANCE_${ds}.getConnection()) {`);
- if (desc) {
- if (first)
- first = false;
- else
- sb.emptyLine();
+ let first = true;
+ let stmtFirst = true;
- this.comment(sb, `Generate ${desc.type}.`);
+ _.forEach(types, (type) => {
+ _.forEach(type.domains, (domain) => {
+ const valType = domain.valueType.toUpperCase();
- if (desc.schema)
- this._prepareStatement(sb, conVar, [`CREATE SCHEMA IF NOT EXISTS ${desc.schema}`]);
+ const desc = _.find(PREDEFINED_QUERIES, (qry) => valType.endsWith(qry.type));
- this._prepareStatement(sb, conVar, desc.create);
+ if (desc) {
+ if (first)
+ first = false;
+ else
+ sb.emptyLi
<TRUNCATED>
[32/37] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-1.8.2'
Posted by vo...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.8.2'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72f03ea7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72f03ea7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72f03ea7
Branch: refs/heads/ignite-2.0
Commit: 72f03ea7d8bc92de624817655e21f05c268a3399
Parents: 228d97b da5b68c
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 30 15:13:06 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Dec 30 15:13:06 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/util/nio/GridNioServer.java | 159 ++++++++++++++++---
.../communication/tcp/TcpCommunicationSpi.java | 20 +--
.../tcp/TcpCommunicationSpiMBean.java | 5 +-
...mmunicationBalancePairedConnectionsTest.java | 28 ++++
.../IgniteCommunicationBalanceTest.java | 25 ++-
...cMessageRecoveryNoPairedConnectionsTest.java | 47 ------
...micMessageRecoveryPairedConnectionsTest.java | 47 ++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 6 +-
.../yardstick/cache/IgniteIoTestBenchmark.java | 73 ---------
9 files changed, 250 insertions(+), 160 deletions(-)
----------------------------------------------------------------------
[11/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.platform.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.platform.provider.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.platform.provider.js
deleted file mode 100644
index 582426e..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.platform.provider.js
+++ /dev/null
@@ -1,49 +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.
- */
-
-import _ from 'lodash';
-
-const enumValueMapper = (val) => _.capitalize(val);
-
-const DFLT_CLUSTER = {
- atomics: {
- cacheMode: {
- clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMode',
- mapper: enumValueMapper
- }
- },
- transactionConfiguration: {
- defaultTxConcurrency: {
- clsName: 'Apache.Ignite.Core.Transactions.TransactionConcurrency',
- mapper: enumValueMapper
- },
- defaultTxIsolation: {
- clsName: 'Apache.Ignite.Core.Transactions.TransactionIsolation',
- mapper: enumValueMapper
- }
- }
-};
-
-export default function() {
- this.append = (dflts) => {
- _.merge(DFLT_CLUSTER, dflts);
- };
-
- this.$get = ['igniteClusterDefaults', (clusterDefaults) => {
- return _.merge({}, clusterDefaults, DFLT_CLUSTER);
- }];
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.provider.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.provider.js
deleted file mode 100644
index 726581d..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/cluster.provider.js
+++ /dev/null
@@ -1,293 +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.
- */
-
-const DFLT_CLUSTER = {
- localHost: '0.0.0.0',
- discovery: {
- localPort: 47500,
- localPortRange: 100,
- socketTimeout: 5000,
- ackTimeout: 5000,
- maxAckTimeout: 600000,
- networkTimeout: 5000,
- joinTimeout: 0,
- threadPriority: 10,
- heartbeatFrequency: 2000,
- maxMissedHeartbeats: 1,
- maxMissedClientHeartbeats: 5,
- topHistorySize: 1000,
- reconnectCount: 10,
- statisticsPrintFrequency: 0,
- ipFinderCleanFrequency: 60000,
- forceServerMode: false,
- clientReconnectDisabled: false,
- Multicast: {
- multicastGroup: '228.1.2.4',
- multicastPort: 47400,
- responseWaitTime: 500,
- addressRequestAttempts: 2,
- localAddress: '0.0.0.0'
- },
- Jdbc: {
- initSchema: false
- },
- SharedFs: {
- path: 'disco/tcp'
- },
- ZooKeeper: {
- basePath: '/services',
- serviceName: 'ignite',
- allowDuplicateRegistrations: false,
- ExponentialBackoff: {
- baseSleepTimeMs: 1000,
- maxRetries: 10
- },
- BoundedExponentialBackoffRetry: {
- baseSleepTimeMs: 1000,
- maxSleepTimeMs: 2147483647,
- maxRetries: 10
- },
- UntilElapsed: {
- maxElapsedTimeMs: 60000,
- sleepMsBetweenRetries: 1000
- },
- RetryNTimes: {
- n: 10,
- sleepMsBetweenRetries: 1000
- },
- OneTime: {
- sleepMsBetweenRetry: 1000
- },
- Forever: {
- retryIntervalMs: 1000
- }
- }
- },
- atomics: {
- atomicSequenceReserveSize: 1000,
- backups: 0,
- cacheMode: {
- clsName: 'org.apache.ignite.cache.CacheMode',
- value: 'PARTITIONED'
- }
- },
- binary: {
- compactFooter: true,
- typeConfigurations: {
- enum: false
- }
- },
- collision: {
- kind: null,
- JobStealing: {
- activeJobsThreshold: 95,
- waitJobsThreshold: 0,
- messageExpireTime: 1000,
- maximumStealingAttempts: 5,
- stealingEnabled: true,
- stealingAttributes: {
- keyClsName: 'java.lang.String',
- valClsName: 'java.io.Serializable',
- items: []
- }
- },
- PriorityQueue: {
- priorityAttributeKey: 'grid.task.priority',
- jobPriorityAttributeKey: 'grid.job.priority',
- defaultPriority: 0,
- starvationIncrement: 1,
- starvationPreventionEnabled: true
- }
- },
- communication: {
- localPort: 47100,
- localPortRange: 100,
- sharedMemoryPort: 48100,
- directBuffer: false,
- directSendBuffer: false,
- idleConnectionTimeout: 30000,
- connectTimeout: 5000,
- maxConnectTimeout: 600000,
- reconnectCount: 10,
- socketSendBuffer: 32768,
- socketReceiveBuffer: 32768,
- messageQueueLimit: 1024,
- tcpNoDelay: true,
- ackSendThreshold: 16,
- unacknowledgedMessagesBufferSize: 0,
- socketWriteTimeout: 2000
- },
- networkTimeout: 5000,
- networkSendRetryDelay: 1000,
- networkSendRetryCount: 3,
- discoveryStartupDelay: 60000,
- connector: {
- port: 11211,
- portRange: 100,
- idleTimeout: 7000,
- idleQueryCursorTimeout: 600000,
- idleQueryCursorCheckFrequency: 60000,
- receiveBufferSize: 32768,
- sendBufferSize: 32768,
- sendQueueLimit: 0,
- directBuffer: false,
- noDelay: true,
- sslEnabled: false,
- sslClientAuth: false
- },
- deploymentMode: {
- clsName: 'org.apache.ignite.configuration.DeploymentMode',
- value: 'SHARED'
- },
- peerClassLoadingEnabled: false,
- peerClassLoadingMissedResourcesCacheSize: 100,
- peerClassLoadingThreadPoolSize: 2,
- failoverSpi: {
- JobStealing: {
- maximumFailoverAttempts: 5
- },
- Always: {
- maximumFailoverAttempts: 5
- }
- },
- logger: {
- Log4j: {
- level: {
- clsName: 'org.apache.log4j.Level'
- }
- },
- Log4j2: {
- level: {
- clsName: 'org.apache.logging.log4j.Level'
- }
- }
- },
- marshalLocalJobs: false,
- marshallerCacheKeepAliveTime: 10000,
- metricsHistorySize: 10000,
- metricsLogFrequency: 60000,
- metricsUpdateFrequency: 2000,
- clockSyncSamples: 8,
- clockSyncFrequency: 120000,
- timeServerPortBase: 31100,
- timeServerPortRange: 100,
- transactionConfiguration: {
- defaultTxConcurrency: {
- clsName: 'org.apache.ignite.transactions.TransactionConcurrency',
- value: 'PESSIMISTIC'
- },
- defaultTxIsolation: {
- clsName: 'org.apache.ignite.transactions.TransactionIsolation',
- value: 'REPEATABLE_READ'
- },
- defaultTxTimeout: 0,
- pessimisticTxLogLinger: 10000
- },
- attributes: {
- keyClsName: 'java.lang.String',
- valClsName: 'java.lang.String',
- items: []
- },
- odbcConfiguration: {
- endpointAddress: '0.0.0.0:10800..10810',
- maxOpenCursors: 128
- },
- eventStorage: {
- Memory: {
- expireCount: 10000
- }
- },
- checkpointSpi: {
- S3: {
- bucketNameSuffix: 'default-bucket',
- clientConfiguration: {
- protocol: {
- clsName: 'com.amazonaws.Protocol',
- value: 'HTTPS'
- },
- maxConnections: 50,
- retryPolicy: {
- retryCondition: {
- clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
- },
- backoffStrategy: {
- clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
- },
- maxErrorRetry: {
- clsName: 'com.amazonaws.retry.PredefinedRetryPolicies'
- }
- },
- maxErrorRetry: -1,
- socketTimeout: 50000,
- connectionTimeout: 50000,
- requestTimeout: 0,
- socketSendBufferSizeHints: 0,
- connectionTTL: -1,
- connectionMaxIdleMillis: 60000,
- responseMetadataCacheSize: 50,
- useReaper: true,
- useGzip: false,
- preemptiveBasicProxyAuth: false,
- useTcpKeepAlive: false
- }
- },
- JDBC: {
- checkpointTableName: 'CHECKPOINTS',
- keyFieldName: 'NAME',
- keyFieldType: 'VARCHAR',
- valueFieldName: 'VALUE',
- valueFieldType: 'BLOB',
- expireDateFieldName: 'EXPIRE_DATE',
- expireDateFieldType: 'DATETIME',
- numberOfRetries: 2
- }
- },
- loadBalancingSpi: {
- RoundRobin: {
- perTask: false
- },
- Adaptive: {
- loadProbe: {
- Job: {
- useAverage: true
- },
- CPU: {
- useAverage: true,
- useProcessors: true,
- processorCoefficient: 1
- },
- ProcessingTime: {
- useAverage: true
- }
- }
- },
- WeightedRandom: {
- nodeWeight: 10,
- useWeights: false
- }
- }
-};
-
-export default function() {
- this.append = (dflts) => {
- _.merge(DFLT_CLUSTER, dflts);
- };
-
- this.$get = [() => {
- return DFLT_CLUSTER;
- }];
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/defaults/igfs.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/igfs.provider.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/igfs.provider.js
deleted file mode 100644
index c556336..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/igfs.provider.js
+++ /dev/null
@@ -1,68 +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.
- */
-
-const DFLT_IGFS = {
- defaultMode: {
- clsName: 'org.apache.ignite.igfs.IgfsMode',
- value: 'DUAL_ASYNC'
- },
- secondaryFileSystem: {
-
- },
- ipcEndpointConfiguration: {
- type: {
- clsName: 'org.apache.ignite.igfs.IgfsIpcEndpointType'
- },
- host: '127.0.0.1',
- port: 10500,
- memorySize: 262144,
- tokenDirectoryPath: 'ipc/shmem'
- },
- fragmentizerConcurrentFiles: 0,
- fragmentizerThrottlingBlockLength: 16777216,
- fragmentizerThrottlingDelay: 200,
- dualModeMaxPendingPutsSize: 0,
- dualModePutExecutorServiceShutdown: false,
- blockSize: 65536,
- streamBufferSize: 65536,
- maxSpaceSize: 0,
- maximumTaskRangeLength: 0,
- managementPort: 11400,
- perNodeBatchSize: 100,
- perNodeParallelBatchCount: 8,
- prefetchBlocks: 0,
- sequentialReadsBeforePrefetch: 0,
- trashPurgeTimeout: 1000,
- colocateMetadata: true,
- relaxedConsistency: true,
- pathModes: {
- keyClsName: 'java.lang.String',
- keyField: 'path',
- valClsName: 'org.apache.ignite.igfs.IgfsMode',
- valField: 'mode'
- }
-};
-
-export default function() {
- this.append = (dflts) => {
- _.merge(DFLT_IGFS, dflts);
- };
-
- this.$get = [() => {
- return DFLT_IGFS;
- }];
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/generator-common.js b/modules/web-console/frontend/app/modules/configuration/generator/generator-common.js
deleted file mode 100644
index d502c8a..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/generator-common.js
+++ /dev/null
@@ -1,625 +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.
- */
-
-// Entry point for common functions for code generation.
-const $generatorCommon = {};
-
-// Add leading zero.
-$generatorCommon.addLeadingZero = function(numberStr, minSize) {
- if (typeof (numberStr) !== 'string')
- numberStr = String(numberStr);
-
- while (numberStr.length < minSize)
- numberStr = '0' + numberStr;
-
- return numberStr;
-};
-
-// Format date to string.
-$generatorCommon.formatDate = function(date) {
- const dd = $generatorCommon.addLeadingZero(date.getDate(), 2);
- const mm = $generatorCommon.addLeadingZero(date.getMonth() + 1, 2);
-
- const yyyy = date.getFullYear();
-
- return mm + '/' + dd + '/' + yyyy + ' ' + $generatorCommon.addLeadingZero(date.getHours(), 2) + ':' + $generatorCommon.addLeadingZero(date.getMinutes(), 2);
-};
-
-/**
- * Generate title comment for XML, Java, ... files.
- *
- * @param sbj {string} What is generated.
- * @returns {string} Text to add as title comment in generated java class.
- */
-$generatorCommon.mainComment = function mainComment(sbj) {
- return 'This ' + sbj + ' was generated by Ignite Web Console (' + $generatorCommon.formatDate(new Date()) + ')';
-};
-
-// Create result holder with service functions and properties for XML and java code generation.
-$generatorCommon.builder = function(deep) {
- if (_.isNil($generatorCommon.JavaTypes))
- $generatorCommon.JavaTypes = angular.element(document.getElementById('app')).injector().get('JavaTypes');
-
- const res = [];
-
- res.deep = deep || 0;
- res.needEmptyLine = false;
- res.lineStart = true;
- res.datasources = [];
- res.imports = {};
- res.staticImports = {};
- res.vars = {};
-
- res.safeDeep = 0;
- res.safeNeedEmptyLine = false;
- res.safeImports = {};
- res.safeDatasources = [];
- res.safePoint = -1;
-
- res.mergeProps = function(fromRes) {
- if ($generatorCommon.isDefinedAndNotEmpty(fromRes)) {
- res.datasources = fromRes.datasources;
-
- angular.extend(res.imports, fromRes.imports);
- angular.extend(res.staticImports, fromRes.staticImports);
- angular.extend(res.vars, fromRes.vars);
- }
- };
-
- res.mergeLines = function(fromRes) {
- if ($generatorCommon.isDefinedAndNotEmpty(fromRes)) {
- if (res.needEmptyLine)
- res.push('');
-
- _.forEach(fromRes, function(line) {
- res.append(line);
- });
- }
- };
-
- res.startSafeBlock = function() {
- res.safeDeep = this.deep;
- this.safeNeedEmptyLine = this.needEmptyLine;
- this.safeImports = _.cloneDeep(this.imports);
- this.safeStaticImports = _.cloneDeep(this.staticImports);
- this.safeDatasources = this.datasources.slice();
- this.safePoint = this.length;
- };
-
- res.rollbackSafeBlock = function() {
- if (this.safePoint >= 0) {
- this.splice(this.safePoint, this.length - this.safePoint);
-
- this.deep = res.safeDeep;
- this.needEmptyLine = this.safeNeedEmptyLine;
- this.datasources = this.safeDatasources;
- this.imports = this.safeImports;
- this.staticImports = this.safeStaticImports;
- this.safePoint = -1;
- }
- };
-
- res.asString = function() {
- return this.join('\n');
- };
-
- res.append = function(s) {
- this.push((this.lineStart ? _.repeat(' ', this.deep) : '') + s);
-
- return this;
- };
-
- res.line = function(s) {
- if (s) {
- if (res.needEmptyLine)
- res.push('');
-
- res.append(s);
- }
-
- res.needEmptyLine = false;
-
- res.lineStart = true;
-
- return res;
- };
-
- res.startBlock = function(s) {
- if (s) {
- if (this.needEmptyLine)
- this.push('');
-
- this.append(s);
- }
-
- this.needEmptyLine = false;
-
- this.lineStart = true;
-
- this.deep++;
-
- return this;
- };
-
- res.endBlock = function(s) {
- this.deep--;
-
- if (s)
- this.append(s);
-
- this.lineStart = true;
-
- return this;
- };
-
- res.softEmptyLine = function() {
- this.needEmptyLine = this.length > 0;
- };
-
- res.emptyLineIfNeeded = function() {
- if (this.needEmptyLine) {
- this.push('');
- this.lineStart = true;
-
- this.needEmptyLine = false;
- }
- };
-
- /**
- * Add class to imports.
- *
- * @param clsName Full class name.
- * @returns {String} Short class name or full class name in case of names conflict.
- */
- res.importClass = function(clsName) {
- if ($generatorCommon.JavaTypes.isJavaPrimitive(clsName))
- return clsName;
-
- const fullClassName = $generatorCommon.JavaTypes.fullClassName(clsName);
-
- const dotIdx = fullClassName.lastIndexOf('.');
-
- const shortName = dotIdx > 0 ? fullClassName.substr(dotIdx + 1) : fullClassName;
-
- if (this.imports[shortName]) {
- if (this.imports[shortName] !== fullClassName)
- return fullClassName; // Short class names conflict. Return full name.
- }
- else
- this.imports[shortName] = fullClassName;
-
- return shortName;
- };
-
- /**
- * Add class to imports.
- *
- * @param member Static member.
- * @returns {String} Short class name or full class name in case of names conflict.
- */
- res.importStatic = function(member) {
- const dotIdx = member.lastIndexOf('.');
-
- const shortName = dotIdx > 0 ? member.substr(dotIdx + 1) : member;
-
- if (this.staticImports[shortName]) {
- if (this.staticImports[shortName] !== member)
- return member; // Short class names conflict. Return full name.
- }
- else
- this.staticImports[shortName] = member;
-
- return shortName;
- };
-
- /**
- * @returns String with "java imports" section.
- */
- res.generateImports = function() {
- const genImports = [];
-
- for (const clsName in this.imports) {
- if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) !== 0)
- genImports.push('import ' + this.imports[clsName] + ';');
- }
-
- genImports.sort();
-
- return genImports.join('\n');
- };
-
- /**
- * @returns String with "java imports" section.
- */
- res.generateStaticImports = function() {
- const statImports = [];
-
- for (const clsName in this.staticImports) {
- if (this.staticImports.hasOwnProperty(clsName) && this.staticImports[clsName].lastIndexOf('java.lang.', 0) !== 0)
- statImports.push('import static ' + this.staticImports[clsName] + ';');
- }
-
- statImports.sort();
-
- return statImports.join('\n');
- };
-
- return res;
-};
-
-// Eviction policies code generation descriptors.
-$generatorCommon.EVICTION_POLICIES = {
- LRU: {
- className: 'org.apache.ignite.cache.eviction.lru.LruEvictionPolicy',
- fields: {batchSize: {dflt: 1}, maxMemorySize: null, maxSize: {dflt: 100000}}
- },
- FIFO: {
- className: 'org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy',
- fields: {batchSize: {dflt: 1}, maxMemorySize: null, maxSize: {dflt: 100000}}
- },
- SORTED: {
- className: 'org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy',
- fields: {batchSize: {dflt: 1}, maxMemorySize: null, maxSize: {dflt: 100000}}
- }
-};
-
-// Marshaller code generation descriptors.
-$generatorCommon.MARSHALLERS = {
- OptimizedMarshaller: {
- className: 'org.apache.ignite.marshaller.optimized.OptimizedMarshaller',
- fields: {poolSize: null, requireSerializable: null }
- },
- JdkMarshaller: {
- className: 'org.apache.ignite.marshaller.jdk.JdkMarshaller',
- fields: {}
- }
-};
-
-// Pairs of supported databases and their JDBC dialects.
-$generatorCommon.JDBC_DIALECTS = {
- Generic: 'org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect',
- Oracle: 'org.apache.ignite.cache.store.jdbc.dialect.OracleDialect',
- DB2: 'org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect',
- SQLServer: 'org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect',
- MySQL: 'org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect',
- PostgreSQL: 'org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect',
- H2: 'org.apache.ignite.cache.store.jdbc.dialect.H2Dialect'
-};
-
-// Return JDBC dialect full class name for specified database.
-$generatorCommon.jdbcDialectClassName = function(db) {
- const dialectClsName = $generatorCommon.JDBC_DIALECTS[db];
-
- return dialectClsName ? dialectClsName : 'Unknown database: ' + db;
-};
-
-// Generate default data cache for specified igfs instance.
-$generatorCommon.igfsDataCache = function(igfs) {
- return {
- name: igfs.name + '-data',
- cacheMode: 'PARTITIONED',
- atomicityMode: 'TRANSACTIONAL',
- writeSynchronizationMode: 'FULL_SYNC',
- backups: 0,
- igfsAffinnityGroupSize: igfs.affinnityGroupSize || 512
- };
-};
-
-// Generate default meta cache for specified igfs instance.
-$generatorCommon.igfsMetaCache = function(igfs) {
- return {
- name: igfs.name + '-meta',
- cacheMode: 'REPLICATED',
- atomicityMode: 'TRANSACTIONAL',
- writeSynchronizationMode: 'FULL_SYNC'
- };
-};
-
-// Pairs of supported databases and their data sources.
-$generatorCommon.DATA_SOURCES = {
- Generic: 'com.mchange.v2.c3p0.ComboPooledDataSource',
- Oracle: 'oracle.jdbc.pool.OracleDataSource',
- DB2: 'com.ibm.db2.jcc.DB2DataSource',
- SQLServer: 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
- MySQL: 'com.mysql.jdbc.jdbc2.optional.MysqlDataSource',
- PostgreSQL: 'org.postgresql.ds.PGPoolingDataSource',
- H2: 'org.h2.jdbcx.JdbcDataSource'
-};
-
-// Return data source full class name for specified database.
-$generatorCommon.dataSourceClassName = function(db) {
- const dsClsName = $generatorCommon.DATA_SOURCES[db];
-
- return dsClsName ? dsClsName : 'Unknown database: ' + db;
-};
-
-// Store factories code generation descriptors.
-$generatorCommon.STORE_FACTORIES = {
- CacheJdbcPojoStoreFactory: {
- className: 'org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory',
- suffix: 'JdbcPojo',
- fields: {
- configuration: {type: 'bean'}
- }
- },
- CacheJdbcBlobStoreFactory: {
- className: 'org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory',
- suffix: 'JdbcBlob',
- fields: {
- initSchema: null,
- createTableQuery: null,
- loadQuery: null,
- insertQuery: null,
- updateQuery: null,
- deleteQuery: null
- }
- },
- CacheHibernateBlobStoreFactory: {
- className: 'org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory',
- suffix: 'Hibernate',
- fields: {hibernateProperties: {type: 'propertiesAsList', propVarName: 'props'}}
- }
-};
-
-// Swap space SPI code generation descriptor.
-$generatorCommon.SWAP_SPACE_SPI = {
- className: 'org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi',
- fields: {
- baseDirectory: {type: 'path'},
- readStripesNumber: null,
- maximumSparsity: {type: 'float'},
- maxWriteQueueSize: null,
- writeBufferSize: null
- }
-};
-
-// Transaction configuration code generation descriptor.
-$generatorCommon.TRANSACTION_CONFIGURATION = {
- className: 'org.apache.ignite.configuration.TransactionConfiguration',
- fields: {
- defaultTxConcurrency: {type: 'enum', enumClass: 'org.apache.ignite.transactions.TransactionConcurrency', dflt: 'PESSIMISTIC'},
- defaultTxIsolation: {type: 'enum', enumClass: 'org.apache.ignite.transactions.TransactionIsolation', dflt: 'REPEATABLE_READ'},
- defaultTxTimeout: {dflt: 0},
- pessimisticTxLogLinger: {dflt: 10000},
- pessimisticTxLogSize: null,
- txSerializableEnabled: null,
- txManagerFactory: {type: 'bean'}
- }
-};
-
-// SSL configuration code generation descriptor.
-$generatorCommon.SSL_CONFIGURATION_TRUST_FILE_FACTORY = {
- className: 'org.apache.ignite.ssl.SslContextFactory',
- fields: {
- keyAlgorithm: null,
- keyStoreFilePath: {type: 'path'},
- keyStorePassword: {type: 'raw'},
- keyStoreType: null,
- protocol: null,
- trustStoreFilePath: {type: 'path'},
- trustStorePassword: {type: 'raw'},
- trustStoreType: null
- }
-};
-
-// SSL configuration code generation descriptor.
-$generatorCommon.SSL_CONFIGURATION_TRUST_MANAGER_FACTORY = {
- className: 'org.apache.ignite.ssl.SslContextFactory',
- fields: {
- keyAlgorithm: null,
- keyStoreFilePath: {type: 'path'},
- keyStorePassword: {type: 'raw'},
- keyStoreType: null,
- protocol: null,
- trustManagers: {type: 'array'}
- }
-};
-
-// Communication configuration code generation descriptor.
-$generatorCommon.CONNECTOR_CONFIGURATION = {
- className: 'org.apache.ignite.configuration.ConnectorConfiguration',
- fields: {
- jettyPath: null,
- host: null,
- port: {dflt: 11211},
- portRange: {dflt: 100},
- idleTimeout: {dflt: 7000},
- idleQueryCursorTimeout: {dflt: 600000},
- idleQueryCursorCheckFrequency: {dflt: 60000},
- receiveBufferSize: {dflt: 32768},
- sendBufferSize: {dflt: 32768},
- sendQueueLimit: {dflt: 0},
- directBuffer: {dflt: false},
- noDelay: {dflt: true},
- selectorCount: null,
- threadPoolSize: null,
- messageInterceptor: {type: 'bean'},
- secretKey: null,
- sslEnabled: {dflt: false}
- }
-};
-
-// Communication configuration code generation descriptor.
-$generatorCommon.COMMUNICATION_CONFIGURATION = {
- className: 'org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi',
- fields: {
- listener: {type: 'bean'},
- localAddress: null,
- localPort: {dflt: 47100},
- localPortRange: {dflt: 100},
- sharedMemoryPort: {dflt: 48100},
- directBuffer: {dflt: false},
- directSendBuffer: {dflt: false},
- idleConnectionTimeout: {dflt: 30000},
- connectTimeout: {dflt: 5000},
- maxConnectTimeout: {dflt: 600000},
- reconnectCount: {dflt: 10},
- socketSendBuffer: {dflt: 32768},
- socketReceiveBuffer: {dflt: 32768},
- messageQueueLimit: {dflt: 1024},
- slowClientQueueLimit: null,
- tcpNoDelay: {dflt: true},
- ackSendThreshold: {dflt: 16},
- unacknowledgedMessagesBufferSize: {dflt: 0},
- socketWriteTimeout: {dflt: 2000},
- selectorsCount: null,
- addressResolver: {type: 'bean'}
- }
-};
-
-// Communication configuration code generation descriptor.
-$generatorCommon.IGFS_IPC_CONFIGURATION = {
- className: 'org.apache.ignite.igfs.IgfsIpcEndpointConfiguration',
- fields: {
- type: {type: 'enum', enumClass: 'org.apache.ignite.igfs.IgfsIpcEndpointType'},
- host: {dflt: '127.0.0.1'},
- port: {dflt: 10500},
- memorySize: {dflt: 262144},
- tokenDirectoryPath: {dflt: 'ipc/shmem'},
- threadCount: null
- }
-};
-
-$generatorCommon.ODBC_CONFIGURATION = {
- className: 'org.apache.ignite.configuration.OdbcConfiguration',
- fields: {
- endpointAddress: {dflt: '0.0.0.0:10800..10810'},
- maxOpenCursors: {dflt: 128}
- }
-};
-
-// Check that cache has datasource.
-$generatorCommon.cacheHasDatasource = function(cache) {
- if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
- const storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind];
-
- return !!(storeFactory && (storeFactory.connectVia ? (storeFactory.connectVia === 'DataSource' ? storeFactory.dialect : false) : storeFactory.dialect)); // eslint-disable-line no-nested-ternary
- }
-
- return false;
-};
-
-$generatorCommon.secretPropertiesNeeded = function(cluster) {
- return !_.isNil(_.find(cluster.caches, $generatorCommon.cacheHasDatasource)) || cluster.sslEnabled;
-};
-
-// Check that binary is configured.
-$generatorCommon.binaryIsDefined = function(binary) {
- return binary && ($generatorCommon.isDefinedAndNotEmpty(binary.idMapper) || $generatorCommon.isDefinedAndNotEmpty(binary.nameMapper) ||
- $generatorCommon.isDefinedAndNotEmpty(binary.serializer) || $generatorCommon.isDefinedAndNotEmpty(binary.typeConfigurations) ||
- (!_.isNil(binary.compactFooter) && !binary.compactFooter));
-};
-
-// Extract domain model metadata location.
-$generatorCommon.domainQueryMetadata = function(domain) {
- return domain.queryMetadata ? domain.queryMetadata : 'Configuration';
-};
-
-/**
- * @param {Object} obj Object to check.
- * @param {Array<String>} props Array of properties names.
- * @returns {boolean} 'true' if
- */
-$generatorCommon.hasAtLeastOneProperty = function(obj, props) {
- return obj && props && _.findIndex(props, (prop) => !_.isNil(obj[prop])) >= 0;
-};
-
-/**
- * Convert some name to valid java name.
- *
- * @param prefix To append to java name.
- * @param name to convert.
- * @returns {string} Valid java name.
- */
-$generatorCommon.toJavaName = function(prefix, name) {
- const javaName = name ? name.replace(/[^A-Za-z_0-9]+/g, '_') : 'dflt';
-
- return prefix + javaName.charAt(0).toLocaleUpperCase() + javaName.slice(1);
-};
-
-/**
- * @param v Value to check.
- * @returns {boolean} 'true' if value defined and not empty string.
- */
-$generatorCommon.isDefinedAndNotEmpty = function(v) {
- let defined = !_.isNil(v);
-
- if (defined && (_.isString(v) || _.isArray(v)))
- defined = v.length > 0;
-
- return defined;
-};
-
-/**
- * @param {Object} obj Object to check.
- * @param {Array<String>} props Properties names.
- * @returns {boolean} 'true' if object contains at least one from specified properties.
- */
-$generatorCommon.hasProperty = function(obj, props) {
- for (const propName in props) {
- if (props.hasOwnProperty(propName)) {
- if (obj[propName])
- return true;
- }
- }
-
- return false;
-};
-
-/**
- * Get class for selected implementation of Failover SPI.
- *
- * @param spi Failover SPI configuration.
- * @returns {*} Class for selected implementation of Failover SPI.
- */
-$generatorCommon.failoverSpiClass = function(spi) {
- switch (spi.kind) {
- case 'JobStealing': return 'org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi';
- case 'Never': return 'org.apache.ignite.spi.failover.never.NeverFailoverSpi';
- case 'Always': return 'org.apache.ignite.spi.failover.always.AlwaysFailoverSpi';
- case 'Custom': return _.get(spi, 'Custom.class');
- default: return 'Unknown';
- }
-};
-
-$generatorCommon.loggerConfigured = function(logger) {
- if (logger && logger.kind) {
- const log = logger[logger.kind];
-
- switch (logger.kind) {
- case 'Log4j2': return log && $generatorCommon.isDefinedAndNotEmpty(log.path);
-
- case 'Log4j':
- if (!log || !log.mode)
- return false;
-
- if (log.mode === 'Path')
- return $generatorCommon.isDefinedAndNotEmpty(log.path);
-
- return true;
-
- case 'Custom': return log && $generatorCommon.isDefinedAndNotEmpty(log.class);
-
- default:
- return true;
- }
- }
-
- return false;
-};
-
-export default $generatorCommon;
[33/37] ignite git commit: IGNITE-4519 Updating ignite-aws java sdk
pom version
Posted by vo...@apache.org.
IGNITE-4519 Updating ignite-aws java sdk pom version
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c1cd162
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c1cd162
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c1cd162
Branch: refs/heads/ignite-2.0
Commit: 6c1cd162e60af37c9d380d801a6d2ce7f3b448b1
Parents: 72f03ea
Author: chandresh.pancholi <ch...@arvindinternet.com>
Authored: Wed Jan 4 18:21:41 2017 +0530
Committer: chandresh.pancholi <ch...@arvindinternet.com>
Committed: Wed Jan 4 18:21:41 2017 +0530
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6c1cd162/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 682efa2..2cb88b0 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -53,7 +53,7 @@
<aspectj.bundle.version>1.7.2_1</aspectj.bundle.version>
<aspectj.version>1.7.2</aspectj.version>
<aws.sdk.bundle.version>1.10.12_1</aws.sdk.bundle.version>
- <aws.sdk.version>1.10.29</aws.sdk.version>
+ <aws.sdk.version>1.11.75</aws.sdk.version>
<camel.version>2.16.0</camel.version>
<commons.beanutils.bundle.version>1.8.3_1</commons.beanutils.bundle.version>
<commons.beanutils.version>1.8.3</commons.beanutils.version>
[09/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/generator-optional.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/generator-optional.js b/modules/web-console/frontend/app/modules/configuration/generator/generator-optional.js
deleted file mode 100644
index 61de1a2..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/generator-optional.js
+++ /dev/null
@@ -1,25 +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.
- */
-
-// Optional content generation entry point.
-const $generatorOptional = {};
-
-$generatorOptional.optionalContent = function(zip, cluster) { // eslint-disable-line no-unused-vars
- // No-op.
-};
-
-export default $generatorOptional;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/generator-spring.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/generator-spring.js b/modules/web-console/frontend/app/modules/configuration/generator/generator-spring.js
deleted file mode 100644
index f70c66f..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/generator-spring.js
+++ /dev/null
@@ -1,2111 +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.
- */
-
-// XML generation entry point.
-const $generatorSpring = {};
-
-// Do XML escape.
-$generatorSpring.escape = function(s) {
- if (typeof (s) !== 'string')
- return s;
-
- return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
-};
-
-// Add constructor argument
-$generatorSpring.constructorArg = function(res, ix, obj, propName, dflt, opt) {
- const v = (obj ? obj[propName] : null) || dflt;
-
- if ($generatorCommon.isDefinedAndNotEmpty(v))
- res.line('<constructor-arg ' + (ix >= 0 ? 'index="' + ix + '" ' : '') + 'value="' + v + '"/>');
- else if (!opt) {
- res.startBlock('<constructor-arg ' + (ix >= 0 ? 'index="' + ix + '"' : '') + '>');
- res.line('<null/>');
- res.endBlock('</constructor-arg>');
- }
-};
-
-// Add XML element.
-$generatorSpring.element = function(res, tag, attr1, val1, attr2, val2) {
- let elem = '<' + tag;
-
- if (attr1)
- elem += ' ' + attr1 + '="' + val1 + '"';
-
- if (attr2)
- elem += ' ' + attr2 + '="' + val2 + '"';
-
- elem += '/>';
-
- res.emptyLineIfNeeded();
- res.line(elem);
-};
-
-// Add property.
-$generatorSpring.property = function(res, obj, propName, setterName, dflt) {
- if (!_.isNil(obj)) {
- const val = obj[propName];
-
- if ($generatorCommon.isDefinedAndNotEmpty(val)) {
- const missDflt = _.isNil(dflt);
-
- // Add to result if no default provided or value not equals to default.
- if (missDflt || (!missDflt && val !== dflt)) {
- $generatorSpring.element(res, 'property', 'name', setterName ? setterName : propName, 'value', $generatorSpring.escape(val));
-
- return true;
- }
- }
- }
-
- return false;
-};
-
-// Add property for class name.
-$generatorSpring.classNameProperty = function(res, obj, propName) {
- const val = obj[propName];
-
- if (!_.isNil(val))
- $generatorSpring.element(res, 'property', 'name', propName, 'value', $generatorCommon.JavaTypes.fullClassName(val));
-};
-
-// Add list property.
-$generatorSpring.listProperty = function(res, obj, propName, listType, rowFactory) {
- const val = obj[propName];
-
- if (val && val.length > 0) {
- res.emptyLineIfNeeded();
-
- if (!listType)
- listType = 'list';
-
- if (!rowFactory)
- rowFactory = (v) => '<value>' + $generatorSpring.escape(v) + '</value>';
-
- res.startBlock('<property name="' + propName + '">');
- res.startBlock('<' + listType + '>');
-
- _.forEach(val, (v) => res.line(rowFactory(v)));
-
- res.endBlock('</' + listType + '>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-};
-
-// Add array property
-$generatorSpring.arrayProperty = function(res, obj, propName, descr, rowFactory) {
- const val = obj[propName];
-
- if (val && val.length > 0) {
- res.emptyLineIfNeeded();
-
- if (!rowFactory)
- rowFactory = (v) => '<bean class="' + v + '"/>';
-
- res.startBlock('<property name="' + propName + '">');
- res.startBlock('<list>');
-
- _.forEach(val, (v) => res.append(rowFactory(v)));
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-};
-
-/**
- * Add bean property with internal content.
- *
- * @param res Optional configuration presentation builder object.
- * @param bean Bean object for code generation.
- * @param beanPropName Name of property to set generated bean as value.
- * @param desc Bean metadata object.
- * @param createBeanAlthoughNoProps Always generate bean even it has no properties defined.
- */
-$generatorSpring.beanProperty = function(res, bean, beanPropName, desc, createBeanAlthoughNoProps) {
- const props = desc.fields;
-
- if (bean && $generatorCommon.hasProperty(bean, props)) {
- if (!createBeanAlthoughNoProps)
- res.startSafeBlock();
-
- res.emptyLineIfNeeded();
- res.startBlock('<property name="' + beanPropName + '">');
-
- if (createBeanAlthoughNoProps)
- res.startSafeBlock();
-
- res.startBlock('<bean class="' + desc.className + '">');
-
- let hasData = false;
-
- _.forIn(props, function(descr, propName) {
- if (props.hasOwnProperty(propName)) {
- if (descr) {
- switch (descr.type) {
- case 'list':
- $generatorSpring.listProperty(res, bean, propName, descr.setterName);
-
- break;
-
- case 'array':
- $generatorSpring.arrayProperty(res, bean, propName, descr);
-
- break;
-
- case 'propertiesAsList':
- const val = bean[propName];
-
- if (val && val.length > 0) {
- res.startBlock('<property name="' + propName + '">');
- res.startBlock('<props>');
-
- _.forEach(val, function(nameAndValue) {
- const eqIndex = nameAndValue.indexOf('=');
- if (eqIndex >= 0) {
- res.line('<prop key="' + $generatorSpring.escape(nameAndValue.substring(0, eqIndex)) + '">' +
- $generatorSpring.escape(nameAndValue.substr(eqIndex + 1)) + '</prop>');
- }
- });
-
- res.endBlock('</props>');
- res.endBlock('</property>');
-
- hasData = true;
- }
-
- break;
-
- case 'bean':
- if ($generatorCommon.isDefinedAndNotEmpty(bean[propName])) {
- res.startBlock('<property name="' + propName + '">');
- res.line('<bean class="' + bean[propName] + '"/>');
- res.endBlock('</property>');
-
- hasData = true;
- }
-
- break;
-
- default:
- if ($generatorSpring.property(res, bean, propName, descr.setterName, descr.dflt))
- hasData = true;
- }
- }
- else
- if ($generatorSpring.property(res, bean, propName))
- hasData = true;
- }
- });
-
- res.endBlock('</bean>');
-
- if (createBeanAlthoughNoProps && !hasData) {
- res.rollbackSafeBlock();
-
- res.line('<bean class="' + desc.className + '"/>');
- }
-
- res.endBlock('</property>');
-
- if (!createBeanAlthoughNoProps && !hasData)
- res.rollbackSafeBlock();
- }
- else if (createBeanAlthoughNoProps) {
- res.emptyLineIfNeeded();
- res.startBlock('<property name="' + beanPropName + '">');
- res.line('<bean class="' + desc.className + '"/>');
- res.endBlock('</property>');
- }
-};
-
-/**
- * Add bean property without internal content.
- *
- * @param res Optional configuration presentation builder object.
- * @param obj Object to take bean class name.
- * @param propName Property name.
- */
-$generatorSpring.simpleBeanProperty = function(res, obj, propName) {
- if (!_.isNil(obj)) {
- const val = obj[propName];
-
- if ($generatorCommon.isDefinedAndNotEmpty(val)) {
- res.startBlock('<property name="' + propName + '">');
- res.line('<bean class="' + val + '"/>');
- res.endBlock('</property>');
- }
- }
-
- return false;
-};
-
-// Generate eviction policy.
-$generatorSpring.evictionPolicy = function(res, evtPlc, propName) {
- if (evtPlc && evtPlc.kind) {
- $generatorSpring.beanProperty(res, evtPlc[evtPlc.kind.toUpperCase()], propName,
- $generatorCommon.EVICTION_POLICIES[evtPlc.kind], true);
- }
-};
-
-// Generate discovery.
-$generatorSpring.clusterGeneral = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cluster, 'name', 'gridName');
- $generatorSpring.property(res, cluster, 'localHost');
-
- if (cluster.discovery) {
- res.startBlock('<property name="discoverySpi">');
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">');
- res.startBlock('<property name="ipFinder">');
-
- const d = cluster.discovery;
-
- switch (d.kind) {
- case 'Multicast':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">');
-
- if (d.Multicast) {
- $generatorSpring.property(res, d.Multicast, 'multicastGroup');
- $generatorSpring.property(res, d.Multicast, 'multicastPort');
- $generatorSpring.property(res, d.Multicast, 'responseWaitTime');
- $generatorSpring.property(res, d.Multicast, 'addressRequestAttempts');
- $generatorSpring.property(res, d.Multicast, 'localAddress');
- $generatorSpring.listProperty(res, d.Multicast, 'addresses');
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Vm':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">');
-
- if (d.Vm)
- $generatorSpring.listProperty(res, d.Vm, 'addresses');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'S3':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">');
-
- if (d.S3) {
- if (d.S3.bucketName)
- res.line('<property name="bucketName" value="' + $generatorSpring.escape(d.S3.bucketName) + '"/>');
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Cloud':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder">');
-
- if (d.Cloud) {
- $generatorSpring.property(res, d.Cloud, 'credential');
- $generatorSpring.property(res, d.Cloud, 'credentialPath');
- $generatorSpring.property(res, d.Cloud, 'identity');
- $generatorSpring.property(res, d.Cloud, 'provider');
- $generatorSpring.listProperty(res, d.Cloud, 'regions');
- $generatorSpring.listProperty(res, d.Cloud, 'zones');
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'GoogleStorage':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder">');
-
- if (d.GoogleStorage) {
- $generatorSpring.property(res, d.GoogleStorage, 'projectName');
- $generatorSpring.property(res, d.GoogleStorage, 'bucketName');
- $generatorSpring.property(res, d.GoogleStorage, 'serviceAccountP12FilePath');
- $generatorSpring.property(res, d.GoogleStorage, 'serviceAccountId');
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'Jdbc':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder">');
-
- if (d.Jdbc) {
- const datasource = d.Jdbc;
-
- res.line('<property name="initSchema" value="' + (!_.isNil(datasource.initSchema) && datasource.initSchema) + '"/>');
-
- if (datasource.dataSourceBean && datasource.dialect) {
- res.line('<property name="dataSource" ref="' + datasource.dataSourceBean + '"/>');
-
- if (!_.find(res.datasources, { dataSourceBean: datasource.dataSourceBean })) {
- res.datasources.push({
- dataSourceBean: datasource.dataSourceBean,
- dialect: datasource.dialect
- });
- }
- }
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'SharedFs':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder">');
-
- if (d.SharedFs)
- $generatorSpring.property(res, d.SharedFs, 'path');
-
- res.endBlock('</bean>');
-
- break;
-
- case 'ZooKeeper':
- res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder">');
-
- if (d.ZooKeeper) {
- if ($generatorCommon.isDefinedAndNotEmpty(d.ZooKeeper.curator)) {
- res.startBlock('<property name="curator">');
- res.line('<bean class="' + d.ZooKeeper.curator + '"/>');
- res.endBlock('</property>');
- }
-
- $generatorSpring.property(res, d.ZooKeeper, 'zkConnectionString');
-
- if (d.ZooKeeper.retryPolicy && d.ZooKeeper.retryPolicy.kind) {
- const kind = d.ZooKeeper.retryPolicy.kind;
- const retryPolicy = d.ZooKeeper.retryPolicy[kind];
- const customClassDefined = retryPolicy && $generatorCommon.isDefinedAndNotEmpty(retryPolicy.className);
-
- if (kind !== 'Custom' || customClassDefined)
- res.startBlock('<property name="retryPolicy">');
-
- switch (kind) {
- case 'ExponentialBackoff':
- res.startBlock('<bean class="org.apache.curator.retry.ExponentialBackoffRetry">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'baseSleepTimeMs', 1000);
- $generatorSpring.constructorArg(res, 1, retryPolicy, 'maxRetries', 10);
- $generatorSpring.constructorArg(res, 2, retryPolicy, 'maxSleepMs', null, true);
- res.endBlock('</bean>');
-
- break;
-
- case 'BoundedExponentialBackoff':
- res.startBlock('<bean class="org.apache.curator.retry.BoundedExponentialBackoffRetry">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'baseSleepTimeMs', 1000);
- $generatorSpring.constructorArg(res, 1, retryPolicy, 'maxSleepTimeMs', 2147483647);
- $generatorSpring.constructorArg(res, 2, retryPolicy, 'maxRetries', 10);
- res.endBlock('</bean>');
-
- break;
-
- case 'UntilElapsed':
- res.startBlock('<bean class="org.apache.curator.retry.RetryUntilElapsed">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'maxElapsedTimeMs', 60000);
- $generatorSpring.constructorArg(res, 1, retryPolicy, 'sleepMsBetweenRetries', 1000);
- res.endBlock('</bean>');
-
- break;
-
- case 'NTimes':
- res.startBlock('<bean class="org.apache.curator.retry.RetryNTimes">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'n', 10);
- $generatorSpring.constructorArg(res, 1, retryPolicy, 'sleepMsBetweenRetries', 1000);
- res.endBlock('</bean>');
-
- break;
-
- case 'OneTime':
- res.startBlock('<bean class="org.apache.curator.retry.RetryOneTime">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'sleepMsBetweenRetry', 1000);
- res.endBlock('</bean>');
-
- break;
-
- case 'Forever':
- res.startBlock('<bean class="org.apache.curator.retry.RetryForever">');
- $generatorSpring.constructorArg(res, 0, retryPolicy, 'retryIntervalMs', 1000);
- res.endBlock('</bean>');
-
- break;
-
- case 'Custom':
- if (customClassDefined)
- res.line('<bean class="' + retryPolicy.className + '"/>');
-
- break;
-
- default:
- }
-
- if (kind !== 'Custom' || customClassDefined)
- res.endBlock('</property>');
- }
-
- $generatorSpring.property(res, d.ZooKeeper, 'basePath', null, '/services');
- $generatorSpring.property(res, d.ZooKeeper, 'serviceName', null, 'ignite');
- $generatorSpring.property(res, d.ZooKeeper, 'allowDuplicateRegistrations', null, false);
- }
-
- res.endBlock('</bean>');
-
- break;
-
- default:
- res.line('Unknown discovery kind: ' + d.kind);
- }
-
- res.endBlock('</property>');
-
- $generatorSpring.clusterDiscovery(d, res);
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate atomics group.
-$generatorSpring.clusterAtomics = function(atomics, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.hasAtLeastOneProperty(atomics, ['cacheMode', 'atomicSequenceReserveSize', 'backups'])) {
- res.startSafeBlock();
-
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="atomicConfiguration">');
- res.startBlock('<bean class="org.apache.ignite.configuration.AtomicConfiguration">');
-
- const cacheMode = atomics.cacheMode ? atomics.cacheMode : 'PARTITIONED';
-
- let hasData = cacheMode !== 'PARTITIONED';
-
- $generatorSpring.property(res, atomics, 'cacheMode', null, 'PARTITIONED');
-
- hasData = $generatorSpring.property(res, atomics, 'atomicSequenceReserveSize', null, 1000) || hasData;
-
- if (cacheMode === 'PARTITIONED')
- hasData = $generatorSpring.property(res, atomics, 'backups', null, 0) || hasData;
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
-
- if (!hasData)
- res.rollbackSafeBlock();
- }
-
- return res;
-};
-
-// Generate binary group.
-$generatorSpring.clusterBinary = function(binary, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.binaryIsDefined(binary)) {
- res.startBlock('<property name="binaryConfiguration">');
- res.startBlock('<bean class="org.apache.ignite.configuration.BinaryConfiguration">');
-
- $generatorSpring.simpleBeanProperty(res, binary, 'idMapper');
- $generatorSpring.simpleBeanProperty(res, binary, 'nameMapper');
- $generatorSpring.simpleBeanProperty(res, binary, 'serializer');
-
- if ($generatorCommon.isDefinedAndNotEmpty(binary.typeConfigurations)) {
- res.startBlock('<property name="typeConfigurations">');
- res.startBlock('<list>');
-
- _.forEach(binary.typeConfigurations, function(type) {
- res.startBlock('<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">');
-
- $generatorSpring.property(res, type, 'typeName');
- $generatorSpring.simpleBeanProperty(res, type, 'idMapper');
- $generatorSpring.simpleBeanProperty(res, type, 'nameMapper');
- $generatorSpring.simpleBeanProperty(res, type, 'serializer');
- $generatorSpring.property(res, type, 'enum', null, false);
-
- res.endBlock('</bean>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- $generatorSpring.property(res, binary, 'compactFooter', null, true);
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cache key configurations.
-$generatorSpring.clusterCacheKeyConfiguration = function(keyCfgs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- keyCfgs = _.filter(keyCfgs, (cfg) => cfg.typeName && cfg.affinityKeyFieldName);
-
- if (_.isEmpty(keyCfgs))
- return res;
-
- res.startBlock('<property name="cacheKeyConfiguration">');
- res.startBlock('<array>');
-
- _.forEach(keyCfgs, (cfg) => {
- res.startBlock('<bean class="org.apache.ignite.cache.CacheKeyConfiguration">');
-
- $generatorSpring.constructorArg(res, -1, cfg, 'typeName');
- $generatorSpring.constructorArg(res, -1, cfg, 'affinityKeyFieldName');
-
- res.endBlock('</bean>');
- });
-
- res.endBlock('</array>');
- res.endBlock('</property>');
-
- return res;
-};
-
-// Generate collision group.
-$generatorSpring.clusterCollision = function(collision, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (collision && collision.kind && collision.kind !== 'Noop') {
- const spi = collision[collision.kind];
-
- if (collision.kind !== 'Custom' || (spi && $generatorCommon.isDefinedAndNotEmpty(spi.class))) {
- res.startBlock('<property name="collisionSpi">');
-
- switch (collision.kind) {
- case 'JobStealing':
- res.startBlock('<bean class="org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi">');
- $generatorSpring.property(res, spi, 'activeJobsThreshold', null, 95);
- $generatorSpring.property(res, spi, 'waitJobsThreshold', null, 0);
- $generatorSpring.property(res, spi, 'messageExpireTime', null, 1000);
- $generatorSpring.property(res, spi, 'maximumStealingAttempts', null, 5);
- $generatorSpring.property(res, spi, 'stealingEnabled', null, true);
-
- if ($generatorCommon.isDefinedAndNotEmpty(spi.externalCollisionListener)) {
- res.needEmptyLine = true;
-
- res.startBlock('<property name="externalCollisionListener">');
- res.line('<bean class="' + spi.externalCollisionListener + ' "/>');
- res.endBlock('</property>');
- }
-
- if ($generatorCommon.isDefinedAndNotEmpty(spi.stealingAttributes)) {
- res.needEmptyLine = true;
-
- res.startBlock('<property name="stealingAttributes">');
- res.startBlock('<map>');
-
- _.forEach(spi.stealingAttributes, function(attr) {
- $generatorSpring.element(res, 'entry', 'key', attr.name, 'value', attr.value);
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
- }
-
- res.endBlock('</bean>');
-
- break;
-
- case 'FifoQueue':
- res.startBlock('<bean class="org.apache.ignite.spi.collision.fifoqueue.FifoQueueCollisionSpi">');
- $generatorSpring.property(res, spi, 'parallelJobsNumber');
- $generatorSpring.property(res, spi, 'waitingJobsNumber');
- res.endBlock('</bean>');
-
- break;
-
- case 'PriorityQueue':
- res.startBlock('<bean class="org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi">');
- $generatorSpring.property(res, spi, 'parallelJobsNumber');
- $generatorSpring.property(res, spi, 'waitingJobsNumber');
- $generatorSpring.property(res, spi, 'priorityAttributeKey', null, 'grid.task.priority');
- $generatorSpring.property(res, spi, 'jobPriorityAttributeKey', null, 'grid.job.priority');
- $generatorSpring.property(res, spi, 'defaultPriority', null, 0);
- $generatorSpring.property(res, spi, 'starvationIncrement', null, 1);
- $generatorSpring.property(res, spi, 'starvationPreventionEnabled', null, true);
- res.endBlock('</bean>');
-
- break;
-
- case 'Custom':
- res.line('<bean class="' + spi.class + '"/>');
-
- break;
-
- default:
- }
-
- res.endBlock('</property>');
- }
- }
-
- return res;
-};
-
-// Generate communication group.
-$generatorSpring.clusterCommunication = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.beanProperty(res, cluster.communication, 'communicationSpi', $generatorCommon.COMMUNICATION_CONFIGURATION);
-
- $generatorSpring.property(res, cluster, 'networkTimeout', null, 5000);
- $generatorSpring.property(res, cluster, 'networkSendRetryDelay', null, 1000);
- $generatorSpring.property(res, cluster, 'networkSendRetryCount', null, 3);
- $generatorSpring.property(res, cluster, 'segmentCheckFrequency');
- $generatorSpring.property(res, cluster, 'waitForSegmentOnStart', null, false);
- $generatorSpring.property(res, cluster, 'discoveryStartupDelay', null, 60000);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-/**
- * XML generator for cluster's REST access configuration.
- *
- * @param connector Cluster REST connector configuration.
- * @param res Optional configuration presentation builder object.
- * @returns Configuration presentation builder object
- */
-$generatorSpring.clusterConnector = function(connector, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!_.isNil(connector) && connector.enabled) {
- const cfg = _.cloneDeep($generatorCommon.CONNECTOR_CONFIGURATION);
-
- if (connector.sslEnabled) {
- cfg.fields.sslClientAuth = {dflt: false};
- cfg.fields.sslFactory = {type: 'bean'};
- }
-
- $generatorSpring.beanProperty(res, connector, 'connectorConfiguration', cfg, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate deployment group.
-$generatorSpring.clusterDeployment = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorSpring.property(res, cluster, 'deploymentMode', null, 'SHARED'))
- res.needEmptyLine = true;
-
- const p2pEnabled = cluster.peerClassLoadingEnabled;
-
- if (!_.isNil(p2pEnabled)) {
- $generatorSpring.property(res, cluster, 'peerClassLoadingEnabled', null, false);
-
- if (p2pEnabled) {
- $generatorSpring.property(res, cluster, 'peerClassLoadingMissedResourcesCacheSize', null, 100);
- $generatorSpring.property(res, cluster, 'peerClassLoadingThreadPoolSize', null, 2);
- $generatorSpring.listProperty(res, cluster, 'peerClassLoadingLocalClassPathExclude');
- }
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate discovery group.
-$generatorSpring.clusterDiscovery = function(disco, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (disco) {
- $generatorSpring.property(res, disco, 'localAddress');
- $generatorSpring.property(res, disco, 'localPort', null, 47500);
- $generatorSpring.property(res, disco, 'localPortRange', null, 100);
- if ($generatorCommon.isDefinedAndNotEmpty(disco.addressResolver))
- $generatorSpring.beanProperty(res, disco, 'addressResolver', {className: disco.addressResolver}, true);
- $generatorSpring.property(res, disco, 'socketTimeout', null, 5000);
- $generatorSpring.property(res, disco, 'ackTimeout', null, 5000);
- $generatorSpring.property(res, disco, 'maxAckTimeout', null, 600000);
- $generatorSpring.property(res, disco, 'networkTimeout', null, 5000);
- $generatorSpring.property(res, disco, 'joinTimeout', null, 0);
- $generatorSpring.property(res, disco, 'threadPriority', null, 10);
- $generatorSpring.property(res, disco, 'heartbeatFrequency', null, 2000);
- $generatorSpring.property(res, disco, 'maxMissedHeartbeats', null, 1);
- $generatorSpring.property(res, disco, 'maxMissedClientHeartbeats', null, 5);
- $generatorSpring.property(res, disco, 'topHistorySize', null, 1000);
- if ($generatorCommon.isDefinedAndNotEmpty(disco.listener))
- $generatorSpring.beanProperty(res, disco, 'listener', {className: disco.listener}, true);
- if ($generatorCommon.isDefinedAndNotEmpty(disco.dataExchange))
- $generatorSpring.beanProperty(res, disco, 'dataExchange', {className: disco.dataExchange}, true);
- if ($generatorCommon.isDefinedAndNotEmpty(disco.metricsProvider))
- $generatorSpring.beanProperty(res, disco, 'metricsProvider', {className: disco.metricsProvider}, true);
- $generatorSpring.property(res, disco, 'reconnectCount', null, 10);
- $generatorSpring.property(res, disco, 'statisticsPrintFrequency', null, 0);
- $generatorSpring.property(res, disco, 'ipFinderCleanFrequency', null, 60000);
- if ($generatorCommon.isDefinedAndNotEmpty(disco.authenticator))
- $generatorSpring.beanProperty(res, disco, 'authenticator', {className: disco.authenticator}, true);
- $generatorSpring.property(res, disco, 'forceServerMode', null, false);
- $generatorSpring.property(res, disco, 'clientReconnectDisabled', null, false);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate events group.
-$generatorSpring.clusterEvents = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cluster.includeEventTypes && cluster.includeEventTypes.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="includeEventTypes">');
-
- const evtGrps = angular.element(document.getElementById('app')).injector().get('igniteEventGroups');
-
- if (cluster.includeEventTypes.length === 1) {
- const evtGrp = _.find(evtGrps, {value: cluster.includeEventTypes[0]});
-
- if (evtGrp)
- res.line('<util:constant static-field="' + evtGrp.class + '.' + evtGrp.value + '"/>');
- }
- else {
- res.startBlock('<list>');
-
- _.forEach(cluster.includeEventTypes, (item, ix) => {
- ix > 0 && res.line();
-
- const evtGrp = _.find(evtGrps, {value: item});
-
- if (evtGrp) {
- res.line('<!-- EventType.' + item + ' -->');
-
- _.forEach(evtGrp.events, (event) => res.line('<util:constant static-field="' + evtGrp.class + '.' + event + '"/>'));
- }
- });
-
- res.endBlock('</list>');
- }
-
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate failover group.
-$generatorSpring.clusterFailover = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(cluster.failoverSpi) && _.findIndex(cluster.failoverSpi, function(spi) {
- return $generatorCommon.isDefinedAndNotEmpty(spi.kind) && (spi.kind !== 'Custom' || $generatorCommon.isDefinedAndNotEmpty(_.get(spi, spi.kind + '.class')));
- }) >= 0) {
- res.startBlock('<property name="failoverSpi">');
- res.startBlock('<list>');
-
- _.forEach(cluster.failoverSpi, function(spi) {
- if (spi.kind && (spi.kind !== 'Custom' || $generatorCommon.isDefinedAndNotEmpty(_.get(spi, spi.kind + '.class')))) {
- const maxAttempts = _.get(spi, spi.kind + '.maximumFailoverAttempts');
-
- if ((spi.kind === 'JobStealing' || spi.kind === 'Always') && $generatorCommon.isDefinedAndNotEmpty(maxAttempts) && maxAttempts !== 5) {
- res.startBlock('<bean class="' + $generatorCommon.failoverSpiClass(spi) + '">');
-
- $generatorSpring.property(res, spi[spi.kind], 'maximumFailoverAttempts', null, 5);
-
- res.endBlock('</bean>');
- }
- else
- res.line('<bean class="' + $generatorCommon.failoverSpiClass(spi) + '"/>');
-
- res.needEmptyLine = true;
- }
- });
-
- res.needEmptyLine = true;
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- return res;
-};
-
-// Generate marshaller group.
-$generatorSpring.clusterLogger = function(logger, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.loggerConfigured(logger)) {
- res.startBlock('<property name="gridLogger">');
-
- const log = logger[logger.kind];
-
- switch (logger.kind) {
- case 'Log4j2':
- res.startBlock('<bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">');
- res.line('<constructor-arg value="' + $generatorSpring.escape(log.path) + '"/>');
- $generatorSpring.property(res, log, 'level');
- res.endBlock('</bean>');
-
- break;
-
- case 'Null':
- res.line('<bean class="org.apache.ignite.logger.NullLogger"/>');
-
- break;
-
- case 'Java':
- res.line('<bean class="org.apache.ignite.logger.java.JavaLogger"/>');
-
- break;
-
- case 'JCL':
- res.line('<bean class="org.apache.ignite.logger.jcl.JclLogger"/>');
-
- break;
-
- case 'SLF4J':
- res.line('<bean class="org.apache.ignite.logger.slf4j.Slf4jLogger"/>');
-
- break;
-
- case 'Log4j':
- if (log.mode === 'Default' && !$generatorCommon.isDefinedAndNotEmpty(log.level))
- res.line('<bean class="org.apache.ignite.logger.log4j.Log4JLogger"/>');
- else {
- res.startBlock('<bean class="org.apache.ignite.logger.log4j.Log4JLogger">');
-
- if (log.mode === 'Path')
- res.line('<constructor-arg value="' + $generatorSpring.escape(log.path) + '"/>');
-
- $generatorSpring.property(res, log, 'level');
- res.endBlock('</bean>');
- }
-
- break;
-
- case 'Custom':
- res.line('<bean class="' + log.class + '"/>');
-
- break;
-
- default:
- }
-
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate marshaller group.
-$generatorSpring.clusterMarshaller = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const marshaller = cluster.marshaller;
-
- if (marshaller && marshaller.kind)
- $generatorSpring.beanProperty(res, marshaller[marshaller.kind], 'marshaller', $generatorCommon.MARSHALLERS[marshaller.kind], true);
-
- res.softEmptyLine();
-
- $generatorSpring.property(res, cluster, 'marshalLocalJobs', null, false);
- $generatorSpring.property(res, cluster, 'marshallerCacheKeepAliveTime', null, 10000);
- $generatorSpring.property(res, cluster, 'marshallerCacheThreadPoolSize', 'marshallerCachePoolSize');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate metrics group.
-$generatorSpring.clusterMetrics = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cluster, 'metricsExpireTime');
- $generatorSpring.property(res, cluster, 'metricsHistorySize', null, 10000);
- $generatorSpring.property(res, cluster, 'metricsLogFrequency', null, 60000);
- $generatorSpring.property(res, cluster, 'metricsUpdateFrequency', null, 2000);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate swap group.
-$generatorSpring.clusterSwap = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind === 'FileSwapSpaceSpi') {
- $generatorSpring.beanProperty(res, cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi',
- $generatorCommon.SWAP_SPACE_SPI, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate time group.
-$generatorSpring.clusterTime = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cluster, 'clockSyncSamples', null, 8);
- $generatorSpring.property(res, cluster, 'clockSyncFrequency', null, 120000);
- $generatorSpring.property(res, cluster, 'timeServerPortBase', null, 31100);
- $generatorSpring.property(res, cluster, 'timeServerPortRange', null, 100);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate OBC configuration group.
-$generatorSpring.clusterODBC = function(odbc, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (odbc && odbc.odbcEnabled)
- $generatorSpring.beanProperty(res, odbc, 'odbcConfiguration', $generatorCommon.ODBC_CONFIGURATION, true);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate thread pools group.
-$generatorSpring.clusterPools = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cluster, 'publicThreadPoolSize');
- $generatorSpring.property(res, cluster, 'systemThreadPoolSize');
- $generatorSpring.property(res, cluster, 'managementThreadPoolSize');
- $generatorSpring.property(res, cluster, 'igfsThreadPoolSize');
- $generatorSpring.property(res, cluster, 'rebalanceThreadPoolSize');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate transactions group.
-$generatorSpring.clusterTransactions = function(transactionConfiguration, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.beanProperty(res, transactionConfiguration, 'transactionConfiguration', $generatorCommon.TRANSACTION_CONFIGURATION, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate user attributes group.
-$generatorSpring.clusterUserAttributes = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(cluster.attributes)) {
- res.startBlock('<property name="userAttributes">');
- res.startBlock('<map>');
-
- _.forEach(cluster.attributes, function(attr) {
- $generatorSpring.element(res, 'entry', 'key', attr.name, 'value', attr.value);
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-/**
- * XML generator for cluster's SSL configuration.
- *
- * @param cluster Cluster to get SSL configuration.
- * @param res Optional configuration presentation builder object.
- * @returns Configuration presentation builder object
- */
-$generatorSpring.clusterSsl = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cluster.sslEnabled && !_.isNil(cluster.sslContextFactory)) {
- let sslFactory;
-
- if (_.isEmpty(cluster.sslContextFactory.keyStoreFilePath) && _.isEmpty(cluster.sslContextFactory.trustStoreFilePath))
- sslFactory = cluster.sslContextFactory;
- else {
- sslFactory = _.clone(cluster.sslContextFactory);
-
- sslFactory.keyStorePassword = _.isEmpty(cluster.sslContextFactory.keyStoreFilePath) ? null : '${ssl.key.storage.password}';
- sslFactory.trustStorePassword = _.isEmpty(cluster.sslContextFactory.trustStoreFilePath) ? null : '${ssl.trust.storage.password}';
- }
-
- const propsDesc = $generatorCommon.isDefinedAndNotEmpty(cluster.sslContextFactory.trustManagers) ?
- $generatorCommon.SSL_CONFIGURATION_TRUST_MANAGER_FACTORY :
- $generatorCommon.SSL_CONFIGURATION_TRUST_FILE_FACTORY;
-
- $generatorSpring.beanProperty(res, sslFactory, 'sslContextFactory', propsDesc, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cache general group.
-$generatorSpring.cacheGeneral = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cache, 'name');
-
- $generatorSpring.property(res, cache, 'cacheMode');
- $generatorSpring.property(res, cache, 'atomicityMode');
-
- if (cache.cacheMode === 'PARTITIONED' && $generatorSpring.property(res, cache, 'backups'))
- $generatorSpring.property(res, cache, 'readFromBackup');
-
- $generatorSpring.property(res, cache, 'copyOnRead');
-
- if (cache.cacheMode === 'PARTITIONED' && cache.atomicityMode === 'TRANSACTIONAL')
- $generatorSpring.property(res, cache, 'invalidate');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache memory group.
-$generatorSpring.cacheMemory = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cache, 'memoryMode', null, 'ONHEAP_TIERED');
-
- if (cache.memoryMode !== 'OFFHEAP_VALUES')
- $generatorSpring.property(res, cache, 'offHeapMaxMemory', null, -1);
-
- res.softEmptyLine();
-
- $generatorSpring.evictionPolicy(res, cache.evictionPolicy, 'evictionPolicy');
-
- res.softEmptyLine();
-
- $generatorSpring.property(res, cache, 'startSize', null, 1500000);
- $generatorSpring.property(res, cache, 'swapEnabled', null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache query & indexing group.
-$generatorSpring.cacheQuery = function(cache, domains, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cache, 'sqlSchema');
- $generatorSpring.property(res, cache, 'sqlOnheapRowCacheSize', null, 10240);
- $generatorSpring.property(res, cache, 'longQueryWarningTimeout', null, 3000);
-
- const indexedTypes = _.filter(domains, (domain) => domain.queryMetadata === 'Annotations');
-
- if (indexedTypes.length > 0) {
- res.softEmptyLine();
-
- res.startBlock('<property name="indexedTypes">');
- res.startBlock('<list>');
-
- _.forEach(indexedTypes, function(domain) {
- res.line('<value>' + $generatorCommon.JavaTypes.fullClassName(domain.keyType) + '</value>');
- res.line('<value>' + $generatorCommon.JavaTypes.fullClassName(domain.valueType) + '</value>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- res.softEmptyLine();
-
- $generatorSpring.listProperty(res, cache, 'sqlFunctionClasses');
-
- res.softEmptyLine();
-
- $generatorSpring.property(res, cache, 'snapshotableIndex', null, false);
- $generatorSpring.property(res, cache, 'sqlEscapeAll', null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache store group.
-$generatorSpring.cacheStore = function(cache, domains, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
- const factoryKind = cache.cacheStoreFactory.kind;
-
- const storeFactory = cache.cacheStoreFactory[factoryKind];
-
- if (storeFactory) {
- if (factoryKind === 'CacheJdbcPojoStoreFactory') {
- res.startBlock('<property name="cacheStoreFactory">');
- res.startBlock('<bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">');
-
- $generatorSpring.property(res, storeFactory, 'dataSourceBean');
-
- res.startBlock('<property name="dialect">');
- res.line('<bean class="' + $generatorCommon.jdbcDialectClassName(storeFactory.dialect) + '"/>');
- res.endBlock('</property>');
-
- if (storeFactory.sqlEscapeAll)
- $generatorSpring.property(res, storeFactory, 'sqlEscapeAll');
-
- const domainConfigs = _.filter(domains, function(domain) {
- return $generatorCommon.isDefinedAndNotEmpty(domain.databaseTable);
- });
-
- if ($generatorCommon.isDefinedAndNotEmpty(domainConfigs)) {
- res.startBlock('<property name="types">');
- res.startBlock('<list>');
-
- _.forEach(domainConfigs, function(domain) {
- res.startBlock('<bean class="org.apache.ignite.cache.store.jdbc.JdbcType">');
-
- $generatorSpring.property(res, cache, 'name', 'cacheName');
-
- $generatorSpring.classNameProperty(res, domain, 'keyType');
- $generatorSpring.property(res, domain, 'valueType');
-
- $generatorSpring.domainStore(domain, res);
-
- res.endBlock('</bean>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
- else if (factoryKind === 'CacheJdbcBlobStoreFactory') {
- res.startBlock('<property name="cacheStoreFactory">');
- res.startBlock('<bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory">');
-
- if (storeFactory.connectVia === 'DataSource')
- $generatorSpring.property(res, storeFactory, 'dataSourceBean');
- else {
- $generatorSpring.property(res, storeFactory, 'connectionUrl');
- $generatorSpring.property(res, storeFactory, 'user');
- res.line('<property name="password" value="${ds.' + storeFactory.user + '.password}"/>');
- }
-
- $generatorSpring.property(res, storeFactory, 'initSchema');
- $generatorSpring.property(res, storeFactory, 'createTableQuery');
- $generatorSpring.property(res, storeFactory, 'loadQuery');
- $generatorSpring.property(res, storeFactory, 'insertQuery');
- $generatorSpring.property(res, storeFactory, 'updateQuery');
- $generatorSpring.property(res, storeFactory, 'deleteQuery');
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
- else
- $generatorSpring.beanProperty(res, storeFactory, 'cacheStoreFactory', $generatorCommon.STORE_FACTORIES[factoryKind], true);
-
- if (storeFactory.dataSourceBean && (storeFactory.connectVia ? (storeFactory.connectVia === 'DataSource' ? storeFactory.dialect : null) : storeFactory.dialect)) {
- if (!_.find(res.datasources, { dataSourceBean: storeFactory.dataSourceBean})) {
- res.datasources.push({
- dataSourceBean: storeFactory.dataSourceBean,
- dialect: storeFactory.dialect
- });
- }
- }
- }
- }
-
- res.softEmptyLine();
-
- $generatorSpring.property(res, cache, 'storeKeepBinary', null, false);
- $generatorSpring.property(res, cache, 'loadPreviousValue', null, false);
- $generatorSpring.property(res, cache, 'readThrough', null, false);
- $generatorSpring.property(res, cache, 'writeThrough', null, false);
-
- res.softEmptyLine();
-
- if (cache.writeBehindEnabled) {
- $generatorSpring.property(res, cache, 'writeBehindEnabled', null, false);
- $generatorSpring.property(res, cache, 'writeBehindBatchSize', null, 512);
- $generatorSpring.property(res, cache, 'writeBehindFlushSize', null, 10240);
- $generatorSpring.property(res, cache, 'writeBehindFlushFrequency', null, 5000);
- $generatorSpring.property(res, cache, 'writeBehindFlushThreadCount', null, 1);
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache node filter group.
-$generatorSpring.cacheNodeFilter = function(cache, igfss, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const kind = _.get(cache, 'nodeFilter.kind');
-
- if (_.isNil(kind) || _.isNil(cache.nodeFilter[kind]))
- return res;
-
- switch (kind) {
- case 'IGFS':
- const foundIgfs = _.find(igfss, (igfs) => igfs._id === cache.nodeFilter.IGFS.igfs);
-
- if (foundIgfs) {
- res.startBlock('<property name="nodeFilter">');
- res.startBlock('<bean class="org.apache.ignite.internal.processors.igfs.IgfsNodePredicate">');
- res.line('<constructor-arg value="' + foundIgfs.name + '"/>');
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
-
- break;
-
- case 'OnNodes':
- const nodes = cache.nodeFilter.OnNodes.nodeIds;
-
- if ($generatorCommon.isDefinedAndNotEmpty(nodes)) {
- res.startBlock('<property name="nodeFilter">');
- res.startBlock('<bean class="org.apache.ignite.internal.util.lang.GridNodePredicate">');
- res.startBlock('<constructor-arg>');
- res.startBlock('<list>');
-
- _.forEach(nodes, (nodeId) => {
- res.startBlock('<bean class="java.util.UUID" factory-method="fromString">');
- res.line('<constructor-arg value="' + nodeId + '"/>');
- res.endBlock('</bean>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</constructor-arg>');
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
-
- break;
-
- case 'Custom':
- res.startBlock('<property name="nodeFilter">');
- res.line('<bean class="' + cache.nodeFilter.Custom.className + '"/>');
- res.endBlock('</property>');
-
- break;
-
- default: break;
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache concurrency group.
-$generatorSpring.cacheConcurrency = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cache, 'maxConcurrentAsyncOperations', null, 500);
- $generatorSpring.property(res, cache, 'defaultLockTimeout', null, 0);
- $generatorSpring.property(res, cache, 'atomicWriteOrderMode');
- $generatorSpring.property(res, cache, 'writeSynchronizationMode', null, 'PRIMARY_SYNC');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache rebalance group.
-$generatorSpring.cacheRebalance = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cache.cacheMode !== 'LOCAL') {
- $generatorSpring.property(res, cache, 'rebalanceMode', null, 'ASYNC');
- $generatorSpring.property(res, cache, 'rebalanceThreadPoolSize', null, 1);
- $generatorSpring.property(res, cache, 'rebalanceBatchSize', null, 524288);
- $generatorSpring.property(res, cache, 'rebalanceBatchesPrefetchCount', null, 2);
- $generatorSpring.property(res, cache, 'rebalanceOrder', null, 0);
- $generatorSpring.property(res, cache, 'rebalanceDelay', null, 0);
- $generatorSpring.property(res, cache, 'rebalanceTimeout', null, 10000);
- $generatorSpring.property(res, cache, 'rebalanceThrottle', null, 0);
- }
-
- res.softEmptyLine();
-
- if (cache.igfsAffinnityGroupSize) {
- res.startBlock('<property name="affinityMapper">');
- res.startBlock('<bean class="org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper">');
- $generatorSpring.constructorArg(res, -1, cache, 'igfsAffinnityGroupSize');
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
-
- return res;
-};
-
-// Generate cache server near cache group.
-$generatorSpring.cacheServerNearCache = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cache.cacheMode === 'PARTITIONED' && cache.nearCacheEnabled) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="nearConfiguration">');
- res.startBlock('<bean class="org.apache.ignite.configuration.NearCacheConfiguration">');
-
- if (cache.nearConfiguration) {
- if (cache.nearConfiguration.nearStartSize)
- $generatorSpring.property(res, cache.nearConfiguration, 'nearStartSize', null, 375000);
-
- $generatorSpring.evictionPolicy(res, cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
- }
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache statistics group.
-$generatorSpring.cacheStatistics = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, cache, 'statisticsEnabled', null, false);
- $generatorSpring.property(res, cache, 'managementEnabled', null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain model query fields.
-$generatorSpring.domainModelQueryFields = function(res, domain) {
- const fields = domain.fields;
-
- if (fields && fields.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="fields">');
- res.startBlock('<map>');
-
- _.forEach(fields, function(field) {
- $generatorSpring.element(res, 'entry', 'key', field.name, 'value', $generatorCommon.JavaTypes.fullClassName(field.className));
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model query fields.
-$generatorSpring.domainModelQueryAliases = function(res, domain) {
- const aliases = domain.aliases;
-
- if (aliases && aliases.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="aliases">');
- res.startBlock('<map>');
-
- _.forEach(aliases, function(alias) {
- $generatorSpring.element(res, 'entry', 'key', alias.field, 'value', alias.alias);
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model indexes.
-$generatorSpring.domainModelQueryIndexes = function(res, domain) {
- const indexes = domain.indexes;
-
- if (indexes && indexes.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="indexes">');
- res.startBlock('<list>');
-
- _.forEach(indexes, function(index) {
- res.startBlock('<bean class="org.apache.ignite.cache.QueryIndex">');
-
- $generatorSpring.property(res, index, 'name');
- $generatorSpring.property(res, index, 'indexType');
-
- const fields = index.fields;
-
- if (fields && fields.length > 0) {
- res.startBlock('<property name="fields">');
- res.startBlock('<map>');
-
- _.forEach(fields, function(field) {
- $generatorSpring.element(res, 'entry', 'key', field.name, 'value', field.direction);
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
- }
-
- res.endBlock('</bean>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model db fields.
-$generatorSpring.domainModelDatabaseFields = function(res, domain, fieldProp) {
- const fields = domain[fieldProp];
-
- if (fields && fields.length > 0) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="' + fieldProp + '">');
-
- res.startBlock('<list>');
-
- _.forEach(fields, function(field) {
- res.startBlock('<bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">');
-
- $generatorSpring.property(res, field, 'databaseFieldName');
-
- res.startBlock('<property name="databaseFieldType">');
- res.line('<util:constant static-field="java.sql.Types.' + field.databaseFieldType + '"/>');
- res.endBlock('</property>');
-
- $generatorSpring.property(res, field, 'javaFieldName');
-
- $generatorSpring.classNameProperty(res, field, 'javaFieldType');
-
- res.endBlock('</bean>');
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model general group.
-$generatorSpring.domainModelGeneral = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- switch ($generatorCommon.domainQueryMetadata(domain)) {
- case 'Annotations':
- if ($generatorCommon.isDefinedAndNotEmpty(domain.keyType) || $generatorCommon.isDefinedAndNotEmpty(domain.valueType)) {
- res.startBlock('<property name="indexedTypes">');
- res.startBlock('<list>');
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.keyType))
- res.line('<value>' + $generatorCommon.JavaTypes.fullClassName(domain.keyType) + '</value>');
- else
- res.line('<value>???</value>');
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.valueType))
- res.line('<value>' + $generatorCommon.JavaTypes.fullClassName(domain.valueType) + '</value>');
- else
- res.line('<value>>???</value>');
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- break;
-
- case 'Configuration':
- $generatorSpring.classNameProperty(res, domain, 'keyType');
- $generatorSpring.property(res, domain, 'valueType');
-
- break;
-
- default:
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain model for query group.
-$generatorSpring.domainModelQuery = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.domainQueryMetadata(domain) === 'Configuration') {
- $generatorSpring.domainModelQueryFields(res, domain);
- $generatorSpring.domainModelQueryAliases(res, domain);
- $generatorSpring.domainModelQueryIndexes(res, domain);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate domain model for store group.
-$generatorSpring.domainStore = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, domain, 'databaseSchema');
- $generatorSpring.property(res, domain, 'databaseTable');
-
- res.softEmptyLine();
-
- $generatorSpring.domainModelDatabaseFields(res, domain, 'keyFields');
- $generatorSpring.domainModelDatabaseFields(res, domain, 'valueFields');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-$generatorSpring.cacheQueryMetadata = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- res.startBlock('<bean class="org.apache.ignite.cache.QueryEntity">');
-
- $generatorSpring.classNameProperty(res, domain, 'keyType');
- $generatorSpring.property(res, domain, 'valueType');
-
- $generatorSpring.domainModelQuery(domain, res);
-
- res.endBlock('</bean>');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain models configs.
-$generatorSpring.cacheDomains = function(domains, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const domainConfigs = _.filter(domains, function(domain) {
- return $generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
- $generatorCommon.isDefinedAndNotEmpty(domain.fields);
- });
-
- if ($generatorCommon.isDefinedAndNotEmpty(domainConfigs)) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="queryEntities">');
- res.startBlock('<list>');
-
- _.forEach(domainConfigs, function(domain) {
- $generatorSpring.cacheQueryMetadata(domain, res);
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
- }
-
- return res;
-};
-
-// Generate cache configs.
-$generatorSpring.cache = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- res.startBlock('<bean class="org.apache.ignite.configuration.CacheConfiguration">');
-
- $generatorSpring.cacheConfiguration(cache, res);
-
- res.endBlock('</bean>');
-
- return res;
-};
-
-// Generate cache configs.
-$generatorSpring.cacheConfiguration = function(cache, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.cacheGeneral(cache, res);
- $generatorSpring.cacheMemory(cache, res);
- $generatorSpring.cacheQuery(cache, cache.domains, res);
- $generatorSpring.cacheStore(cache, cache.domains, res);
-
- const igfs = _.get(cache, 'nodeFilter.IGFS.instance');
-
- $generatorSpring.cacheNodeFilter(cache, igfs ? [igfs] : [], res);
- $generatorSpring.cacheConcurrency(cache, res);
- $generatorSpring.cacheRebalance(cache, res);
- $generatorSpring.cacheServerNearCache(cache, res);
- $generatorSpring.cacheStatistics(cache, res);
- $generatorSpring.cacheDomains(cache.domains, res);
-
- return res;
-};
-
-// Generate caches configs.
-$generatorSpring.clusterCaches = function(caches, igfss, isSrvCfg, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(caches) || (isSrvCfg && $generatorCommon.isDefinedAndNotEmpty(igfss))) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="cacheConfiguration">');
- res.startBlock('<list>');
-
- _.forEach(caches, function(cache) {
- $generatorSpring.cache(cache, res);
-
- res.needEmptyLine = true;
- });
-
- if (isSrvCfg) {
- _.forEach(igfss, (igfs) => {
- $generatorSpring.cache($generatorCommon.igfsDataCache(igfs), res);
-
- res.needEmptyLine = true;
-
- $generatorSpring.cache($generatorCommon.igfsMetaCache(igfs), res);
-
- res.needEmptyLine = true;
- });
- }
-
- res.endBlock('</list>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate IGFSs configs.
-$generatorSpring.igfss = function(igfss, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(igfss)) {
- res.emptyLineIfNeeded();
-
- res.startBlock('<property name="fileSystemConfiguration">');
- res.startBlock('<list>');
-
- _.forEach(igfss, function(igfs) {
- res.startBlock('<bean class="org.apache.ignite.configuration.FileSystemConfiguration">');
-
- $generatorSpring.igfsGeneral(igfs, res);
- $generatorSpring.igfsIPC(igfs, res);
- $generatorSpring.igfsFragmentizer(igfs, res);
- $generatorSpring.igfsDualMode(igfs, res);
- $generatorSpring.igfsSecondFS(igfs, res);
- $generatorSpring.igfsMisc(igfs, res);
-
- res.endBlock('</bean>');
-
- res.needEmptyLine = true;
- });
-
- res.endBlock('</list>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate IGFS IPC configuration.
-$generatorSpring.igfsIPC = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (igfs.ipcEndpointEnabled) {
- $generatorSpring.beanProperty(res, igfs.ipcEndpointConfiguration, 'ipcEndpointConfiguration', $generatorCommon.IGFS_IPC_CONFIGURATION, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate IGFS fragmentizer configuration.
-$generatorSpring.igfsFragmentizer = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (igfs.fragmentizerEnabled) {
- $generatorSpring.property(res, igfs, 'fragmentizerConcurrentFiles', null, 0);
- $generatorSpring.property(res, igfs, 'fragmentizerThrottlingBlockLength', null, 16777216);
- $generatorSpring.property(res, igfs, 'fragmentizerThrottlingDelay', null, 200);
-
- res.needEmptyLine = true;
- }
- else
- $generatorSpring.property(res, igfs, 'fragmentizerEnabled');
-
- return res;
-};
-
-// Generate IGFS dual mode configuration.
-$generatorSpring.igfsDualMode = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, igfs, 'dualModeMaxPendingPutsSize', null, 0);
-
- if ($generatorCommon.isDefinedAndNotEmpty(igfs.dualModePutExecutorService)) {
- res.startBlock('<property name="dualModePutExecutorService">');
- res.line('<bean class="' + igfs.dualModePutExecutorService + '"/>');
- res.endBlock('</property>');
- }
-
- $generatorSpring.property(res, igfs, 'dualModePutExecutorServiceShutdown', null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-$generatorSpring.igfsSecondFS = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (igfs.secondaryFileSystemEnabled) {
- const secondFs = igfs.secondaryFileSystem || {};
-
- res.startBlock('<property name="secondaryFileSystem">');
-
- res.startBlock('<bean class="org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem">');
-
- const nameDefined = $generatorCommon.isDefinedAndNotEmpty(secondFs.userName);
- const cfgDefined = $generatorCommon.isDefinedAndNotEmpty(secondFs.cfgPath);
-
- $generatorSpring.constructorArg(res, 0, secondFs, 'uri');
-
- if (cfgDefined || nameDefined)
- $generatorSpring.constructorArg(res, 1, secondFs, 'cfgPath');
-
- $generatorSpring.constructorArg(res, 2, secondFs, 'userName', null, true);
-
- res.endBlock('</bean>');
- res.endBlock('</property>');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate IGFS general configuration.
-$generatorSpring.igfsGeneral = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(igfs.name)) {
- igfs.dataCacheName = $generatorCommon.igfsDataCache(igfs).name;
- igfs.metaCacheName = $generatorCommon.igfsMetaCache(igfs).name;
-
- $generatorSpring.property(res, igfs, 'name');
- $generatorSpring.property(res, igfs, 'dataCacheName');
- $generatorSpring.property(res, igfs, 'metaCacheName');
- $generatorSpring.property(res, igfs, 'defaultMode', null, 'DUAL_ASYNC');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate IGFS misc configuration.
-$generatorSpring.igfsMisc = function(igfs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorSpring.property(res, igfs, 'blockSize', null, 65536);
- $generatorSpring.property(res, igfs, 'streamBufferSize', null, 65536);
- $generatorSpring.property(res, igfs, 'maxSpaceSize', null, 0);
- $generatorSpring.property(res, igfs, 'maximumTaskRangeLength', null, 0);
- $generatorSpring.property(res, igfs, 'managementPort', null, 11400);
- $generatorSpring.property(res, igfs, 'perNodeBatchSize', null, 100);
- $generatorSpring.property(res, igfs, 'perNodeParallelBatchCount', null, 8);
- $generatorSpring.property(res, igfs, 'prefetchBlocks', null, 0);
- $generatorSpring.property(res, igfs, 'sequentialReadsBeforePrefetch', null, 0);
- $generatorSpring.property(res, igfs, 'trashPurgeTimeout', null, 1000);
- $generatorSpring.property(res, igfs, 'colocateMetadata', null, true);
- $generatorSpring.property(res, igfs, 'relaxedConsistency', null, true);
-
- res.softEmptyLine();
-
- if (igfs.pathModes && igfs.pathModes.length > 0) {
- res.startBlock('<property name="pathModes">');
- res.startBlock('<map>');
-
- _.forEach(igfs.pathModes, function(pair) {
- res.line('<entry key="' + pair.path + '" value="' + pair.mode + '"/>');
- });
-
- res.endBlock('</map>');
- res.endBlock('</property>');
- }
-
- return res;
-};
-
-// Generate DataSource beans.
-$generatorSpring.generateDataSources = function(datasources, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (datasources.length > 0) {
- res.line('<!-- Data source beans will be initialized from external properties file. -->');
-
- _.forEach(datasources, (datasource) => $generatorSpring.generateDataSource(datasource, res));
-
- res.needEmptyLine = true;
-
- res.emptyLineIfNeeded();
- }
-
- return res;
-};
-
-$generatorSpring.generateDataSource = function(datasource, res) {
- const beanId = datasource.dataSourceBean;
-
- res.startBlock('<bean id="' + beanId + '" class="' + $generatorCommon.DATA_SOURCES[datasource.dialect] + '">');
-
- switch (datasource.dialect) {
- case 'Generic':
- res.line('<property name="jdbcUrl" value="${' + beanId + '.jdbc.url}"/>');
-
- break;
-
- case 'DB2':
- res.line('<property name="serverName" value="${' + beanId + '.jdbc.server_name}"/>');
- res.line('<property name="portNumber" value="${' + beanId + '.jdbc.port_number}"/>');
- res.line('<property name="databaseName" value="${' + beanId + '.jdbc.database_name}"/>');
- res.line('<property name="driverType" value="${' + beanId + '.jdbc.driver_type}"/>');
-
- break;
-
- case 'PostgreSQL':
- res.line('<property name="url" value="${' + beanId + '.jdbc.url}"/>');
-
- break;
-
- default:
- res.line('<property name="URL" value="${' + beanId + '.jdbc.url}"/>');
- }
-
- res.line('<property name="user" value="${' + beanId + '.jdbc.username}"/>');
- res.line('<property name="password" value="${' + beanId + '.jdbc.password}"/>');
-
- res.endBlock('</bean>');
-
- res.needEmptyLine = true;
-
- res.emptyLineIfNeeded();
-};
-
-$generatorSpring.clusterConfiguration = function(cluster, clientNearCfg, res) {
- const isSrvCfg = _.isNil(clientNearCfg);
-
- if (!isSrvCfg) {
- res.line('<property name="clientMode" value="true"/>');
-
- res.needEmptyLine = true;
- }
-
- $generatorSpring.clusterGeneral(cluster, res);
-
- $generatorSpring.clusterAtomics(cluster.atomicConfiguration, res);
-
- $generatorSpring.clusterBinary(cluster.binaryConfiguration, res);
-
- $generatorSpring.clusterCacheKeyConfiguration(cluster.cacheKeyConfiguration, res);
-
- $generatorSpring.clusterCollision(cluster.collision, res);
-
- $generatorSpring.clusterCommunication(cluster, res);
-
- $generatorSpring.clusterConnector(cluster.connector, res);
-
- $generatorSpring.clusterDeployment(cluster, res);
-
- $generatorSpring.clusterEvents(cluster, res);
-
- $generatorSpring.clusterFailover(cluster, res);
-
- $generatorSpring.clusterLogger(cluster.logger, res);
-
- $generatorSpring.clusterODBC(cluster.odbc, res);
-
- $generatorSpring.clusterMarshaller(cluster, res);
-
- $generatorSpring.clusterMetrics(cluster, res);
-
- $generatorSpring.clusterSwap(cluster, res);
-
- $generatorSpring.clusterTime(cluster, res);
-
- $generatorSpring.clusterPools(cluster, res);
-
- $generatorSpring.clusterTransactions(cluster.transactionConfiguration, res);
-
- $generatorSpring.clusterCaches(cluster.caches, cluster.igfss, isSrvCfg, res);
-
- $generatorSpring.clusterSsl(cluster, res);
-
- if (isSrvCfg)
- $generatorSpring.igfss(cluster.igfss, res);
-
- $generatorSpring.clusterUserAttributes(cluster, res);
-
- return res;
-};
-
-$generatorSpring.cluster = function(cluster, clientNearCfg) {
- if (cluster) {
- const res = $generatorCommon.builder(1);
-
- if (clientNearCfg) {
- res.startBlock('<bean id="nearCacheBean" class="org.apache.ignite.configuration.NearCacheConfiguration">');
-
- if (clientNearCfg.nearStartSize)
- $generatorSpring.property(res, clientNearCfg, 'nearStartSize');
-
- if (clientNearCfg.nearEvictionPolicy && clientNearCfg.nearEvictionPolicy.kind)
- $generatorSpring.evictionPolicy(res, clientNearCfg.nearEvictionPolicy, 'nearEvictionPolicy');
-
- res.endBlock('</bean>');
-
- res.needEmptyLine = true;
-
- res.emptyLineIfNeeded();
- }
-
- // Generate Ignite Configuration.
- res.startBlock('<bean class="org.apache.ignite.configuration.IgniteConfiguration">');
-
- $generatorSpring.clusterConfiguration(cluster, clientNearCfg, res);
-
- res.endBlock('</bean>');
-
- // Build final XML:
- // 1. Add header.
- let xml = '<?xml version="1.0" encoding="UTF-8"?>\n\n';
-
- xml += '<!-- ' + $generatorCommon.mainComment('configuration') + ' -->\n\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
- if ($generatorCommon.secretPropertiesNeeded(cluster)) {
- 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';
- }
-
- // 3. Add data sources.
- xml += $generatorSpring.generateDataSources(res.datasources, $generatorCommon.builder(1)).asString();
-
- // 3. Add main content.
- xml += res.asString();
-
- // 4. Add footer.
- xml += '\n</beans>';
-
- return xml;
- }
-
- return '';
-};
-
-export default $generatorSpring;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/Notebook.data.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/Notebook.data.js b/modules/web-console/frontend/app/modules/sql/Notebook.data.js
index f66faba..3f98bed 100644
--- a/modules/web-console/frontend/app/modules/sql/Notebook.data.js
+++ b/modules/web-console/frontend/app/modules/sql/Notebook.data.js
@@ -21,7 +21,8 @@ const DEMO_NOTEBOOK = {
{
name: 'Query with refresh rate',
cacheName: 'CarCache',
- pageSize: 50,
+ pageSize: 100,
+ limit: 0,
query: [
'SELECT count(*)',
'FROM "CarCache".Car'
@@ -37,7 +38,8 @@ const DEMO_NOTEBOOK = {
{
name: 'Simple query',
cacheName: 'CarCache',
- pageSize: 50,
+ pageSize: 100,
+ limit: 0,
query: 'SELECT * FROM "CarCache".Car',
result: 'table',
timeLineSpan: '1',
@@ -49,8 +51,9 @@ const DEMO_NOTEBOOK = {
},
{
name: 'Query with aggregates',
- cacheName: 'CarCache',
- pageSize: 50,
+ cacheName: 'ParkingCache',
+ pageSize: 100,
+ limit: 0,
query: [
'SELECT p.name, count(*) AS cnt',
'FROM "ParkingCache".Parking p',
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/Notebook.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/Notebook.service.js b/modules/web-console/frontend/app/modules/sql/Notebook.service.js
index 12730be..f32d26f 100644
--- a/modules/web-console/frontend/app/modules/sql/Notebook.service.js
+++ b/modules/web-console/frontend/app/modules/sql/Notebook.service.js
@@ -60,7 +60,7 @@ export default class Notebook {
}
remove(notebook) {
- return this.confirmModal.confirm(`Are you sure you want to remove: "${notebook.name}"?`)
+ return this.confirmModal.confirm(`Are you sure you want to remove notebook: "${notebook.name}"?`)
.then(() => this.NotebookData.findIndex(notebook))
.then((idx) => {
this.NotebookData.remove(notebook)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade b/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
deleted file mode 100644
index 0396727..0000000
--- a/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
+++ /dev/null
@@ -1,39 +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.
-
-include /app/helpers/jade/mixins.jade
-
-.modal(tabindex='-1' role='dialog')
- .modal-dialog
- .modal-content
- .modal-header
- button.close(ng-click='$hide()') ×
- h4.modal-title Scan filter
- form.form-horizontal.modal-body.row(name='ui.inputForm' novalidate)
- .settings-row
- .col-sm-2
- label.required.labelFormField Filter:
- .col-sm-10
- .input-tip
- +ignite-form-field-input('"filter"', 'ui.filter', false, 'true', 'Enter filter')(
- data-ignite-form-field-input-autofocus='true'
- ignite-on-enter='form.$valid && ok()'
- )
- .settings-row
- +checkbox('Case sensitive search', 'ui.caseSensitive', '"caseSensitive"', 'Select this checkbox for case sensitive search')
- .modal-footer
- button.btn.btn-default(id='btn-cancel' ng-click='$hide()') Cancel
- button.btn.btn-primary(id='btn-scan' ng-disabled='ui.inputForm.$invalid' ng-click='ok()') Scan
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js b/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
deleted file mode 100644
index 18ba3ba..0000000
--- a/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
+++ /dev/null
@@ -1,51 +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.
- */
-
-export default class ScanFilter {
- static $inject = ['$rootScope', '$q', '$modal'];
-
- constructor($root, $q, $modal) {
- this.deferred = null;
- this.$q = $q;
-
- const scope = $root.$new();
-
- scope.ui = {};
-
- scope.ok = () => {
- this.deferred.resolve({filter: scope.ui.filter, caseSensitive: !!scope.ui.caseSensitive});
-
- this.modal.hide();
- };
-
- scope.$hide = () => {
- this.modal.hide();
-
- this.deferred.reject();
- };
-
- this.modal = $modal({templateUrl: '/scan-filter-input.html', scope, placement: 'center', show: false});
- }
-
- open() {
- this.deferred = this.$q.defer();
-
- this.modal.$promise.then(this.modal.show);
-
- return this.deferred.promise;
- }
-}
[28/37] ignite git commit: IGNITE-4167: Changed
IGNITE_TO_STRING_INCLUDE_SENSITIVE default value to "true".
Posted by vo...@apache.org.
IGNITE-4167: Changed IGNITE_TO_STRING_INCLUDE_SENSITIVE default value to "true".
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c38eb28
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c38eb28
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c38eb28
Branch: refs/heads/ignite-2.0
Commit: 6c38eb28623271a3604ee8d966deb88677a3adb1
Parents: 5494dfb
Author: devozerov <vo...@gridgain.com>
Authored: Thu Dec 29 12:20:20 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Dec 29 12:20:20 2016 +0300
----------------------------------------------------------------------
.../util/tostring/GridToStringBuilder.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6c38eb28/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
index 333f95e..6807b3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
@@ -17,6 +17,13 @@
package org.apache.ignite.internal.util.tostring;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
import java.io.Externalizable;
import java.io.InputStream;
import java.io.OutputStream;
@@ -34,12 +41,8 @@ import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_TO_STRING_INCLUDE_SENSITIVE;
/**
* Provides auto-generation framework for {@code toString()} output.
@@ -87,7 +90,8 @@ public class GridToStringBuilder {
public static final int MAX_COL_SIZE = 100;
/** {@link IgniteSystemProperties#IGNITE_TO_STRING_INCLUDE_SENSITIVE} */
- public static final boolean INCLUDE_SENSITIVE = IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_TO_STRING_INCLUDE_SENSITIVE, false);
+ public static final boolean INCLUDE_SENSITIVE =
+ IgniteSystemProperties.getBoolean(IGNITE_TO_STRING_INCLUDE_SENSITIVE, true);
/** */
private static ThreadLocal<Queue<GridToStringThreadLocal>> threadCache = new ThreadLocal<Queue<GridToStringThreadLocal>>() {
[17/37] ignite git commit: Implemented Visor tasks for Services.
Posted by vo...@apache.org.
Implemented Visor tasks for Services.
(cherry picked from commit fdf1f4b)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b252b441
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b252b441
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b252b441
Branch: refs/heads/ignite-2.0
Commit: b252b441a9ada31c7200b385d75e0b3e7c0362dd
Parents: 2b3a180
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Dec 23 18:20:44 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Dec 23 18:35:58 2016 +0700
----------------------------------------------------------------------
.../visor/service/VisorCancelServiceTask.java | 70 ++++++++++
.../visor/service/VisorServiceDescriptor.java | 132 +++++++++++++++++++
.../visor/service/VisorServiceTask.java | 75 +++++++++++
.../internal/visor/util/VisorTaskUtils.java | 15 ++-
.../resources/META-INF/classnames.properties | 65 +++++++--
5 files changed, 342 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b252b441/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorCancelServiceTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorCancelServiceTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorCancelServiceTask.java
new file mode 100644
index 0000000..64987e9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorCancelServiceTask.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.visor.service;
+
+import org.apache.ignite.IgniteServices;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Task for cancel services with specified name.
+ */
+@GridInternal
+public class VisorCancelServiceTask extends VisorOneNodeTask<String, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCancelServiceJob job(String arg) {
+ return new VisorCancelServiceJob(arg, debug);
+ }
+
+ /**
+ * Job for cancel services with specified name.
+ */
+ private static class VisorCancelServiceJob extends VisorJob<String, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Debug flag.
+ */
+ protected VisorCancelServiceJob(String arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(final String arg) {
+ IgniteServices services = ignite.services();
+
+ services.cancel(arg);
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCancelServiceJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b252b441/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
new file mode 100644
index 0000000..83ec77d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.visor.service;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.util.VisorTaskUtils;
+import org.apache.ignite.services.ServiceDescriptor;
+
+/**
+ * Data transfer object for {@link ServiceDescriptor} object.
+ */
+public class VisorServiceDescriptor implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Service name. */
+ private String name;
+
+ /** Service class. */
+ private String srvcCls;
+
+ /** Maximum allowed total number of deployed services in the grid, {@code 0} for unlimited. */
+ private int totalCnt;
+
+ /** Maximum allowed number of deployed services on each node. */
+ private int maxPerNodeCnt;
+
+ /** Cache name used for key-to-node affinity calculation. */
+ private String cacheName;
+
+ /** ID of grid node that initiated the service deployment. */
+ private UUID originNodeId;
+
+ /**
+ * Service deployment topology snapshot.
+ * Number of service instances deployed on a node mapped to node ID.
+ */
+ private Map<UUID, Integer> topSnapshot;
+
+ /**
+ * Default constructor.
+ */
+ public VisorServiceDescriptor() {
+ // No-op.
+ }
+
+ /**
+ * Create task result with given parameters
+ *
+ */
+ public VisorServiceDescriptor(ServiceDescriptor srvc) {
+ name = srvc.name();
+ srvcCls = VisorTaskUtils.compactClass(srvc.serviceClass());
+ totalCnt = srvc.totalCount();
+ maxPerNodeCnt = srvc.maxPerNodeCount();
+ cacheName = srvc.cacheName();
+ originNodeId = srvc.originNodeId();
+ topSnapshot = srvc.topologySnapshot();
+ }
+
+ /**
+ * @return Service name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Service class.
+ */
+ public String getServiceClass() {
+ return srvcCls;
+ }
+
+ /**
+ * @return Maximum allowed total number of deployed services in the grid, 0 for unlimited.
+ */
+ public int getTotalCnt() {
+ return totalCnt;
+ }
+
+ /**
+ * @return Maximum allowed number of deployed services on each node.
+ */
+ public int getMaxPerNodeCnt() {
+ return maxPerNodeCnt;
+ }
+
+ /**
+ * @return Cache name used for key-to-node affinity calculation.
+ */
+ public String getCacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @return ID of grid node that initiated the service deployment.
+ */
+ public UUID getOriginNodeId() {
+ return originNodeId;
+ }
+
+ /**
+ * @return Service deployment topology snapshot. Number of service instances deployed on a node mapped to node ID.
+ */
+ public Map<UUID, Integer> getTopologySnapshot() {
+ return topSnapshot;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorServiceDescriptor.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b252b441/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java
new file mode 100644
index 0000000..1b3495c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceTask.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.visor.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.services.ServiceDescriptor;
+
+/**
+ * Task for collect topology service configuration.
+ */
+@GridInternal
+public class VisorServiceTask extends VisorOneNodeTask<Void, Collection<VisorServiceDescriptor>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorServiceJob job(Void arg) {
+ return new VisorServiceJob(arg, debug);
+ }
+
+ /**
+ * Job for collect topology service configuration.
+ */
+ private static class VisorServiceJob extends VisorJob<Void, Collection<VisorServiceDescriptor>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Debug flag.
+ */
+ protected VisorServiceJob(Void arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<VisorServiceDescriptor> run(final Void arg) {
+ Collection<ServiceDescriptor> services = ignite.services().serviceDescriptors();
+
+ Collection<VisorServiceDescriptor> res = new ArrayList<>(services.size());
+
+ for (ServiceDescriptor srvc: services)
+ res.add(new VisorServiceDescriptor(srvc));
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorServiceJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b252b441/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 1e9346c..3f5003a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -270,6 +270,19 @@ public class VisorTaskUtils {
/**
* Compact class names.
*
+ * @param cls Class object for compact.
+ * @return Compacted string.
+ */
+ @Nullable public static String compactClass(Class cls) {
+ if (cls == null)
+ return null;
+
+ return U.compact(cls.getName());
+ }
+
+ /**
+ * Compact class names.
+ *
* @param obj Object for compact.
* @return Compacted string.
*/
@@ -277,7 +290,7 @@ public class VisorTaskUtils {
if (obj == null)
return null;
- return U.compact(obj.getClass().getName());
+ return compactClass(obj.getClass());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b252b441/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 4c9596c..4d0b931 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -294,12 +294,17 @@ org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
org.apache.ignite.internal.jdbc2.JdbcQueryTask$QueryResult
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$1
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$QueryResult
+org.apache.ignite.internal.jdbc2.JdbcSqlFieldsQuery
org.apache.ignite.internal.managers.GridManagerAdapter$1$1
org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0
org.apache.ignite.internal.managers.communication.GridIoMessage
org.apache.ignite.internal.managers.communication.GridIoUserMessage
+org.apache.ignite.internal.managers.communication.IgniteIoTestMessage
org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean
org.apache.ignite.internal.managers.deployment.GridDeploymentPerVersionStore$2
org.apache.ignite.internal.managers.deployment.GridDeploymentRequest
@@ -387,20 +392,20 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$3
org.apache.ignite.internal.processors.cache.GridCacheAdapter$30
org.apache.ignite.internal.processors.cache.GridCacheAdapter$32
org.apache.ignite.internal.processors.cache.GridCacheAdapter$4
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$48
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$49
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$50
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$51
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$52
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$53
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$54
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$55
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$57
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$58
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$58$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$59
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
org.apache.ignite.internal.processors.cache.GridCacheAdapter$60
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$61
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$62
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$63
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$64
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$65
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$66
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$67
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$69
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$70
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$70$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$71
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$72
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
@@ -719,8 +724,11 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtFor
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
@@ -1110,6 +1118,12 @@ org.apache.ignite.internal.processors.hadoop.HadoopJobStatus
org.apache.ignite.internal.processors.hadoop.HadoopMapReducePlan
org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo
org.apache.ignite.internal.processors.hadoop.HadoopTaskType
+org.apache.ignite.internal.processors.hadoop.message.HadoopMessage
+org.apache.ignite.internal.processors.hadoop.shuffle.HadoopDirectShuffleMessage
+org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleAck
+org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishRequest
+org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishResponse
+org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleMessage
org.apache.ignite.internal.processors.igfs.IgfsAckMessage
org.apache.ignite.internal.processors.igfs.IgfsAttributes
org.apache.ignite.internal.processors.igfs.IgfsBlockKey
@@ -1207,6 +1221,7 @@ org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException
org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity$1
org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction
+org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicyFactory
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl
@@ -1243,6 +1258,9 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
+org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkCacheExtension$CleanupCompletionListener
+org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkCacheExtension$RemoveOldEntriesRunnable
+org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkIncreaseVersionProcessor
org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl
org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl
@@ -1265,6 +1283,7 @@ org.apache.ignite.internal.processors.query.GridQueryProcessor$6
org.apache.ignite.internal.processors.query.GridQueryProcessor$7
org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
+org.apache.ignite.internal.processors.query.IgniteSQLException
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
@@ -1330,6 +1349,9 @@ org.apache.ignite.internal.processors.rest.handlers.datastructures.DataStructure
org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryFieldsMetaResult
org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryResult
org.apache.ignite.internal.processors.rest.handlers.query.QueryCommandHandler$QueryCursorIterator
+org.apache.ignite.internal.processors.rest.handlers.redis.GridRedisRestCommandHandler$1
+org.apache.ignite.internal.processors.rest.handlers.redis.exception.GridRedisGenericException
+org.apache.ignite.internal.processors.rest.handlers.redis.exception.GridRedisTypeException
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$2
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$ExeCallable
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest
@@ -1341,6 +1363,9 @@ org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioList
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$2
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1$1
+org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisCommand
+org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisMessage
+org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisNioListener$1
org.apache.ignite.internal.processors.rest.request.RestQueryRequest$QueryType
org.apache.ignite.internal.processors.service.GridServiceAssignments
org.apache.ignite.internal.processors.service.GridServiceAssignmentsKey
@@ -1585,10 +1610,13 @@ org.apache.ignite.internal.util.lang.IgniteReducer2X
org.apache.ignite.internal.util.lang.IgniteReducer3
org.apache.ignite.internal.util.lang.IgniteReducer3X
org.apache.ignite.internal.util.lang.IgniteReducerX
+org.apache.ignite.internal.util.lang.IgniteSingletonIterator
org.apache.ignite.internal.util.nio.GridNioEmbeddedFuture$1
org.apache.ignite.internal.util.nio.GridNioException
org.apache.ignite.internal.util.nio.GridNioMessageTracker
org.apache.ignite.internal.util.nio.GridNioServer$NioOperation
+org.apache.ignite.internal.util.nio.GridNioServer$RandomBalancer
+org.apache.ignite.internal.util.nio.GridNioServer$SizeBasedBalancer
org.apache.ignite.internal.util.nio.GridNioSessionMetaKey
org.apache.ignite.internal.util.nio.ssl.GridNioSslHandler
org.apache.ignite.internal.util.offheap.GridOffHeapEvent
@@ -1801,6 +1829,11 @@ org.apache.ignite.internal.visor.query.VisorQueryResult
org.apache.ignite.internal.visor.query.VisorQueryResultEx
org.apache.ignite.internal.visor.query.VisorQueryScanSubstringFilter
org.apache.ignite.internal.visor.query.VisorQueryTask
+org.apache.ignite.internal.visor.service.VisorCancelServiceTask
+org.apache.ignite.internal.visor.service.VisorCancelServiceTask$VisorCancelServiceJob
+org.apache.ignite.internal.visor.service.VisorServiceDescriptor
+org.apache.ignite.internal.visor.service.VisorServiceTask
+org.apache.ignite.internal.visor.service.VisorServiceTask$VisorServiceJob
org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
@@ -1858,12 +1891,15 @@ org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointData
org.apache.ignite.spi.collision.jobstealing.JobStealingRequest
org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi$PriorityGridCollisionJobContextComparator
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$1
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$10
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$11
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure$1
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$8
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$9
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew$1
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeClosure
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeMessage
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeMessage2
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeTimeoutException
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$NodeIdMessage
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$RecoveryLastReceivedMessage
@@ -1923,3 +1959,4 @@ org.apache.ignite.transactions.TransactionOptimisticException
org.apache.ignite.transactions.TransactionRollbackException
org.apache.ignite.transactions.TransactionState
org.apache.ignite.transactions.TransactionTimeoutException
+org.apache.ignite.util.AttributeNodeFilter
[21/37] ignite git commit: ignite-4167 Do not log cache key/values
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
index b29d7cd..333f95e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
@@ -35,6 +35,7 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -85,6 +86,9 @@ public class GridToStringBuilder {
/** Maximum number of collection (map) entries to print. */
public static final int MAX_COL_SIZE = 100;
+ /** {@link IgniteSystemProperties#IGNITE_TO_STRING_INCLUDE_SENSITIVE} */
+ public static final boolean INCLUDE_SENSITIVE = IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_TO_STRING_INCLUDE_SENSITIVE, false);
+
/** */
private static ThreadLocal<Queue<GridToStringThreadLocal>> threadCache = new ThreadLocal<Queue<GridToStringThreadLocal>>() {
@Override protected Queue<GridToStringThreadLocal> initialValue() {
@@ -114,8 +118,45 @@ public class GridToStringBuilder {
* @param val4 Additional parameter value.
* @return String presentation of the given object.
*/
- public static <T> String toString(Class<T> cls, T obj, String name0, Object val0, String name1, Object val1,
- String name2, Object val2, String name3, Object val3, String name4, Object val4) {
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0,
+ String name1, Object val1,
+ String name2, Object val2,
+ String name3, Object val3,
+ String name4, Object val4) {
+ return toString(cls,
+ obj,
+ name0, val0, false,
+ name1, val1, false,
+ name2, val2, false,
+ name3, val3, false,
+ name4, val4, false);
+ }
+
+ /**
+ * Produces auto-generated output of string presentation for given object and its declaration class.
+ *
+ * @param <T> Type of the object.
+ * @param cls Declaration class of the object. Note that this should not be a runtime class.
+ * @param obj Object to get a string presentation for.
+ * @param name0 Additional parameter name.
+ * @param val0 Additional parameter value.
+ * @param name1 Additional parameter name.
+ * @param val1 Additional parameter value.
+ * @param name2 Additional parameter name.
+ * @param val2 Additional parameter value.
+ * @param name3 Additional parameter name.
+ * @param val3 Additional parameter value.
+ * @param name4 Additional parameter name.
+ * @param val4 Additional parameter value.
+ * @return String presentation of the given object.
+ */
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0, boolean sens0,
+ String name1, Object val1, boolean sens1,
+ String name2, Object val2, boolean sens2,
+ String name3, Object val3, boolean sens3,
+ String name4, Object val4, boolean sens4) {
assert cls != null;
assert obj != null;
assert name0 != null;
@@ -135,20 +176,26 @@ public class GridToStringBuilder {
Object[] addNames = tmp.getAdditionalNames();
Object[] addVals = tmp.getAdditionalValues();
+ boolean[] addSens = tmp.getAdditionalSensitives();
addNames[0] = name0;
addVals[0] = val0;
+ addSens[0] = sens0;
addNames[1] = name1;
addVals[1] = val1;
+ addSens[1] = sens1;
addNames[2] = name2;
addVals[2] = val2;
+ addSens[2] = sens2;
addNames[3] = name3;
addVals[3] = val3;
+ addSens[3] = sens3;
addNames[4] = name4;
addVals[4] = val4;
+ addSens[4] = sens4;
try {
- return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, 5);
+ return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, addSens, 5);
}
finally {
queue.offer(tmp);
@@ -171,8 +218,43 @@ public class GridToStringBuilder {
* @param val3 Additional parameter value.
* @return String presentation of the given object.
*/
- public static <T> String toString(Class<T> cls, T obj, String name0, Object val0, String name1, Object val1,
- String name2, Object val2, String name3, Object val3) {
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0,
+ String name1, Object val1,
+ String name2, Object val2,
+ String name3, Object val3) {
+ return toString(cls, obj,
+ name0, val0, false,
+ name1, val1, false,
+ name2, val2, false,
+ name3, val3, false);
+ }
+
+ /**
+ * Produces auto-generated output of string presentation for given object and its declaration class.
+ *
+ * @param <T> Type of the object.
+ * @param cls Declaration class of the object. Note that this should not be a runtime class.
+ * @param obj Object to get a string presentation for.
+ * @param name0 Additional parameter name.
+ * @param val0 Additional parameter value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Additional parameter name.
+ * @param val1 Additional parameter value.
+ * @param sens1 Property sensitive flag.
+ * @param name2 Additional parameter name.
+ * @param val2 Additional parameter value.
+ * @param sens2 Property sensitive flag.
+ * @param name3 Additional parameter name.
+ * @param val3 Additional parameter value.
+ * @param sens3 Property sensitive flag.
+ * @return String presentation of the given object.
+ */
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0, boolean sens0,
+ String name1, Object val1, boolean sens1,
+ String name2, Object val2, boolean sens2,
+ String name3, Object val3, boolean sens3) {
assert cls != null;
assert obj != null;
assert name0 != null;
@@ -191,18 +273,23 @@ public class GridToStringBuilder {
Object[] addNames = tmp.getAdditionalNames();
Object[] addVals = tmp.getAdditionalValues();
+ boolean[] addSens = tmp.getAdditionalSensitives();
addNames[0] = name0;
addVals[0] = val0;
+ addSens[0] = sens0;
addNames[1] = name1;
addVals[1] = val1;
+ addSens[1] = sens1;
addNames[2] = name2;
addVals[2] = val2;
+ addSens[2] = sens2;
addNames[3] = name3;
addVals[3] = val3;
+ addSens[3] = sens3;
try {
- return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, 4);
+ return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, addSens, 4);
}
finally {
queue.offer(tmp);
@@ -223,8 +310,38 @@ public class GridToStringBuilder {
* @param val2 Additional parameter value.
* @return String presentation of the given object.
*/
- public static <T> String toString(Class<T> cls, T obj, String name0, Object val0, String name1, Object val1,
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0,
+ String name1, Object val1,
String name2, Object val2) {
+ return toString(cls,
+ obj,
+ name0, val0, false,
+ name1, val1, false,
+ name2, val2, false);
+ }
+
+ /**
+ * Produces auto-generated output of string presentation for given object and its declaration class.
+ *
+ * @param <T> Type of the object.
+ * @param cls Declaration class of the object. Note that this should not be a runtime class.
+ * @param obj Object to get a string presentation for.
+ * @param name0 Additional parameter name.
+ * @param val0 Additional parameter value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Additional parameter name.
+ * @param val1 Additional parameter value.
+ * @param sens1 Property sensitive flag.
+ * @param name2 Additional parameter name.
+ * @param val2 Additional parameter value.
+ * @param sens2 Property sensitive flag.
+ * @return String presentation of the given object.
+ */
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0, boolean sens0,
+ String name1, Object val1, boolean sens1,
+ String name2, Object val2, boolean sens2) {
assert cls != null;
assert obj != null;
assert name0 != null;
@@ -242,16 +359,20 @@ public class GridToStringBuilder {
Object[] addNames = tmp.getAdditionalNames();
Object[] addVals = tmp.getAdditionalValues();
+ boolean[] addSens = tmp.getAdditionalSensitives();
addNames[0] = name0;
addVals[0] = val0;
+ addSens[0] = sens0;
addNames[1] = name1;
addVals[1] = val1;
+ addSens[1] = sens1;
addNames[2] = name2;
addVals[2] = val2;
+ addSens[2] = sens2;
try {
- return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, 3);
+ return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, addSens, 3);
}
finally {
queue.offer(tmp);
@@ -270,7 +391,29 @@ public class GridToStringBuilder {
* @param val1 Additional parameter value.
* @return String presentation of the given object.
*/
- public static <T> String toString(Class<T> cls, T obj, String name0, Object val0, String name1, Object val1) {
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0,
+ String name1, Object val1) {
+ return toString(cls, obj, name0, val0, false, name1, val1, false);
+ }
+
+ /**
+ * Produces auto-generated output of string presentation for given object and its declaration class.
+ *
+ * @param <T> Type of the object.
+ * @param cls Declaration class of the object. Note that this should not be a runtime class.
+ * @param obj Object to get a string presentation for.
+ * @param name0 Additional parameter name.
+ * @param val0 Additional parameter value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Additional parameter name.
+ * @param val1 Additional parameter value.
+ * @param sens1 Property sensitive flag.
+ * @return String presentation of the given object.
+ */
+ public static <T> String toString(Class<T> cls, T obj,
+ String name0, Object val0, boolean sens0,
+ String name1, Object val1, boolean sens1) {
assert cls != null;
assert obj != null;
assert name0 != null;
@@ -287,14 +430,17 @@ public class GridToStringBuilder {
Object[] addNames = tmp.getAdditionalNames();
Object[] addVals = tmp.getAdditionalValues();
+ boolean[] addSens = tmp.getAdditionalSensitives();
addNames[0] = name0;
addVals[0] = val0;
+ addSens[0] = sens0;
addNames[1] = name1;
addVals[1] = val1;
+ addSens[1] = sens1;
try {
- return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, 2);
+ return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, addSens, 2);
}
finally {
queue.offer(tmp);
@@ -312,6 +458,21 @@ public class GridToStringBuilder {
* @return String presentation of the given object.
*/
public static <T> String toString(Class<T> cls, T obj, String name, @Nullable Object val) {
+ return toString(cls, obj, name, val, false);
+ }
+
+ /**
+ * Produces auto-generated output of string presentation for given object and its declaration class.
+ *
+ * @param <T> Type of the object.
+ * @param cls Declaration class of the object. Note that this should not be a runtime class.
+ * @param obj Object to get a string presentation for.
+ * @param name Additional parameter name.
+ * @param val Additional parameter value.
+ * @param sens Property sensitive flag.
+ * @return String presentation of the given object.
+ */
+ public static <T> String toString(Class<T> cls, T obj, String name, @Nullable Object val, boolean sens) {
assert cls != null;
assert obj != null;
assert name != null;
@@ -327,12 +488,14 @@ public class GridToStringBuilder {
Object[] addNames = tmp.getAdditionalNames();
Object[] addVals = tmp.getAdditionalValues();
+ boolean[] addSens = tmp.getAdditionalSensitives();
addNames[0] = name;
addVals[0] = val;
+ addSens[0] = sens;
try {
- return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, 1);
+ return toStringImpl(cls, tmp.getStringBuilder(), obj, addNames, addVals, addSens, 1);
}
finally {
queue.offer(tmp);
@@ -362,7 +525,7 @@ public class GridToStringBuilder {
try {
return toStringImpl(cls, tmp.getStringBuilder(), obj, tmp.getAdditionalNames(),
- tmp.getAdditionalValues(), 0);
+ tmp.getAdditionalValues(), null, 0);
}
finally {
queue.offer(tmp);
@@ -390,12 +553,16 @@ public class GridToStringBuilder {
* @param obj Object for which to get string presentation.
* @param addNames Names of additional values to be included.
* @param addVals Additional values to be included.
+ * @param addSens Sensitive flag of values or {@code null} if all values are not sensitive.
* @param addLen How many additional values will be included.
* @return String presentation of the given object.
* @param <T> Type of object.
*/
@SuppressWarnings({"unchecked"})
- private static <T> String toStringImpl(Class<T> cls, SB buf, T obj, Object[] addNames, Object[] addVals,
+ private static <T> String toStringImpl(Class<T> cls, SB buf, T obj,
+ Object[] addNames,
+ Object[] addVals,
+ @Nullable boolean[] addSens,
int addLen) {
assert cls != null;
assert buf != null;
@@ -430,26 +597,10 @@ public class GridToStringBuilder {
buf.a(name).a('=');
- if (field.getType().isArray()) {
- if (field.getType().equals(byte[].class))
- buf.a(Arrays.toString((byte[])field.get(obj)));
- else if (field.getType().equals(boolean[].class))
- buf.a(Arrays.toString((boolean[])field.get(obj)));
- else if (field.getType().equals(short[].class))
- buf.a(Arrays.toString((short[])field.get(obj)));
- else if (field.getType().equals(int[].class))
- buf.a(Arrays.toString((int[])field.get(obj)));
- else if (field.getType().equals(long[].class))
- buf.a(Arrays.toString((long[])field.get(obj)));
- else if (field.getType().equals(float[].class))
- buf.a(Arrays.toString((float[])field.get(obj)));
- else if (field.getType().equals(double[].class))
- buf.a(Arrays.toString((double[])field.get(obj)));
- else if (field.getType().equals(char[].class))
- buf.a(Arrays.toString((char[])field.get(obj)));
- else
- buf.a(Arrays.toString((Object[])field.get(obj)));
- }
+ Class<?> fieldType = field.getType();
+
+ if (fieldType.isArray())
+ buf.a(arrayToString(fieldType, field.get(obj)));
else {
Object val = field.get(obj);
@@ -475,15 +626,7 @@ public class GridToStringBuilder {
}
}
- if (addLen > 0)
- for (int i = 0; i < addLen; i++) {
- if (!first)
- buf.a(", ");
- else
- first = false;
-
- buf.a(addNames[i]).a('=').a(addVals[i]);
- }
+ appendVals(buf, first, addNames, addVals, addSens, addLen);
buf.a(']');
@@ -508,6 +651,402 @@ public class GridToStringBuilder {
}
/**
+ * @param arrType Type of the array.
+ * @param arr Array object.
+ * @return String representation of an array.
+ */
+ private static String arrayToString(Class arrType, Object arr) {
+ if (arrType.equals(byte[].class))
+ return Arrays.toString((byte[])arr);
+ if (arrType.equals(boolean[].class))
+ return Arrays.toString((boolean[])arr);
+ if (arrType.equals(short[].class))
+ return Arrays.toString((short[])arr);
+ if (arrType.equals(int[].class))
+ return Arrays.toString((int[])arr);
+ if (arrType.equals(long[].class))
+ return Arrays.toString((long[])arr);
+ if (arrType.equals(float[].class))
+ return Arrays.toString((float[])arr);
+ if (arrType.equals(double[].class))
+ return Arrays.toString((double[])arr);
+ if (arrType.equals(char[].class))
+ return Arrays.toString((char[])arr);
+
+ return Arrays.toString((Object[])arr);
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name Property name.
+ * @param val Property value.
+ * @return String presentation.
+ */
+ public static String toString(String str, String name, @Nullable Object val) {
+ return toString(str, name, val, false);
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name Property name.
+ * @param val Property value.
+ * @param sens Property sensitive flag.
+ * @return String presentation.
+ */
+ public static String toString(String str, String name, @Nullable Object val, boolean sens) {
+ assert name != null;
+
+ Queue<GridToStringThreadLocal> queue = threadCache.get();
+
+ assert queue != null;
+
+ // Since string() methods can be chain-called from the same thread we
+ // have to keep a list of thread-local objects and remove/add them
+ // in each string() apply.
+ GridToStringThreadLocal tmp = queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove();
+
+ Object[] propNames = tmp.getAdditionalNames();
+ Object[] propVals = tmp.getAdditionalValues();
+ boolean[] propSens = tmp.getAdditionalSensitives();
+
+ propNames[0] = name;
+ propVals[0] = val;
+ propSens[0] = sens;
+
+ try {
+ return toStringImpl(str, tmp.getStringBuilder(), propNames, propVals, propSens, 1);
+ }
+ finally {
+ queue.offer(tmp);
+ }
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name0 Property name.
+ * @param val0 Property value.
+ * @param name1 Property name.
+ * @param val1 Property value.
+ * @return String presentation.
+ */
+ public static String toString(String str, String name0, @Nullable Object val0, String name1,
+ @Nullable Object val1) {
+ return toString(str, name0, val0, false, name1, val1, false);
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name0 Property name.
+ * @param val0 Property value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Property name.
+ * @param val1 Property value.
+ * @param sens1 Property sensitive flag.
+ * @return String presentation.
+ */
+ public static String toString(String str,
+ String name0, @Nullable Object val0, boolean sens0,
+ String name1, @Nullable Object val1, boolean sens1) {
+ assert name0 != null;
+ assert name1 != null;
+
+ Queue<GridToStringThreadLocal> queue = threadCache.get();
+
+ assert queue != null;
+
+ // Since string() methods can be chain-called from the same thread we
+ // have to keep a list of thread-local objects and remove/add them
+ // in each string() apply.
+ GridToStringThreadLocal tmp = queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove();
+
+ Object[] propNames = tmp.getAdditionalNames();
+ Object[] propVals = tmp.getAdditionalValues();
+ boolean[] propSens = tmp.getAdditionalSensitives();
+
+ propNames[0] = name0;
+ propVals[0] = val0;
+ propSens[0] = sens0;
+ propNames[1] = name1;
+ propVals[1] = val1;
+ propSens[1] = sens1;
+
+ try {
+ return toStringImpl(str, tmp.getStringBuilder(), propNames, propVals, propSens, 2);
+ }
+ finally {
+ queue.offer(tmp);
+ }
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name0 Property name.
+ * @param val0 Property value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Property name.
+ * @param val1 Property value.
+ * @param sens1 Property sensitive flag.
+ * @param name2 Property name.
+ * @param val2 Property value.
+ * @param sens2 Property sensitive flag.
+ * @return String presentation.
+ */
+ public static String toString(String str,
+ String name0, @Nullable Object val0, boolean sens0,
+ String name1, @Nullable Object val1, boolean sens1,
+ String name2, @Nullable Object val2, boolean sens2) {
+ assert name0 != null;
+ assert name1 != null;
+ assert name2 != null;
+
+ Queue<GridToStringThreadLocal> queue = threadCache.get();
+
+ assert queue != null;
+
+ // Since string() methods can be chain-called from the same thread we
+ // have to keep a list of thread-local objects and remove/add them
+ // in each string() apply.
+ GridToStringThreadLocal tmp = queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove();
+
+ Object[] propNames = tmp.getAdditionalNames();
+ Object[] propVals = tmp.getAdditionalValues();
+ boolean[] propSens = tmp.getAdditionalSensitives();
+
+ propNames[0] = name0;
+ propVals[0] = val0;
+ propSens[0] = sens0;
+ propNames[1] = name1;
+ propVals[1] = val1;
+ propSens[1] = sens1;
+ propNames[2] = name2;
+ propVals[2] = val2;
+ propSens[2] = sens2;
+
+ try {
+ return toStringImpl(str, tmp.getStringBuilder(), propNames, propVals, propSens, 3);
+ }
+ finally {
+ queue.offer(tmp);
+ }
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name0 Property name.
+ * @param val0 Property value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Property name.
+ * @param val1 Property value.
+ * @param sens1 Property sensitive flag.
+ * @param name2 Property name.
+ * @param val2 Property value.
+ * @param sens2 Property sensitive flag.
+ * @param name3 Property name.
+ * @param val3 Property value.
+ * @param sens3 Property sensitive flag.
+ * @return String presentation.
+ */
+ public static String toString(String str,
+ String name0, @Nullable Object val0, boolean sens0,
+ String name1, @Nullable Object val1, boolean sens1,
+ String name2, @Nullable Object val2, boolean sens2,
+ String name3, @Nullable Object val3, boolean sens3) {
+ assert name0 != null;
+ assert name1 != null;
+ assert name2 != null;
+ assert name3 != null;
+
+ Queue<GridToStringThreadLocal> queue = threadCache.get();
+
+ assert queue != null;
+
+ // Since string() methods can be chain-called from the same thread we
+ // have to keep a list of thread-local objects and remove/add them
+ // in each string() apply.
+ GridToStringThreadLocal tmp = queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove();
+
+ Object[] propNames = tmp.getAdditionalNames();
+ Object[] propVals = tmp.getAdditionalValues();
+ boolean[] propSens = tmp.getAdditionalSensitives();
+
+ propNames[0] = name0;
+ propVals[0] = val0;
+ propSens[0] = sens0;
+ propNames[1] = name1;
+ propVals[1] = val1;
+ propSens[1] = sens1;
+ propNames[2] = name2;
+ propVals[2] = val2;
+ propSens[2] = sens2;
+ propNames[3] = name3;
+ propVals[3] = val3;
+ propSens[3] = sens3;
+
+ try {
+ return toStringImpl(str, tmp.getStringBuilder(), propNames, propVals, propSens, 4);
+ }
+ finally {
+ queue.offer(tmp);
+ }
+ }
+
+ /**
+ * Produces uniformed output of string with context properties
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param name0 Property name.
+ * @param val0 Property value.
+ * @param sens0 Property sensitive flag.
+ * @param name1 Property name.
+ * @param val1 Property value.
+ * @param sens1 Property sensitive flag.
+ * @param name2 Property name.
+ * @param val2 Property value.
+ * @param sens2 Property sensitive flag.
+ * @param name3 Property name.
+ * @param val3 Property value.
+ * @param sens3 Property sensitive flag.
+ * @param name4 Property name.
+ * @param val4 Property value.
+ * @param sens4 Property sensitive flag.
+ * @return String presentation.
+ */
+ public static String toString(String str,
+ String name0, @Nullable Object val0, boolean sens0,
+ String name1, @Nullable Object val1, boolean sens1,
+ String name2, @Nullable Object val2, boolean sens2,
+ String name3, @Nullable Object val3, boolean sens3,
+ String name4, @Nullable Object val4, boolean sens4) {
+ assert name0 != null;
+ assert name1 != null;
+ assert name2 != null;
+ assert name3 != null;
+ assert name4 != null;
+
+ Queue<GridToStringThreadLocal> queue = threadCache.get();
+
+ assert queue != null;
+
+ // Since string() methods can be chain-called from the same thread we
+ // have to keep a list of thread-local objects and remove/add them
+ // in each string() apply.
+ GridToStringThreadLocal tmp = queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove();
+
+ Object[] propNames = tmp.getAdditionalNames();
+ Object[] propVals = tmp.getAdditionalValues();
+ boolean[] propSens = tmp.getAdditionalSensitives();
+
+ propNames[0] = name0;
+ propVals[0] = val0;
+ propSens[0] = sens0;
+ propNames[1] = name1;
+ propVals[1] = val1;
+ propSens[1] = sens1;
+ propNames[2] = name2;
+ propVals[2] = val2;
+ propSens[2] = sens2;
+ propNames[3] = name3;
+ propVals[3] = val3;
+ propSens[3] = sens3;
+ propNames[4] = name4;
+ propVals[4] = val4;
+ propSens[4] = sens4;
+
+ try {
+ return toStringImpl(str, tmp.getStringBuilder(), propNames, propVals, propSens, 5);
+ }
+ finally {
+ queue.offer(tmp);
+ }
+ }
+
+ /**
+ * Creates an uniformed string presentation for the binary-like object.
+ *
+ * @param str Output prefix or {@code null} if empty.
+ * @param buf String builder buffer.
+ * @param propNames Names of object properties.
+ * @param propVals Property values.
+ * @param propSens Sensitive flag of values or {@code null} if all values is not sensitive.
+ * @param propCnt Properties count.
+ * @return String presentation of the object.
+ */
+ private static String toStringImpl(String str, SB buf, Object[] propNames, Object[] propVals,
+ boolean[] propSens, int propCnt) {
+
+ buf.setLength(0);
+
+ if (str != null)
+ buf.a(str).a(" ");
+
+ buf.a("[");
+
+ appendVals(buf, true, propNames, propVals, propSens, propCnt);
+
+ buf.a(']');
+
+ return buf.toString();
+ }
+
+ /**
+ * Append additional values to the buffer.
+ *
+ * @param buf Buffer.
+ * @param first First value flag.
+ * @param addNames Names of additional values to be included.
+ * @param addVals Additional values to be included.
+ * @param addSens Sensitive flag of values or {@code null} if all values are not sensitive.
+ * @param addLen How many additional values will be included.
+ */
+ private static void appendVals(SB buf,
+ boolean first,
+ Object[] addNames,
+ Object[] addVals,
+ boolean[] addSens,
+ int addLen)
+ {
+ if (addLen > 0) {
+ for (int i = 0; i < addLen; i++) {
+ Object addVal = addVals[i];
+
+ if (addVal != null) {
+ if (addSens != null && addSens[i] && !INCLUDE_SENSITIVE)
+ continue;
+
+ GridToStringInclude incAnn = addVal.getClass().getAnnotation(GridToStringInclude.class);
+
+ if (incAnn != null && incAnn.sensitive() && !INCLUDE_SENSITIVE)
+ continue;
+
+ Class<?> cls = addVal.getClass();
+
+ if (cls.isArray())
+ addVal = arrayToString(cls, addVal);
+ }
+
+ if (!first)
+ buf.a(", ");
+ else
+ first = false;
+
+ buf.a(addNames[i]).a('=').a(addVal);
+ }
+ }
+ }
+
+ /**
* @param cls Class.
* @param <T> Type of the object.
* @return Descriptor for the class.
@@ -518,7 +1057,7 @@ public class GridToStringBuilder {
String key = cls.getName() + System.identityHashCode(cls.getClassLoader());
- GridToStringClassDescriptor cd = null;
+ GridToStringClassDescriptor cd;
rwLock.readLock().lock();
@@ -537,9 +1076,15 @@ public class GridToStringBuilder {
Class<?> type = f.getType();
- if (f.isAnnotationPresent(GridToStringInclude.class) ||
- type.isAnnotationPresent(GridToStringInclude.class))
- add = true;
+ final GridToStringInclude incFld = f.getAnnotation(GridToStringInclude.class);
+ final GridToStringInclude incType = type.getAnnotation(GridToStringInclude.class);
+
+ if (incFld != null || incType != null) {
+ // Information is not sensitive when both the field and the field type are not sensitive.
+ // When @GridToStringInclude is not present then the flag is false by default for that attribute.
+ final boolean notSens = (incFld == null || !incFld.sensitive()) && (incType == null || !incType.sensitive());
+ add = notSens || INCLUDE_SENSITIVE;
+ }
else if (!f.isAnnotationPresent(GridToStringExclude.class) &&
!f.getType().isAnnotationPresent(GridToStringExclude.class)) {
if (
@@ -573,8 +1118,9 @@ public class GridToStringBuilder {
GridToStringFieldDescriptor fd = new GridToStringFieldDescriptor(f.getName());
// Get order, if any.
- if (f.isAnnotationPresent(GridToStringOrder.class))
- fd.setOrder(f.getAnnotation(GridToStringOrder.class).value());
+ final GridToStringOrder annOrder = f.getAnnotation(GridToStringOrder.class);
+ if (annOrder != null)
+ fd.setOrder(annOrder.value());
cd.addField(fd);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringInclude.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringInclude.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringInclude.java
index ec502a7..5ea1fe6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringInclude.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringInclude.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.util.tostring;
+import org.apache.ignite.IgniteSystemProperties;
+
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -32,5 +34,13 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface GridToStringInclude {
- // No-op.
+ /**
+ * A flag indicating a sensitive information stored in the field or fields of the class.<br/>
+ * Such information will be included in {@code toString()} output ONLY when the system property
+ * {@link IgniteSystemProperties#IGNITE_TO_STRING_INCLUDE_SENSITIVE IGNITE_TO_STRING_INCLUDE_SENSITIVE}
+ * is set to {@code true}.
+ *
+ * @return Attribute value.
+ */
+ boolean sensitive() default false;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringThreadLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringThreadLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringThreadLocal.java
index ab91452..33fc6a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringThreadLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringThreadLocal.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.util.tostring;
import org.apache.ignite.internal.util.typedef.internal.SB;
/**
- * Helper wrapper containing StringBuilder and additional values. Stored as a thread-lcal variable.
+ * Helper wrapper containing StringBuilder and additional values. Stored as a thread-local variable.
*/
class GridToStringThreadLocal {
/** */
@@ -32,6 +32,9 @@ class GridToStringThreadLocal {
/** */
private Object[] addVals = new Object[5];
+ /** */
+ private boolean[] addSens = new boolean[5];
+
/**
* @return String builder.
*/
@@ -52,4 +55,11 @@ class GridToStringThreadLocal {
Object[] getAdditionalValues() {
return addVals;
}
+
+ /**
+ * @return Additional values.
+ */
+ boolean[] getAdditionalSensitives() {
+ return addSens;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 150c245..bf72782 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.util.typedef.P2;
import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -224,7 +225,11 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
String typeName = nameMapper.typeName(TestReferenceObject.class.getName());
- assertTrue("Unexpected toString: " + str, str.startsWith(typeName) && str.contains("obj=" + typeName + " ["));
+ assertTrue("Unexpected toString: " + str,
+ S.INCLUDE_SENSITIVE ?
+ str.startsWith(typeName) && str.contains("obj=" + typeName + " [") :
+ str.startsWith("BinaryObject") && str.contains("idHash=") && str.contains("hash=")
+ );
TestReferenceObject obj1_r = po.deserialize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/9273e51c/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
index 4f5fe9b..6a0eae2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
@@ -54,7 +54,13 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
IgniteLogger log = log();
- log.info(obj.toStringWithAdditional());
+ String manual = obj.toStringWithAdditionalManual();
+ log.info(manual);
+
+ String automatic = obj.toStringWithAdditionalAutomatic();
+ log.info(automatic);
+
+ assert manual.equals(automatic);
}
/**
@@ -117,7 +123,7 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
/**
* Test class.
*/
- private class TestClass1 {
+ private static class TestClass1 {
/** */
@SuppressWarnings("unused")
@GridToStringOrder(0)
@@ -129,6 +135,7 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
/** */
@SuppressWarnings("unused")
+ @GridToStringInclude(sensitive = true)
private long longVar;
/** */
@@ -180,7 +187,8 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
buf.append("id=").append(id).append(", ");
buf.append("uuidVar=").append(uuidVar).append(", ");
buf.append("intVar=").append(intVar).append(", ");
- buf.append("longVar=").append(longVar).append(", ");
+ if (S.INCLUDE_SENSITIVE)
+ buf.append("longVar=").append(longVar).append(", ");
buf.append("boolVar=").append(boolVar).append(", ");
buf.append("byteVar=").append(byteVar).append(", ");
buf.append("name=").append(name).append(", ");
@@ -200,10 +208,23 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
}
/**
- * @return String with additional parameters.
+ * @return Automatic string with additional parameters.
+ */
+ String toStringWithAdditionalAutomatic() {
+ return S.toString(TestClass1.class, this, "newParam1", 1, false, "newParam2", 2, true);
+ }
+
+ /**
+ * @return Manual string with additional parameters.
*/
- String toStringWithAdditional() {
- return S.toString(TestClass1.class, this, "newParam1", 1, "newParam2", 2);
+ String toStringWithAdditionalManual() {
+ StringBuilder s = new StringBuilder(toStringManual());
+ s.setLength(s.length() - 1);
+ s.append(", newParam1=").append(1);
+ if (S.INCLUDE_SENSITIVE)
+ s.append(", newParam2=").append(2);
+ s.append(']');
+ return s.toString();
}
}
}
\ No newline at end of file
[35/37] ignite git commit: IGNITE-4516: Hadoop: implemented optional
compression for remote shuffle output. This closes #1399.
Posted by vo...@apache.org.
IGNITE-4516: Hadoop: implemented optional compression for remote shuffle output. This closes #1399.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d62542b9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d62542b9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d62542b9
Branch: refs/heads/ignite-2.0
Commit: d62542b9bbfff5a221915f2bd1d23ecfee9814cf
Parents: 2774d87
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jan 5 11:30:42 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jan 5 11:30:42 2017 +0300
----------------------------------------------------------------------
.../processors/hadoop/HadoopJobProperty.java | 7 +++
.../shuffle/HadoopDirectShuffleMessage.java | 34 +++++++++++-
.../hadoop/shuffle/HadoopShuffleJob.java | 57 +++++++++++++++++---
.../shuffle/direct/HadoopDirectDataOutput.java | 14 +++++
.../direct/HadoopDirectDataOutputContext.java | 48 +++++++++++++++--
.../direct/HadoopDirectDataOutputState.java | 14 ++++-
.../hadoop/impl/HadoopTeraSortTest.java | 32 +++++++++--
7 files changed, 188 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
index 4398acd..4dd3bf5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
@@ -103,6 +103,13 @@ public enum HadoopJobProperty {
SHUFFLE_MSG_SIZE("ignite.shuffle.message.size"),
/**
+ * Whether shuffle message should be compressed with GZIP.
+ * <p>
+ * Defaults to {@code false}.
+ */
+ SHUFFLE_MSG_GZIP("ignite.shuffle.message.gzip"),
+
+ /**
* Whether to stripe mapper output for remote reducers.
* <p>
* Defaults to {@code false}.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
index e81dc5f..f596100 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopDirectShuffleMessage.java
@@ -57,6 +57,9 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
@GridDirectTransient
private transient int bufLen;
+ /** Data length. */
+ private int dataLen;
+
/**
* Default constructor.
*/
@@ -72,8 +75,9 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
* @param cnt Count.
* @param buf Buffer.
* @param bufLen Buffer length.
+ * @param dataLen Data length.
*/
- public HadoopDirectShuffleMessage(HadoopJobId jobId, int reducer, int cnt, byte[] buf, int bufLen) {
+ public HadoopDirectShuffleMessage(HadoopJobId jobId, int reducer, int cnt, byte[] buf, int bufLen, int dataLen) {
assert jobId != null;
this.jobId = jobId;
@@ -81,6 +85,7 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
this.cnt = cnt;
this.buf = buf;
this.bufLen = bufLen;
+ this.dataLen = dataLen;
}
/**
@@ -111,6 +116,13 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
return buf;
}
+ /**
+ * @return Data length.
+ */
+ public int dataLength() {
+ return dataLen;
+ }
+
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
@@ -147,6 +159,12 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
writer.incrementState();
+ case 4:
+ if (!writer.writeInt("dataLen", dataLen))
+ return false;
+
+ writer.incrementState();
+
}
return true;
@@ -194,6 +212,14 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
reader.incrementState();
+ case 4:
+ dataLen = reader.readInt("dataLen");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
}
return reader.afterMessageRead(HadoopDirectShuffleMessage.class);
@@ -206,7 +232,7 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 4;
+ return 5;
}
/** {@inheritDoc} */
@@ -222,6 +248,8 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
out.writeInt(cnt);
U.writeByteArray(out, buf);
+
+ out.writeInt(dataLen);
}
/** {@inheritDoc} */
@@ -234,6 +262,8 @@ public class HadoopDirectShuffleMessage implements Message, HadoopMessage {
buf = U.readByteArray(in);
bufLen = buf != null ? buf.length : 0;
+
+ dataLen = in.readInt();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
index 1c546a1..0394865 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
@@ -56,6 +56,8 @@ import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -63,10 +65,12 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReferenceArray;
+import java.util.zip.GZIPInputStream;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.PARTITION_HASHMAP_SIZE;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.SHUFFLE_JOB_THROTTLE;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.SHUFFLE_MAPPER_STRIPED_OUTPUT;
+import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.SHUFFLE_MSG_GZIP;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.SHUFFLE_MSG_SIZE;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.SHUFFLE_REDUCER_NO_SORTING;
import static org.apache.ignite.internal.processors.hadoop.HadoopJobProperty.get;
@@ -79,6 +83,9 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
private static final int DFLT_SHUFFLE_MSG_SIZE = 1024 * 1024;
/** */
+ private static final boolean DFLT_SHUFFLE_MSG_GZIP = false;
+
+ /** */
private final HadoopJob job;
/** */
@@ -130,6 +137,9 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
/** Message size. */
private final int msgSize;
+ /** Whether to GZIP shuffle messages. */
+ private final boolean msgGzip;
+
/** Whether to strip mappers for remote execution. */
private final boolean stripeMappers;
@@ -190,6 +200,7 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
stripeMappers = stripeMappers0;
msgSize = get(job.info(), SHUFFLE_MSG_SIZE, DFLT_SHUFFLE_MSG_SIZE);
+ msgGzip = get(job.info(), SHUFFLE_MSG_GZIP, DFLT_SHUFFLE_MSG_GZIP);
locReducersCtx = new AtomicReferenceArray<>(totalReducerCnt);
@@ -360,22 +371,26 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
* @throws IgniteCheckedException Exception.
*/
public void onDirectShuffleMessage(T src, HadoopDirectShuffleMessage msg) throws IgniteCheckedException {
- assert msg.buffer() != null;
+ byte[] buf = extractBuffer(msg);
- HadoopTaskContext taskCtx = locReducersCtx.get(msg.reducer()).get();
+ assert buf != null;
+
+ int rdc = msg.reducer();
+
+ HadoopTaskContext taskCtx = locReducersCtx.get(rdc).get();
HadoopPerformanceCounter perfCntr = HadoopPerformanceCounter.getCounter(taskCtx.counters(), null);
- perfCntr.onShuffleMessage(msg.reducer(), U.currentTimeMillis());
+ perfCntr.onShuffleMessage(rdc, U.currentTimeMillis());
- HadoopMultimap map = getOrCreateMap(locMaps, msg.reducer());
+ HadoopMultimap map = getOrCreateMap(locMaps, rdc);
HadoopSerialization keySer = taskCtx.keySerialization();
HadoopSerialization valSer = taskCtx.valueSerialization();
// Add data from message to the map.
try (HadoopMultimap.Adder adder = map.startAdding(taskCtx)) {
- HadoopDirectDataInput in = new HadoopDirectDataInput(msg.buffer());
+ HadoopDirectDataInput in = new HadoopDirectDataInput(buf);
Object key = null;
Object val = null;
@@ -393,6 +408,31 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
}
/**
+ * Extract buffer from direct shuffle message.
+ *
+ * @param msg Message.
+ * @return Buffer.
+ */
+ private byte[] extractBuffer(HadoopDirectShuffleMessage msg) throws IgniteCheckedException {
+ if (msgGzip) {
+ byte[] res = new byte[msg.dataLength()];
+
+ try (GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(msg.buffer()), res.length)) {
+ int len = in.read(res, 0, res.length);
+
+ assert len == res.length;
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to uncompress direct shuffle message.", e);
+ }
+
+ return res;
+ }
+ else
+ return msg.buffer();
+ }
+
+ /**
* @param ack Shuffle ack.
*/
@SuppressWarnings("ConstantConditions")
@@ -595,7 +635,8 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
* @param rmtDirectCtx Remote direct context.
* @param reset Whether to perform reset.
*/
- private void sendShuffleMessage(int rmtMapIdx, @Nullable HadoopDirectDataOutputContext rmtDirectCtx, boolean reset) {
+ private void sendShuffleMessage(int rmtMapIdx, @Nullable HadoopDirectDataOutputContext rmtDirectCtx,
+ boolean reset) {
if (rmtDirectCtx == null)
return;
@@ -612,7 +653,7 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
rmtDirectCtx.reset();
HadoopDirectShuffleMessage msg = new HadoopDirectShuffleMessage(job.id(), rmtRdcIdx, cnt,
- state.buffer(), state.bufferLength());
+ state.buffer(), state.bufferLength(), state.dataLength());
T nodeId = reduceAddrs[rmtRdcIdx];
@@ -983,7 +1024,7 @@ public class HadoopShuffleJob<T> implements AutoCloseable {
HadoopDirectDataOutputContext rmtDirectCtx = rmtDirectCtxs[idx];
if (rmtDirectCtx == null) {
- rmtDirectCtx = new HadoopDirectDataOutputContext(msgSize, taskCtx);
+ rmtDirectCtx = new HadoopDirectDataOutputContext(msgSize, msgGzip, taskCtx);
rmtDirectCtxs[idx] = rmtDirectCtx;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutput.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutput.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutput.java
index 151e552..5840994 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutput.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutput.java
@@ -170,6 +170,13 @@ public class HadoopDirectDataOutput extends OutputStream implements DataOutput {
}
/**
+ * @return Buffer length (how much memory is allocated).
+ */
+ public int bufferLength() {
+ return bufSize;
+ }
+
+ /**
* @return Position.
*/
public int position() {
@@ -184,6 +191,13 @@ public class HadoopDirectDataOutput extends OutputStream implements DataOutput {
}
/**
+ * Reset the stream.
+ */
+ public void reset() {
+ pos = 0;
+ }
+
+ /**
* Ensure that the given amount of bytes is available within the stream, then shift the position.
*
* @param cnt Count.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputContext.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputContext.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputContext.java
index bc70ef3..454278b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputContext.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputContext.java
@@ -18,16 +18,29 @@
package org.apache.ignite.internal.processors.hadoop.shuffle.direct;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.processors.hadoop.HadoopSerialization;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskContext;
+import java.io.IOException;
+import java.util.zip.GZIPOutputStream;
+
/**
* Hadoop data output context for direct communication.
*/
public class HadoopDirectDataOutputContext {
+ /** Initial allocation size for GZIP output. We start with very low value, but then it will grow if needed. */
+ private static final int GZIP_OUT_MIN_ALLOC_SIZE = 1024;
+
+ /** GZIP buffer size. We should remove it when we implement efficient direct GZIP output. */
+ private static final int GZIP_BUFFER_SIZE = 8096;
+
/** Flush size. */
private final int flushSize;
+ /** Whether to perform GZIP. */
+ private final boolean gzip;
+
/** Key serialization. */
private final HadoopSerialization keySer;
@@ -37,6 +50,9 @@ public class HadoopDirectDataOutputContext {
/** Data output. */
private HadoopDirectDataOutput out;
+ /** Data output for GZIP. */
+ private HadoopDirectDataOutput gzipOut;
+
/** Number of keys written. */
private int cnt;
@@ -44,17 +60,22 @@ public class HadoopDirectDataOutputContext {
* Constructor.
*
* @param flushSize Flush size.
+ * @param gzip Whether to perform GZIP.
* @param taskCtx Task context.
* @throws IgniteCheckedException If failed.
*/
- public HadoopDirectDataOutputContext(int flushSize, HadoopTaskContext taskCtx)
+ public HadoopDirectDataOutputContext(int flushSize, boolean gzip, HadoopTaskContext taskCtx)
throws IgniteCheckedException {
this.flushSize = flushSize;
+ this.gzip = gzip;
keySer = taskCtx.keySerialization();
valSer = taskCtx.valueSerialization();
out = new HadoopDirectDataOutput(flushSize);
+
+ if (gzip)
+ gzipOut = new HadoopDirectDataOutput(Math.max(flushSize / 8, GZIP_OUT_MIN_ALLOC_SIZE));
}
/**
@@ -85,16 +106,35 @@ public class HadoopDirectDataOutputContext {
* @return State.
*/
public HadoopDirectDataOutputState state() {
- return new HadoopDirectDataOutputState(out.buffer(), out.position());
+ if (gzip) {
+ try {
+ try (GZIPOutputStream gzip = new GZIPOutputStream(gzipOut, GZIP_BUFFER_SIZE)) {
+ gzip.write(out.buffer(), 0, out.position());
+ }
+
+ return new HadoopDirectDataOutputState(gzipOut.buffer(), gzipOut.position(), out.position());
+ }
+ catch (IOException e) {
+ throw new IgniteException("Failed to compress.", e);
+ }
+ }
+ else
+ return new HadoopDirectDataOutputState(out.buffer(), out.position(), out.position());
}
/**
* Reset buffer.
*/
public void reset() {
- int allocSize = Math.max(flushSize, out.position());
+ if (gzip) {
+ // In GZIP mode we do not expose normal output to the outside. Hence, no need for reallocation, just reset.
+ out.reset();
+
+ gzipOut = new HadoopDirectDataOutput(gzipOut.bufferLength());
+ }
+ else
+ out = new HadoopDirectDataOutput(flushSize, out.bufferLength());
- out = new HadoopDirectDataOutput(flushSize, allocSize);
cnt = 0;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputState.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputState.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputState.java
index a9c12e3..cadde7a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputState.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/direct/HadoopDirectDataOutputState.java
@@ -27,15 +27,20 @@ public class HadoopDirectDataOutputState {
/** Buffer length. */
private final int bufLen;
+ /** Data length. */
+ private final int dataLen;
+
/**
* Constructor.
*
* @param buf Buffer.
* @param bufLen Buffer length.
+ * @param dataLen Data length.
*/
- public HadoopDirectDataOutputState(byte[] buf, int bufLen) {
+ public HadoopDirectDataOutputState(byte[] buf, int bufLen, int dataLen) {
this.buf = buf;
this.bufLen = bufLen;
+ this.dataLen = dataLen;
}
/**
@@ -51,4 +56,11 @@ public class HadoopDirectDataOutputState {
public int bufferLength() {
return bufLen;
}
+
+ /**
+ * @return Original data length.
+ */
+ public int dataLength() {
+ return dataLen;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d62542b9/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTeraSortTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTeraSortTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTeraSortTest.java
index b1fa91f..d237180 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTeraSortTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTeraSortTest.java
@@ -137,8 +137,10 @@ public class HadoopTeraSortTest extends HadoopAbstractSelfTest {
/**
* Does actual test TeraSort job Through Ignite API
+ *
+ * @param gzip Whether to use GZIP.
*/
- protected final void teraSort() throws Exception {
+ protected final void teraSort(boolean gzip) throws Exception {
System.out.println("TeraSort ===============================================================");
getFileSystem().delete(new Path(sortOutDir), true);
@@ -164,6 +166,10 @@ public class HadoopTeraSortTest extends HadoopAbstractSelfTest {
jobConf.set("mapred.max.split.size", String.valueOf(splitSize));
jobConf.setBoolean(HadoopJobProperty.SHUFFLE_MAPPER_STRIPED_OUTPUT.propertyName(), true);
+ jobConf.setInt(HadoopJobProperty.SHUFFLE_MSG_SIZE.propertyName(), 4096);
+
+ if (gzip)
+ jobConf.setBoolean(HadoopJobProperty.SHUFFLE_MSG_GZIP.propertyName(), true);
jobConf.set(HadoopJobProperty.JOB_PARTIALLY_RAW_COMPARATOR.propertyName(),
TextPartiallyRawComparator.class.getName());
@@ -347,12 +353,32 @@ public class HadoopTeraSortTest extends HadoopAbstractSelfTest {
/**
* Runs generate/sort/validate phases of the terasort sample.
- * @throws Exception
+ *
+ * @throws Exception If failed.
*/
public void testTeraSort() throws Exception {
+ checkTeraSort(false);
+ }
+
+ /**
+ * Runs generate/sort/validate phases of the terasort sample.
+ *
+ * @throws Exception If failed.
+ */
+ public void testTeraSortGzip() throws Exception {
+ checkTeraSort(true);
+ }
+
+ /**
+ * Check terasort.
+ *
+ * @param gzip GZIP flag.
+ * @throws Exception If failed.
+ */
+ private void checkTeraSort(boolean gzip) throws Exception {
teraGenerate();
- teraSort();
+ teraSort(gzip);
teraValidate();
}
[06/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.jade b/modules/web-console/frontend/views/sql/sql.jade
index e3f6461..03015e8 100644
--- a/modules/web-console/frontend/views/sql/sql.jade
+++ b/modules/web-console/frontend/views/sql/sql.jade
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
+include /app/helpers/jade/mixins.jade
include /app/directives/ui-grid-settings/ui-grid-settings.jade
mixin btn-toolbar(btn, click, tip, focusId)
@@ -56,10 +57,15 @@ mixin notebook-rename
.input-tip
input.form-control(ng-model='notebook.editName' required ignite-on-enter='renameNotebook(notebook.editName)' ignite-on-escape='notebook.edit = false;')
h1.pull-right
- a.dropdown-toggle(data-toggle='dropdown' bs-dropdown='scrollParagraphs' data-placement='bottom-right') Scroll to query
+ a.dropdown-toggle(style='margin-right: 20px' data-toggle='dropdown' bs-dropdown='scrollParagraphs' data-placement='bottom-right') Scroll to query
span.caret
- .btn-group(style='margin-top: 2px')
- +btn-toolbar('fa-plus', 'addParagraph()', 'Add new query')
+ button.btn.btn-default(style='margin-top: 2px' ng-click='addQuery()' ignite-on-click-focus=focusId)
+ i.fa.fa-fw.fa-plus
+ | Add query
+
+ button.btn.btn-default(style='margin-top: 2px' ng-click='addScan()' ignite-on-click-focus=focusId)
+ i.fa.fa-fw.fa-plus
+ | Add scan
mixin notebook-error
h2 Failed to load notebook
@@ -68,7 +74,7 @@ mixin notebook-error
mixin paragraph-rename
.col-sm-6(ng-hide='paragraph.edit')
- i.tipLabel.fa(ng-class='paragraphExpanded(paragraph) ? "fa-chevron-circle-down" : "fa-chevron-circle-right"')
+ i.fa(ng-class='paragraphExpanded(paragraph) ? "fa-chevron-circle-down" : "fa-chevron-circle-right"')
label {{paragraph.name}}
.btn-group(ng-hide='notebook.paragraphs.length > 1')
@@ -85,51 +91,45 @@ mixin paragraph-rename
input.form-control(id='paragraph-name-{{paragraph.id}}' ng-model='paragraph.editName' required ng-click='$event.stopPropagation();' ignite-on-enter='renameParagraph(paragraph, paragraph.editName)' ignite-on-escape='paragraph.edit = false')
mixin query-settings
- label.tipLabel Refresh rate:
- button.btn.btn-default.fa.fa-clock-o.tipLabel(title='Click to show refresh rate dialog' ng-class='{"btn-info": paragraph.rate && paragraph.rate.installed}' bs-popover data-template-url='/sql/paragraph-rate.html' data-placement='left' data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
- label.tipLabel Page size:
- button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.pageSize' bs-options='item for item in pageSizes' bs-select bs-tooltip data-placement='bottom-right' data-title='Max number of rows to show in query result as one page')
- label.margin-left-dflt(title='Fetch first page of results only')
- input(type='checkbox' ng-model='paragraph.firstPageOnly')
- span Fetch first page only
- label.margin-left-dflt(title='Execute query locally on selected node.\nNode selection dialog will be shown before query execution.')
- input(type='checkbox' ng-model='paragraph.localQry')
- span Local query
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Configure periodical execution of last successfully executed query') Refresh rate:
+ button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info": paragraph.rate && paragraph.rate.installed}' bs-popover data-template-url='/sql/paragraph-rate.html' data-placement='left' data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
+
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Max number of rows to show in query result as one page') Page size:
+ button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.pageSize' bs-select bs-options='item for item in pageSizes')
+
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Limit query max results to specified number of pages') Max pages:
+ button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.maxPages' bs-select bs-options='item.value as item.label for item in maxPages')
+
+ label.tipLabel(ng-if='nonCollocatedJoinsAvailable(paragraph)' bs-tooltip data-placement='bottom' data-title='Non-collocated joins is a special mode that allow to join data across cluster without collocation.<br/>\
+ Nested joins are not supported for now.<br/>\
+ <b>NOTE</b>: In some cases it may consume more heap memory or may take a long time than collocated joins.' data-trigger='hover')
+ input(type='checkbox' ng-model='paragraph.nonCollocatedJoins')
+ span Allow non-collocated joins
mixin query-actions
- .btn-group(bs-tooltip='' data-title='{{actionTooltip(paragraph, "execute", true)}}' data-placement='bottom')
- button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, true)' ng-click='execute(paragraph)') Execute
- button.btn.btn-primary.dropdown-toggle(
- ng-disabled='!actionAvailable(paragraph, true)'
- bs-dropdown=''
- data-container='body'
- data-placement='bottom-right'
- )
- span.caret
- ul.dropdown-menu(role='menu')
- li #[a(href='javascript:void(0)' ng-click='execute(paragraph)') Execute]
- li #[a(href='javascript:void(0)' ng-if='nonCollocatedJoinsAvailable(paragraph)' ng-click='execute(paragraph, true)') Execute non collocated joins]
- .btn-group(bs-tooltip='' data-title='{{actionTooltip(paragraph, "execute scan", false)}}' data-placement='bottom')
- button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, false)' ng-click='scan(paragraph)') Scan
- button.btn.btn-primary.dropdown-toggle(
- ng-disabled='!actionAvailable(paragraph, false)'
- bs-dropdown=''
- data-container='body'
- data-placement='bottom-right'
- )
- span.caret
- ul.dropdown-menu(role='menu')
- li #[a(href='javascript:void(0)' ng-click='scan(paragraph)') Scan]
- li #[a(href='javascript:void(0)' ng-click='actionAvailable(paragraph, false) && scanWithFilter(paragraph)') Scan with filter]
+ button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, true)' ng-click='execute(paragraph)') Execute
+ button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, true)' ng-click='execute(paragraph, true)') Execute on selected node
+
a.btn.btn-default(ng-disabled='!actionAvailable(paragraph, true)' ng-click='explain(paragraph)' data-placement='bottom' bs-tooltip='' data-title='{{actionTooltip(paragraph, "explain", true)}}') Explain
-mixin query-controls
- .sql-controls
- +query-actions()
- .pull-right
- +query-settings()
+mixin table-result-heading-query
+ .total.row
+ .col-xs-4
+ +ui-grid-settings
+ label Page: #[b {{paragraph.page}}]
+ label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
+ label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
+ .col-xs-4
+ div(ng-if='paragraph.qryType === "query"')
+ +result-toolbar
+ .col-xs-4
+ .pull-right
+ .btn-group(ng-disabled='paragraph.loading')
+ button.btn.btn-primary(ng-click='exportCsv(paragraph)' bs-tooltip data-title='{{actionTooltip(paragraph, "export", false)}}') Export
+ button.btn.btn-primary.dropdown-toggle(id='export-item-dropdown' data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
+ span.caret
-mixin table-result
+mixin table-result-heading-scan
.total.row
.col-xs-4
+ui-grid-settings
@@ -137,17 +137,16 @@ mixin table-result
label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
.col-xs-4
- +result-toolbar
+ div(ng-if='paragraph.qryType === "query"')
+ +result-toolbar
.col-xs-4
.pull-right
- label(style='margin-right: 10px;')
- input(type='checkbox' ng-model='paragraph.systemColumns' ng-change='toggleSystemColumns(paragraph)' ng-disabled='paragraph.disabledSystemColumns')
- span Show _KEY, _VAL columns
.btn-group(ng-disabled='paragraph.loading')
button.btn.btn-primary(ng-click='exportCsv(paragraph)' bs-tooltip data-title='{{actionTooltip(paragraph, "export", false)}}') Export
button.btn.btn-primary.dropdown-toggle(id='export-item-dropdown' data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
span.caret
-
+
+mixin table-result-body
.grid(ui-grid='paragraph.gridOptions' ui-grid-resize-columns ui-grid-exporter)
mixin chart-result
@@ -166,12 +165,99 @@ mixin chart-result
+result-toolbar
label.margin-top-dflt Charts do not support #[b Explain] and #[b Scan] query
+mixin paragraph-scan
+ .panel-heading(bs-collapse-toggle)
+ .row
+ +paragraph-rename
+ .panel-collapse(role='tabpanel' bs-collapse-target)
+ .col-sm-12.sql-controls
+ .col-sm-3
+ +dropdown-required('Cache:', 'paragraph.cacheName', '"cache"', 'true', 'false', 'Choose cache', 'caches')
+ .col-sm-3
+ +text-enabled('Filter:', 'paragraph.filter', '"filter"', true, false, 'Enter filter')
+ label.btn.btn-default.ignite-form-field__btn(ng-click='paragraph.caseSensitive = !paragraph.caseSensitive')
+ input(type='checkbox' ng-model='paragraph.caseSensitive')
+ span(bs-tooltip data-title='Select this checkbox for case sensitive search') Cs
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Max number of rows to show in query result as one page') Page size:
+ button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.pageSize' bs-select bs-options='item for item in pageSizes')
+
+ .col-sm-12.sql-controls
+ button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, false)' ng-click='scan(paragraph)')
+ | Scan
+ button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, false)' ng-click='scan(paragraph, true)')
+ | Scan on selected node
+
+ .col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
+ .error(ng-switch-when='error') Error: {{paragraph.errMsg}}
+ .empty(ng-switch-when='empty') Result set is empty
+ .table(ng-switch-when='table')
+ +table-result-heading-scan
+ +table-result-body
+ .footer.clearfix()
+ .pull-left
+ | Showing results for scan of #[b{{ paragraph.queryArgs.cacheName | defaultName }}]
+ span(ng-if='paragraph.queryArgs.filter') with filter: #[b {{ paragraph.queryArgs.filter }}]
+ span(ng-if='paragraph.queryArgs.localNid') on node: #[b {{ paragraph.queryArgs.localNid | limitTo:8 }}]
+
+ -var nextVisibleCondition = 'paragraph.resultType() != "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
+
+ .pull-right(ng-show='#{nextVisibleCondition}' ng-class='{disabled: paragraph.loading}' ng-click='!paragraph.loading && nextPage(paragraph)')
+ i.fa.fa-chevron-circle-right
+ a Next
+
+mixin paragraph-query
+ .row.panel-heading(bs-collapse-toggle)
+ +paragraph-rename
+ .panel-collapse(role='tabpanel' bs-collapse-target)
+ .col-sm-12
+ .col-xs-8.col-sm-9(style='border-right: 1px solid #eee')
+ .sql-editor(ignite-ace='{onLoad: aceInit(paragraph), theme: "chrome", mode: "sql", require: ["ace/ext/language_tools"],' +
+ 'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true}}'
+ ng-model='paragraph.query')
+ .col-xs-4.col-sm-3
+ div(ng-show='caches.length > 0' style='padding: 5px 10px' st-table='displayedCaches' st-safe-src='caches')
+ lable.labelField.labelFormField Caches:
+ i.fa.fa-database.tipField(title='Click to show cache types metadata dialog' bs-popover data-template-url='/sql/cache-metadata.html' data-placement='bottom' data-trigger='click' data-container='#{{ paragraph.id }}')
+ .input-tip
+ input.form-control(type='text' st-search='label' placeholder='Filter caches...')
+ table.links
+ tbody.scrollable-y(style='max-height: 15em; display: block;')
+ tr(ng-repeat='cache in displayedCaches track by cache.name')
+ td(style='width: 100%')
+ input.labelField(id='cache_{{ [paragraph.id, $index].join("_") }}' type='radio' value='{{cache.name}}' ng-model='paragraph.cacheName')
+ label(for='cache_{{ [paragraph.id, $index].join("_") }} ' ng-bind-html='cache.label')
+ .empty-caches(ng-show='displayedCaches.length == 0 && caches.length != 0')
+ label Wrong caches filter
+ .empty-caches(ng-show='caches.length == 0')
+ label No caches
+ .col-sm-12.sql-controls
+ +query-actions
+
+ .pull-right
+ +query-settings
+ .col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
+ .error(ng-switch-when='error') Error: {{paragraph.errMsg}}
+ .empty(ng-switch-when='empty') Result set is empty
+ .table(ng-switch-when='table')
+ +table-result-heading-query
+ +table-result-body
+ .chart(ng-switch-when='chart')
+ +chart-result
+ .footer.clearfix
+ a.pull-left(ng-click='showResultQuery(paragraph)') Show query
+
+ -var nextVisibleCondition = 'paragraph.resultType() != "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
+
+ .pull-right(ng-show='#{nextVisibleCondition}' ng-class='{disabled: paragraph.loading}' ng-click='!paragraph.loading && nextPage(paragraph)')
+ i.fa.fa-chevron-circle-right
+ a Next
+
.row(ng-controller='sqlController')
.docs-content
.row(ng-if='notebook' bs-affix style='margin-bottom: 20px;')
+notebook-rename
- ignite-information(data-title='With SQL notebook you can' style='margin-top: 0; margin-bottom: 30px')
+ ignite-information(data-title='With query notebook you can' style='margin-top: 0; margin-bottom: 30px')
ul
li Create any number of queries
li Execute and explain SQL queries
@@ -184,46 +270,9 @@ mixin chart-result
div(ng-if='notebook' ignite-loading='sqlLoading' ignite-loading-text='{{ loadingText }}' ignite-loading-position='top')
.docs-body.paragraphs
.panel-group(bs-collapse ng-model='notebook.expandedParagraphs' data-allow-multiple='true' data-start-collapsed='false')
- .panel.panel-default(ng-repeat='paragraph in notebook.paragraphs' id='{{paragraph.id}}')
- .panel-heading(bs-collapse-toggle)
- .row
- +paragraph-rename
- .panel-collapse(role='tabpanel' bs-collapse-target)
- .col-sm-12
- .col-xs-8.col-sm-9(style='border-right: 1px solid #eee')
- .sql-editor(ignite-ace='{onLoad: aceInit(paragraph), theme: "chrome", mode: "sql", require: ["ace/ext/language_tools"],' +
- 'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true}}'
- ng-model='paragraph.query')
- .col-xs-4.col-sm-3
- div(ng-show='caches.length > 0' style='padding: 5px 10px' st-table='displayedCaches' st-safe-src='caches')
- lable.labelField.labelFormField Caches:
- i.fa.fa-database.tipField(title='Click to show cache types metadata dialog' bs-popover data-template-url='/sql/cache-metadata.html' data-placement='bottom' data-trigger='click' data-container='#{{ paragraph.id }}')
- .input-tip
- input.form-control(type='text' st-search='label' placeholder='Filter caches...')
- table.links
- tbody.scrollable-y(style='max-height: 15em; display: block;')
- tr(ng-repeat='cache in displayedCaches track by cache.name')
- td(style='width: 100%')
- input.labelField(id='cache_{{ [paragraph.id, $index].join("_") }}' type='radio' value='{{cache.name}}' ng-model='paragraph.cacheName')
- label(for='cache_{{ [paragraph.id, $index].join("_") }} ' ng-bind='cache.label')
- .empty-caches(ng-show='displayedCaches.length == 0 && caches.length != 0')
- label Wrong caches filter
- .empty-caches(ng-show='caches.length == 0')
- label No caches
- .col-sm-12
- +query-controls
- .col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
- .error(ng-switch-when='error') Error: {{paragraph.errMsg}}
- .empty(ng-switch-when='empty') Result set is empty
- .table(ng-switch-when='table')
- +table-result
- .chart(ng-switch-when='chart')
- +chart-result
- .footer.clearfix
- a.pull-left(ng-click='showResultQuery(paragraph)') Show query
-
- -var nextVisibleCondition = 'paragraph.resultType() != "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
-
- .pull-right(ng-show=nextVisibleCondition ng-class='{disabled: paragraph.loading}' ng-click='!paragraph.loading && nextPage(paragraph)')
- i.fa.fa-chevron-circle-right
- a Next
+
+ .panel-paragraph(ng-repeat='paragraph in notebook.paragraphs' id='{{paragraph.id}}' ng-form='form_{{paragraph.id}}')
+ .panel.panel-default(ng-if='paragraph.qryType === "scan"')
+ +paragraph-scan
+ .panel.panel-default(ng-if='paragraph.qryType === "query"')
+ +paragraph-query
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/templates/alert.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/alert.jade b/modules/web-console/frontend/views/templates/alert.jade
index 182ba99..d30d2fd 100644
--- a/modules/web-console/frontend/views/templates/alert.jade
+++ b/modules/web-console/frontend/views/templates/alert.jade
@@ -16,6 +16,6 @@
.alert(ng-show='type' ng-class='[type ? "alert-" + type : null]')
button.close(type='button', ng-if='dismissable', ng-click='$hide()') ×
- i.alert-icon.fa(ng-if='icon' ng-class='[icon]')
+ i.alert-icon(ng-if='icon' ng-class='[icon]')
span.alert-title(ng-bind-html='title')
span.alert-content(ng-bind-html='content')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/views/templates/select.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/select.jade b/modules/web-console/frontend/views/templates/select.jade
index 5b6cc01..aa6a2ef 100644
--- a/modules/web-console/frontend/views/templates/select.jade
+++ b/modules/web-console/frontend/views/templates/select.jade
@@ -23,4 +23,4 @@ ul.select.dropdown-menu(tabindex='-1' ng-show='$isVisible()' role='select')
hr(ng-if='match.value == undefined' style='margin: 5px 0')
a(id='li-dropdown-item-{{$index}}' role='menuitem' tabindex='-1' ng-class='{active: $isActive($index)}' ng-click='$select($index, $event)' bs-tooltip='widthIsSufficient && !widthIsSufficient("li-dropdown-item-{{$index}}", $index, match.label) ? match.label : ""' data-placement='right auto')
i(class='{{$iconCheckmark}}' ng-if='$isActive($index)' ng-class='{active: $isActive($index)}')
- span(ng-bind='match.label')
+ span(ng-bind-html='match.label')
[20/37] ignite git commit: IGNITE-4109 - BinaryType.isEnum() throws
an exception if typeId==0
Posted by vo...@apache.org.
IGNITE-4109 - BinaryType.isEnum() throws an exception if typeId==0
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ccae40e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ccae40e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ccae40e
Branch: refs/heads/ignite-2.0
Commit: 2ccae40e2a21398d15c3762b72575216c56a7fb0
Parents: 2da2816
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Dec 23 17:51:49 2016 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Dec 23 17:51:49 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 4 ++--
.../ignite/internal/binary/BinaryTypeProxy.java | 15 ++++++++++++---
.../ignite/internal/binary/BinaryUtils.java | 4 +++-
.../internal/binary/BinaryEnumsSelfTest.java | 18 ++++++++++++++++++
4 files changed, 35 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ccae40e/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index cc18318..4030ef0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -928,7 +928,7 @@ public class BinaryContext {
* @param typeId Type ID.
* @return Instance of ID mapper.
*/
- public BinaryInternalMapper userTypeMapper(int typeId) {
+ BinaryInternalMapper userTypeMapper(int typeId) {
BinaryInternalMapper mapper = typeId2Mapper.get(typeId);
return mapper != null ? mapper : SIMPLE_NAME_LOWER_CASE_MAPPER;
@@ -938,7 +938,7 @@ public class BinaryContext {
* @param clsName Type name.
* @return Instance of ID mapper.
*/
- private BinaryInternalMapper userTypeMapper(String clsName) {
+ BinaryInternalMapper userTypeMapper(String clsName) {
BinaryInternalMapper mapper = cls2Mappers.get(clsName);
if (mapper != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ccae40e/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
index 17b0bc6..df9901e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import java.util.Collection;
+import org.jetbrains.annotations.Nullable;
/**
* Binary type proxy. Is used to delay or completely avoid metadata lookup.
@@ -34,21 +35,26 @@ public class BinaryTypeProxy implements BinaryType {
private final BinaryContext ctx;
/** Type ID. */
- private final int typeId;
+ private int typeId;
+
+ /** Raw data. */
+ private final String clsName;
/** Target type. */
@GridToStringExclude
private volatile BinaryType target;
/**
- * Constrcutor.
+ * Constructor.
*
* @param ctx Context.
* @param typeId Type ID.
+ * @param clsName Class name.
*/
- public BinaryTypeProxy(BinaryContext ctx, int typeId) {
+ public BinaryTypeProxy(BinaryContext ctx, int typeId, @Nullable String clsName) {
this.ctx = ctx;
this.typeId = typeId;
+ this.clsName = clsName;
}
/** {@inheritDoc} */
@@ -93,6 +99,9 @@ public class BinaryTypeProxy implements BinaryType {
if (target == null) {
synchronized (this) {
if (target == null) {
+ if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID && clsName != null)
+ typeId = ctx.typeId(clsName);
+
target = ctx.metadata(typeId);
if (target == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ccae40e/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index bbf5021..fdc54c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -2228,7 +2228,9 @@ public class BinaryUtils {
if (ctx == null)
throw new BinaryObjectException("BinaryContext is not set for the object.");
- return new BinaryTypeProxy(ctx, obj.typeId());
+ String clsName = obj instanceof BinaryEnumObjectImpl ? ((BinaryEnumObjectImpl)obj).className() : null;
+
+ return new BinaryTypeProxy(ctx, obj.typeId(), clsName);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ccae40e/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
index fb7e618..91add0d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.marshaller.Marshaller;
@@ -389,6 +390,23 @@ public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
}
/**
+ * Check ability to resolve typeId from class name.
+ *
+ * @throws Exception If failed.
+ */
+ public void testZeroTypeId() throws Exception {
+ startUp(true);
+
+ final BinaryContext ctx =
+ ((CacheObjectBinaryProcessorImpl)((IgniteEx)node1).context().cacheObjects()).binaryContext();
+
+ final BinaryObject enumObj =
+ new BinaryEnumObjectImpl(ctx, 0, EnumType.class.getName(), EnumType.ONE.ordinal());
+
+ assert enumObj.type().isEnum();
+ }
+
+ /**
* Validate simple array.
*
* @param registered Registered flag.
[37/37] ignite git commit: Merge branch 'master' into ignite-2.0
Posted by vo...@apache.org.
Merge branch 'master' into ignite-2.0
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6090ebdf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6090ebdf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6090ebdf
Branch: refs/heads/ignite-2.0
Commit: 6090ebdfcd0ea3840b0d32cb10197b43615e1e89
Parents: 1f74346 beb242b
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jan 5 12:23:06 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jan 5 12:23:06 2017 +0300
----------------------------------------------------------------------
modules/cloud/pom.xml | 6 +-
.../java/org/apache/ignite/IgniteLogger.java | 4 +-
.../apache/ignite/IgniteSystemProperties.java | 13 +
.../ignite/cache/affinity/AffinityKey.java | 4 +-
.../org/apache/ignite/events/CacheEvent.java | 6 +-
.../ignite/events/CacheQueryReadEvent.java | 8 +-
.../ignite/internal/binary/BinaryContext.java | 4 +-
.../internal/binary/BinaryEnumObjectImpl.java | 10 +-
.../ignite/internal/binary/BinaryMetadata.java | 5 +-
.../internal/binary/BinaryObjectExImpl.java | 8 +-
.../ignite/internal/binary/BinaryTypeProxy.java | 15 +-
.../ignite/internal/binary/BinaryUtils.java | 4 +-
.../cache/CacheInvokeDirectResult.java | 2 +-
.../processors/cache/CacheInvokeResult.java | 2 +-
.../processors/cache/CacheLazyEntry.java | 4 +-
.../processors/cache/CacheObjectAdapter.java | 7 +-
.../processors/cache/GridCacheAdapter.java | 5 +-
.../cache/GridCacheMvccCandidate.java | 9 +-
.../processors/cache/GridCacheReturn.java | 2 +-
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 2 +-
.../distributed/near/GridNearLockFuture.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 4 +-
.../cache/query/GridCacheQueryManager.java | 13 +-
.../cache/query/GridCacheQueryRequest.java | 2 +
.../cache/query/GridCacheSqlQuery.java | 4 +-
.../continuous/CacheContinuousQueryEvent.java | 8 +-
.../continuous/CacheContinuousQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 30 +-
.../cache/store/GridCacheWriteBehindStore.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 11 +-
.../GridCacheVersionConflictContext.java | 2 +-
.../closure/GridClosureProcessor.java | 4 +-
.../continuous/GridContinuousMessage.java | 2 +-
.../datastructures/CollocatedSetItemKey.java | 2 +-
.../GridCacheAtomicLongValue.java | 2 +
.../GridCacheAtomicSequenceImpl.java | 2 +
.../GridCacheAtomicSequenceValue.java | 2 +
.../GridCacheCountDownLatchValue.java | 3 +
.../datastructures/GridCacheSetItemKey.java | 2 +-
.../processors/hadoop/HadoopJobProperty.java | 7 +
.../shuffle/HadoopDirectShuffleMessage.java | 34 +-
.../internal/processors/job/GridJobWorker.java | 7 +-
.../odbc/OdbcQueryExecuteRequest.java | 6 +-
.../platform/PlatformNativeException.java | 3 +-
.../processors/query/GridQueryProcessor.java | 35 +-
.../processors/rest/GridRestResponse.java | 2 +-
.../internal/util/future/GridFutureAdapter.java | 2 +-
.../util/lang/GridMetadataAwareAdapter.java | 2 +-
.../ignite/internal/util/nio/GridNioServer.java | 159 ++++-
.../util/tostring/GridToStringBuilder.java | 656 +++++++++++++++++--
.../util/tostring/GridToStringInclude.java | 12 +-
.../util/tostring/GridToStringThreadLocal.java | 12 +-
.../query/VisorQueryScanSubstringFilter.java | 5 +-
.../internal/visor/query/VisorQueryUtils.java | 60 ++
.../communication/tcp/TcpCommunicationSpi.java | 20 +-
.../tcp/TcpCommunicationSpiMBean.java | 5 +-
.../apache/ignite/spi/indexing/IndexingSpi.java | 3 +
.../roundrobin/RoundRobinLoadBalancingSpi.java | 16 +-
.../resources/META-INF/classnames.properties | 1 +
.../internal/binary/BinaryEnumsSelfTest.java | 18 +
...mmunicationBalancePairedConnectionsTest.java | 28 +
.../IgniteCommunicationBalanceTest.java | 25 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 7 +-
...cMessageRecoveryNoPairedConnectionsTest.java | 47 --
...micMessageRecoveryPairedConnectionsTest.java | 47 ++
.../cache/query/IndexingSpiQuerySelfTest.java | 199 +++++-
.../tostring/GridToStringBuilderSelfTest.java | 33 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 6 +-
modules/gce/pom.xml | 4 +-
.../hadoop/impl/igfs/HadoopIgfsJclLogger.java | 9 +-
.../hadoop/shuffle/HadoopShuffleJob.java | 57 +-
.../shuffle/direct/HadoopDirectDataOutput.java | 14 +
.../direct/HadoopDirectDataOutputContext.java | 48 +-
.../direct/HadoopDirectDataOutputState.java | 14 +-
.../hadoop/impl/HadoopTeraSortTest.java | 32 +-
.../org/apache/ignite/logger/jcl/JclLogger.java | 9 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Cache/CacheAbstractTest.cs | 625 ------------------
.../Cache/CacheAbstractTransactionalTest.cs | 565 ++++++++++++++++
.../Cache/CacheLocalAtomicTest.cs | 5 -
.../Cache/CacheLocalTest.cs | 6 +-
.../CachePartitionedAtomicNearEnabledTest.cs | 5 -
.../Cache/CachePartitionedAtomicTest.cs | 5 -
.../Cache/CachePartitionedNearEnabledTest.cs | 7 +-
.../Cache/CachePartitionedTest.cs | 7 +-
.../Cache/CacheReplicatedAtomicTest.cs | 5 -
.../Cache/CacheReplicatedTest.cs | 7 +-
.../Query/CacheQueriesCodeConfigurationTest.cs | 4 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Impl/Transactions/TransactionsImpl.cs | 18 +
.../Transactions/ITransactions.cs | 19 +-
.../apache/ignite/logger/slf4j/Slf4jLogger.java | 11 +-
modules/web-console/backend/app/mongo.js | 19 +
.../generator/AbstractTransformer.js | 5 +
.../modules/configuration/generator/Beans.js | 4 +
.../generator/ConfigurationGenerator.js | 36 +
.../states/configuration/caches/affinity.jade | 82 +++
.../states/configuration/caches/memory.jade | 4 +-
.../frontend/views/configuration/caches.jade | 1 +
.../yardstick/cache/IgniteIoTestBenchmark.java | 73 ---
parent/pom.xml | 2 +-
104 files changed, 2351 insertions(+), 1038 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6090ebdf/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6090ebdf/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
index a3115bf,4dd3bf5..60992d5
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobProperty.java
@@@ -103,9 -103,16 +103,16 @@@ public enum HadoopJobProperty
SHUFFLE_MSG_SIZE("ignite.shuffle.message.size"),
/**
+ * Whether shuffle message should be compressed with GZIP.
+ * <p>
+ * Defaults to {@code false}.
+ */
+ SHUFFLE_MSG_GZIP("ignite.shuffle.message.gzip"),
+
+ /**
* Whether to stripe mapper output for remote reducers.
* <p>
- * Defaults to {@code false}.
+ * Defaults to {@code true}.
*/
SHUFFLE_MAPPER_STRIPED_OUTPUT("ignite.shuffle.mapper.striped.output"),
http://git-wip-us.apache.org/repos/asf/ignite/blob/6090ebdf/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffleJob.java
----------------------------------------------------------------------
[04/37] ignite git commit: IGNITE-4439 - Attribute based node filter
Posted by vo...@apache.org.
IGNITE-4439 - Attribute based node filter
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e71ef26
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e71ef26
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e71ef26
Branch: refs/heads/ignite-2.0
Commit: 6e71ef26d8e3c6f86d1f0b9f4bec97b7e33d0b2e
Parents: 708cc8c
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Dec 22 13:05:35 2016 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Dec 22 13:13:51 2016 -0800
----------------------------------------------------------------------
.../apache/ignite/util/AttributeNodeFilter.java | 105 +++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
.../util/AttributeNodeFilterSelfTest.java | 184 +++++++++++++++++++
3 files changed, 292 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e71ef26/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java b/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
new file mode 100644
index 0000000..e2b972b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/util/AttributeNodeFilter.java
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.util;
+
+import java.util.Collections;
+import java.util.Map;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@code IgnitePredicate<ClusterNode>} based on
+ * {@link IgniteConfiguration#getUserAttributes() user attributes}.
+ * This filter can be used in methods like {@link ClusterGroup#forPredicate(IgnitePredicate)},
+ * {@link CacheConfiguration#setNodeFilter(IgnitePredicate)},
+ * {@link ServiceConfiguration#setNodeFilter(IgnitePredicate)}, etc.
+ * <p>
+ * The filter will evaluate to true if a node has <b>all</b> provided attributes set to
+ * corresponding values. Here is an example of how you can configure node filter for a
+ * cache or a service so that it's deployed only on nodes that have {@code group}
+ * attribute set to value {@code data}:
+ * <pre name="code" class="xml">
+ * <property name="nodeFilter">
+ * <bean class="org.apache.ignite.util.ClusterAttributeNodeFilter">
+ * <constructor-arg value="group"/>
+ * <constructor-arg value="data"/>
+ * </bean>
+ * </property>
+ * </pre>
+ * You can also specify multiple attributes for the filter:
+ * <pre name="code" class="xml">
+ * <property name="nodeFilter">
+ * <bean class="org.apache.ignite.util.ClusterAttributeNodeFilter">
+ * <constructor-arg>
+ * <map>
+ * <entry key="cpu-group" value="high"/>
+ * <entry key="memory-group" value="high"/>
+ * </map>
+ * </constructor-arg>
+ * </bean>
+ * </property>
+ * </pre>
+ * With this configuration a cache or a service will deploy only on nodes that have both
+ * {@code cpu-group} and {@code memory-group} attributes set to value {@code high}.
+ */
+public class AttributeNodeFilter implements IgnitePredicate<ClusterNode> {
+ /** Attributes. */
+ private final Map<String, Object> attrs;
+
+ /**
+ * Creates new node filter with a single attribute value.
+ *
+ * @param attrName Attribute name.
+ * @param attrVal Attribute value.
+ */
+ public AttributeNodeFilter(String attrName, @Nullable Object attrVal) {
+ A.notNull(attrName, "attrName");
+
+ attrs = Collections.singletonMap(attrName, attrVal);
+ }
+
+ /**
+ * Creates new node filter with a set of attributes.
+ *
+ * @param attrs Attributes.
+ */
+ public AttributeNodeFilter(Map<String, Object> attrs) {
+ A.notNull(attrs, "attrs");
+
+ this.attrs = attrs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode node) {
+ Map<String, Object> nodeAttrs = node.attributes();
+
+ for (Map.Entry<String, Object> attr : attrs.entrySet()) {
+ if (!F.eq(nodeAttrs.get(attr.getKey()), attr.getValue()))
+ return false;
+ }
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e71ef26/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 1c1fcf7..b2fafe2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testsuites;
import java.util.Set;
import junit.framework.TestSuite;
import org.apache.ignite.GridSuppressedExceptionSelfTest;
+import org.apache.ignite.util.AttributeNodeFilterSelfTest;
import org.apache.ignite.internal.ClusterGroupHostsSelfTest;
import org.apache.ignite.internal.ClusterGroupSelfTest;
import org.apache.ignite.internal.GridFailFastNodeFailureDetectionSelfTest;
@@ -148,6 +149,8 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(SecurityPermissionSetBuilderTest.class);
+ suite.addTestSuite(AttributeNodeFilterSelfTest.class);
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e71ef26/modules/core/src/test/java/org/apache/ignite/util/AttributeNodeFilterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/AttributeNodeFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/AttributeNodeFilterSelfTest.java
new file mode 100644
index 0000000..ac3800f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/util/AttributeNodeFilterSelfTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.util;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Collections;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests for {@link AttributeNodeFilter}.
+ */
+public class AttributeNodeFilterSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private Map<String, ?> attrs;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
+
+ if (attrs != null)
+ cfg.setUserAttributes(attrs);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ attrs = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleAttribute() throws Exception {
+ IgnitePredicate<ClusterNode> filter = new AttributeNodeFilter("attr", "value");
+
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr", "value"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr", "wrong"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr", null))));
+ assertFalse(filter.apply(nodeProxy(Collections.<String, Object>emptyMap())));
+ assertFalse(filter.apply(nodeProxy(F.asMap("wrong", "value"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("null", "value"))));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleAttributeNullValue() throws Exception {
+ IgnitePredicate<ClusterNode> filter = new AttributeNodeFilter("attr", null);
+
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr", null))));
+ assertTrue(filter.apply(nodeProxy(Collections.<String, Object>emptyMap())));
+ assertTrue(filter.apply(nodeProxy(F.asMap("wrong", "value"))));
+ assertTrue(filter.apply(nodeProxy(F.asMap("wrong", null))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr", "value"))));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultipleAttributes() throws Exception {
+ IgnitePredicate<ClusterNode> filter =
+ new AttributeNodeFilter(F.<String, Object>asMap("attr1", "value1", "attr2", "value2"));
+
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr1", "value1", "attr2", "value2"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "wrong", "attr2", "value2"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "value1", "attr2", "wrong"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "wrong", "attr2", "wrong"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "value1"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr2", "value2"))));
+ assertFalse(filter.apply(nodeProxy(Collections.<String, Object>emptyMap())));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMultipleAttributesNullValues() throws Exception {
+ IgnitePredicate<ClusterNode> filter = new AttributeNodeFilter(F.asMap("attr1", null, "attr2", null));
+
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr1", null, "attr2", null))));
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr1", null))));
+ assertTrue(filter.apply(nodeProxy(F.asMap("attr2", null))));
+ assertTrue(filter.apply(nodeProxy(Collections.<String, Object>emptyMap())));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "value1"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr2", "value2"))));
+ assertFalse(filter.apply(nodeProxy(F.asMap("attr1", "value1", "attr2", "value2"))));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClusterGroup() throws Exception {
+ Ignite group1 = startGridsMultiThreaded(3);
+
+ attrs = F.asMap("group", "data");
+
+ Ignite group2 = startGridsMultiThreaded(3, 2);
+
+ assertEquals(2, group1.cluster().forPredicate(new AttributeNodeFilter("group", "data")).nodes().size());
+ assertEquals(2, group2.cluster().forPredicate(new AttributeNodeFilter("group", "data")).nodes().size());
+
+ assertEquals(3, group1.cluster().forPredicate(new AttributeNodeFilter("group", null)).nodes().size());
+ assertEquals(3, group2.cluster().forPredicate(new AttributeNodeFilter("group", null)).nodes().size());
+
+ assertEquals(0, group1.cluster().forPredicate(new AttributeNodeFilter("group", "wrong")).nodes().size());
+ assertEquals(0, group2.cluster().forPredicate(new AttributeNodeFilter("group", "wrong")).nodes().size());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheFilter() throws Exception {
+ Ignite group1 = startGridsMultiThreaded(3);
+
+ attrs = F.asMap("group", "data");
+
+ Ignite group2 = startGridsMultiThreaded(3, 2);
+
+ group1.createCache(new CacheConfiguration<>("test-cache").
+ setNodeFilter(new AttributeNodeFilter("group", "data")));
+
+ assertEquals(2, group1.cluster().forDataNodes("test-cache").nodes().size());
+ assertEquals(2, group2.cluster().forDataNodes("test-cache").nodes().size());
+
+ assertEquals(0, group1.cluster().forDataNodes("wrong").nodes().size());
+ assertEquals(0, group2.cluster().forDataNodes("wrong").nodes().size());
+ }
+
+ /**
+ * @param attrs Attributes.
+ * @return Node proxy.
+ */
+ private static ClusterNode nodeProxy(final Map<String, ?> attrs) {
+ return (ClusterNode)Proxy.newProxyInstance(
+ ClusterNode.class.getClassLoader(),
+ new Class[] { ClusterNode.class },
+ new InvocationHandler() {
+ @SuppressWarnings("SuspiciousMethodCalls")
+ @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable {
+ if ("attributes".equals(mtd.getName()))
+ return attrs;
+
+ throw new UnsupportedOperationException();
+ }
+ });
+ }
+}
[31/37] ignite git commit: Fixed JavaDoc for
RoundRobinLoadBalancingSpi
Posted by vo...@apache.org.
Fixed JavaDoc for RoundRobinLoadBalancingSpi
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/228d97ba
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/228d97ba
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/228d97ba
Branch: refs/heads/ignite-2.0
Commit: 228d97bab116a513ed03f4f7f48ddeb1ef5b6577
Parents: f4a1e6c
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Dec 29 12:21:34 2016 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Dec 29 12:21:34 2016 -0800
----------------------------------------------------------------------
.../roundrobin/RoundRobinLoadBalancingSpi.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/228d97ba/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
index 069641b..b0e2c78 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
@@ -51,15 +51,13 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
/**
* This SPI iterates through nodes in round-robin fashion and pick the next
* sequential node. Two modes of operation are supported: per-task and global
- * (see {@link #setPerTask(boolean)} configuration).
+ * (see {@link #setPerTask(boolean)} configuration). Global mode is used be default.
* <p>
- * When configured in per-task mode, implementation will pick a random starting
- * node at the beginning of every task execution and then sequentially iterate through all
- * nodes in topology starting from the picked node. This is the default configuration
- * and should fit most of the use cases as it provides a fairly well-distributed
- * split and also ensures that jobs within a single task are spread out across
- * nodes to the maximum. For cases when split size is equal to the number of nodes,
- * this mode guarantees that all nodes will participate in the split.
+ * When configured in per-task mode, implementation will pick a random node at the
+ * beginning of every task execution and then sequentially iterate through all
+ * nodes in topology starting from the picked node. For cases when split size
+ * is equal to the number of nodes, this mode guarantees that all nodes will
+ * participate in the split.
* <p>
* When configured in global mode, a single sequential queue of nodes is maintained for
* all tasks and the next node in the queue is picked every time. In this mode (unlike in
@@ -336,4 +334,4 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load
@Override public String toString() {
return S.toString(RoundRobinLoadBalancingSpi.class, this);
}
-}
\ No newline at end of file
+}
[18/37] ignite git commit: Updated classnames for ignite-1.7.5.
Posted by vo...@apache.org.
Updated classnames for ignite-1.7.5.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fb819102
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fb819102
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fb819102
Branch: refs/heads/ignite-2.0
Commit: fb8191028eb19b0683b8239b7024f7fa6ccabd4e
Parents: b252b44
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Dec 23 18:40:51 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Dec 23 18:40:51 2016 +0700
----------------------------------------------------------------------
.../resources/META-INF/classnames.properties | 60 +++++---------------
1 file changed, 15 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb819102/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 4d0b931..8a6dc66 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -294,17 +294,12 @@ org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
org.apache.ignite.internal.jdbc2.JdbcQueryTask$QueryResult
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$1
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$QueryResult
-org.apache.ignite.internal.jdbc2.JdbcSqlFieldsQuery
org.apache.ignite.internal.managers.GridManagerAdapter$1$1
org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0
org.apache.ignite.internal.managers.communication.GridIoMessage
org.apache.ignite.internal.managers.communication.GridIoUserMessage
-org.apache.ignite.internal.managers.communication.IgniteIoTestMessage
org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean
org.apache.ignite.internal.managers.deployment.GridDeploymentPerVersionStore$2
org.apache.ignite.internal.managers.deployment.GridDeploymentRequest
@@ -392,20 +387,20 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$3
org.apache.ignite.internal.processors.cache.GridCacheAdapter$30
org.apache.ignite.internal.processors.cache.GridCacheAdapter$32
org.apache.ignite.internal.processors.cache.GridCacheAdapter$4
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$48
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$49
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$50
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$51
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$52
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$53
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$54
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$55
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$57
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$58
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$58$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$59
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
org.apache.ignite.internal.processors.cache.GridCacheAdapter$60
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$61
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$62
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$63
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$64
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$65
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$66
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$67
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$69
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$70
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$70$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$71
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$72
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
@@ -724,11 +719,9 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtFor
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
@@ -1118,12 +1111,6 @@ org.apache.ignite.internal.processors.hadoop.HadoopJobStatus
org.apache.ignite.internal.processors.hadoop.HadoopMapReducePlan
org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo
org.apache.ignite.internal.processors.hadoop.HadoopTaskType
-org.apache.ignite.internal.processors.hadoop.message.HadoopMessage
-org.apache.ignite.internal.processors.hadoop.shuffle.HadoopDirectShuffleMessage
-org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleAck
-org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishRequest
-org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleFinishResponse
-org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffleMessage
org.apache.ignite.internal.processors.igfs.IgfsAckMessage
org.apache.ignite.internal.processors.igfs.IgfsAttributes
org.apache.ignite.internal.processors.igfs.IgfsBlockKey
@@ -1221,7 +1208,6 @@ org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException
org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity$1
org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction
-org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpiryPolicyFactory
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl
@@ -1258,9 +1244,6 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
-org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkCacheExtension$CleanupCompletionListener
-org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkCacheExtension$RemoveOldEntriesRunnable
-org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkIncreaseVersionProcessor
org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl
org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl
@@ -1283,7 +1266,6 @@ org.apache.ignite.internal.processors.query.GridQueryProcessor$6
org.apache.ignite.internal.processors.query.GridQueryProcessor$7
org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
-org.apache.ignite.internal.processors.query.IgniteSQLException
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
@@ -1349,9 +1331,6 @@ org.apache.ignite.internal.processors.rest.handlers.datastructures.DataStructure
org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryFieldsMetaResult
org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryResult
org.apache.ignite.internal.processors.rest.handlers.query.QueryCommandHandler$QueryCursorIterator
-org.apache.ignite.internal.processors.rest.handlers.redis.GridRedisRestCommandHandler$1
-org.apache.ignite.internal.processors.rest.handlers.redis.exception.GridRedisGenericException
-org.apache.ignite.internal.processors.rest.handlers.redis.exception.GridRedisTypeException
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$2
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$ExeCallable
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest
@@ -1363,9 +1342,6 @@ org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioList
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$2
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1$1
-org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisCommand
-org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisMessage
-org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisNioListener$1
org.apache.ignite.internal.processors.rest.request.RestQueryRequest$QueryType
org.apache.ignite.internal.processors.service.GridServiceAssignments
org.apache.ignite.internal.processors.service.GridServiceAssignmentsKey
@@ -1610,13 +1586,10 @@ org.apache.ignite.internal.util.lang.IgniteReducer2X
org.apache.ignite.internal.util.lang.IgniteReducer3
org.apache.ignite.internal.util.lang.IgniteReducer3X
org.apache.ignite.internal.util.lang.IgniteReducerX
-org.apache.ignite.internal.util.lang.IgniteSingletonIterator
org.apache.ignite.internal.util.nio.GridNioEmbeddedFuture$1
org.apache.ignite.internal.util.nio.GridNioException
org.apache.ignite.internal.util.nio.GridNioMessageTracker
org.apache.ignite.internal.util.nio.GridNioServer$NioOperation
-org.apache.ignite.internal.util.nio.GridNioServer$RandomBalancer
-org.apache.ignite.internal.util.nio.GridNioServer$SizeBasedBalancer
org.apache.ignite.internal.util.nio.GridNioSessionMetaKey
org.apache.ignite.internal.util.nio.ssl.GridNioSslHandler
org.apache.ignite.internal.util.offheap.GridOffHeapEvent
@@ -1891,15 +1864,12 @@ org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointData
org.apache.ignite.spi.collision.jobstealing.JobStealingRequest
org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi$PriorityGridCollisionJobContextComparator
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$1
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$10
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$11
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure$1
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew$1
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$8
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$9
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeClosure
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeMessage
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeMessage2
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeTimeoutException
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$NodeIdMessage
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$RecoveryLastReceivedMessage
[02/37] ignite git commit: IGNITE-4248: Fixed: Some loggers ignore
IGNITE_QUIET system property. This closes #1367.
Posted by vo...@apache.org.
IGNITE-4248: Fixed: Some loggers ignore IGNITE_QUIET system property. This closes #1367.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c103ac33
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c103ac33
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c103ac33
Branch: refs/heads/ignite-2.0
Commit: c103ac33d590492577bb687b29969550cdb532cf
Parents: 83d961c
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Dec 21 16:53:18 2016 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Wed Dec 21 16:53:18 2016 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/IgniteLogger.java | 4 ++--
.../processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java | 9 ++++++++-
.../java/org/apache/ignite/logger/jcl/JclLogger.java | 9 ++++++++-
.../java/org/apache/ignite/logger/slf4j/Slf4jLogger.java | 11 +++++++++--
4 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c103ac33/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java b/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
index f3afa99..8d814fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteLogger.java
@@ -146,9 +146,9 @@ public interface IgniteLogger {
public boolean isInfoEnabled();
/**
- * Tests whether {@code info} and {@code debug} levels are turned off.
+ * Tests whether Logger is in "Quiet mode".
*
- * @return Whether {@code info} and {@code debug} levels are turned off.
+ * @return {@code true} "Quiet mode" is enabled, {@code false} otherwise
*/
public boolean isQuiet();
http://git-wip-us.apache.org/repos/asf/ignite/blob/c103ac33/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java
index 0ae8a9f..6475204 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsJclLogger.java
@@ -24,6 +24,8 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
+
/**
* JCL logger wrapper for Hadoop.
*/
@@ -32,6 +34,9 @@ public class HadoopIgfsJclLogger implements IgniteLogger {
@GridToStringInclude
private Log impl;
+ /** Quiet flag. */
+ private final boolean quiet;
+
/**
* Constructor.
*
@@ -41,6 +46,8 @@ public class HadoopIgfsJclLogger implements IgniteLogger {
assert impl != null;
this.impl = impl;
+
+ quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
}
/** {@inheritDoc} */
@@ -81,7 +88,7 @@ public class HadoopIgfsJclLogger implements IgniteLogger {
/** {@inheritDoc} */
@Override public boolean isQuiet() {
- return !isInfoEnabled() && !isDebugEnabled();
+ return quiet;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c103ac33/modules/jcl/src/main/java/org/apache/ignite/logger/jcl/JclLogger.java
----------------------------------------------------------------------
diff --git a/modules/jcl/src/main/java/org/apache/ignite/logger/jcl/JclLogger.java b/modules/jcl/src/main/java/org/apache/ignite/logger/jcl/JclLogger.java
index a13caa1..c75197a 100644
--- a/modules/jcl/src/main/java/org/apache/ignite/logger/jcl/JclLogger.java
+++ b/modules/jcl/src/main/java/org/apache/ignite/logger/jcl/JclLogger.java
@@ -22,6 +22,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.ignite.IgniteLogger;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
+
/**
* This logger wraps any JCL (<a target=_blank href="http://jakarta.apache.org/commons/logging/">Jakarta Commons Logging</a>)
* loggers. Implementation simply delegates to underlying JCL logger. This logger
@@ -77,6 +79,9 @@ public class JclLogger implements IgniteLogger {
/** JCL implementation proxy. */
private Log impl;
+ /** Quiet flag. */
+ private final boolean quiet;
+
/**
* Creates new logger.
*/
@@ -93,6 +98,8 @@ public class JclLogger implements IgniteLogger {
assert impl != null;
this.impl = impl;
+
+ quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
}
/** {@inheritDoc} */
@@ -133,7 +140,7 @@ public class JclLogger implements IgniteLogger {
/** {@inheritDoc} */
@Override public boolean isQuiet() {
- return !isInfoEnabled() && !isDebugEnabled();
+ return quiet;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c103ac33/modules/slf4j/src/main/java/org/apache/ignite/logger/slf4j/Slf4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/slf4j/src/main/java/org/apache/ignite/logger/slf4j/Slf4jLogger.java b/modules/slf4j/src/main/java/org/apache/ignite/logger/slf4j/Slf4jLogger.java
index 51e5669..2b0e980 100644
--- a/modules/slf4j/src/main/java/org/apache/ignite/logger/slf4j/Slf4jLogger.java
+++ b/modules/slf4j/src/main/java/org/apache/ignite/logger/slf4j/Slf4jLogger.java
@@ -22,6 +22,8 @@ import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_QUIET;
+
/**
* SLF4J-based implementation for logging. This logger should be used
* by loaders that have prefer slf4j-based logging.
@@ -41,11 +43,14 @@ public class Slf4jLogger implements IgniteLogger {
/** SLF4J implementation proxy. */
private final Logger impl;
+ /** Quiet flag. */
+ private final boolean quiet;
+
/**
* Creates new logger.
*/
public Slf4jLogger() {
- impl = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+ this(LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME));
}
/**
@@ -57,6 +62,8 @@ public class Slf4jLogger implements IgniteLogger {
assert impl != null;
this.impl = impl;
+
+ quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
}
/** {@inheritDoc} */
@@ -129,7 +136,7 @@ public class Slf4jLogger implements IgniteLogger {
/** {@inheritDoc} */
@Override public boolean isQuiet() {
- return !isInfoEnabled() && !isDebugEnabled();
+ return quiet;
}
/** {@inheritDoc} */
[10/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/generator-java.js b/modules/web-console/frontend/app/modules/configuration/generator/generator-java.js
deleted file mode 100644
index 296b942..0000000
--- a/modules/web-console/frontend/app/modules/configuration/generator/generator-java.js
+++ /dev/null
@@ -1,3617 +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.
- */
-
-// Java generation entry point.
-const $generatorJava = {};
-
-/**
- * Translate some value to valid java code.
- *
- * @param val Value to convert.
- * @param type Value type.
- * @returns {*} String with value that will be valid for java.
- */
-$generatorJava.toJavaCode = function(val, type) {
- if (val === null)
- return 'null';
-
- if (type === 'raw')
- return val;
-
- if (type === 'class')
- return val + '.class';
-
- if (type === 'float')
- return val + 'f';
-
- if (type === 'path')
- return '"' + val.replace(/\\/g, '\\\\') + '"';
-
- if (type)
- return type + '.' + val;
-
- if (typeof (val) === 'string')
- return '"' + val.replace('"', '\\"') + '"';
-
- if (typeof (val) === 'number' || typeof (val) === 'boolean')
- return String(val);
-
- return 'Unknown type: ' + typeof (val) + ' (' + val + ')';
-};
-
-/**
- * @param propName Property name.
- * @param setterName Optional concrete setter name.
- * @returns Property setter with name by java conventions.
- */
-$generatorJava.setterName = function(propName, setterName) {
- return setterName ? setterName : $generatorCommon.toJavaName('set', propName);
-};
-
-// Add constructor argument
-$generatorJava.constructorArg = function(obj, propName, dflt, notFirst, opt) {
- const v = (obj ? obj[propName] : null) || dflt;
-
- if ($generatorCommon.isDefinedAndNotEmpty(v))
- return (notFirst ? ', ' : '') + $generatorJava.toJavaCode(v);
- else if (!opt)
- return notFirst ? ', null' : 'null';
-
- return '';
-};
-
-/**
- * Add variable declaration.
- *
- * @param res Resulting output with generated code.
- * @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.
- * @param subClass If 'true' then variable will be declared as anonymous subclass.
- */
-$generatorJava.declareVariable = function(res, varName, varFullType, varFullActualType, varFullGenericType1, varFullGenericType2, subClass) {
- res.emptyLineIfNeeded();
-
- const varType = res.importClass(varFullType);
-
- const varNew = !res.vars[varName];
-
- if (varNew)
- res.vars[varName] = true;
-
- if (varFullActualType && varFullGenericType1) {
- const varActualType = res.importClass(varFullActualType);
- const varGenericType1 = res.importClass(varFullGenericType1);
- let varGenericType2 = null;
-
- if (varFullGenericType2)
- varGenericType2 = res.importClass(varFullGenericType2);
-
- res.line((varNew ? (varType + '<' + varGenericType1 + (varGenericType2 ? ', ' + varGenericType2 : '') + '> ') : '') +
- varName + ' = new ' + varActualType + '<>();');
- }
- else
- res.line((varNew ? (varType + ' ') : '') + varName + ' = new ' + varType + '()' + (subClass ? ' {' : ';'));
-
- if (!subClass)
- res.needEmptyLine = true;
-
- return varName;
-};
-
-/**
- * Add local variable declaration.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param varFullType Variable full class name to be added to imports.
- */
-$generatorJava.declareVariableLocal = function(res, varName, varFullType) {
- const varType = res.importClass(varFullType);
-
- res.line(varType + ' ' + varName + ' = new ' + varType + '();');
-
- res.needEmptyLine = true;
-};
-
-/**
- * Add custom variable declaration.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param varFullType Variable full class name to be added to imports.
- * @param varExpr Custom variable creation expression.
- * @param modifier Additional variable modifier.
- */
-$generatorJava.declareVariableCustom = function(res, varName, varFullType, varExpr, modifier) {
- const varType = res.importClass(varFullType);
-
- const varNew = !res.vars[varName];
-
- if (varNew)
- res.vars[varName] = true;
-
- res.line((varNew ? ((modifier ? modifier + ' ' : '') + varType + ' ') : '') + varName + ' = ' + varExpr + ';');
-
- res.needEmptyLine = true;
-};
-
-/**
- * Add array variable declaration.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param varFullType Variable full class name to be added to imports.
- * @param length Array length.
- */
-$generatorJava.declareVariableArray = function(res, varName, varFullType, length) {
- const varType = res.importClass(varFullType);
-
- const varNew = !res.vars[varName];
-
- if (varNew)
- res.vars[varName] = true;
-
- res.line((varNew ? (varType + '[] ') : '') + varName + ' = new ' + varType + '[' + length + '];');
-
- res.needEmptyLine = true;
-};
-
-/**
- * Clear list of declared variables.
- *
- * @param res
- */
-$generatorJava.resetVariables = function(res) {
- res.vars = {};
-};
-
-/**
- * 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 dataType Optional info about property data type.
- * @param setterName Optional special setter name.
- * @param dflt Optional default value.
- */
-$generatorJava.property = function(res, varName, obj, propName, dataType, setterName, dflt) {
- if (!_.isNil(obj)) {
- const val = obj[propName];
-
- if ($generatorCommon.isDefinedAndNotEmpty(val)) {
- const missDflt = _.isNil(dflt);
-
- // Add to result if no default provided or value not equals to default.
- if (missDflt || (!missDflt && val !== dflt)) {
- res.line(varName + '.' + $generatorJava.setterName(propName, setterName) +
- '(' + $generatorJava.toJavaCode(val, dataType) + ');');
-
- return true;
- }
- }
- }
-
- return false;
-};
-
-/**
- * Add enum 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 dataType Name of enum class
- * @param setterName Optional special setter name.
- * @param dflt Optional default value.
- */
-$generatorJava.enumProperty = function(res, varName, obj, propName, dataType, setterName, dflt) {
- const val = obj[propName];
-
- if ($generatorCommon.isDefinedAndNotEmpty(val)) {
- const missDflt = _.isNil(dflt);
-
- // Add to result if no default provided or value not equals to default.
- if (missDflt || (!missDflt && val !== dflt)) {
- res.line(varName + '.' + $generatorJava.setterName(propName, setterName) +
- '(' + $generatorJava.toJavaCode(val, dataType ? res.importClass(dataType) : null) + ');');
-
- return true;
- }
- }
-
- return false;
-};
-
-// Add property for class name.
-$generatorJava.classNameProperty = function(res, varName, obj, propName) {
- const val = obj[propName];
-
- if (!_.isNil(val)) {
- res.line(varName + '.' + $generatorJava.setterName(propName) +
- '("' + $generatorCommon.JavaTypes.fullClassName(val) + '");');
- }
-};
-
-/**
- * Add list property.
- *
- * @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 dataType Optional data type.
- * @param setterName Optional setter name.
- */
-$generatorJava.listProperty = function(res, varName, obj, propName, dataType, setterName) {
- const val = obj[propName];
-
- if (val && val.length > 0) {
- res.emptyLineIfNeeded();
-
- res.importClass('java.util.Arrays');
-
- $generatorJava.fxVarArgs(res, varName + '.' + $generatorJava.setterName(propName, setterName), false,
- _.map(val, (v) => $generatorJava.toJavaCode(v, dataType)), '(Arrays.asList(', '))');
-
- res.needEmptyLine = true;
- }
-};
-
-/**
- * Add function with varargs arguments.
- *
- * @param res Resulting output with generated code.
- * @param fx Function name.
- * @param quote Whether to quote arguments.
- * @param args Array with arguments.
- * @param startBlock Optional start block string.
- * @param endBlock Optional end block string.
- * @param startQuote Start quote string.
- * @param endQuote End quote string.
- */
-$generatorJava.fxVarArgs = function(res, fx, quote, args, startBlock = '(', endBlock = ')', startQuote = '"', endQuote = '"') {
- const quoteArg = (arg) => quote ? startQuote + arg + endQuote : arg;
-
- if (args.length === 1)
- res.append(fx + startBlock + quoteArg(args[0]) + endBlock + ';');
- else {
- res.startBlock(fx + startBlock);
-
- const len = args.length - 1;
-
- _.forEach(args, (arg, ix) => res.line(quoteArg(arg) + (ix < len ? ', ' : '')));
-
- res.endBlock(endBlock + ';');
- }
-};
-
-/**
- * Add array property.
- *
- * @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 setterName Optional setter name.
- */
-$generatorJava.arrayProperty = function(res, varName, obj, propName, setterName) {
- const val = obj[propName];
-
- if (val && val.length > 0) {
- res.emptyLineIfNeeded();
-
- $generatorJava.fxVarArgs(res, varName + '.' + $generatorJava.setterName(propName, setterName), false,
- _.map(val, (v) => 'new ' + res.importClass(v) + '()'), '({ ', ' });');
-
- res.needEmptyLine = true;
- }
-};
-
-/**
- * Add multi-param property (setter with several arguments).
- *
- * @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 dataType Optional data type.
- * @param setterName Optional setter name.
- */
-$generatorJava.multiparamProperty = function(res, varName, obj, propName, dataType, setterName) {
- const val = obj[propName];
-
- if (val && val.length > 0) {
- $generatorJava.fxVarArgs(res, varName + '.' + $generatorJava.setterName(propName, setterName), false,
- _.map(val, (v) => $generatorJava.toJavaCode(dataType === 'class' ? res.importClass(v) : v, dataType)));
- }
-};
-
-/**
- * Add complex bean.
- *
- * @param res Resulting output with generated code.
- * @param varName Variable name.
- * @param bean
- * @param beanPropName Bean property name.
- * @param beanVarName
- * @param beanClass Bean class.
- * @param props
- * @param createBeanAlthoughNoProps If 'true' then create empty bean.
- */
-$generatorJava.beanProperty = function(res, varName, bean, beanPropName, beanVarName, beanClass, props, createBeanAlthoughNoProps) {
- if (bean && $generatorCommon.hasProperty(bean, props)) {
- res.emptyLineIfNeeded();
-
- $generatorJava.declareVariable(res, beanVarName, beanClass);
-
- _.forIn(props, function(descr, propName) {
- if (props.hasOwnProperty(propName)) {
- if (descr) {
- switch (descr.type) {
- case 'list':
- $generatorJava.listProperty(res, beanVarName, bean, propName, descr.elementsType, descr.setterName);
- break;
-
- case 'array':
- $generatorJava.arrayProperty(res, beanVarName, bean, propName, descr.setterName);
- break;
-
- case 'enum':
- $generatorJava.enumProperty(res, beanVarName, bean, propName, descr.enumClass, descr.setterName, descr.dflt);
- break;
-
- case 'float':
- $generatorJava.property(res, beanVarName, bean, propName, 'float', descr.setterName);
- break;
-
- case 'path':
- $generatorJava.property(res, beanVarName, bean, propName, 'path', descr.setterName);
- break;
-
- case 'raw':
- $generatorJava.property(res, beanVarName, bean, propName, 'raw', descr.setterName);
- break;
-
- case 'propertiesAsList':
- const val = bean[propName];
-
- if (val && val.length > 0) {
- $generatorJava.declareVariable(res, descr.propVarName, 'java.util.Properties');
-
- _.forEach(val, function(nameAndValue) {
- const eqIndex = nameAndValue.indexOf('=');
-
- if (eqIndex >= 0) {
- 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;
-
- case 'bean':
- if ($generatorCommon.isDefinedAndNotEmpty(bean[propName]))
- res.line(beanVarName + '.' + $generatorJava.setterName(propName) + '(new ' + res.importClass(bean[propName]) + '());');
-
- break;
-
- default:
- $generatorJava.property(res, beanVarName, bean, propName, null, descr.setterName, descr.dflt);
- }
- }
- else
- $generatorJava.property(res, beanVarName, bean, propName);
- }
- });
-
- res.needEmptyLine = true;
-
- res.line(varName + '.' + $generatorJava.setterName(beanPropName) + '(' + beanVarName + ');');
-
- res.needEmptyLine = true;
- }
- else if (createBeanAlthoughNoProps) {
- res.emptyLineIfNeeded();
- res.line(varName + '.' + $generatorJava.setterName(beanPropName) + '(new ' + res.importClass(beanClass) + '());');
-
- res.needEmptyLine = true;
- }
-};
-
-/**
- * Add eviction policy.
- *
- * @param res Resulting output with generated code.
- * @param varName Current using variable name.
- * @param evtPlc Data to add.
- * @param propName Name in source data.
- */
-$generatorJava.evictionPolicy = function(res, varName, evtPlc, propName) {
- if (evtPlc && evtPlc.kind) {
- const evictionPolicyDesc = $generatorCommon.EVICTION_POLICIES[evtPlc.kind];
-
- const obj = evtPlc[evtPlc.kind.toUpperCase()];
-
- $generatorJava.beanProperty(res, varName, obj, propName, propName,
- evictionPolicyDesc.className, evictionPolicyDesc.fields, true);
- }
-};
-
-// Generate cluster general group.
-$generatorJava.clusterGeneral = function(cluster, clientNearCfg, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.declareVariable(res, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
-
- $generatorJava.property(res, 'cfg', cluster, 'name', null, 'setGridName');
- res.needEmptyLine = true;
-
- $generatorJava.property(res, 'cfg', cluster, 'localHost');
- res.needEmptyLine = true;
-
- if (clientNearCfg) {
- res.line('cfg.setClientMode(true);');
-
- res.needEmptyLine = true;
- }
-
- if (cluster.discovery) {
- const d = cluster.discovery;
-
- $generatorJava.declareVariable(res, 'discovery', 'org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi');
-
- switch (d.kind) {
- case 'Multicast':
- $generatorJava.beanProperty(res, 'discovery', d.Multicast, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder',
- {
- multicastGroup: null,
- multicastPort: null,
- responseWaitTime: null,
- addressRequestAttempts: null,
- localAddress: null,
- addresses: {type: 'list'}
- }, true);
-
- break;
-
- case 'Vm':
- $generatorJava.beanProperty(res, 'discovery', d.Vm, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder',
- {addresses: {type: 'list'}}, true);
-
- break;
-
- case 'S3':
- $generatorJava.beanProperty(res, 'discovery', d.S3, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder', {bucketName: null}, true);
-
- break;
-
- case 'Cloud':
- $generatorJava.beanProperty(res, 'discovery', d.Cloud, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder',
- {
- credential: null,
- credentialPath: null,
- identity: null,
- provider: null,
- regions: {type: 'list'},
- zones: {type: 'list'}
- }, true);
-
- break;
-
- case 'GoogleStorage':
- $generatorJava.beanProperty(res, 'discovery', d.GoogleStorage, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder',
- {
- projectName: null,
- bucketName: null,
- serviceAccountP12FilePath: null,
- serviceAccountId: null
- }, true);
-
- break;
-
- case 'Jdbc':
- $generatorJava.declareVariable(res, 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder');
- $generatorJava.property(res, 'ipFinder', d.Jdbc, 'initSchema');
-
- const datasource = d.Jdbc;
- if (datasource.dataSourceBean && datasource.dialect) {
- res.needEmptyLine = !datasource.initSchema;
-
- res.line('ipFinder.setDataSource(DataSources.INSTANCE_' + datasource.dataSourceBean + ');');
- }
-
- res.needEmptyLine = true;
-
- res.line('discovery.setIpFinder(ipFinder);');
-
- break;
-
- case 'SharedFs':
- $generatorJava.beanProperty(res, 'discovery', d.SharedFs, 'ipFinder', 'ipFinder',
- 'org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder', {path: null}, true);
-
- break;
-
- case 'ZooKeeper':
- const finderVar = 'ipFinder';
-
- $generatorJava.declareVariable(res, 'ipFinder', 'org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder');
-
- if (d.ZooKeeper) {
- if ($generatorCommon.isDefinedAndNotEmpty(d.ZooKeeper.curator))
- res.line(finderVar + '.setCurator(new ' + res.importClass(d.ZooKeeper.curator) + '());');
-
- $generatorJava.property(res, finderVar, d.ZooKeeper, 'zkConnectionString');
-
- if (d.ZooKeeper.retryPolicy && d.ZooKeeper.retryPolicy.kind) {
- const kind = d.ZooKeeper.retryPolicy.kind;
- const retryPolicy = d.ZooKeeper.retryPolicy[kind];
-
- switch (kind) {
- case 'ExponentialBackoff':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.ExponentialBackoffRetry') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'baseSleepTimeMs', 1000) +
- $generatorJava.constructorArg(retryPolicy, 'maxRetries', 10, true) +
- $generatorJava.constructorArg(retryPolicy, 'maxSleepMs', null, true, true) + '));');
-
- break;
-
- case 'BoundedExponentialBackoff':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.BoundedExponentialBackoffRetry') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'baseSleepTimeMs', 1000) +
- $generatorJava.constructorArg(retryPolicy, 'maxSleepTimeMs', 2147483647, true) +
- $generatorJava.constructorArg(retryPolicy, 'maxRetries', 10, true) + '));');
-
- break;
-
- case 'UntilElapsed':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.RetryUntilElapsed') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'maxElapsedTimeMs', 60000) +
- $generatorJava.constructorArg(retryPolicy, 'sleepMsBetweenRetries', 1000, true) + '));');
-
- break;
-
- case 'NTimes':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.RetryNTimes') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'n', 10) +
- $generatorJava.constructorArg(retryPolicy, 'sleepMsBetweenRetries', 1000, true) + '));');
-
- break;
-
- case 'OneTime':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.RetryOneTime') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'sleepMsBetweenRetry', 1000) + '));');
-
- break;
-
- case 'Forever':
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass('org.apache.curator.retry.RetryForever') + '(' +
- $generatorJava.constructorArg(retryPolicy, 'retryIntervalMs', 1000) + '));');
-
- break;
-
- case 'Custom':
- if (retryPolicy && $generatorCommon.isDefinedAndNotEmpty(retryPolicy.className))
- res.line(finderVar + '.setRetryPolicy(new ' + res.importClass(retryPolicy.className) + '());');
-
- break;
-
- default:
- }
- }
-
- $generatorJava.property(res, finderVar, d.ZooKeeper, 'basePath', null, null, '/services');
- $generatorJava.property(res, finderVar, d.ZooKeeper, 'serviceName', null, null, 'ignite');
- $generatorJava.property(res, finderVar, d.ZooKeeper, 'allowDuplicateRegistrations', null, null, false);
- }
-
- res.line('discovery.setIpFinder(ipFinder);');
-
- break;
-
- default:
- res.line('Unknown discovery kind: ' + d.kind);
- }
-
- res.needEmptyLine = false;
-
- $generatorJava.clusterDiscovery(d, res);
-
- res.emptyLineIfNeeded();
-
- res.line('cfg.setDiscoverySpi(discovery);');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate atomics group.
-$generatorJava.clusterAtomics = function(atomics, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.hasAtLeastOneProperty(atomics, ['cacheMode', 'atomicSequenceReserveSize', 'backups'])) {
- res.startSafeBlock();
-
- $generatorJava.declareVariable(res, 'atomicCfg', 'org.apache.ignite.configuration.AtomicConfiguration');
-
- $generatorJava.enumProperty(res, 'atomicCfg', atomics, 'cacheMode', 'org.apache.ignite.cache.CacheMode', null, 'PARTITIONED');
-
- const cacheMode = atomics.cacheMode ? atomics.cacheMode : 'PARTITIONED';
-
- let hasData = cacheMode !== 'PARTITIONED';
-
- hasData = $generatorJava.property(res, 'atomicCfg', atomics, 'atomicSequenceReserveSize', null, null, 1000) || hasData;
-
- if (cacheMode === 'PARTITIONED')
- hasData = $generatorJava.property(res, 'atomicCfg', atomics, 'backups', null, null, 0) || hasData;
-
- res.needEmptyLine = true;
-
- res.line('cfg.setAtomicConfiguration(atomicCfg);');
-
- res.needEmptyLine = true;
-
- if (!hasData)
- res.rollbackSafeBlock();
- }
-
- return res;
-};
-
-// Generate binary group.
-$generatorJava.clusterBinary = function(binary, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.binaryIsDefined(binary)) {
- const varName = 'binary';
-
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.configuration.BinaryConfiguration');
-
- if ($generatorCommon.isDefinedAndNotEmpty(binary.idMapper))
- res.line(varName + '.setIdMapper(new ' + res.importClass(binary.idMapper) + '());');
-
- if ($generatorCommon.isDefinedAndNotEmpty(binary.nameMapper))
- res.line(varName + '.setNameMapper(new ' + res.importClass(binary.nameMapper) + '());');
-
- if ($generatorCommon.isDefinedAndNotEmpty(binary.serializer))
- res.line(varName + '.setSerializer(new ' + res.importClass(binary.serializer) + '());');
-
- res.needEmptyLine = $generatorCommon.isDefinedAndNotEmpty(binary.idMapper) || $generatorCommon.isDefinedAndNotEmpty(binary.serializer);
-
- if ($generatorCommon.isDefinedAndNotEmpty(binary.typeConfigurations)) {
- const arrVar = 'types';
-
- $generatorJava.declareVariable(res, arrVar, 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.binary.BinaryTypeConfiguration');
-
- _.forEach(binary.typeConfigurations, function(type) {
- if ($generatorCommon.isDefinedAndNotEmpty(type.typeName))
- res.line(arrVar + '.add(' + $generatorJava.binaryTypeFunctionName(type.typeName) + '());'); // TODO IGNITE-2269 Replace using of separated methods for binary type configurations to extended constructors.
- });
-
- res.needEmptyLine = true;
-
- res.line(varName + '.setTypeConfigurations(' + arrVar + ');');
-
- res.needEmptyLine = true;
- }
-
- $generatorJava.property(res, varName, binary, 'compactFooter', null, null, true);
-
- res.needEmptyLine = true;
-
- res.line('cfg.setBinaryConfiguration(' + varName + ');');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cache key configurations.
-$generatorJava.clusterCacheKeyConfiguration = function(keyCfgs, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- keyCfgs = _.filter(keyCfgs, (cfg) => cfg.typeName && cfg.affinityKeyFieldName);
-
- if (_.isEmpty(keyCfgs))
- return res;
-
- $generatorJava.declareVariableArray(res, 'keyConfigurations', 'org.apache.ignite.cache.CacheKeyConfiguration', keyCfgs.length);
-
- const cacheKeyCfg = res.importClass('org.apache.ignite.cache.CacheKeyConfiguration');
-
- _.forEach(keyCfgs, (cfg, idx) => {
- res.needEmptyLine = true;
-
- res.line(`keyConfigurations[${idx}] = new ${cacheKeyCfg}("${cfg.typeName}", "${cfg.affinityKeyFieldName}");`);
-
- res.needEmptyLine = true;
- });
-
- res.line('cfg.setCacheKeyConfiguration(keyConfigurations);');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// TODO IGNITE-2269 Remove specified methods after implamentation of extended constructors.
-// Construct binary type configuration factory method name.
-$generatorJava.binaryTypeFunctionName = function(typeName) {
- const dotIdx = typeName.lastIndexOf('.');
-
- const shortName = dotIdx > 0 ? typeName.substr(dotIdx + 1) : typeName;
-
- return $generatorCommon.toJavaName('binaryType', shortName);
-};
-
-// TODO IGNITE-2269 Remove specified methods after implamentation of extended constructors.
-// Generate factory method for specified BinaryTypeConfiguration.
-$generatorJava.binaryTypeConfiguration = function(type, res) {
- const typeName = type.typeName;
-
- res.line('/**');
- res.line(' * Create binary type configuration for ' + typeName + '.');
- res.line(' *');
- res.line(' * @return Configured binary type.');
- res.line(' */');
- res.startBlock('private static BinaryTypeConfiguration ' + $generatorJava.binaryTypeFunctionName(typeName) + '() {');
-
- $generatorJava.resetVariables(res);
-
- const typeVar = 'typeCfg';
-
- $generatorJava.declareVariable(res, typeVar, 'org.apache.ignite.binary.BinaryTypeConfiguration');
-
- $generatorJava.property(res, typeVar, type, 'typeName');
-
- if ($generatorCommon.isDefinedAndNotEmpty(type.idMapper))
- res.line(typeVar + '.setIdMapper(new ' + res.importClass(type.idMapper) + '());');
-
- if ($generatorCommon.isDefinedAndNotEmpty(type.nameMapper))
- res.line(typeVar + '.setNameMapper(new ' + res.importClass(type.nameMapper) + '());');
-
- if ($generatorCommon.isDefinedAndNotEmpty(type.serializer))
- res.line(typeVar + '.setSerializer(new ' + res.importClass(type.serializer) + '());');
-
- $generatorJava.property(res, typeVar, type, 'enum', null, null, false);
-
- res.needEmptyLine = true;
-
- res.line('return ' + typeVar + ';');
- res.endBlock('}');
-
- res.needEmptyLine = true;
-};
-
-// TODO IGNITE-2269 Remove specified methods after implamentation of extended constructors.
-// Generates binary type configuration factory methods.
-$generatorJava.binaryTypeConfigurations = function(binary, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!_.isNil(binary)) {
- _.forEach(binary.typeConfigurations, function(type) {
- $generatorJava.binaryTypeConfiguration(type, res);
- });
- }
-
- return res;
-};
-
-// Generate collision group.
-$generatorJava.clusterCollision = function(collision, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (collision && collision.kind && collision.kind !== 'Noop') {
- const spi = collision[collision.kind];
-
- if (collision.kind !== 'Custom' || (spi && $generatorCommon.isDefinedAndNotEmpty(spi.class))) {
- const varName = 'collisionSpi';
-
- switch (collision.kind) {
- case 'JobStealing':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi');
-
- $generatorJava.property(res, varName, spi, 'activeJobsThreshold', null, null, 95);
- $generatorJava.property(res, varName, spi, 'waitJobsThreshold', null, null, 0);
- $generatorJava.property(res, varName, spi, 'messageExpireTime', null, null, 1000);
- $generatorJava.property(res, varName, spi, 'maximumStealingAttempts', null, null, 5);
- $generatorJava.property(res, varName, spi, 'stealingEnabled', null, null, true);
-
- if ($generatorCommon.isDefinedAndNotEmpty(spi.externalCollisionListener)) {
- res.line(varName + '.' + $generatorJava.setterName('externalCollisionListener') +
- '(new ' + res.importClass(spi.externalCollisionListener) + '());');
- }
-
- if ($generatorCommon.isDefinedAndNotEmpty(spi.stealingAttributes)) {
- const stealingAttrsVar = 'stealingAttrs';
-
- res.needEmptyLine = true;
-
- $generatorJava.declareVariable(res, stealingAttrsVar, 'java.util.Map', 'java.util.HashMap', 'String', 'java.io.Serializable');
-
- _.forEach(spi.stealingAttributes, function(attr) {
- res.line(stealingAttrsVar + '.put("' + attr.name + '", "' + attr.value + '");');
- });
-
- res.needEmptyLine = true;
-
- res.line(varName + '.setStealingAttributes(' + stealingAttrsVar + ');');
- }
-
- break;
-
- case 'FifoQueue':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.spi.collision.fifoqueue.FifoQueueCollisionSpi');
-
- $generatorJava.property(res, varName, spi, 'parallelJobsNumber');
- $generatorJava.property(res, varName, spi, 'waitingJobsNumber');
-
- break;
-
- case 'PriorityQueue':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi');
-
- $generatorJava.property(res, varName, spi, 'parallelJobsNumber');
- $generatorJava.property(res, varName, spi, 'waitingJobsNumber');
- $generatorJava.property(res, varName, spi, 'priorityAttributeKey', null, null, 'grid.task.priority');
- $generatorJava.property(res, varName, spi, 'jobPriorityAttributeKey', null, null, 'grid.job.priority');
- $generatorJava.property(res, varName, spi, 'defaultPriority', null, null, 0);
- $generatorJava.property(res, varName, spi, 'starvationIncrement', null, null, 1);
- $generatorJava.property(res, varName, spi, 'starvationPreventionEnabled', null, null, true);
-
- break;
-
- case 'Custom':
- $generatorJava.declareVariable(res, varName, spi.class);
-
- break;
-
- default:
- }
-
- res.needEmptyLine = true;
-
- res.line('cfg.setCollisionSpi(' + varName + ');');
-
- res.needEmptyLine = true;
- }
- }
-
- return res;
-};
-
-// Generate communication group.
-$generatorJava.clusterCommunication = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const cfg = $generatorCommon.COMMUNICATION_CONFIGURATION;
-
- $generatorJava.beanProperty(res, 'cfg', cluster.communication, 'communicationSpi', 'commSpi', cfg.className, cfg.fields);
-
- res.needEmptyLine = false;
-
- $generatorJava.property(res, 'cfg', cluster, 'networkTimeout', null, null, 5000);
- $generatorJava.property(res, 'cfg', cluster, 'networkSendRetryDelay', null, null, 1000);
- $generatorJava.property(res, 'cfg', cluster, 'networkSendRetryCount', null, null, 3);
- $generatorJava.property(res, 'cfg', cluster, 'segmentCheckFrequency');
- $generatorJava.property(res, 'cfg', cluster, 'waitForSegmentOnStart', null, null, false);
- $generatorJava.property(res, 'cfg', cluster, 'discoveryStartupDelay', null, null, 60000);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate REST access group.
-$generatorJava.clusterConnector = function(connector, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!_.isNil(connector) && connector.enabled) {
- const cfg = _.cloneDeep($generatorCommon.CONNECTOR_CONFIGURATION);
-
- if (connector.sslEnabled) {
- cfg.fields.sslClientAuth = {dflt: false};
- cfg.fields.sslFactory = {type: 'bean'};
- }
-
- $generatorJava.beanProperty(res, 'cfg', connector, 'connectorConfiguration', 'clientCfg',
- cfg.className, cfg.fields, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate deployment group.
-$generatorJava.clusterDeployment = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.enumProperty(res, 'cfg', cluster, 'deploymentMode', 'org.apache.ignite.configuration.DeploymentMode', null, 'SHARED');
-
- res.softEmptyLine();
-
- const p2pEnabled = cluster.peerClassLoadingEnabled;
-
- if (!_.isNil(p2pEnabled)) {
- $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingEnabled', null, null, false);
-
- if (p2pEnabled) {
- $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingMissedResourcesCacheSize', null, null, 100);
- $generatorJava.property(res, 'cfg', cluster, 'peerClassLoadingThreadPoolSize', null, null, 2);
- $generatorJava.multiparamProperty(res, 'cfg', cluster, 'peerClassLoadingLocalClassPathExclude');
- }
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate discovery group.
-$generatorJava.clusterDiscovery = function(disco, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (disco) {
- $generatorJava.property(res, 'discovery', disco, 'localAddress');
- $generatorJava.property(res, 'discovery', disco, 'localPort', null, null, 47500);
- $generatorJava.property(res, 'discovery', disco, 'localPortRange', null, null, 100);
-
- if ($generatorCommon.isDefinedAndNotEmpty(disco.addressResolver)) {
- $generatorJava.beanProperty(res, 'discovery', disco, 'addressResolver', 'addressResolver', disco.addressResolver, {}, true);
- res.needEmptyLine = false;
- }
-
- $generatorJava.property(res, 'discovery', disco, 'socketTimeout', null, null, 5000);
- $generatorJava.property(res, 'discovery', disco, 'ackTimeout', null, null, 5000);
- $generatorJava.property(res, 'discovery', disco, 'maxAckTimeout', null, null, 600000);
- $generatorJava.property(res, 'discovery', disco, 'networkTimeout', null, null, 5000);
- $generatorJava.property(res, 'discovery', disco, 'joinTimeout', null, null, 0);
- $generatorJava.property(res, 'discovery', disco, 'threadPriority', null, null, 10);
- $generatorJava.property(res, 'discovery', disco, 'heartbeatFrequency', null, null, 2000);
- $generatorJava.property(res, 'discovery', disco, 'maxMissedHeartbeats', null, null, 1);
- $generatorJava.property(res, 'discovery', disco, 'maxMissedClientHeartbeats', null, null, 5);
- $generatorJava.property(res, 'discovery', disco, 'topHistorySize', null, null, 1000);
-
- if ($generatorCommon.isDefinedAndNotEmpty(disco.listener)) {
- $generatorJava.beanProperty(res, 'discovery', disco, 'listener', 'listener', disco.listener, {}, true);
- res.needEmptyLine = false;
- }
-
- if ($generatorCommon.isDefinedAndNotEmpty(disco.dataExchange)) {
- $generatorJava.beanProperty(res, 'discovery', disco, 'dataExchange', 'dataExchange', disco.dataExchange, {}, true);
- res.needEmptyLine = false;
- }
-
- if ($generatorCommon.isDefinedAndNotEmpty(disco.metricsProvider)) {
- $generatorJava.beanProperty(res, 'discovery', disco, 'metricsProvider', 'metricsProvider', disco.metricsProvider, {}, true);
- res.needEmptyLine = false;
- }
-
- $generatorJava.property(res, 'discovery', disco, 'reconnectCount', null, null, 10);
- $generatorJava.property(res, 'discovery', disco, 'statisticsPrintFrequency', null, null, 0);
- $generatorJava.property(res, 'discovery', disco, 'ipFinderCleanFrequency', null, null, 60000);
-
- if ($generatorCommon.isDefinedAndNotEmpty(disco.authenticator)) {
- $generatorJava.beanProperty(res, 'discovery', disco, 'authenticator', 'authenticator', disco.authenticator, {}, true);
- res.needEmptyLine = false;
- }
-
- $generatorJava.property(res, 'discovery', disco, 'forceServerMode', null, null, false);
- $generatorJava.property(res, 'discovery', disco, 'clientReconnectDisabled', null, null, false);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate events group.
-$generatorJava.clusterEvents = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cluster.includeEventTypes && cluster.includeEventTypes.length > 0) {
- res.emptyLineIfNeeded();
-
- const evtGrps = angular.element(document.getElementById('app')).injector().get('igniteEventGroups');
-
- if (cluster.includeEventTypes.length === 1) {
- const evtGrp = _.find(evtGrps, {value: cluster.includeEventTypes[0]});
- const evts = res.importStatic(evtGrp.class + '.' + evtGrp.value);
-
- res.line('cfg.setIncludeEventTypes(' + evts + ');');
- }
- else {
- _.forEach(cluster.includeEventTypes, function(value, ix) {
- const evtGrp = _.find(evtGrps, {value});
- const evts = res.importStatic(evtGrp.class + '.' + evtGrp.value);
-
- if (ix === 0)
- res.line('int[] events = new int[' + evts + '.length');
- else
- res.line(' + ' + evts + '.length');
- });
-
- res.line('];');
-
- res.needEmptyLine = true;
-
- res.line('int k = 0;');
-
- _.forEach(cluster.includeEventTypes, function(value, idx) {
- res.needEmptyLine = true;
-
- const evtGrp = _.find(evtGrps, {value});
- const evts = res.importStatic(evtGrp.class + '.' + value);
-
- res.line('System.arraycopy(' + evts + ', 0, events, k, ' + evts + '.length);');
-
- if (idx < cluster.includeEventTypes.length - 1)
- res.line('k += ' + evts + '.length;');
- });
-
- res.needEmptyLine = true;
-
- res.line('cfg.setIncludeEventTypes(events);');
- }
-
- res.needEmptyLine = true;
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate failover group.
-$generatorJava.clusterFailover = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(cluster.failoverSpi) && _.findIndex(cluster.failoverSpi, function(spi) {
- return $generatorCommon.isDefinedAndNotEmpty(spi.kind) && (spi.kind !== 'Custom' || $generatorCommon.isDefinedAndNotEmpty(_.get(spi, spi.kind + '.class')));
- }) >= 0) {
- const arrayVarName = 'failoverSpiList';
-
- $generatorJava.declareVariable(res, arrayVarName, 'java.util.List', 'java.util.ArrayList', 'org.apache.ignite.spi.failover.FailoverSpi');
-
- _.forEach(cluster.failoverSpi, function(spi) {
- if (spi.kind && (spi.kind !== 'Custom' || $generatorCommon.isDefinedAndNotEmpty(_.get(spi, spi.kind + '.class')))) {
- const varName = 'failoverSpi';
-
- const maxAttempts = _.get(spi, spi.kind + '.maximumFailoverAttempts');
-
- if ((spi.kind === 'JobStealing' || spi.kind === 'Always') && $generatorCommon.isDefinedAndNotEmpty(maxAttempts) && maxAttempts !== 5) {
- const spiCls = res.importClass($generatorCommon.failoverSpiClass(spi));
-
- $generatorJava.declareVariableCustom(res, varName, 'org.apache.ignite.spi.failover.FailoverSpi', 'new ' + spiCls + '()');
-
- if ($generatorCommon.isDefinedAndNotEmpty(spi[spi.kind].maximumFailoverAttempts))
- res.line('((' + spiCls + ') ' + varName + ').setMaximumFailoverAttempts(' + spi[spi.kind].maximumFailoverAttempts + ');');
-
- res.needEmptyLine = true;
-
- res.line(arrayVarName + '.add(' + varName + ');');
- }
- else
- res.line(arrayVarName + '.add(new ' + res.importClass($generatorCommon.failoverSpiClass(spi)) + '());');
-
- res.needEmptyLine = true;
- }
- });
-
- res.line('cfg.setFailoverSpi(' + arrayVarName + '.toArray(new FailoverSpi[' + arrayVarName + '.size()]));');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate marshaller group.
-$generatorJava.clusterLogger = function(logger, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.loggerConfigured(logger)) {
- const varName = 'logger';
-
- const log = logger[logger.kind];
-
- switch (logger.kind) {
- case 'Log4j2':
- $generatorJava.declareVariableCustom(res, varName, 'org.apache.ignite.logger.log4j2.Log4J2Logger',
- 'new Log4J2Logger(' + $generatorJava.toJavaCode(log.path, 'path') + ')');
-
- res.needEmptyLine = true;
-
- if ($generatorCommon.isDefinedAndNotEmpty(log.level))
- res.line(varName + '.setLevel(' + res.importClass('org.apache.logging.log4j.Level') + '.' + log.level + ');');
-
- break;
-
- case 'Null':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.logger.NullLogger');
-
- break;
-
- case 'Java':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.logger.java.JavaLogger');
-
- break;
-
- case 'JCL':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.logger.jcl.JclLogger');
-
- break;
-
- case 'SLF4J':
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.logger.slf4j.Slf4jLogger');
-
- break;
-
- case 'Log4j':
- if (log.mode === 'Default')
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.logger.log4j.Log4JLogger');
- else {
- $generatorJava.declareVariableCustom(res, varName, 'org.apache.ignite.logger.log4j.Log4JLogger',
- 'new Log4JLogger(' + $generatorJava.toJavaCode(log.path, 'path') + ')');
- }
-
- if ($generatorCommon.isDefinedAndNotEmpty(log.level))
- res.line(varName + '.setLevel(' + res.importClass('org.apache.log4j.Level') + '.' + log.level + ');');
-
- break;
-
- case 'Custom':
- $generatorJava.declareVariable(res, varName, log.class);
-
- break;
-
- default:
- }
-
- res.needEmptyLine = true;
-
- res.line('cfg.setGridLogger(' + varName + ');');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate marshaller group.
-$generatorJava.clusterMarshaller = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const marshaller = cluster.marshaller;
-
- if (marshaller && marshaller.kind) {
- const marshallerDesc = $generatorCommon.MARSHALLERS[marshaller.kind];
-
- $generatorJava.beanProperty(res, 'cfg', marshaller[marshaller.kind], 'marshaller', 'marshaller',
- marshallerDesc.className, marshallerDesc.fields, true);
-
- $generatorJava.beanProperty(res, 'marshaller', marshaller[marshaller.kind], marshallerDesc.className, marshallerDesc.fields, true);
- }
-
- $generatorJava.property(res, 'cfg', cluster, 'marshalLocalJobs', null, null, false);
- $generatorJava.property(res, 'cfg', cluster, 'marshallerCacheKeepAliveTime', null, null, 10000);
- $generatorJava.property(res, 'cfg', cluster, 'marshallerCacheThreadPoolSize', null, 'setMarshallerCachePoolSize');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate metrics group.
-$generatorJava.clusterMetrics = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.property(res, 'cfg', cluster, 'metricsExpireTime');
- $generatorJava.property(res, 'cfg', cluster, 'metricsHistorySize', null, null, 10000);
- $generatorJava.property(res, 'cfg', cluster, 'metricsLogFrequency', null, null, 60000);
- $generatorJava.property(res, 'cfg', cluster, 'metricsUpdateFrequency', null, null, 2000);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate swap group.
-$generatorJava.clusterSwap = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (cluster.swapSpaceSpi && cluster.swapSpaceSpi.kind === 'FileSwapSpaceSpi') {
- $generatorJava.beanProperty(res, 'cfg', cluster.swapSpaceSpi.FileSwapSpaceSpi, 'swapSpaceSpi', 'swapSpi',
- $generatorCommon.SWAP_SPACE_SPI.className, $generatorCommon.SWAP_SPACE_SPI.fields, true);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate time group.
-$generatorJava.clusterTime = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.property(res, 'cfg', cluster, 'clockSyncSamples', null, null, 8);
- $generatorJava.property(res, 'cfg', cluster, 'clockSyncFrequency', null, null, 120000);
- $generatorJava.property(res, 'cfg', cluster, 'timeServerPortBase', null, null, 31100);
- $generatorJava.property(res, 'cfg', cluster, 'timeServerPortRange', null, null, 100);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate ODBC configuration group.
-$generatorJava.clusterODBC = function(odbc, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (odbc && odbc.odbcEnabled) {
- $generatorJava.beanProperty(res, 'cfg', odbc, 'odbcConfiguration', 'odbcConfiguration',
- $generatorCommon.ODBC_CONFIGURATION.className, $generatorCommon.ODBC_CONFIGURATION.fields, true);
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate thread pools group.
-$generatorJava.clusterPools = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.property(res, 'cfg', cluster, 'publicThreadPoolSize');
- $generatorJava.property(res, 'cfg', cluster, 'systemThreadPoolSize');
- $generatorJava.property(res, 'cfg', cluster, 'managementThreadPoolSize');
- $generatorJava.property(res, 'cfg', cluster, 'igfsThreadPoolSize');
- $generatorJava.property(res, 'cfg', cluster, 'rebalanceThreadPoolSize');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate transactions group.
-$generatorJava.clusterTransactions = function(transactionConfiguration, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.beanProperty(res, 'cfg', transactionConfiguration, 'transactionConfiguration',
- 'transactionConfiguration', $generatorCommon.TRANSACTION_CONFIGURATION.className,
- $generatorCommon.TRANSACTION_CONFIGURATION.fields, false);
-
- return res;
-};
-
-// Generate user attributes group.
-$generatorJava.clusterUserAttributes = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.isDefinedAndNotEmpty(cluster.attributes)) {
- $generatorJava.declareVariable(res, 'attributes', 'java.util.Map', 'java.util.HashMap', 'java.lang.String', 'java.lang.String');
-
- _.forEach(cluster.attributes, function(attr) {
- res.line('attributes.put("' + attr.name + '", "' + attr.value + '");');
- });
-
- res.needEmptyLine = true;
-
- res.line('cfg.setUserAttributes(attributes);');
-
- res.needEmptyLine = true;
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-
-// Generate cache general group.
-$generatorJava.cacheGeneral = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- $generatorJava.property(res, varName, cache, 'name');
-
- $generatorJava.enumProperty(res, varName, cache, 'cacheMode', 'org.apache.ignite.cache.CacheMode');
- $generatorJava.enumProperty(res, varName, cache, 'atomicityMode', 'org.apache.ignite.cache.CacheAtomicityMode');
-
- if (cache.cacheMode === 'PARTITIONED' && $generatorJava.property(res, varName, cache, 'backups'))
- $generatorJava.property(res, varName, cache, 'readFromBackup');
-
- $generatorJava.property(res, varName, cache, 'copyOnRead');
-
- if (cache.cacheMode === 'PARTITIONED' && cache.atomicityMode === 'TRANSACTIONAL')
- $generatorJava.property(res, varName, cache, 'invalidate');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache memory group.
-$generatorJava.cacheMemory = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- $generatorJava.enumProperty(res, varName, cache, 'memoryMode', 'org.apache.ignite.cache.CacheMemoryMode', null, 'ONHEAP_TIERED');
-
- if (cache.memoryMode !== 'OFFHEAP_VALUES')
- $generatorJava.property(res, varName, cache, 'offHeapMaxMemory', null, null, -1);
-
- res.softEmptyLine();
-
- $generatorJava.evictionPolicy(res, varName, cache.evictionPolicy, 'evictionPolicy');
-
- $generatorJava.property(res, varName, cache, 'startSize', null, null, 1500000);
- $generatorJava.property(res, varName, cache, 'swapEnabled', null, null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache query & indexing group.
-$generatorJava.cacheQuery = function(cache, domains, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- $generatorJava.property(res, varName, cache, 'sqlSchema');
- $generatorJava.property(res, varName, cache, 'sqlOnheapRowCacheSize', null, null, 10240);
- $generatorJava.property(res, varName, cache, 'longQueryWarningTimeout', null, null, 3000);
-
- const indexedTypes = _.reduce(domains, (acc, domain) => {
- if (domain.queryMetadata === 'Annotations') {
- acc.push(domain.keyType);
- acc.push(domain.valueType);
- }
-
- return acc;
- }, []);
-
- if (indexedTypes.length > 0) {
- res.softEmptyLine();
-
- $generatorJava.multiparamProperty(res, varName, {indexedTypes}, 'indexedTypes', 'class');
- }
-
- res.softEmptyLine();
-
- $generatorJava.multiparamProperty(res, varName, cache, 'sqlFunctionClasses', 'class');
-
- res.softEmptyLine();
-
- $generatorJava.property(res, varName, cache, 'snapshotableIndex', null, null, false);
- $generatorJava.property(res, varName, cache, 'sqlEscapeAll', null, null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-/**
- * Generate cache store datasource.
- *
- * @param storeFactory Factory to generate data source for.
- * @param res Resulting output with generated code.
- */
-$generatorJava.cacheStoreDataSource = function(storeFactory, res) {
- const dialect = storeFactory.connectVia ? (storeFactory.connectVia === 'DataSource' ? storeFactory.dialect : null) : storeFactory.dialect;
-
- if (dialect) {
- const varName = 'dataSource';
-
- const dataSourceBean = storeFactory.dataSourceBean;
-
- const varType = res.importClass($generatorCommon.dataSourceClassName(dialect));
-
- res.line('public static final ' + varType + ' INSTANCE_' + dataSourceBean + ' = create' + dataSourceBean + '();');
-
- res.needEmptyLine = true;
-
- res.startBlock('private static ' + varType + ' create' + dataSourceBean + '() {');
- if (dialect === 'Oracle')
- res.startBlock('try {');
-
- $generatorJava.resetVariables(res);
-
- $generatorJava.declareVariable(res, varName, varType);
-
- switch (dialect) {
- case 'Generic':
- res.line(varName + '.setJdbcUrl(props.getProperty("' + dataSourceBean + '.jdbc.url"));');
-
- break;
-
- case 'DB2':
- res.line(varName + '.setServerName(props.getProperty("' + dataSourceBean + '.jdbc.server_name"));');
- res.line(varName + '.setPortNumber(Integer.valueOf(props.getProperty("' + dataSourceBean + '.jdbc.port_number")));');
- res.line(varName + '.setDatabaseName(props.getProperty("' + dataSourceBean + '.jdbc.database_name"));');
- res.line(varName + '.setDriverType(Integer.valueOf(props.getProperty("' + dataSourceBean + '.jdbc.driver_type")));');
-
- break;
-
- case 'PostgreSQL':
- res.line(varName + '.setUrl(props.getProperty("' + dataSourceBean + '.jdbc.url"));');
-
- break;
-
- default:
- res.line(varName + '.setURL(props.getProperty("' + dataSourceBean + '.jdbc.url"));');
- }
-
- res.line(varName + '.setUser(props.getProperty("' + dataSourceBean + '.jdbc.username"));');
- res.line(varName + '.setPassword(props.getProperty("' + dataSourceBean + '.jdbc.password"));');
-
- res.needEmptyLine = true;
-
- res.line('return dataSource;');
-
- if (dialect === 'Oracle') {
- res.endBlock('}');
- res.startBlock('catch (' + res.importClass('java.sql.SQLException') + ' ex) {');
- res.line('throw new Error(ex);');
- res.endBlock('}');
- }
-
- res.endBlock('}');
-
- res.needEmptyLine = true;
-
- return dataSourceBean;
- }
-
- return null;
-};
-
-$generatorJava.clusterDataSources = function(cluster, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const datasources = [];
-
- let storeFound = false;
-
- function startSourcesFunction() {
- if (!storeFound) {
- res.line('/** Helper class for datasource creation. */');
- res.startBlock('public static class DataSources {');
-
- storeFound = true;
- }
- }
-
- _.forEach(cluster.caches, function(cache) {
- const factoryKind = cache.cacheStoreFactory.kind;
-
- const storeFactory = cache.cacheStoreFactory[factoryKind];
-
- if (storeFactory) {
- const beanClassName = $generatorJava.dataSourceClassName(res, storeFactory);
-
- if (beanClassName && !_.includes(datasources, beanClassName)) {
- datasources.push(beanClassName);
-
- if (factoryKind === 'CacheJdbcPojoStoreFactory' || factoryKind === 'CacheJdbcBlobStoreFactory') {
- startSourcesFunction();
-
- $generatorJava.cacheStoreDataSource(storeFactory, res);
- }
- }
- }
- });
-
- if (cluster.discovery.kind === 'Jdbc') {
- const datasource = cluster.discovery.Jdbc;
-
- if (datasource.dataSourceBean && datasource.dialect) {
- const beanClassName = $generatorJava.dataSourceClassName(res, datasource);
-
- if (beanClassName && !_.includes(datasources, beanClassName)) {
- startSourcesFunction();
-
- $generatorJava.cacheStoreDataSource(datasource, res);
- }
- }
- }
-
- if (storeFound)
- res.endBlock('}');
-
- return res;
-};
-
-/**
- * Generate cache store group.
- *
- * @param cache Cache descriptor.
- * @param domains Domain model descriptors.
- * @param cacheVarName Cache variable name.
- * @param res Resulting output with generated code.
- * @returns {*} Java code for cache store configuration.
- */
-$generatorJava.cacheStore = function(cache, domains, cacheVarName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!cacheVarName)
- cacheVarName = $generatorJava.nextVariableName('cache', cache);
-
- if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) {
- const factoryKind = cache.cacheStoreFactory.kind;
-
- const storeFactory = cache.cacheStoreFactory[factoryKind];
-
- if (storeFactory) {
- const storeFactoryDesc = $generatorCommon.STORE_FACTORIES[factoryKind];
-
- const varName = 'storeFactory' + storeFactoryDesc.suffix;
-
- if (factoryKind === 'CacheJdbcPojoStoreFactory') {
- // Generate POJO store factory.
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory', null, null, null, true);
- res.deep++;
-
- res.line('/** {@inheritDoc} */');
- res.startBlock('@Override public ' + res.importClass('org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore') + ' create() {');
-
- res.line('setDataSource(DataSources.INSTANCE_' + storeFactory.dataSourceBean + ');');
-
- res.needEmptyLine = true;
-
- res.line('return super.create();');
- res.endBlock('}');
- res.endBlock('};');
-
- res.needEmptyLine = true;
-
- res.line(varName + '.setDialect(new ' +
- res.importClass($generatorCommon.jdbcDialectClassName(storeFactory.dialect)) + '());');
-
- res.needEmptyLine = true;
-
- if (storeFactory.sqlEscapeAll) {
- res.line(varName + '.setSqlEscapeAll(true);');
-
- res.needEmptyLine = true;
- }
-
- const domainConfigs = _.filter(domains, function(domain) {
- return $generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
- $generatorCommon.isDefinedAndNotEmpty(domain.databaseTable);
- });
-
- if ($generatorCommon.isDefinedAndNotEmpty(domainConfigs)) {
- $generatorJava.declareVariable(res, 'jdbcTypes', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.store.jdbc.JdbcType');
-
- res.needEmptyLine = true;
-
- _.forEach(domainConfigs, function(domain) {
- if ($generatorCommon.isDefinedAndNotEmpty(domain.databaseTable))
- res.line('jdbcTypes.add(jdbcType' + $generatorJava.extractType(domain.valueType) + '(' + cacheVarName + '.getName()));');
- });
-
- res.needEmptyLine = true;
-
- res.line(varName + '.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));');
-
- res.needEmptyLine = true;
- }
-
- res.line(cacheVarName + '.setCacheStoreFactory(' + varName + ');');
- }
- else if (factoryKind === 'CacheJdbcBlobStoreFactory') {
- // Generate POJO store factory.
- $generatorJava.declareVariable(res, varName, 'org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory', null, null, null, storeFactory.connectVia === 'DataSource');
-
- if (storeFactory.connectVia === 'DataSource') {
- res.deep++;
-
- res.line('/** {@inheritDoc} */');
- res.startBlock('@Override public ' + res.importClass('org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStore') + ' create() {');
-
- res.line('setDataSource(DataSources.INSTANCE_' + storeFactory.dataSourceBean + ');');
-
- res.needEmptyLine = true;
-
- res.line('return super.create();');
- res.endBlock('}');
- res.endBlock('};');
-
- res.needEmptyLine = true;
-
- $generatorJava.property(res, varName, storeFactory, 'initSchema');
- $generatorJava.property(res, varName, storeFactory, 'createTableQuery');
- $generatorJava.property(res, varName, storeFactory, 'loadQuery');
- $generatorJava.property(res, varName, storeFactory, 'insertQuery');
- $generatorJava.property(res, varName, storeFactory, 'updateQuery');
- $generatorJava.property(res, varName, storeFactory, 'deleteQuery');
- }
- else {
- $generatorJava.property(res, varName, storeFactory, 'connectionUrl');
-
- if (storeFactory.user) {
- $generatorJava.property(res, varName, storeFactory, 'user');
- res.line(varName + '.setPassword(props.getProperty("ds.' + storeFactory.user + '.password"));');
- }
- }
-
- res.needEmptyLine = true;
-
- res.line(cacheVarName + '.setCacheStoreFactory(' + varName + ');');
- }
- else
- $generatorJava.beanProperty(res, cacheVarName, storeFactory, 'cacheStoreFactory', varName, storeFactoryDesc.className, storeFactoryDesc.fields, true);
-
- res.needEmptyLine = true;
- }
- }
-
- res.softEmptyLine();
-
- $generatorJava.property(res, cacheVarName, cache, 'storeKeepBinary', null, null, false);
- $generatorJava.property(res, cacheVarName, cache, 'loadPreviousValue', null, null, false);
- $generatorJava.property(res, cacheVarName, cache, 'readThrough', null, null, false);
- $generatorJava.property(res, cacheVarName, cache, 'writeThrough', null, null, false);
-
- res.softEmptyLine();
-
- if (cache.writeBehindEnabled) {
- $generatorJava.property(res, cacheVarName, cache, 'writeBehindEnabled', null, null, false);
- $generatorJava.property(res, cacheVarName, cache, 'writeBehindBatchSize', null, null, 512);
- $generatorJava.property(res, cacheVarName, cache, 'writeBehindFlushSize', null, null, 10240);
- $generatorJava.property(res, cacheVarName, cache, 'writeBehindFlushFrequency', null, null, 5000);
- $generatorJava.property(res, cacheVarName, cache, 'writeBehindFlushThreadCount', null, null, 1);
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache node filter group.
-$generatorJava.cacheNodeFilter = function(cache, igfss, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- switch (_.get(cache, 'nodeFilter.kind')) {
- case 'IGFS':
- const foundIgfs = _.find(igfss, (igfs) => igfs._id === cache.nodeFilter.IGFS.igfs);
-
- if (foundIgfs) {
- const predClsName = res.importClass('org.apache.ignite.internal.processors.igfs.IgfsNodePredicate');
-
- res.line(`${varName}.setNodeFilter(new ${predClsName}("${foundIgfs.name}"));`);
- }
-
- break;
-
- case 'OnNodes':
- const nodes = cache.nodeFilter.OnNodes.nodeIds;
-
- if ($generatorCommon.isDefinedAndNotEmpty(nodes)) {
- const startQuote = res.importClass('java.util.UUID') + '.fromString("';
-
- $generatorJava.fxVarArgs(res, varName + '.setNodeFilter(new ' +
- res.importClass('org.apache.ignite.internal.util.lang.GridNodePredicate'), true, nodes, '(', '))',
- startQuote, '")');
- }
-
- break;
-
- case 'Custom':
- res.line(varName + '.setNodeFilter(new ' + res.importClass(cache.nodeFilter.Custom.className) + '());');
-
- break;
-
- default: break;
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache concurrency group.
-$generatorJava.cacheConcurrency = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- $generatorJava.property(res, varName, cache, 'maxConcurrentAsyncOperations', null, null, 500);
- $generatorJava.property(res, varName, cache, 'defaultLockTimeout', null, null, 0);
- $generatorJava.enumProperty(res, varName, cache, 'atomicWriteOrderMode', 'org.apache.ignite.cache.CacheAtomicWriteOrderMode');
- $generatorJava.enumProperty(res, varName, cache, 'writeSynchronizationMode', 'org.apache.ignite.cache.CacheWriteSynchronizationMode', null, 'PRIMARY_SYNC');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate cache rebalance group.
-$generatorJava.cacheRebalance = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- if (cache.cacheMode !== 'LOCAL') {
- $generatorJava.enumProperty(res, varName, cache, 'rebalanceMode', 'org.apache.ignite.cache.CacheRebalanceMode', null, 'ASYNC');
- $generatorJava.property(res, varName, cache, 'rebalanceThreadPoolSize', null, null, 1);
- $generatorJava.property(res, varName, cache, 'rebalanceBatchSize', null, null, 524288);
- $generatorJava.property(res, varName, cache, 'rebalanceBatchesPrefetchCount', null, null, 2);
- $generatorJava.property(res, varName, cache, 'rebalanceOrder', null, null, 0);
- $generatorJava.property(res, varName, cache, 'rebalanceDelay', null, null, 0);
- $generatorJava.property(res, varName, cache, 'rebalanceTimeout', null, null, 10000);
- $generatorJava.property(res, varName, cache, 'rebalanceThrottle', null, null, 0);
- }
-
- res.softEmptyLine();
-
- if (cache.igfsAffinnityGroupSize) {
- res.line(varName + '.setAffinityMapper(new ' + res.importClass('org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper') + '(' + cache.igfsAffinnityGroupSize + '));');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cache server near cache group.
-$generatorJava.cacheServerNearCache = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- if (cache.cacheMode === 'PARTITIONED' && cache.nearCacheEnabled) {
- res.needEmptyLine = true;
-
- if (cache.nearConfiguration) {
- $generatorJava.declareVariable(res, 'nearCfg', 'org.apache.ignite.configuration.NearCacheConfiguration');
-
- res.needEmptyLine = true;
-
- if (cache.nearConfiguration.nearStartSize) {
- $generatorJava.property(res, 'nearCfg', cache.nearConfiguration, 'nearStartSize', null, null, 375000);
-
- res.needEmptyLine = true;
- }
-
- if (cache.nearConfiguration.nearEvictionPolicy && cache.nearConfiguration.nearEvictionPolicy.kind) {
- $generatorJava.evictionPolicy(res, 'nearCfg', cache.nearConfiguration.nearEvictionPolicy, 'nearEvictionPolicy');
-
- res.needEmptyLine = true;
- }
-
- res.line(varName + '.setNearConfiguration(nearCfg);');
-
- res.needEmptyLine = true;
- }
- }
-
- return res;
-};
-
-// Generate cache statistics group.
-$generatorJava.cacheStatistics = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if (!varName)
- varName = $generatorJava.nextVariableName('cache', cache);
-
- $generatorJava.property(res, varName, cache, 'statisticsEnabled', null, null, false);
- $generatorJava.property(res, varName, cache, 'managementEnabled', null, null, false);
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain model query fields.
-$generatorJava.domainModelQueryFields = function(res, domain) {
- const fields = domain.fields;
-
- if (fields && fields.length > 0) {
- $generatorJava.declareVariable(res, 'fields', 'java.util.LinkedHashMap', 'java.util.LinkedHashMap', 'java.lang.String', 'java.lang.String');
-
- _.forEach(fields, function(field) {
- res.line('fields.put("' + field.name + '", "' + $generatorCommon.JavaTypes.fullClassName(field.className) + '");');
- });
-
- res.needEmptyLine = true;
-
- res.line('qryMeta.setFields(fields);');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model query aliases.
-$generatorJava.domainModelQueryAliases = function(res, domain) {
- const aliases = domain.aliases;
-
- if (aliases && aliases.length > 0) {
- $generatorJava.declareVariable(res, 'aliases', 'java.util.Map', 'java.util.HashMap', 'java.lang.String', 'java.lang.String');
-
- _.forEach(aliases, function(alias) {
- res.line('aliases.put("' + alias.field + '", "' + alias.alias + '");');
- });
-
- res.needEmptyLine = true;
-
- res.line('qryMeta.setAliases(aliases);');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model indexes.
-$generatorJava.domainModelQueryIndexes = function(res, domain) {
- const indexes = domain.indexes;
-
- if (indexes && indexes.length > 0) {
- res.needEmptyLine = true;
-
- $generatorJava.declareVariable(res, 'indexes', 'java.util.List', 'java.util.ArrayList', 'org.apache.ignite.cache.QueryIndex');
-
- _.forEach(indexes, function(index) {
- const fields = index.fields;
-
- // One row generation for 1 field index.
- if (fields && fields.length === 1) {
- const field = index.fields[0];
-
- res.line('indexes.add(new ' + res.importClass('org.apache.ignite.cache.QueryIndex') +
- '("' + field.name + '", ' +
- res.importClass('org.apache.ignite.cache.QueryIndexType') + '.' + index.indexType + ', ' +
- field.direction + ', "' + index.name + '"));');
- }
- else {
- res.needEmptyLine = true;
-
- $generatorJava.declareVariable(res, 'index', 'org.apache.ignite.cache.QueryIndex');
-
- $generatorJava.property(res, 'index', index, 'name');
- $generatorJava.enumProperty(res, 'index', index, 'indexType', 'org.apache.ignite.cache.QueryIndexType');
-
- res.needEmptyLine = true;
-
- if (fields && fields.length > 0) {
- $generatorJava.declareVariable(res, 'indFlds', 'java.util.LinkedHashMap', 'java.util.LinkedHashMap', 'String', 'Boolean');
-
- _.forEach(fields, function(field) {
- res.line('indFlds.put("' + field.name + '", ' + field.direction + ');');
- });
-
- res.needEmptyLine = true;
-
- res.line('index.setFields(indFlds);');
-
- res.needEmptyLine = true;
- }
-
- res.line('indexes.add(index);');
- }
- });
-
- res.needEmptyLine = true;
-
- res.line('qryMeta.setIndexes(indexes);');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model db fields.
-$generatorJava.domainModelDatabaseFields = function(res, domain, fieldProperty) {
- const dbFields = domain[fieldProperty];
-
- if (dbFields && dbFields.length > 0) {
- res.needEmptyLine = true;
-
- res.importClass('java.sql.Types');
-
- res.startBlock('jdbcType.' + $generatorCommon.toJavaName('set', fieldProperty) + '(');
-
- const lastIx = dbFields.length - 1;
-
- res.importClass('org.apache.ignite.cache.store.jdbc.JdbcTypeField');
-
- _.forEach(dbFields, function(field, ix) {
- res.line('new JdbcTypeField(' +
- 'Types.' + field.databaseFieldType + ', ' + '"' + field.databaseFieldName + '", ' +
- res.importClass(field.javaFieldType) + '.class, ' + '"' + field.javaFieldName + '"' + ')' + (ix < lastIx ? ',' : ''));
- });
-
- res.endBlock(');');
-
- res.needEmptyLine = true;
- }
-};
-
-// Generate domain model general group.
-$generatorJava.domainModelGeneral = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- switch ($generatorCommon.domainQueryMetadata(domain)) {
- case 'Annotations':
- if ($generatorCommon.isDefinedAndNotEmpty(domain.keyType) || $generatorCommon.isDefinedAndNotEmpty(domain.valueType)) {
- const types = [];
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.keyType))
- types.push($generatorJava.toJavaCode(res.importClass(domain.keyType), 'class'));
- else
- types.push('???');
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.valueType))
- types.push($generatorJava.toJavaCode(res.importClass(domain.valueType), 'class'));
- else
- types.push('???');
-
- if ($generatorCommon.isDefinedAndNotEmpty(types))
- $generatorJava.fxVarArgs(res, 'cache.setIndexedTypes', false, types);
- }
-
- break;
-
- case 'Configuration':
- $generatorJava.classNameProperty(res, 'jdbcTypes', domain, 'keyType');
- $generatorJava.property(res, 'jdbcTypes', domain, 'valueType');
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.fields)) {
- res.needEmptyLine = true;
-
- $generatorJava.classNameProperty(res, 'qryMeta', domain, 'keyType');
- $generatorJava.property(res, 'qryMeta', domain, 'valueType');
- }
-
- break;
-
- default:
- }
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain model for query group.
-$generatorJava.domainModelQuery = function(domain, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- if ($generatorCommon.domainQueryMetadata(domain) === 'Configuration') {
- $generatorJava.domainModelQueryFields(res, domain);
- $generatorJava.domainModelQueryAliases(res, domain);
- $generatorJava.domainModelQueryIndexes(res, domain);
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate domain model for store group.
-$generatorJava.domainStore = function(domain, withTypes, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.property(res, 'jdbcType', domain, 'databaseSchema');
- $generatorJava.property(res, 'jdbcType', domain, 'databaseTable');
-
- if (withTypes) {
- $generatorJava.classNameProperty(res, 'jdbcType', domain, 'keyType');
- $generatorJava.property(res, 'jdbcType', domain, 'valueType');
- }
-
- $generatorJava.domainModelDatabaseFields(res, domain, 'keyFields');
- $generatorJava.domainModelDatabaseFields(res, domain, 'valueFields');
-
- res.needEmptyLine = true;
-
- return res;
-};
-
-// Generate domain model configs.
-$generatorJava.cacheDomains = function(domains, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- const domainConfigs = _.filter(domains, function(domain) {
- return $generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
- $generatorCommon.isDefinedAndNotEmpty(domain.fields);
- });
-
- // Generate domain model configs.
- if ($generatorCommon.isDefinedAndNotEmpty(domainConfigs)) {
- $generatorJava.declareVariable(res, 'queryEntities', 'java.util.Collection', 'java.util.ArrayList', 'org.apache.ignite.cache.QueryEntity');
-
- _.forEach(domainConfigs, function(domain) {
- if ($generatorCommon.isDefinedAndNotEmpty(domain.fields))
- res.line('queryEntities.add(queryEntity' + $generatorJava.extractType(domain.valueType) + '());');
- });
-
- res.needEmptyLine = true;
-
- res.line(varName + '.setQueryEntities(queryEntities);');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cache configs.
-$generatorJava.cache = function(cache, varName, res) {
- if (!res)
- res = $generatorCommon.builder();
-
- $generatorJava.cacheGeneral(cache, varName, res);
- $generatorJava.cacheMemory(cache, varName, res);
- $generatorJava.cacheQuery(cache, cache.domains, varName, res);
- $generatorJava.cacheStore(cache, cache.domains, varName, res);
-
- const igfs = _.get(cache, 'nodeFilter.IGFS.instance');
-
- $generatorJava.cacheNodeFilter(cache, igfs ? [igfs] : [], varName, res);
- $generatorJava.cacheConcurrency(cache, varName, res);
- $generatorJava.cacheRebalance(cache, varName, res);
- $generatorJava.cacheServerNearCache(cache, varName, res);
- $generatorJava.cacheStatistics(cache, varName, res);
- $generatorJava.cacheDomains(cache.domains, varName, res);
-};
-
-// Generation of cache domain model in separate methods.
-$generatorJava.clusterDomains = function(caches, res) {
- const domains = [];
-
- const typeVarName = 'jdbcType';
- const metaVarName = 'qryMeta';
-
- _.forEach(caches, function(cache) {
- _.forEach(cache.domains, function(domain) {
- if (_.isNil(_.find(domains, function(m) {
- return m === domain.valueType;
- }))) {
- $generatorJava.resetVariables(res);
-
- const type = $generatorJava.extractType(domain.valueType);
-
- if ($generatorCommon.isDefinedAndNotEmpty(domain.databaseTable)) {
- res.line('/**');
- res.line(' * Create JDBC type for ' + type + '.');
- res.line(' *');
- res.line(' * @param cacheName Cache name.');
- res.line(' * @return Configured JDBC type.');
- res.line(' */');
- res.startBlock('private static JdbcType jdbcType' + type + '(String cacheName) {');
-
- $generatorJava.declareVariable(res, typeVarName, 'org.apache.ignite.cache.store.jdbc.JdbcType');
-
- res.needEmptyLine = true;
-
- res.line(typeVarName + '.setCacheName(cacheName);');
-
- $generatorJava.domainStore(domain, true, res);
-
- res.needEmptyLine = true;
-
- res.line('return ' + typeVarName + ';');
- res.endBlock('}');
-
- res.needEmptyLine = true;
- }
-
- if ($generatorCommon.domainQueryMetadata(domain) === 'Configuration' &&
- $generatorCommon.isDefinedAndNotEmpty(domain.fields)) {
- res.line('/**');
- res.line(' * Create SQL Query descriptor for ' + type + '.');
- res.line(' *');
- res.line(' * @return Configured query entity.');
- res.line(' */');
- res.startBlock('private static QueryEntity queryEntity' + type + '() {');
-
- $generatorJava.declareVariable(res, metaVarName, 'org.apache.ignite.cache.QueryEntity');
-
- $generatorJava.classNameProperty(res, metaVarName, domain, 'keyType');
- $generatorJava.property(res, metaVarName, domain, 'valueType');
-
- res.needEmptyLine = true;
-
- $generatorJava.domainModelQuery(domain, res);
-
- res.emptyLineIfNeeded();
- res.line('return ' + metaVarName + ';');
-
- res.needEmptyLine = true;
-
- res.endBlock('}');
- }
-
- domains.push(domain.valueType);
- }
- });
- });
-};
-
-/**
- * @param prefix Variable prefix.
- * @param obj Object to process.
- * @param names Known names to generate next unique name.
- */
-$generatorJava.nextVariableName = function(prefix, obj, names) {
- let nextName = $generatorCommon.toJavaName(prefix, obj.name);
-
- let ix = 0;
-
- const checkNextName = (name) => name === nextName + (ix === 0 ? '' : '_' + ix);
-
- while (_.find(names, (name) => checkNextName(name)))
- ix++;
-
- if (ix > 0)
- nextName = nextName + '_' + ix;
-
- return nextName;
-};
-
-// Generate cluster caches.
-$generatorJava.clusterCaches = function(caches, igfss, isSrvCfg, res) {
- function clusterCache(cache, names) {
- res.emptyLineIfNeeded();
-
- const cacheName = $generatorJava.nextVariableName('cache', cache, names);
-
- $generatorJava.resetVariables(res);
-
- const hasDatasource = $generatorCommon.cacheHasDatasource(cache);
-
- res.line('/**');
- res.line(' * Create configuration for cache "' + cache.name + '".');
- res.line(' *');
- res.line(' * @return Configured cache.');
-
- if (hasDatasource)
- res.line(' * @throws Exception if failed to create cache configuration.');
-
- res.line(' */');
- res.startBlock('public static CacheConfiguration ' + cacheName + '()' + (hasDatasource ? ' throws Exception' : '') + ' {');
-
- $generatorJava.declareVariable(res, cacheName, 'org.apache.ignite.configuration.CacheConfiguration');
-
- $generatorJava.cache(cache, cacheName, res);
-
- res.line('return ' + cacheName + ';');
- res.endBlock('}');
-
- names.push(cacheName);
-
- res.needEmptyLine = true;
- }
-
- if (!res)
- res = $generatorCommon.builder();
-
- const names = [];
-
- if ($generatorCommon.isDefinedAndNotEmpty(caches)) {
- res.emptyLineIfNeeded();
-
- _.forEach(caches, function(cache) {
- clusterCache(cache, names);
- });
-
- res.needEmptyLine = true;
- }
-
- if (isSrvCfg && $generatorCommon.isDefinedAndNotEmpty(igfss)) {
- res.emptyLineIfNeeded();
-
- _.forEach(igfss, function(igfs) {
- clusterCache($generatorCommon.igfsDataCache(igfs), names);
- clusterCache($generatorCommon.igfsMetaCache(igfs), names);
- });
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Generate cluster caches.
-$generatorJava.clusterCacheUse = function(caches, igfss, res) {
- function clusterCacheInvoke(cache, names) {
- names.push($generatorJava.nextVariableName('cache', cache, names));
- }
-
- if (!res)
- res = $generatorCommon.builder();
-
- const cacheNames = [];
-
- _.forEach(caches, function(cache) {
- clusterCacheInvoke(cache, cacheNames);
- });
-
- const igfsNames = [];
-
- _.forEach(igfss, function(igfs) {
- clusterCacheInvoke($generatorCommon.igfsDataCache(igfs), igfsNames);
- clusterCacheInvoke($generatorCommon.igfsMetaCache(igfs), igfsNames);
- });
-
- const allCacheNames = cacheNames.concat(igfsNames);
-
- if (allCacheNames.length) {
- res.line('cfg.setCacheConfiguration(' + allCacheNames.join('(), ') + '());');
-
- res.needEmptyLine = true;
- }
-
- return res;
-};
-
-// Get class name from fully specified class path.
-$generatorJava.extractType = function(fullType) {
- return fullType.substring(fullType.lastIndexOf('.') + 1);
-};
-
-/**
- * Generate java class code.
- *
- * @param domain Domain model object.
- * @param key If 'true' then key class should be generated.
- * @param pkg Package name.
- * @param useConstructor If 'true' then empty and full constructors should be generat
<TRUNCATED>
[29/37] ignite git commit: Removed duplicated benchmark.
Posted by vo...@apache.org.
Removed duplicated benchmark.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/864a95e1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/864a95e1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/864a95e1
Branch: refs/heads/ignite-2.0
Commit: 864a95e13f1262f14351df0883d0a1abd1bf70c7
Parents: 8372e69
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 29 14:45:08 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 29 14:45:08 2016 +0300
----------------------------------------------------------------------
.../yardstick/cache/IgniteIoTestBenchmark.java | 73 --------------------
1 file changed, 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/864a95e1/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteIoTestBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteIoTestBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteIoTestBenchmark.java
deleted file mode 100644
index bee45e0..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteIoTestBenchmark.java
+++ /dev/null
@@ -1,73 +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.
- */
-
-package org.apache.ignite.yardstick.cache;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
-import org.yardstickframework.BenchmarkConfiguration;
-import org.yardstickframework.BenchmarkUtils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-public class IgniteIoTestBenchmark extends IgniteAbstractBenchmark {
- /** */
- private List<ClusterNode> targetNodes;
-
- /** */
- private IgniteKernal ignite;
-
- /** {@inheritDoc} */
- @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
- super.setUp(cfg);
-
- ignite = (IgniteKernal)ignite();
-
- targetNodes = new ArrayList<>();
-
- ClusterNode loc = ignite().cluster().localNode();
-
- Collection<ClusterNode> nodes = ignite().cluster().forServers().nodes();
-
- for (ClusterNode node : nodes) {
- if (!loc.equals(node))
- targetNodes.add(node);
- }
-
- if (targetNodes.isEmpty())
- throw new IgniteException("Failed to find remote server nodes [nodes=" + nodes + ']');
-
- BenchmarkUtils.println(cfg, "Initialized target nodes: " + targetNodes + ']');
- }
-
- /** {@inheritDoc} */
- @Override public boolean test(Map<Object, Object> ctx) throws Exception {
- ClusterNode node = targetNodes.get(nextRandom(targetNodes.size()));
-
- ignite.sendIoTest(node, null, false).get();
-
- return true;
- }
-}
[16/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
Web console beta-7.
(cherry picked from commit 8e7c852)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2b3a180f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2b3a180f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2b3a180f
Branch: refs/heads/ignite-2.0
Commit: 2b3a180ff7692c0253da3ff7c32d65c09f9488d2
Parents: babfc2f
Author: Andrey Novikov <an...@gridgain.com>
Authored: Fri Dec 23 16:34:10 2016 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Dec 23 16:38:37 2016 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agent.js | 15 +
modules/web-console/backend/app/browser.js | 13 +
modules/web-console/backend/app/mongo.js | 24 +-
modules/web-console/backend/routes/demo.js | 17 +-
modules/web-console/backend/routes/profile.js | 3 +-
.../web-console/backend/services/notebooks.js | 14 +-
.../web-console/backend/services/sessions.js | 6 +-
modules/web-console/backend/services/spaces.js | 15 +
modules/web-console/frontend/app/app.js | 5 -
.../controllers/reset-password.controller.js | 14 +-
.../frontend/app/data/event-groups.json | 169 +
.../frontend/app/data/event-types.json | 169 -
.../frontend/app/data/pom-dependencies.json | 12 +-
.../ui-ace-docker/ui-ace-docker.controller.js | 2 +-
.../directives/ui-ace-docker/ui-ace-docker.jade | 2 +-
.../ui-ace-pojos/ui-ace-pojos.controller.js | 12 +-
.../ui-ace-pom/ui-ace-pom.controller.js | 4 +-
.../helpers/jade/form/form-field-dropdown.jade | 5 +-
.../helpers/jade/form/form-field-number.jade | 3 +-
.../app/helpers/jade/form/form-field-text.jade | 19 +-
.../frontend/app/helpers/jade/mixins.jade | 52 +-
.../frontend/app/modules/Demo/Demo.module.js | 6 +-
.../configuration/EventGroups.provider.js | 30 -
.../modules/configuration/Version.service.js | 6 +-
.../configuration/configuration.module.js | 63 +-
.../generator/AbstractTransformer.js | 17 +
.../modules/configuration/generator/Beans.js | 5 +
.../generator/ConfigurationGenerator.js | 2795 +++++++-------
.../configuration/generator/Custom.service.js | 23 +
.../configuration/generator/Docker.service.js | 4 +-
.../generator/JavaTransformer.service.js | 2318 +++++------
.../configuration/generator/Maven.service.js | 234 ++
.../configuration/generator/Pom.service.js | 233 --
.../generator/Properties.service.js | 2 +-
.../configuration/generator/Readme.service.js | 2 +-
.../generator/SharpTransformer.service.js | 437 ++-
.../generator/SpringTransformer.service.js | 497 ++-
.../defaults/Cache.platform.service.js | 56 +
.../generator/defaults/Cache.service.js | 131 +
.../defaults/Cluster.platform.service.js | 43 +
.../generator/defaults/Cluster.service.js | 289 ++
.../generator/defaults/Event-groups.service.js | 27 +
.../generator/defaults/IGFS.service.js | 64 +
.../defaults/cache.platform.provider.js | 60 -
.../generator/defaults/cache.provider.js | 137 -
.../defaults/cluster.platform.provider.js | 49 -
.../generator/defaults/cluster.provider.js | 293 --
.../generator/defaults/igfs.provider.js | 68 -
.../configuration/generator/generator-common.js | 625 ---
.../configuration/generator/generator-java.js | 3617 ------------------
.../generator/generator-optional.js | 25 -
.../configuration/generator/generator-spring.js | 2111 ----------
.../frontend/app/modules/sql/Notebook.data.js | 11 +-
.../app/modules/sql/Notebook.service.js | 2 +-
.../app/modules/sql/scan-filter-input.jade | 39 -
.../modules/sql/scan-filter-input.service.js | 51 -
.../frontend/app/modules/sql/sql.controller.js | 211 +-
.../frontend/app/modules/sql/sql.module.js | 2 -
.../app/modules/states/configuration.state.js | 2 +
.../configuration/caches/node-filter.jade | 2 +-
.../states/configuration/caches/query.jade | 3 +
.../states/configuration/caches/store.jade | 4 +-
.../configuration/clusters/checkpoint.jade | 11 +-
.../configuration/clusters/checkpoint/fs.jade | 8 +-
.../configuration/clusters/checkpoint/jdbc.jade | 8 +-
.../configuration/clusters/checkpoint/s3.jade | 25 +-
.../clusters/collision/custom.jade | 2 +-
.../clusters/collision/job-stealing.jade | 2 +-
.../configuration/clusters/deployment.jade | 129 +-
.../states/configuration/clusters/events.jade | 4 +-
.../states/configuration/clusters/failover.jade | 4 +-
.../clusters/general/discovery/zookeeper.jade | 2 +-
.../discovery/zookeeper/retrypolicy/custom.jade | 2 +-
.../configuration/clusters/load-balancing.jade | 23 +-
.../configuration/clusters/logger/custom.jade | 2 +-
.../states/configuration/clusters/ssl.jade | 2 +-
.../summary/summary-zipper.service.js | 37 +
.../configuration/summary/summary.controller.js | 103 +-
.../configuration/summary/summary.worker.js | 123 +
.../frontend/app/modules/user/Auth.service.js | 11 +-
.../frontend/app/services/JavaTypes.service.js | 13 +-
.../frontend/app/services/Messages.service.js | 17 +-
.../frontend/controllers/admin-controller.js | 211 +-
.../frontend/controllers/caches-controller.js | 22 +-
.../frontend/controllers/clusters-controller.js | 42 +-
.../frontend/controllers/domains-controller.js | 32 +-
.../frontend/controllers/igfs-controller.js | 20 +-
.../frontend/controllers/profile-controller.js | 3 +-
.../gulpfile.babel.js/webpack/common.js | 17 +-
.../webpack/environments/development.js | 14 +-
.../webpack/environments/production.js | 3 +-
.../webpack/plugins/progress.js | 82 -
modules/web-console/frontend/package.json | 178 +-
.../frontend/public/images/cache.png | Bin 23700 -> 24791 bytes
.../frontend/public/images/domains.png | Bin 23828 -> 22131 bytes
.../web-console/frontend/public/images/igfs.png | Bin 14307 -> 14139 bytes
.../frontend/public/images/query-chart.png | Bin 16637 -> 17142 bytes
.../frontend/public/images/query-metadata.png | Bin 32298 -> 39361 bytes
.../frontend/public/images/query-table.png | Bin 29189 -> 28065 bytes
.../frontend/public/images/summary.png | Bin 31997 -> 33650 bytes
.../stylesheets/_font-awesome-custom.scss | 23 +-
.../frontend/public/stylesheets/form-field.scss | 37 +
.../frontend/public/stylesheets/style.scss | 111 +-
.../frontend/test/unit/JavaTypes.test.js | 17 +-
.../frontend/test/unit/Version.test.js | 8 +-
.../views/configuration/domains-import.jade | 5 +-
.../frontend/views/configuration/summary.jade | 25 +-
.../frontend/views/settings/admin.jade | 85 +-
.../frontend/views/sql/notebook-new.jade | 2 +-
modules/web-console/frontend/views/sql/sql.jade | 235 +-
.../frontend/views/templates/alert.jade | 2 +-
.../frontend/views/templates/select.jade | 2 +-
112 files changed, 5577 insertions(+), 11296 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/app/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agent.js b/modules/web-console/backend/app/agent.js
index f74a3f2..791ea50 100644
--- a/modules/web-console/backend/app/agent.js
+++ b/modules/web-console/backend/app/agent.js
@@ -314,6 +314,21 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo)
/**
* @param {Boolean} demo Is need run command on demo node.
+ * @param {Array.<String>} nids Node ids.
+ * @returns {Promise}
+ */
+ queryResetDetailMetrics(demo, nids) {
+ const cmd = new Command(demo, 'exe')
+ .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
+ .addParam('p1', nids)
+ .addParam('p2', 'org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask')
+ .addParam('p3', 'java.lang.Void');
+
+ return this.executeRest(cmd);
+ }
+
+ /**
+ * @param {Boolean} demo Is need run command on demo node.
* @param {String} cacheName Cache name.
* @returns {Promise}
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/app/browser.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browser.js b/modules/web-console/backend/app/browser.js
index 2710829..499d84d 100644
--- a/modules/web-console/backend/app/browser.js
+++ b/modules/web-console/backend/app/browser.js
@@ -162,6 +162,19 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
.catch((err) => cb(_errorToJson(err)));
});
+ // Collect cache query metrics and return result to browser.
+ socket.on('node:query:reset:metrics', (nids, cb) => {
+ agentMgr.findAgent(accountId())
+ .then((agent) => agent.queryResetDetailMetrics(demo, nids))
+ .then((data) => {
+ if (data.finished)
+ return cb(null, data.result);
+
+ cb(_errorToJson(data.error));
+ })
+ .catch((err) => cb(_errorToJson(err)));
+ });
+
// Return cache metadata from all nodes in grid.
socket.on('node:cache:metadata', (cacheName, cb) => {
agentMgr.findAgent(accountId())
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 0f38eb2..58ab119 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -247,6 +247,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
longQueryWarningTimeout: Number,
sqlFunctionClasses: [String],
snapshotableIndex: Boolean,
+ queryDetailMetricsSize: Number,
statisticsEnabled: Boolean,
managementEnabled: Boolean,
readFromBackup: Boolean,
@@ -823,7 +824,24 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
Custom: {
className: String
}
- }]
+ }],
+ deploymentSpi: {
+ kind: {type: String, enum: ['URI', 'Local', 'Custom']},
+ URI: {
+ uriList: [String],
+ temporaryDirectoryPath: String,
+ scanners: [String],
+ listener: String,
+ checkMd5: Boolean,
+ encodeUri: Boolean
+ },
+ Local: {
+ listener: String
+ },
+ Custom: {
+ className: String
+ }
+ }
});
ClusterSchema.index({name: 1, space: 1}, {unique: true});
@@ -843,13 +861,15 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
result: {type: String, enum: ['none', 'table', 'bar', 'pie', 'line', 'area']},
pageSize: Number,
timeLineSpan: String,
+ maxPages: Number,
hideSystemColumns: Boolean,
cacheName: String,
chartsOptions: {barChart: {stacked: Boolean}, areaChart: {style: String}},
rate: {
value: Number,
unit: Number
- }
+ },
+ qryType: String
}]
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/routes/demo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/demo.js b/modules/web-console/backend/routes/demo.js
index ad4be6e..3f4166d 100644
--- a/modules/web-console/backend/routes/demo.js
+++ b/modules/web-console/backend/routes/demo.js
@@ -39,20 +39,17 @@ module.exports.factory = (_, express, settings, mongo, spacesService, errors) =>
router.post('/reset', (req, res) => {
spacesService.spaces(req.user._id, true)
.then((spaces) => {
- if (spaces.length) {
- const spaceIds = spaces.map((space) => space._id);
-
- return Promise.all([
- mongo.Cluster.remove({space: {$in: spaceIds}}).exec(),
- mongo.Cache.remove({space: {$in: spaceIds}}).exec(),
- mongo.DomainModel.remove({space: {$in: spaceIds}}).exec(),
- mongo.Igfs.remove({space: {$in: spaceIds}}).exec()
- ]).then(() => spaces[0]);
- }
+ const spaceIds = _.map(spaces, '_id');
+
+ return spacesService.cleanUp(spaceIds)
+ .then(() => mongo.Space.remove({_id: {$in: _.tail(spaceIds)}}).exec())
+ .then(() => _.head(spaces));
})
.catch((err) => {
if (err instanceof errors.MissingResourceException)
return spacesService.createDemoSpace(req.user._id);
+
+ throw err;
})
.then((space) => {
return Promise.all(_.map(clusters, (cluster) => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/routes/profile.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/profile.js b/modules/web-console/backend/routes/profile.js
index 4d01cda..1d6fccb 100644
--- a/modules/web-console/backend/routes/profile.js
+++ b/modules/web-console/backend/routes/profile.js
@@ -45,7 +45,7 @@ module.exports.factory = function(_, express, mongo, usersService) {
usersService.save(req.body)
.then((user) => {
- const becomeUsed = req.session.viewedUser && user.admin;
+ const becomeUsed = req.session.viewedUser && req.user.admin;
if (becomeUsed) {
req.session.viewedUser = user;
@@ -64,6 +64,7 @@ module.exports.factory = function(_, express, mongo, usersService) {
});
});
})
+ .then(() => usersService.get(req.user, req.session.viewedUser))
.then(res.api.ok)
.catch(res.api.error);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/services/notebooks.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/notebooks.js b/modules/web-console/backend/services/notebooks.js
index 8846d8e..9aa2c38 100644
--- a/modules/web-console/backend/services/notebooks.js
+++ b/modules/web-console/backend/services/notebooks.js
@@ -34,12 +34,14 @@ module.exports = {
module.exports.factory = (_, mongo, spacesService, errors) => {
/**
* Convert remove status operation to own presentation.
+ *
* @param {RemoveResult} result - The results of remove operation.
*/
const convertRemoveStatus = ({result}) => ({rowsAffected: result.n});
/**
- * Update existing notebook
+ * Update existing notebook.
+ *
* @param {Object} notebook - The notebook for updating
* @returns {Promise.<mongo.ObjectId>} that resolves cache id
*/
@@ -53,6 +55,7 @@ module.exports.factory = (_, mongo, spacesService, errors) => {
/**
* Create new notebook.
+ *
* @param {Object} notebook - The notebook for creation.
* @returns {Promise.<mongo.ObjectId>} that resolves cache id.
*/
@@ -67,6 +70,7 @@ module.exports.factory = (_, mongo, spacesService, errors) => {
class NotebooksService {
/**
* Create or update Notebook.
+ *
* @param {Object} notebook - The Notebook
* @returns {Promise.<mongo.ObjectId>} that resolves Notebook id of merge operation.
*/
@@ -78,16 +82,18 @@ module.exports.factory = (_, mongo, spacesService, errors) => {
}
/**
- * Get caches by spaces.
+ * Get notebooks by spaces.
+ *
* @param {mongo.ObjectId|String} spaceIds - The spaces ids that own caches.
- * @returns {Promise.<mongo.Cache[]>} - contains requested caches.
+ * @returns {Promise.<mongo.Notebook[]>} - contains requested caches.
*/
static listBySpaces(spaceIds) {
return mongo.Notebook.find({space: {$in: spaceIds}}).sort('name').lean().exec();
}
/**
- * Remove Notebook.
+ * Remove notebook.
+ *
* @param {mongo.ObjectId|String} notebookId - The Notebook id for remove.
* @returns {Promise.<{rowsAffected}>} - The number of affected rows.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/services/sessions.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/sessions.js b/modules/web-console/backend/services/sessions.js
index ff0e303..7f62a60 100644
--- a/modules/web-console/backend/services/sessions.js
+++ b/modules/web-console/backend/services/sessions.js
@@ -38,11 +38,11 @@ module.exports.factory = (_, mongo, errors) => {
* @param {mongo.ObjectId|String} viewedUserId - id of user to become.
*/
static become(session, viewedUserId) {
+ if (!session.req.user.admin)
+ return Promise.reject(new errors.IllegalAccessError('Became this user is not permitted. Only administrators can perform this actions.'));
+
return mongo.Account.findById(viewedUserId).lean().exec()
.then((viewedUser) => {
- if (!session.req.user.admin)
- throw new errors.IllegalAccessError('Became this user is not permitted. Only administrators can perform this actions.');
-
viewedUser.token = session.req.user.token;
session.viewedUser = viewedUser;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/backend/services/spaces.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/spaces.js b/modules/web-console/backend/services/spaces.js
index 863d57c..85f346e 100644
--- a/modules/web-console/backend/services/spaces.js
+++ b/modules/web-console/backend/services/spaces.js
@@ -68,6 +68,21 @@ module.exports.factory = (mongo, errors) => {
static createDemoSpace(userId) {
return new mongo.Space({name: 'Demo space', owner: userId, demo: true}).save();
}
+
+ /**
+ * Clean up spaces.
+ *
+ * @param {mongo.ObjectId|String} spaceIds - The space ids for clean up.
+ * @returns {Promise.<>}
+ */
+ static cleanUp(spaceIds) {
+ return Promise.all([
+ mongo.Cluster.remove({space: {$in: spaceIds}}).exec(),
+ mongo.Cache.remove({space: {$in: spaceIds}}).exec(),
+ mongo.DomainModel.remove({space: {$in: spaceIds}}).exec(),
+ mongo.Igfs.remove({space: {$in: spaceIds}}).exec()
+ ]);
+ }
}
return SpacesService;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 3510743..4ecd9b5 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -99,11 +99,6 @@ import domainsValidation from './filters/domainsValidation.filter';
import duration from './filters/duration.filter';
import hasPojo from './filters/hasPojo.filter';
-// Generators
-import $generatorOptional from './modules/configuration/generator/generator-optional';
-
-window.$generatorOptional = $generatorOptional;
-
// Controllers
import admin from 'controllers/admin-controller';
import caches from 'controllers/caches-controller';
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/controllers/reset-password.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/controllers/reset-password.controller.js b/modules/web-console/frontend/app/controllers/reset-password.controller.js
index da0c37b..f84a876 100644
--- a/modules/web-console/frontend/app/controllers/reset-password.controller.js
+++ b/modules/web-console/frontend/app/controllers/reset-password.controller.js
@@ -21,10 +21,10 @@ export default ['resetPassword', [
($scope, $modal, $http, $state, Messages, Focus) => {
if ($state.params.token) {
$http.post('/api/v1/password/validate/token', {token: $state.params.token})
- .success((res) => {
- $scope.email = res.email;
- $scope.token = res.token;
- $scope.error = res.error;
+ .then(({data}) => {
+ $scope.email = data.email;
+ $scope.token = data.token;
+ $scope.error = data.error;
if ($scope.token && !$scope.error)
Focus.move('user_password');
@@ -34,16 +34,16 @@ export default ['resetPassword', [
// Try to reset user password for provided token.
$scope.resetPassword = (reset_info) => {
$http.post('/api/v1/password/reset', reset_info)
- .success(() => {
+ .then(() => {
$state.go('signin');
Messages.showInfo('Password successfully changed');
})
- .error((err, state) => {
+ .catch(({data, state}) => {
if (state === 503)
$state.go('signin');
- Messages.showError(err);
+ Messages.showError(data);
});
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/data/event-groups.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/event-groups.json b/modules/web-console/frontend/app/data/event-groups.json
new file mode 100644
index 0000000..8d0c878
--- /dev/null
+++ b/modules/web-console/frontend/app/data/event-groups.json
@@ -0,0 +1,169 @@
+[
+ {
+ "label": "EVTS_CHECKPOINT",
+ "value": "EVTS_CHECKPOINT",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CHECKPOINT_SAVED",
+ "EVT_CHECKPOINT_LOADED",
+ "EVT_CHECKPOINT_REMOVED"
+ ]
+ },
+ {
+ "label": "EVTS_DEPLOYMENT",
+ "value": "EVTS_DEPLOYMENT",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CLASS_DEPLOYED",
+ "EVT_CLASS_UNDEPLOYED",
+ "EVT_CLASS_DEPLOY_FAILED",
+ "EVT_TASK_DEPLOYED",
+ "EVT_TASK_UNDEPLOYED",
+ "EVT_TASK_DEPLOY_FAILED"
+ ]
+ },
+ {
+ "label": "EVTS_ERROR",
+ "value": "EVTS_ERROR",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_JOB_TIMEDOUT",
+ "EVT_JOB_FAILED",
+ "EVT_JOB_FAILED_OVER",
+ "EVT_JOB_REJECTED",
+ "EVT_JOB_CANCELLED",
+ "EVT_TASK_TIMEDOUT",
+ "EVT_TASK_FAILED",
+ "EVT_CLASS_DEPLOY_FAILED",
+ "EVT_TASK_DEPLOY_FAILED",
+ "EVT_TASK_DEPLOYED",
+ "EVT_TASK_UNDEPLOYED",
+ "EVT_CACHE_REBALANCE_STARTED",
+ "EVT_CACHE_REBALANCE_STOPPED"
+ ]
+ },
+ {
+ "label": "EVTS_DISCOVERY",
+ "value": "EVTS_DISCOVERY",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_NODE_JOINED",
+ "EVT_NODE_LEFT",
+ "EVT_NODE_FAILED",
+ "EVT_NODE_SEGMENTED",
+ "EVT_CLIENT_NODE_DISCONNECTED",
+ "EVT_CLIENT_NODE_RECONNECTED"
+ ]
+ },
+ {
+ "label": "EVTS_JOB_EXECUTION",
+ "value": "EVTS_JOB_EXECUTION",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_JOB_MAPPED",
+ "EVT_JOB_RESULTED",
+ "EVT_JOB_FAILED_OVER",
+ "EVT_JOB_STARTED",
+ "EVT_JOB_FINISHED",
+ "EVT_JOB_TIMEDOUT",
+ "EVT_JOB_REJECTED",
+ "EVT_JOB_FAILED",
+ "EVT_JOB_QUEUED",
+ "EVT_JOB_CANCELLED"
+ ]
+ },
+ {
+ "label": "EVTS_TASK_EXECUTION",
+ "value": "EVTS_TASK_EXECUTION",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_TASK_STARTED",
+ "EVT_TASK_FINISHED",
+ "EVT_TASK_FAILED",
+ "EVT_TASK_TIMEDOUT",
+ "EVT_TASK_SESSION_ATTR_SET",
+ "EVT_TASK_REDUCED"
+ ]
+ },
+ {
+ "label": "EVTS_CACHE",
+ "value": "EVTS_CACHE",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CACHE_ENTRY_CREATED",
+ "EVT_CACHE_ENTRY_DESTROYED",
+ "EVT_CACHE_OBJECT_PUT",
+ "EVT_CACHE_OBJECT_READ",
+ "EVT_CACHE_OBJECT_REMOVED",
+ "EVT_CACHE_OBJECT_LOCKED",
+ "EVT_CACHE_OBJECT_UNLOCKED",
+ "EVT_CACHE_OBJECT_SWAPPED",
+ "EVT_CACHE_OBJECT_UNSWAPPED",
+ "EVT_CACHE_OBJECT_EXPIRED"
+ ]
+ },
+ {
+ "label": "EVTS_CACHE_REBALANCE",
+ "value": "EVTS_CACHE_REBALANCE",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CACHE_REBALANCE_STARTED",
+ "EVT_CACHE_REBALANCE_STOPPED",
+ "EVT_CACHE_REBALANCE_PART_LOADED",
+ "EVT_CACHE_REBALANCE_PART_UNLOADED",
+ "EVT_CACHE_REBALANCE_OBJECT_LOADED",
+ "EVT_CACHE_REBALANCE_OBJECT_UNLOADED",
+ "EVT_CACHE_REBALANCE_PART_DATA_LOST"
+ ]
+ },
+ {
+ "label": "EVTS_CACHE_LIFECYCLE",
+ "value": "EVTS_CACHE_LIFECYCLE",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CACHE_STARTED",
+ "EVT_CACHE_STOPPED",
+ "EVT_CACHE_NODES_LEFT"
+ ]
+ },
+ {
+ "label": "EVTS_CACHE_QUERY",
+ "value": "EVTS_CACHE_QUERY",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_CACHE_QUERY_EXECUTED",
+ "EVT_CACHE_QUERY_OBJECT_READ"
+ ]
+ },
+ {
+ "label": "EVTS_SWAPSPACE",
+ "value": "EVTS_SWAPSPACE",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_SWAP_SPACE_CLEARED",
+ "EVT_SWAP_SPACE_DATA_REMOVED",
+ "EVT_SWAP_SPACE_DATA_READ",
+ "EVT_SWAP_SPACE_DATA_STORED",
+ "EVT_SWAP_SPACE_DATA_EVICTED"
+ ]
+ },
+ {
+ "label": "EVTS_IGFS",
+ "value": "EVTS_IGFS",
+ "class": "org.apache.ignite.events.EventType",
+ "events": [
+ "EVT_IGFS_FILE_CREATED",
+ "EVT_IGFS_FILE_RENAMED",
+ "EVT_IGFS_FILE_DELETED",
+ "EVT_IGFS_FILE_OPENED_READ",
+ "EVT_IGFS_FILE_OPENED_WRITE",
+ "EVT_IGFS_FILE_CLOSED_WRITE",
+ "EVT_IGFS_FILE_CLOSED_READ",
+ "EVT_IGFS_FILE_PURGED",
+ "EVT_IGFS_META_UPDATED",
+ "EVT_IGFS_DIR_CREATED",
+ "EVT_IGFS_DIR_RENAMED",
+ "EVT_IGFS_DIR_DELETED"
+ ]
+ }
+]
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/data/event-types.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/event-types.json b/modules/web-console/frontend/app/data/event-types.json
deleted file mode 100644
index 8d0c878..0000000
--- a/modules/web-console/frontend/app/data/event-types.json
+++ /dev/null
@@ -1,169 +0,0 @@
-[
- {
- "label": "EVTS_CHECKPOINT",
- "value": "EVTS_CHECKPOINT",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CHECKPOINT_SAVED",
- "EVT_CHECKPOINT_LOADED",
- "EVT_CHECKPOINT_REMOVED"
- ]
- },
- {
- "label": "EVTS_DEPLOYMENT",
- "value": "EVTS_DEPLOYMENT",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CLASS_DEPLOYED",
- "EVT_CLASS_UNDEPLOYED",
- "EVT_CLASS_DEPLOY_FAILED",
- "EVT_TASK_DEPLOYED",
- "EVT_TASK_UNDEPLOYED",
- "EVT_TASK_DEPLOY_FAILED"
- ]
- },
- {
- "label": "EVTS_ERROR",
- "value": "EVTS_ERROR",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_JOB_TIMEDOUT",
- "EVT_JOB_FAILED",
- "EVT_JOB_FAILED_OVER",
- "EVT_JOB_REJECTED",
- "EVT_JOB_CANCELLED",
- "EVT_TASK_TIMEDOUT",
- "EVT_TASK_FAILED",
- "EVT_CLASS_DEPLOY_FAILED",
- "EVT_TASK_DEPLOY_FAILED",
- "EVT_TASK_DEPLOYED",
- "EVT_TASK_UNDEPLOYED",
- "EVT_CACHE_REBALANCE_STARTED",
- "EVT_CACHE_REBALANCE_STOPPED"
- ]
- },
- {
- "label": "EVTS_DISCOVERY",
- "value": "EVTS_DISCOVERY",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_NODE_JOINED",
- "EVT_NODE_LEFT",
- "EVT_NODE_FAILED",
- "EVT_NODE_SEGMENTED",
- "EVT_CLIENT_NODE_DISCONNECTED",
- "EVT_CLIENT_NODE_RECONNECTED"
- ]
- },
- {
- "label": "EVTS_JOB_EXECUTION",
- "value": "EVTS_JOB_EXECUTION",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_JOB_MAPPED",
- "EVT_JOB_RESULTED",
- "EVT_JOB_FAILED_OVER",
- "EVT_JOB_STARTED",
- "EVT_JOB_FINISHED",
- "EVT_JOB_TIMEDOUT",
- "EVT_JOB_REJECTED",
- "EVT_JOB_FAILED",
- "EVT_JOB_QUEUED",
- "EVT_JOB_CANCELLED"
- ]
- },
- {
- "label": "EVTS_TASK_EXECUTION",
- "value": "EVTS_TASK_EXECUTION",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_TASK_STARTED",
- "EVT_TASK_FINISHED",
- "EVT_TASK_FAILED",
- "EVT_TASK_TIMEDOUT",
- "EVT_TASK_SESSION_ATTR_SET",
- "EVT_TASK_REDUCED"
- ]
- },
- {
- "label": "EVTS_CACHE",
- "value": "EVTS_CACHE",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CACHE_ENTRY_CREATED",
- "EVT_CACHE_ENTRY_DESTROYED",
- "EVT_CACHE_OBJECT_PUT",
- "EVT_CACHE_OBJECT_READ",
- "EVT_CACHE_OBJECT_REMOVED",
- "EVT_CACHE_OBJECT_LOCKED",
- "EVT_CACHE_OBJECT_UNLOCKED",
- "EVT_CACHE_OBJECT_SWAPPED",
- "EVT_CACHE_OBJECT_UNSWAPPED",
- "EVT_CACHE_OBJECT_EXPIRED"
- ]
- },
- {
- "label": "EVTS_CACHE_REBALANCE",
- "value": "EVTS_CACHE_REBALANCE",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CACHE_REBALANCE_STARTED",
- "EVT_CACHE_REBALANCE_STOPPED",
- "EVT_CACHE_REBALANCE_PART_LOADED",
- "EVT_CACHE_REBALANCE_PART_UNLOADED",
- "EVT_CACHE_REBALANCE_OBJECT_LOADED",
- "EVT_CACHE_REBALANCE_OBJECT_UNLOADED",
- "EVT_CACHE_REBALANCE_PART_DATA_LOST"
- ]
- },
- {
- "label": "EVTS_CACHE_LIFECYCLE",
- "value": "EVTS_CACHE_LIFECYCLE",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CACHE_STARTED",
- "EVT_CACHE_STOPPED",
- "EVT_CACHE_NODES_LEFT"
- ]
- },
- {
- "label": "EVTS_CACHE_QUERY",
- "value": "EVTS_CACHE_QUERY",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_CACHE_QUERY_EXECUTED",
- "EVT_CACHE_QUERY_OBJECT_READ"
- ]
- },
- {
- "label": "EVTS_SWAPSPACE",
- "value": "EVTS_SWAPSPACE",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_SWAP_SPACE_CLEARED",
- "EVT_SWAP_SPACE_DATA_REMOVED",
- "EVT_SWAP_SPACE_DATA_READ",
- "EVT_SWAP_SPACE_DATA_STORED",
- "EVT_SWAP_SPACE_DATA_EVICTED"
- ]
- },
- {
- "label": "EVTS_IGFS",
- "value": "EVTS_IGFS",
- "class": "org.apache.ignite.events.EventType",
- "events": [
- "EVT_IGFS_FILE_CREATED",
- "EVT_IGFS_FILE_RENAMED",
- "EVT_IGFS_FILE_DELETED",
- "EVT_IGFS_FILE_OPENED_READ",
- "EVT_IGFS_FILE_OPENED_WRITE",
- "EVT_IGFS_FILE_CLOSED_WRITE",
- "EVT_IGFS_FILE_CLOSED_READ",
- "EVT_IGFS_FILE_PURGED",
- "EVT_IGFS_META_UPDATED",
- "EVT_IGFS_DIR_CREATED",
- "EVT_IGFS_DIR_RENAMED",
- "EVT_IGFS_DIR_DELETED"
- ]
- }
-]
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/data/pom-dependencies.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/pom-dependencies.json b/modules/web-console/frontend/app/data/pom-dependencies.json
index acf2bc8..7d2bed0 100644
--- a/modules/web-console/frontend/app/data/pom-dependencies.json
+++ b/modules/web-console/frontend/app/data/pom-dependencies.json
@@ -10,11 +10,11 @@
"HadoopIgfsJcl": {"artifactId": "ignite-hadoop"},
"SLF4J": {"artifactId": "ignite-slf4j"},
- "Generic": {"groupId": "com.mchange", "artifactId": "c3p0", "version": "0.9.5.1"},
- "MySQL": {"groupId": "mysql", "artifactId": "mysql-connector-java", "version": "5.1.37"},
- "PostgreSQL": {"groupId": "org.postgresql", "artifactId": "postgresql", "version": "9.4-1204-jdbc42"},
+ "Generic": {"groupId": "com.mchange", "artifactId": "c3p0", "version": "0.9.5.2"},
+ "MySQL": {"groupId": "mysql", "artifactId": "mysql-connector-java", "version": "5.1.40"},
+ "PostgreSQL": {"groupId": "org.postgresql", "artifactId": "postgresql", "version": "9.4.1212.jre7"},
"H2": {"groupId": "com.h2database", "artifactId": "h2", "version": "1.4.191"},
- "Oracle": {"groupId": "oracle", "artifactId": "jdbc", "version": "11.2", "jar": "ojdbc6.jar"},
- "DB2": {"groupId": "ibm", "artifactId": "jdbc", "version": "4.19.26", "jar": "db2jcc4.jar"},
- "SQLServer": {"groupId": "microsoft", "artifactId": "jdbc", "version": "4.1", "jar": "sqljdbc41.jar"}
+ "Oracle": {"groupId": "com.oracle.jdbc", "artifactId": "ojdbc7", "version": "12.1.0.2", "jar": "ojdbc7.jar"},
+ "DB2": {"groupId": "ibm", "artifactId": "jdbc", "version": "4.21.29", "jar": "db2jcc4.jar"},
+ "SQLServer": {"groupId": "microsoft", "artifactId": "jdbc", "version": "4.2", "jar": "sqljdbc41.jar"}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js
index 32feaf3..de335ae 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js
+++ b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-export default ['$scope', 'GeneratorDocker', function($scope, docker) {
+export default ['$scope', 'IgniteDockerGenerator', function($scope, docker) {
const ctrl = this;
// Watchers definition.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.jade b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.jade
index 3b0e7b8..3a24cfb 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.jade
+++ b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.jade
@@ -20,7 +20,7 @@ mixin hard-link(ref, txt)
.panel-details-noborder
.details-row
p
- +hard-link('https://docs.docker.com/reference/builder', 'Docker')
+ +hard-link('https://docs.docker.com/engine/reference/builder/', 'Docker')
| file is a text file with instructions to create Docker image.<br/>
| To build image you have to store following Docker file with your Ignite XML configuration to the same directory.<br>
| Also you could use predefined
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
index 4e11874..61bf086 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
+++ b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js
@@ -30,7 +30,7 @@ export default ['$scope', 'JavaTypes', 'JavaTransformer', function($scope, JavaT
const updatePojos = () => {
delete ctrl.pojos;
- if (!ctrl.cluster || !ctrl.cluster.caches)
+ if (_.isNil(ctrl.cluster) || _.isEmpty(ctrl.cluster.caches))
return;
ctrl.pojos = generator.pojos(ctrl.cluster.caches, ctrl.useConstructor, ctrl.includeKeyFields);
@@ -46,7 +46,7 @@ export default ['$scope', 'JavaTypes', 'JavaTransformer', function($scope, JavaT
const classes = ctrl.classes = [];
_.forEach(ctrl.pojos, (pojo) => {
- if (pojo.keyType && JavaTypes.nonBuiltInClass(pojo.keyType))
+ if (_.nonNil(pojo.keyClass))
classes.push(pojo.keyType);
classes.push(pojo.valueType);
@@ -55,17 +55,17 @@ export default ['$scope', 'JavaTypes', 'JavaTransformer', function($scope, JavaT
// Update pojos class.
const updateClass = (value) => {
- if (!value || !ctrl.pojos.length)
+ if (_.isEmpty(value))
return;
- const keyType = ctrl.pojos[0].keyType;
+ const pojo = value[0];
- ctrl.class = ctrl.class || (JavaTypes.nonBuiltInClass(keyType) ? keyType : null) || ctrl.pojos[0].valueType;
+ ctrl.class = ctrl.class || (pojo.keyClass ? pojo.keyType : pojo.valueType);
};
// Update pojos data.
const updatePojosData = (value) => {
- if (!value)
+ if (_.isNil(value))
return;
_.forEach(ctrl.pojos, (pojo) => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
index 2bf78c3..477cf20 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
+++ b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-export default ['$scope', 'GeneratorPom', 'IgniteVersion', function($scope, pom, Version) {
+export default ['$scope', 'IgniteMavenGenerator', 'IgniteVersion', function($scope, maven, Version) {
const ctrl = this;
// Watchers definition.
@@ -25,7 +25,7 @@ export default ['$scope', 'GeneratorPom', 'IgniteVersion', function($scope, pom,
if (!value)
return;
- ctrl.data = pom.generate($scope.cluster, Version.productVersion().ignite).asString();
+ ctrl.data = maven.generate($scope.cluster, Version.productVersion().ignite).asString();
};
// Setup watchers.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.jade b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.jade
index 298db52..33af6d1 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.jade
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.jade
@@ -28,7 +28,7 @@ mixin ignite-form-field-dropdown(label, model, name, disabled, required, multipl
data-ng-disabled=disabled && '#{disabled}' || '!#{options}.length'
bs-select
- bs-options='item.value as item.label for item in #{options}'
+ bs-options='item.value as item.label for item in #{options}'
data-multiple=multiple ? '1' : false
data-container='body > .wrapper'
@@ -41,7 +41,8 @@ mixin ignite-form-field-dropdown(label, model, name, disabled, required, multipl
.ignite-form-field
+ignite-form-field__label(label, name, required)
.ignite-form-field__control
- i.tipField.icon-help(bs-tooltip='' data-title=tip)
+ if tip
+ i.tipField.icon-help(bs-tooltip='' data-title=tip)
if block
block
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/helpers/jade/form/form-field-number.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-number.jade b/modules/web-console/frontend/app/helpers/jade/form/form-field-number.jade
index d48343c..58b0dcd 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-number.jade
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-number.jade
@@ -38,7 +38,8 @@ mixin ignite-form-field-number(label, model, name, disabled, required, placehold
.ignite-form-field
+ignite-form-field__label(label, name, required)
.ignite-form-field__control
- i.tipField.icon-help(bs-tooltip='' data-title=tip)
+ if tip
+ i.tipField.icon-help(bs-tooltip='' data-title=tip)
+form-field-feedback(name, 'required', 'This field could not be empty')
+form-field-feedback(name, 'min', 'Value is less than allowable minimum: '+ min || 0)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/helpers/jade/form/form-field-text.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.jade b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.jade
index 136d23b..1f93d3b 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.jade
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.jade
@@ -30,13 +30,30 @@ mixin ignite-form-field-input(name, model, disabled, required, placeholder)
data-ignite-form-panel-field=''
)&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes: {})
+mixin ignite-form-field-url-input(name, model, disabled, required, placeholder)
+ input.form-control(
+ id='{{ #{name} }}Input'
+ name='{{ #{name} }}'
+ placeholder=placeholder
+ type='url'
+
+ data-ng-model=model
+
+ data-ng-required=required && '#{required}'
+ data-ng-disabled=disabled && '#{disabled}'
+ data-ng-focus='tableReset()'
+
+ data-ignite-form-panel-field=''
+ )&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes: {})
+
mixin ignite-form-field-text(label, model, name, disabled, required, placeholder, tip)
-var errLbl = label.substring(0, label.length - 1)
.ignite-form-field
+ignite-form-field__label(label, name, required)
.ignite-form-field__control
- i.tipField.icon-help(bs-tooltip='' data-title=tip)
+ if tip
+ i.tipField.icon-help(bs-tooltip='' data-title=tip)
if block
block
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/helpers/jade/mixins.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.jade b/modules/web-console/frontend/app/helpers/jade/mixins.jade
index 92af1b0..6ca41f6 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.jade
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.jade
@@ -183,6 +183,14 @@ mixin text-enabled(lbl, model, name, enabled, required, placeholder, tip)
if block
block
+//- Mixin for text field with autofocus.
+mixin text-enabled-autofocus(lbl, model, name, enabled, required, placeholder, tip)
+ +ignite-form-field-text(lbl, model, name, enabledToDisabled(enabled), required, placeholder, tip)(
+ data-ignite-form-field-input-autofocus='true'
+ )
+ if block
+ block
+
//- Mixin for text field.
mixin text(lbl, model, name, required, placeholder, tip)
+ignite-form-field-text(lbl, model, name, false, required, placeholder, tip)
@@ -221,12 +229,28 @@ mixin dropdown-required-empty(lbl, model, name, enabled, required, placeholder,
if block
block
+//- Mixin for required dropdown field with autofocus.
+mixin dropdown-required-empty-autofocus(lbl, model, name, enabled, required, placeholder, placeholderEmpty, options, tip)
+ +ignite-form-field-dropdown(lbl, model, name, enabledToDisabled(enabled), required, false, placeholder, placeholderEmpty, options, tip)(
+ data-ignite-form-field-input-autofocus='true'
+ )
+ if block
+ block
+
//- Mixin for required dropdown field.
mixin dropdown-required(lbl, model, name, enabled, required, placeholder, options, tip)
+ignite-form-field-dropdown(lbl, model, name, enabledToDisabled(enabled), required, false, placeholder, '', options, tip)
if block
block
+//- Mixin for required dropdown field with autofocus.
+mixin dropdown-required-autofocus(lbl, model, name, enabled, required, placeholder, options, tip)
+ +ignite-form-field-dropdown(lbl, model, name, enabledToDisabled(enabled), required, false, placeholder, '', options, tip)(
+ data-ignite-form-field-input-autofocus='true'
+ )
+ if block
+ block
+
//- Mixin for dropdown field.
mixin dropdown(lbl, model, name, enabled, placeholder, options, tip)
+ignite-form-field-dropdown(lbl, model, name, enabledToDisabled(enabled), false, false, placeholder, '', options, tip)
@@ -324,6 +348,28 @@ mixin table-java-package-field(name, model, items, valid, save, newItem)
ignite-on-escape=onEscape
)
+//- Mixin for table java package field.
+mixin table-url-field(name, model, items, valid, save, newItem)
+ -var resetOnEnter = newItem ? '(stopblur = true) && (group.add = [{}])' : '(field.edit = false)'
+ -var onEnter = valid + ' && (' + save + '); ' + valid + ' && ' + resetOnEnter + ';'
+
+ -var onEscape = newItem ? 'group.add = []' : 'field.edit = false'
+
+ -var resetOnBlur = newItem ? '!stopblur && (group.add = [])' : 'field.edit = false'
+ -var onBlur = valid + ' && ( ' + save + '); ' + resetOnBlur + ';'
+
+ div(ignite-on-focus-out=onBlur)
+ if block
+ block
+
+ .input-tip
+ +ignite-form-field-url-input(name, model, false, 'true', 'Enter URL')(
+ data-ignite-unique=items
+ data-ignite-form-field-input-autofocus='true'
+
+ ignite-on-enter=onEnter
+ ignite-on-escape=onEscape
+ )
//- Mixin for table address field.
mixin table-address-field(name, model, items, valid, save, newItem, portRange)
@@ -393,17 +439,17 @@ mixin table-save-button(valid, save, newItem)
)
//- Mixin for table remove button.
-mixin table-remove-conditional-button(items, show, tip)
+mixin table-remove-conditional-button(items, show, tip, row)
i.tipField.fa.fa-remove(
ng-hide='!#{show} || field.edit'
bs-tooltip
data-title=tip
- ng-click='#{items}.splice(#{items}.indexOf(model), 1)'
+ ng-click='#{items}.splice(#{items}.indexOf(#{row}), 1)'
)
//- Mixin for table remove button.
mixin table-remove-button(items, tip)
- +table-remove-conditional-button(items, 'true', tip)
+ +table-remove-conditional-button(items, 'true', tip, 'model')
//- Mixin for cache mode.
mixin cacheMode(lbl, model, name, placeholder)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/Demo/Demo.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/Demo/Demo.module.js b/modules/web-console/frontend/app/modules/Demo/Demo.module.js
index 83d55ed..a3700ca 100644
--- a/modules/web-console/frontend/app/modules/Demo/Demo.module.js
+++ b/modules/web-console/frontend/app/modules/Demo/Demo.module.js
@@ -41,11 +41,11 @@ angular
url: '/demo/reset',
controller: ['$state', '$http', 'IgniteMessages', ($state, $http, Messages) => {
$http.post('/api/v1/demo/reset')
- .success(() => $state.go('base.configuration.clusters'))
- .error((err) => {
+ .then(() => $state.go('base.configuration.clusters'))
+ .catch((res) => {
$state.go('base.configuration.clusters');
- Messages.showError(err);
+ Messages.showError(res);
});
}],
metaTags: {}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/EventGroups.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/EventGroups.provider.js b/modules/web-console/frontend/app/modules/configuration/EventGroups.provider.js
deleted file mode 100644
index 61f3188..0000000
--- a/modules/web-console/frontend/app/modules/configuration/EventGroups.provider.js
+++ /dev/null
@@ -1,30 +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.
- */
-
-// Events groups.
-import GROUPS from 'app/data/event-types.json';
-
-export default ['igniteEventGroups', function() {
- const groups = GROUPS;
-
- this.push = (data) => groups.push(data);
-
- this.$get = [() => {
- return groups;
- }];
-}];
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/Version.service.js b/modules/web-console/frontend/app/modules/configuration/Version.service.js
index 06efdda..f0e9c4c 100644
--- a/modules/web-console/frontend/app/modules/configuration/Version.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/Version.service.js
@@ -22,7 +22,7 @@ const VERSION_MATCHER = /(\d+)\.(\d+)\.(\d+)([-.]([^0123456789][^-]+)(-SNAPSHOT)
const numberComparator = (a, b) => a > b ? 1 : a < b ? -1 : 0;
-export default class Version {
+export default class IgniteVersion {
/**
* Tries to parse product version from it's string representation.
*
@@ -70,7 +70,7 @@ export default class Version {
if (res !== 0)
return res;
- return numberComparator(pa.revTs, pb.maintenance);
+ return numberComparator(pa.revTs, pb.revTs);
}
/**
@@ -79,7 +79,7 @@ export default class Version {
*/
productVersion() {
return {
- ignite: '1.7.0'
+ ignite: '1.8.0'
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/configuration.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/configuration.module.js b/modules/web-console/frontend/app/modules/configuration/configuration.module.js
index 27f7bef..4288ff7 100644
--- a/modules/web-console/frontend/app/modules/configuration/configuration.module.js
+++ b/modules/web-console/frontend/app/modules/configuration/configuration.module.js
@@ -17,26 +17,28 @@
import angular from 'angular';
-import igniteEventGroups from './EventGroups.provider';
+
import igniteSidebar from './Sidebar.provider';
-import Version from './Version.service';
+import IgniteVersion from './Version.service';
-import clusterDefaults from './generator/defaults/cluster.provider';
-import clusterPlatformDefaults from './generator/defaults/cluster.platform.provider';
-import cacheDefaults from './generator/defaults/cache.provider';
-import cachePlatformDefaults from './generator/defaults/cache.platform.provider';
-import igfsDefaults from './generator/defaults/igfs.provider';
+import IgniteClusterDefaults from './generator/defaults/Cluster.service';
+import IgniteClusterPlatformDefaults from './generator/defaults/Cluster.platform.service';
+import IgniteCacheDefaults from './generator/defaults/Cache.service';
+import IgniteCachePlatformDefaults from './generator/defaults/Cache.platform.service';
+import IgniteIGFSDefaults from './generator/defaults/IGFS.service';
+import IgniteEventGroups from './generator/defaults/Event-groups.service';
-import ConfigurationGenerator from './generator/ConfigurationGenerator';
-import PlatformGenerator from './generator/PlatformGenerator';
+import IgniteConfigurationGenerator from './generator/ConfigurationGenerator';
+import IgnitePlatformGenerator from './generator/PlatformGenerator';
-import SpringTransformer from './generator/SpringTransformer.service';
-import JavaTransformer from './generator/JavaTransformer.service';
+import IgniteSpringTransformer from './generator/SpringTransformer.service';
+import IgniteJavaTransformer from './generator/JavaTransformer.service';
import SharpTransformer from './generator/SharpTransformer.service';
-import GeneratorDocker from './generator/Docker.service';
-import GeneratorPom from './generator/Pom.service';
-import GeneratorProperties from './generator/Properties.service';
-import GeneratorReadme from './generator/Readme.service';
+import IgniteDockerGenerator from './generator/Docker.service';
+import IgniteMavenGenerator from './generator/Maven.service';
+import IgniteGeneratorProperties from './generator/Properties.service';
+import IgniteReadmeGenerator from './generator/Readme.service';
+import IgniteCustomGenerator from './generator/Custom.service';
import igniteSidebarDirective from './sidebar.directive';
@@ -45,21 +47,22 @@ angular
.module('ignite-console.configuration', [
])
-.provider('igniteClusterDefaults', clusterDefaults)
-.provider('igniteClusterPlatformDefaults', clusterPlatformDefaults)
-.provider('igniteCacheDefaults', cacheDefaults)
-.provider('igniteCachePlatformDefaults', cachePlatformDefaults)
-.provider('igniteIgfsDefaults', igfsDefaults)
-.provider(...igniteEventGroups)
.provider(...igniteSidebar)
.directive(...igniteSidebarDirective)
-.service('IgniteVersion', Version)
-.service('IgniteConfigurationGenerator', ConfigurationGenerator)
-.service('IgnitePlatformGenerator', PlatformGenerator)
-.service('SpringTransformer', SpringTransformer)
-.service('JavaTransformer', JavaTransformer)
+.service('IgniteConfigurationGenerator', IgniteConfigurationGenerator)
+.service('IgnitePlatformGenerator', IgnitePlatformGenerator)
+.service('SpringTransformer', IgniteSpringTransformer)
+.service('JavaTransformer', IgniteJavaTransformer)
.service('IgniteSharpTransformer', SharpTransformer)
-.service('IgnitePropertiesGenerator', GeneratorProperties)
-.service('IgniteReadmeGenerator', GeneratorReadme)
-.service(...GeneratorDocker)
-.service(...GeneratorPom);
+.service('IgniteVersion', IgniteVersion)
+.service('IgniteEventGroups', IgniteEventGroups)
+.service('IgniteClusterDefaults', IgniteClusterDefaults)
+.service('IgniteClusterPlatformDefaults', IgniteClusterPlatformDefaults)
+.service('IgniteCacheDefaults', IgniteCacheDefaults)
+.service('IgniteCachePlatformDefaults', IgniteCachePlatformDefaults)
+.service('IgniteIGFSDefaults', IgniteIGFSDefaults)
+.service('IgnitePropertiesGenerator', IgniteGeneratorProperties)
+.service('IgniteReadmeGenerator', IgniteReadmeGenerator)
+.service('IgniteDockerGenerator', IgniteDockerGenerator)
+.service('IgniteMavenGenerator', IgniteMavenGenerator)
+.service('IgniteCustomGenerator', IgniteCustomGenerator);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/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 6244a53..f5afe59 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -17,7 +17,24 @@
import StringBuilder from './StringBuilder';
+import IgniteConfigurationGenerator from './ConfigurationGenerator';
+import IgniteEventGroups from './defaults/Event-groups.service';
+
+import IgniteClusterDefaults from './defaults/Cluster.service';
+import IgniteCacheDefaults from './defaults/Cache.service';
+import IgniteIGFSDefaults from './defaults/IGFS.service';
+
+import JavaTypes from '../../../services/JavaTypes.service';
+
+const clusterDflts = new IgniteClusterDefaults();
+const cacheDflts = new IgniteCacheDefaults();
+const igfsDflts = new IgniteIGFSDefaults();
+
export default class AbstractTransformer {
+ static generator = IgniteConfigurationGenerator;
+ static javaTypes = new JavaTypes(clusterDflts, cacheDflts, igfsDflts);
+ static eventGroups = new IgniteEventGroups();
+
// Append comment with time stamp.
static mainComment(sb, ...lines) {
lines.push(sb.generatedBy());
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Beans.js b/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
index 2750626..ca19342 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Beans.js
@@ -17,6 +17,11 @@
import _ from 'lodash';
+_.mixin({
+ nonNil: _.negate(_.isNil),
+ nonEmpty: _.negate(_.isEmpty)
+});
+
export class EmptyBean {
/**
* @param {String} clsName
[25/37] ignite git commit: IGNITE-3430 .NET: Refactor transactional
tests to a separate class
Posted by vo...@apache.org.
IGNITE-3430 .NET: Refactor transactional tests to a separate class
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/864af7eb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/864af7eb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/864af7eb
Branch: refs/heads/ignite-2.0
Commit: 864af7eb48f19b8d6350332100f741fcdccdb5ad
Parents: 06ef846
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Dec 28 13:55:26 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Dec 28 13:55:26 2016 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Cache/CacheAbstractTest.cs | 625 -------------------
.../Cache/CacheAbstractTransactionalTest.cs | 556 +++++++++++++++++
.../Cache/CacheLocalAtomicTest.cs | 5 -
.../Cache/CacheLocalTest.cs | 6 +-
.../CachePartitionedAtomicNearEnabledTest.cs | 5 -
.../Cache/CachePartitionedAtomicTest.cs | 5 -
.../Cache/CachePartitionedNearEnabledTest.cs | 7 +-
.../Cache/CachePartitionedTest.cs | 7 +-
.../Cache/CacheReplicatedAtomicTest.cs | 5 -
.../Cache/CacheReplicatedTest.cs | 7 +-
11 files changed, 561 insertions(+), 668 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index f440c25..5948593 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -71,6 +71,7 @@
<Compile Include="Cache\CacheMetricsTest.cs" />
<Compile Include="Cache\CacheResultTest.cs" />
<Compile Include="Cache\CacheSwapSpaceTest.cs" />
+ <Compile Include="Cache\CacheAbstractTransactionalTest.cs" />
<Compile Include="Cache\Store\CacheStoreAdapterTest.cs" />
<Compile Include="Collections\MultiValueDictionaryTest.cs" />
<Compile Include="Collections\ReadOnlyCollectionTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 821a179..250f974 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -1917,621 +1917,6 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Simple cache lock test (while <see cref="TestLock"/> is ignored).
- /// </summary>
- [Test]
- public void TestLockSimple()
- {
- if (!LockingEnabled())
- return;
-
- var cache = Cache();
-
- const int key = 7;
-
- Action<ICacheLock> checkLock = lck =>
- {
- using (lck)
- {
- Assert.Throws<InvalidOperationException>(lck.Exit); // can't exit if not entered
-
- lck.Enter();
-
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- lck.Exit();
-
- Assert.IsFalse(cache.IsLocalLocked(key, true));
- Assert.IsFalse(cache.IsLocalLocked(key, false));
-
- Assert.IsTrue(lck.TryEnter());
-
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- lck.Exit();
- }
-
- Assert.Throws<ObjectDisposedException>(lck.Enter); // Can't enter disposed lock
- };
-
- checkLock(cache.Lock(key));
- checkLock(cache.LockAll(new[] {key, 1, 2, 3}));
- }
-
- [Test]
- [Ignore("IGNITE-835")]
- public void TestLock()
- {
- if (!LockingEnabled())
- return;
-
- var cache = Cache();
-
- const int key = 7;
-
- // Lock
- CheckLock(cache, key, () => cache.Lock(key));
-
- // LockAll
- CheckLock(cache, key, () => cache.LockAll(new[] { key, 2, 3, 4, 5 }));
- }
-
- /// <summary>
- /// Internal lock test routine.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <param name="key">Key.</param>
- /// <param name="getLock">Function to get the lock.</param>
- private static void CheckLock(ICache<int, int> cache, int key, Func<ICacheLock> getLock)
- {
- var sharedLock = getLock();
-
- using (sharedLock)
- {
- Assert.Throws<InvalidOperationException>(() => sharedLock.Exit()); // can't exit if not entered
-
- sharedLock.Enter();
-
- try
- {
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
-
- sharedLock.Enter();
-
- try
- {
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
- }
- finally
- {
- sharedLock.Exit();
- }
-
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
-
- Assert.Throws<SynchronizationLockException>(() => sharedLock.Dispose()); // can't dispose while locked
- }
- finally
- {
- sharedLock.Exit();
- }
-
- Assert.IsFalse(cache.IsLocalLocked(key, true));
- Assert.IsFalse(cache.IsLocalLocked(key, false));
-
- var innerTask = new Task(() =>
- {
- Assert.IsTrue(sharedLock.TryEnter());
- sharedLock.Exit();
-
- using (var otherLock = getLock())
- {
- Assert.IsTrue(otherLock.TryEnter());
- otherLock.Exit();
- }
- });
-
- innerTask.Start();
- innerTask.Wait();
- }
-
- Assert.IsFalse(cache.IsLocalLocked(key, true));
- Assert.IsFalse(cache.IsLocalLocked(key, false));
-
- var outerTask = new Task(() =>
- {
- using (var otherLock = getLock())
- {
- Assert.IsTrue(otherLock.TryEnter());
- otherLock.Exit();
- }
- });
-
- outerTask.Start();
- outerTask.Wait();
-
- Assert.Throws<ObjectDisposedException>(() => sharedLock.Enter()); // Can't enter disposed lock
- }
-
- /// <summary>
- /// Ensure that lock cannot be obtained by other threads.
- /// </summary>
- /// <param name="getLock">Get lock function.</param>
- /// <param name="sharedLock">Shared lock.</param>
- private static void EnsureCannotLock(Func<ICacheLock> getLock, ICacheLock sharedLock)
- {
- var task = new Task(() =>
- {
- Assert.IsFalse(sharedLock.TryEnter());
- Assert.IsFalse(sharedLock.TryEnter(TimeSpan.FromMilliseconds(100)));
-
- using (var otherLock = getLock())
- {
- Assert.IsFalse(otherLock.TryEnter());
- Assert.IsFalse(otherLock.TryEnter(TimeSpan.FromMilliseconds(100)));
- }
- });
-
- task.Start();
- task.Wait();
- }
-
- [Test]
- public void TestTxCommit()
- {
- TestTxCommit(false);
- }
-
- [Test]
- public void TestTxCommitAsync()
- {
- TestTxCommit(true);
- }
-
- private void TestTxCommit(bool async)
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try
- {
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- if (async)
- {
- var task = tx.CommitAsync();
-
- task.Wait();
-
- Assert.IsTrue(task.IsCompleted);
- }
- else
- tx.Commit();
- }
- finally
- {
- tx.Dispose();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxRollback()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try {
- cache.Put(1, 10);
-
- cache.Put(2, 20);
- }
- finally {
- tx.Rollback();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- Assert.IsNull(Transactions.Tx);
- }
-
- [Test]
- public void TestTxClose()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try
- {
- cache.Put(1, 10);
-
- cache.Put(2, 20);
- }
- finally
- {
- tx.Dispose();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxAllModes()
- {
- TestTxAllModes(false);
-
- TestTxAllModes(true);
-
- Console.WriteLine("Done");
- }
-
- protected void TestTxAllModes(bool withTimeout)
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- int cntr = 0;
-
- foreach (TransactionConcurrency concurrency in Enum.GetValues(typeof(TransactionConcurrency))) {
- foreach (TransactionIsolation isolation in Enum.GetValues(typeof(TransactionIsolation))) {
- Console.WriteLine("Test tx [concurrency=" + concurrency + ", isolation=" + isolation + "]");
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = withTimeout
- ? Transactions.TxStart(concurrency, isolation, TimeSpan.FromMilliseconds(1100), 10)
- : Transactions.TxStart(concurrency, isolation);
-
- Assert.AreEqual(concurrency, tx.Concurrency);
- Assert.AreEqual(isolation, tx.Isolation);
-
- if (withTimeout)
- Assert.AreEqual(1100, tx.Timeout.TotalMilliseconds);
-
- try {
- cache.Put(1, cntr);
-
- tx.Commit();
- }
- finally {
- tx.Dispose();
- }
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- Assert.AreEqual(cntr, cache.Get(1));
-
- cntr++;
- }
- }
- }
-
- [Test]
- public void TestTxAttributes()
- {
- if (!TxEnabled())
- return;
-
- ITransaction tx = Transactions.TxStart(TransactionConcurrency.Optimistic,
- TransactionIsolation.RepeatableRead, TimeSpan.FromMilliseconds(2500), 100);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime.Ticks > 0);
- Assert.AreEqual(tx.NodeId, GetIgnite(0).GetCluster().GetLocalNode().Id);
-
- DateTime startTime1 = tx.StartTime;
-
- tx.Commit();
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionState.Committed, tx.State);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime1, tx.StartTime);
-
- Thread.Sleep(100);
-
- tx = Transactions.TxStart(TransactionConcurrency.Pessimistic, TransactionIsolation.ReadCommitted,
- TimeSpan.FromMilliseconds(3500), 200);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
- Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime.Ticks > 0);
- Assert.IsTrue(tx.StartTime > startTime1);
-
- DateTime startTime2 = tx.StartTime;
-
- tx.Rollback();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
- Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
- Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime2, tx.StartTime);
-
- Thread.Sleep(100);
-
- tx = Transactions.TxStart(TransactionConcurrency.Optimistic, TransactionIsolation.RepeatableRead,
- TimeSpan.FromMilliseconds(2500), 100);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime > startTime2);
-
- DateTime startTime3 = tx.StartTime;
-
- tx.Commit();
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionState.Committed, tx.State);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime3, tx.StartTime);
- }
-
- [Test]
- public void TestTxRollbackOnly()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.TxStart();
-
- cache.Put(1, 10);
-
- cache.Put(2, 20);
-
- Assert.IsFalse(tx.IsRollbackOnly);
-
- tx.SetRollbackonly();
-
- Assert.IsTrue(tx.IsRollbackOnly);
-
- Assert.AreEqual(TransactionState.MarkedRollback, tx.State);
-
- try
- {
- tx.Commit();
-
- Assert.Fail("Commit must fail.");
- }
- catch (IgniteException e)
- {
- Console.WriteLine("Expected exception: " + e);
- }
-
- tx.Dispose();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
-
- Assert.IsTrue(tx.IsRollbackOnly);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxMetrics()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- var startTime = DateTime.UtcNow.AddSeconds(-1);
-
- Transactions.ResetMetrics();
-
- var metrics = Transactions.GetMetrics();
-
- Assert.AreEqual(0, metrics.TxCommits);
- Assert.AreEqual(0, metrics.TxRollbacks);
-
- using (Transactions.TxStart())
- {
- cache.Put(1, 1);
- }
-
- using (var tx = Transactions.TxStart())
- {
- cache.Put(1, 1);
- tx.Commit();
- }
-
- metrics = Transactions.GetMetrics();
-
- Assert.AreEqual(1, metrics.TxCommits);
- Assert.AreEqual(1, metrics.TxRollbacks);
-
- Assert.LessOrEqual(startTime, metrics.CommitTime);
- Assert.LessOrEqual(startTime, metrics.RollbackTime);
-
- Assert.GreaterOrEqual(DateTime.UtcNow, metrics.CommitTime);
- Assert.GreaterOrEqual(DateTime.UtcNow, metrics.RollbackTime);
- }
-
- [Test]
- public void TestTxStateAndExceptions()
- {
- if (!TxEnabled())
- return;
-
- var tx = Transactions.TxStart();
-
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.AreEqual(Thread.CurrentThread.ManagedThreadId, tx.ThreadId);
-
- tx.AddMeta("myMeta", 42);
- Assert.AreEqual(42, tx.Meta<int>("myMeta"));
- Assert.AreEqual(42, tx.RemoveMeta<int>("myMeta"));
-
- tx.RollbackAsync().Wait();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
-
- try
- {
- tx.Commit();
- Assert.Fail();
- }
- catch (InvalidOperationException)
- {
- // Expected
- }
-
- tx = Transactions.TxStart();
-
- Assert.AreEqual(TransactionState.Active, tx.State);
-
- tx.CommitAsync().Wait();
-
- Assert.AreEqual(TransactionState.Committed, tx.State);
-
- var task = tx.RollbackAsync(); // Illegal, but should not fail here; will fail in task
-
- try
- {
- task.Wait();
- Assert.Fail();
- }
- catch (AggregateException)
- {
- // Expected
- }
- }
-
- /// <summary>
- /// Tests the transaction deadlock detection.
- /// </summary>
- [Test]
- public void TestTxDeadlockDetection()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- var keys0 = Enumerable.Range(1, 100).ToArray();
-
- cache.PutAll(keys0.ToDictionary(x => x, x => x));
-
- var barrier = new Barrier(2);
-
- Action<int[]> increment = keys =>
- {
- using (var tx = Transactions.TxStart(TransactionConcurrency.Pessimistic,
- TransactionIsolation.RepeatableRead, TimeSpan.FromSeconds(0.5), 0))
- {
- foreach (var key in keys)
- cache[key]++;
-
- barrier.SignalAndWait(500);
-
- tx.Commit();
- }
- };
-
- // Increment keys within tx in different order to cause a deadlock.
- var aex = Assert.Throws<AggregateException>(() =>
- Task.WaitAll(Task.Factory.StartNew(() => increment(keys0)),
- Task.Factory.StartNew(() => increment(keys0.Reverse().ToArray()))));
-
- Assert.AreEqual(2, aex.InnerExceptions.Count);
-
- var deadlockEx = aex.InnerExceptions.OfType<TransactionDeadlockException>().First();
- Assert.IsTrue(deadlockEx.Message.Trim().StartsWith("Deadlock detected:"), deadlockEx.Message);
- }
-
- /// <summary>
/// Test thraed-locals leak.
/// </summary>
[Test]
@@ -3404,16 +2789,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected virtual bool TxEnabled()
- {
- return true;
- }
-
- protected bool LockingEnabled()
- {
- return TxEnabled();
- }
-
protected virtual bool LocalCache()
{
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
new file mode 100644
index 0000000..e836ba2
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
@@ -0,0 +1,556 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache
+{
+ using System;
+ using System.Linq;
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Apache.Ignite.Core.Cache;
+ using Apache.Ignite.Core.Transactions;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Transactional cache tests.
+ /// </summary>
+ public abstract class CacheAbstractTransactionalTest : CacheAbstractTest
+ {
+ /// <summary>
+ /// Simple cache lock test (while <see cref="TestLock"/> is ignored).
+ /// </summary>
+ [Test]
+ public void TestLockSimple()
+ {
+ var cache = Cache();
+
+ const int key = 7;
+
+ Action<ICacheLock> checkLock = lck =>
+ {
+ using (lck)
+ {
+ Assert.Throws<InvalidOperationException>(lck.Exit); // can't exit if not entered
+
+ lck.Enter();
+
+ Assert.IsTrue(cache.IsLocalLocked(key, true));
+ Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+ lck.Exit();
+
+ Assert.IsFalse(cache.IsLocalLocked(key, true));
+ Assert.IsFalse(cache.IsLocalLocked(key, false));
+
+ Assert.IsTrue(lck.TryEnter());
+
+ Assert.IsTrue(cache.IsLocalLocked(key, true));
+ Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+ lck.Exit();
+ }
+
+ Assert.Throws<ObjectDisposedException>(lck.Enter); // Can't enter disposed lock
+ };
+
+ checkLock(cache.Lock(key));
+ checkLock(cache.LockAll(new[] { key, 1, 2, 3 }));
+ }
+
+ /// <summary>
+ /// Tests cache locks.
+ /// </summary>
+ [Test]
+ [Ignore("IGNITE-835")]
+ public void TestLock()
+ {
+ var cache = Cache();
+
+ const int key = 7;
+
+ // Lock
+ CheckLock(cache, key, () => cache.Lock(key));
+
+ // LockAll
+ CheckLock(cache, key, () => cache.LockAll(new[] { key, 2, 3, 4, 5 }));
+ }
+
+ /// <summary>
+ /// Internal lock test routine.
+ /// </summary>
+ /// <param name="cache">Cache.</param>
+ /// <param name="key">Key.</param>
+ /// <param name="getLock">Function to get the lock.</param>
+ private static void CheckLock(ICache<int, int> cache, int key, Func<ICacheLock> getLock)
+ {
+ var sharedLock = getLock();
+
+ using (sharedLock)
+ {
+ Assert.Throws<InvalidOperationException>(() => sharedLock.Exit()); // can't exit if not entered
+
+ sharedLock.Enter();
+
+ try
+ {
+ Assert.IsTrue(cache.IsLocalLocked(key, true));
+ Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+ EnsureCannotLock(getLock, sharedLock);
+
+ sharedLock.Enter();
+
+ try
+ {
+ Assert.IsTrue(cache.IsLocalLocked(key, true));
+ Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+ EnsureCannotLock(getLock, sharedLock);
+ }
+ finally
+ {
+ sharedLock.Exit();
+ }
+
+ Assert.IsTrue(cache.IsLocalLocked(key, true));
+ Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+ EnsureCannotLock(getLock, sharedLock);
+
+ Assert.Throws<SynchronizationLockException>(() => sharedLock.Dispose()); // can't dispose while locked
+ }
+ finally
+ {
+ sharedLock.Exit();
+ }
+
+ Assert.IsFalse(cache.IsLocalLocked(key, true));
+ Assert.IsFalse(cache.IsLocalLocked(key, false));
+
+ var innerTask = new Task(() =>
+ {
+ Assert.IsTrue(sharedLock.TryEnter());
+ sharedLock.Exit();
+
+ using (var otherLock = getLock())
+ {
+ Assert.IsTrue(otherLock.TryEnter());
+ otherLock.Exit();
+ }
+ });
+
+ innerTask.Start();
+ innerTask.Wait();
+ }
+
+ Assert.IsFalse(cache.IsLocalLocked(key, true));
+ Assert.IsFalse(cache.IsLocalLocked(key, false));
+
+ var outerTask = new Task(() =>
+ {
+ using (var otherLock = getLock())
+ {
+ Assert.IsTrue(otherLock.TryEnter());
+ otherLock.Exit();
+ }
+ });
+
+ outerTask.Start();
+ outerTask.Wait();
+
+ Assert.Throws<ObjectDisposedException>(() => sharedLock.Enter()); // Can't enter disposed lock
+ }
+
+ /// <summary>
+ /// Ensure that lock cannot be obtained by other threads.
+ /// </summary>
+ /// <param name="getLock">Get lock function.</param>
+ /// <param name="sharedLock">Shared lock.</param>
+ private static void EnsureCannotLock(Func<ICacheLock> getLock, ICacheLock sharedLock)
+ {
+ var task = new Task(() =>
+ {
+ Assert.IsFalse(sharedLock.TryEnter());
+ Assert.IsFalse(sharedLock.TryEnter(TimeSpan.FromMilliseconds(100)));
+
+ using (var otherLock = getLock())
+ {
+ Assert.IsFalse(otherLock.TryEnter());
+ Assert.IsFalse(otherLock.TryEnter(TimeSpan.FromMilliseconds(100)));
+ }
+ });
+
+ task.Start();
+ task.Wait();
+ }
+
+ /// <summary>
+ /// Tests that commit applies cache changes.
+ /// </summary>
+ [Test]
+ public void TestTxCommit([Values(true, false)] bool async)
+ {
+ var cache = Cache();
+
+ Assert.IsNull(Transactions.Tx);
+
+ using (var tx = Transactions.TxStart())
+ {
+ cache.Put(1, 1);
+ cache.Put(2, 2);
+
+ if (async)
+ {
+ var task = tx.CommitAsync();
+
+ task.Wait();
+
+ Assert.IsTrue(task.IsCompleted);
+ }
+ else
+ tx.Commit();
+ }
+
+ Assert.AreEqual(1, cache.Get(1));
+ Assert.AreEqual(2, cache.Get(2));
+
+ Assert.IsNull(Transactions.Tx);
+ }
+
+ /// <summary>
+ /// Tests that rollback reverts cache changes.
+ /// </summary>
+ [Test]
+ public void TestTxRollback()
+ {
+ var cache = Cache();
+
+ cache.Put(1, 1);
+ cache.Put(2, 2);
+
+ Assert.IsNull(Transactions.Tx);
+
+ using (var tx = Transactions.TxStart())
+ {
+ cache.Put(1, 10);
+ cache.Put(2, 20);
+
+ tx.Rollback();
+ }
+
+ Assert.AreEqual(1, cache.Get(1));
+ Assert.AreEqual(2, cache.Get(2));
+
+ Assert.IsNull(Transactions.Tx);
+ }
+
+ /// <summary>
+ /// Tests that Dispose without Commit reverts changes.
+ /// </summary>
+ [Test]
+ public void TestTxClose()
+ {
+ var cache = Cache();
+
+ cache.Put(1, 1);
+ cache.Put(2, 2);
+
+ Assert.IsNull(Transactions.Tx);
+
+ using (Transactions.TxStart())
+ {
+ cache.Put(1, 10);
+ cache.Put(2, 20);
+ }
+
+ Assert.AreEqual(1, cache.Get(1));
+ Assert.AreEqual(2, cache.Get(2));
+
+ Assert.IsNull(Transactions.Tx);
+ }
+
+ /// <summary>
+ /// Tests all concurrency and isolation modes with and without timeout.
+ /// </summary>
+ [Test]
+ public void TestTxAllModes([Values(true, false)] bool withTimeout)
+ {
+ var cache = Cache();
+
+ int cntr = 0;
+
+ foreach (TransactionConcurrency concurrency in Enum.GetValues(typeof(TransactionConcurrency)))
+ {
+ foreach (TransactionIsolation isolation in Enum.GetValues(typeof(TransactionIsolation)))
+ {
+ Console.WriteLine("Test tx [concurrency=" + concurrency + ", isolation=" + isolation + "]");
+
+ Assert.IsNull(Transactions.Tx);
+
+ using (var tx = withTimeout
+ ? Transactions.TxStart(concurrency, isolation, TimeSpan.FromMilliseconds(1100), 10)
+ : Transactions.TxStart(concurrency, isolation))
+ {
+
+ Assert.AreEqual(concurrency, tx.Concurrency);
+ Assert.AreEqual(isolation, tx.Isolation);
+
+ if (withTimeout)
+ Assert.AreEqual(1100, tx.Timeout.TotalMilliseconds);
+
+ cache.Put(1, cntr);
+
+ tx.Commit();
+ }
+
+ Assert.IsNull(Transactions.Tx);
+
+ Assert.AreEqual(cntr, cache.Get(1));
+
+ cntr++;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Tests that transaction properties are applied and propagated properly.
+ /// </summary>
+ [Test]
+ public void TestTxAttributes()
+ {
+ ITransaction tx = Transactions.TxStart(TransactionConcurrency.Optimistic,
+ TransactionIsolation.RepeatableRead, TimeSpan.FromMilliseconds(2500), 100);
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+ Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
+ Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(TransactionState.Active, tx.State);
+ Assert.IsTrue(tx.StartTime.Ticks > 0);
+ Assert.AreEqual(tx.NodeId, GetIgnite(0).GetCluster().GetLocalNode().Id);
+
+ DateTime startTime1 = tx.StartTime;
+
+ tx.Commit();
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+ Assert.AreEqual(TransactionState.Committed, tx.State);
+ Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
+ Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(startTime1, tx.StartTime);
+
+ Thread.Sleep(100);
+
+ tx = Transactions.TxStart(TransactionConcurrency.Pessimistic, TransactionIsolation.ReadCommitted,
+ TimeSpan.FromMilliseconds(3500), 200);
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+ Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
+ Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(TransactionState.Active, tx.State);
+ Assert.IsTrue(tx.StartTime.Ticks > 0);
+ Assert.IsTrue(tx.StartTime > startTime1);
+
+ DateTime startTime2 = tx.StartTime;
+
+ tx.Rollback();
+
+ Assert.AreEqual(TransactionState.RolledBack, tx.State);
+ Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
+ Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(startTime2, tx.StartTime);
+
+ Thread.Sleep(100);
+
+ tx = Transactions.TxStart(TransactionConcurrency.Optimistic, TransactionIsolation.RepeatableRead,
+ TimeSpan.FromMilliseconds(2500), 100);
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+ Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
+ Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(TransactionState.Active, tx.State);
+ Assert.IsTrue(tx.StartTime > startTime2);
+
+ DateTime startTime3 = tx.StartTime;
+
+ tx.Commit();
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+ Assert.AreEqual(TransactionState.Committed, tx.State);
+ Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
+ Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
+ Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
+ Assert.AreEqual(startTime3, tx.StartTime);
+ }
+
+ /// <summary>
+ /// Tests <see cref="ITransaction.IsRollbackOnly"/> flag.
+ /// </summary>
+ [Test]
+ public void TestTxRollbackOnly()
+ {
+ var cache = Cache();
+
+ cache.Put(1, 1);
+ cache.Put(2, 2);
+
+ var tx = Transactions.TxStart();
+
+ cache.Put(1, 10);
+ cache.Put(2, 20);
+
+ Assert.IsFalse(tx.IsRollbackOnly);
+
+ tx.SetRollbackonly();
+
+ Assert.IsTrue(tx.IsRollbackOnly);
+
+ Assert.AreEqual(TransactionState.MarkedRollback, tx.State);
+
+ var ex = Assert.Throws<TransactionRollbackException>(() => tx.Commit());
+ Assert.IsTrue(ex.Message.StartsWith("Invalid transaction state for prepare [state=MARKED_ROLLBACK"));
+
+ tx.Dispose();
+
+ Assert.AreEqual(TransactionState.RolledBack, tx.State);
+
+ Assert.IsTrue(tx.IsRollbackOnly);
+
+ Assert.AreEqual(1, cache.Get(1));
+ Assert.AreEqual(2, cache.Get(2));
+
+ Assert.IsNull(Transactions.Tx);
+ }
+
+ /// <summary>
+ /// Tests transaction metrics.
+ /// </summary>
+ [Test]
+ public void TestTxMetrics()
+ {
+ var cache = Cache();
+
+ var startTime = DateTime.UtcNow.AddSeconds(-1);
+
+ Transactions.ResetMetrics();
+
+ var metrics = Transactions.GetMetrics();
+
+ Assert.AreEqual(0, metrics.TxCommits);
+ Assert.AreEqual(0, metrics.TxRollbacks);
+
+ using (Transactions.TxStart())
+ {
+ cache.Put(1, 1);
+ }
+
+ using (var tx = Transactions.TxStart())
+ {
+ cache.Put(1, 1);
+ tx.Commit();
+ }
+
+ metrics = Transactions.GetMetrics();
+
+ Assert.AreEqual(1, metrics.TxCommits);
+ Assert.AreEqual(1, metrics.TxRollbacks);
+
+ Assert.LessOrEqual(startTime, metrics.CommitTime);
+ Assert.LessOrEqual(startTime, metrics.RollbackTime);
+
+ Assert.GreaterOrEqual(DateTime.UtcNow, metrics.CommitTime);
+ Assert.GreaterOrEqual(DateTime.UtcNow, metrics.RollbackTime);
+ }
+
+ /// <summary>
+ /// Tests transaction state transitions.
+ /// </summary>
+ [Test]
+ public void TestTxStateAndExceptions()
+ {
+ var tx = Transactions.TxStart();
+
+ Assert.AreEqual(TransactionState.Active, tx.State);
+ Assert.AreEqual(Thread.CurrentThread.ManagedThreadId, tx.ThreadId);
+
+ tx.AddMeta("myMeta", 42);
+ Assert.AreEqual(42, tx.Meta<int>("myMeta"));
+ Assert.AreEqual(42, tx.RemoveMeta<int>("myMeta"));
+
+ tx.RollbackAsync().Wait();
+
+ Assert.AreEqual(TransactionState.RolledBack, tx.State);
+
+ Assert.Throws<InvalidOperationException>(() => tx.Commit());
+
+ tx = Transactions.TxStart();
+
+ Assert.AreEqual(TransactionState.Active, tx.State);
+
+ tx.CommitAsync().Wait();
+
+ Assert.AreEqual(TransactionState.Committed, tx.State);
+
+ var task = tx.RollbackAsync(); // Illegal, but should not fail here; will fail in task
+
+ Assert.Throws<AggregateException>(() => task.Wait());
+ }
+
+ /// <summary>
+ /// Tests the transaction deadlock detection.
+ /// </summary>
+ [Test]
+ public void TestTxDeadlockDetection()
+ {
+ var cache = Cache();
+
+ var keys0 = Enumerable.Range(1, 100).ToArray();
+
+ cache.PutAll(keys0.ToDictionary(x => x, x => x));
+
+ var barrier = new Barrier(2);
+
+ Action<int[]> increment = keys =>
+ {
+ using (var tx = Transactions.TxStart(TransactionConcurrency.Pessimistic,
+ TransactionIsolation.RepeatableRead, TimeSpan.FromSeconds(0.5), 0))
+ {
+ foreach (var key in keys)
+ cache[key]++;
+
+ barrier.SignalAndWait(500);
+
+ tx.Commit();
+ }
+ };
+
+ // Increment keys within tx in different order to cause a deadlock.
+ var aex = Assert.Throws<AggregateException>(() =>
+ Task.WaitAll(Task.Factory.StartNew(() => increment(keys0)),
+ Task.Factory.StartNew(() => increment(keys0.Reverse().ToArray()))));
+
+ Assert.AreEqual(2, aex.InnerExceptions.Count);
+
+ var deadlockEx = aex.InnerExceptions.OfType<TransactionDeadlockException>().First();
+ Assert.IsTrue(deadlockEx.Message.Trim().StartsWith("Deadlock detected:"), deadlockEx.Message);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
index b60c254..2c8c070 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
@@ -39,11 +39,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return false;
- }
-
protected override bool LocalCache()
{
return true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
index 02cb987..000218b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
@@ -17,7 +17,7 @@
namespace Apache.Ignite.Core.Tests.Cache
{
- public class CacheLocalTest : CacheAbstractTest
+ public class CacheLocalTest : CacheAbstractTransactionalTest
{
protected override int CachePartitions()
{
@@ -39,10 +39,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return true;
- }
protected override bool LocalCache()
{
return true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
index 4f6e7a0..77cc77f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
@@ -37,11 +37,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return true;
}
- protected override bool TxEnabled()
- {
- return false;
- }
-
protected override int Backups()
{
return 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
index ab59c64..e6f851e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
@@ -37,11 +37,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return false;
- }
-
protected override int Backups()
{
return 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
index 830698b..81d2e5a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache
using NUnit.Framework;
[Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedNearEnabledTest : CacheAbstractTest
+ public class CachePartitionedNearEnabledTest : CacheAbstractTransactionalTest
{
protected override int GridCount()
{
@@ -37,11 +37,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return true;
}
- protected override bool TxEnabled()
- {
- return true;
- }
-
protected override int Backups()
{
return 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
index 02d3208..68546b9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache
using NUnit.Framework;
[Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedTest : CacheAbstractTest
+ public class CachePartitionedTest : CacheAbstractTransactionalTest
{
protected override int GridCount()
{
@@ -37,11 +37,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return true;
- }
-
protected override int Backups()
{
return 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
index db6f5a5..bd31c77 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
@@ -42,11 +42,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return false;
- }
-
protected override int Backups()
{
return GridCount() - 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/864af7eb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
index 7c70222..2d1c257 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
@@ -20,7 +20,7 @@ namespace Apache.Ignite.Core.Tests.Cache
using NUnit.Framework;
[Category(TestUtils.CategoryIntensive)]
- public class CacheReplicatedTest : CacheAbstractTest
+ public class CacheReplicatedTest : CacheAbstractTransactionalTest
{
protected override int CachePartitions()
{
@@ -42,11 +42,6 @@ namespace Apache.Ignite.Core.Tests.Cache
return false;
}
- protected override bool TxEnabled()
- {
- return true;
- }
-
protected override int Backups()
{
return GridCount() - 1;
[08/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 4e6e372..0d0b171 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -50,6 +50,9 @@ class Paragraph {
const self = this;
self.id = 'paragraph-' + paragraphId++;
+ self.qryType = paragraph.qryType || 'query';
+ self.maxPages = 0;
+ self.filter = '';
_.assign(this, paragraph);
@@ -77,27 +80,28 @@ class Paragraph {
enableColumnMenus: false,
flatEntityAccess: true,
fastWatch: true,
+ categories: [],
rebuildColumns() {
if (_.isNil(this.api))
return;
- this.categories = [];
+ this.categories.length = 0;
+
this.columnDefs = _.reduce(self.meta, (cols, col, idx) => {
- if (self.columnFilter(col)) {
- cols.push({
- displayName: col.fieldName,
- headerTooltip: _fullColName(col),
- field: idx.toString(),
- minWidth: 50,
- cellClass: 'cell-left'
- });
+ cols.push({
+ displayName: col.fieldName,
+ headerTooltip: _fullColName(col),
+ field: idx.toString(),
+ minWidth: 50,
+ cellClass: 'cell-left',
+ visible: self.columnFilter(col)
+ });
- this.categories.push({
- name: col.fieldName,
- visible: true,
- selectable: true
- });
- }
+ this.categories.push({
+ name: col.fieldName,
+ visible: self.columnFilter(col),
+ selectable: true
+ });
return cols;
}, []);
@@ -182,8 +186,8 @@ class Paragraph {
}
// Controller for SQL notebook screen.
-export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteScanFilterInput', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion',
- function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, ScanFilterInput, Nodes, uiGridExporterConstants, Version) {
+export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion',
+ function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version) {
let stopTopology = null;
const _tryStopRefresh = function(paragraph) {
@@ -206,6 +210,15 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.caches = [];
$scope.pageSizes = [50, 100, 200, 400, 800, 1000];
+ $scope.maxPages = [
+ {label: 'Unlimited', value: 0},
+ {label: '1', value: 1},
+ {label: '5', value: 5},
+ {label: '10', value: 10},
+ {label: '20', value: 20},
+ {label: '50', value: 50},
+ {label: '100', value: 100}
+ ];
$scope.timeLineSpans = ['1', '5', '10', '15', '30'];
@@ -213,7 +226,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.modes = LegacyUtils.mkOptions(['PARTITIONED', 'REPLICATED', 'LOCAL']);
- $scope.loadingText = $root.IgniteDemoMode ? 'Demo grid is starting. Please wait...' : 'Loading notebook screen...';
+ $scope.loadingText = $root.IgniteDemoMode ? 'Demo grid is starting. Please wait...' : 'Loading query notebook screen...';
$scope.timeUnit = [
{value: 1000, label: 'seconds', short: 's'},
@@ -768,11 +781,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
if (idx >= 0) {
if (!_.includes($scope.notebook.expandedParagraphs, idx))
- $scope.notebook.expandedParagraphs.push(idx);
+ $scope.notebook.expandedParagraphs = $scope.notebook.expandedParagraphs.concat([idx]);
- setTimeout(function() {
- $scope.notebook.paragraphs[idx].ace.focus();
- });
+ if ($scope.notebook.paragraphs[idx].ace)
+ setTimeout(() => $scope.notebook.paragraphs[idx].ace.focus());
}
$location.hash(id);
@@ -816,7 +828,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
let item = _.find(cachesAcc, {name: cache.name});
if (_.isNil(item)) {
- cache.label = maskCacheName(cache.name);
+ cache.label = maskCacheName(cache.name, true);
+ cache.value = cache.name;
cache.nodes = [];
@@ -839,7 +852,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return;
// Reset to first cache in case of stopped selected.
- const cacheNames = _.map($scope.caches, (cache) => cache.name);
+ const cacheNames = _.map($scope.caches, (cache) => cache.value);
_.forEach($scope.notebook.paragraphs, (paragraph) => {
if (!_.includes(cacheNames, paragraph.cacheName))
@@ -885,7 +898,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
(paragraph) => new Paragraph($animate, $timeout, paragraph));
if (_.isEmpty($scope.notebook.paragraphs))
- $scope.addParagraph();
+ $scope.addQuery();
else
$scope.rebuildScrollParagraphs();
})
@@ -936,32 +949,37 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
paragraph.edit = false;
};
- $scope.addParagraph = function() {
+ $scope.addParagraph = (paragraph, sz) => {
+ if ($scope.caches && $scope.caches.length > 0)
+ paragraph.cacheName = _.head($scope.caches).value;
+
+ $scope.notebook.paragraphs.push(paragraph);
+
+ $scope.notebook.expandedParagraphs.push(sz);
+
+ $scope.rebuildScrollParagraphs();
+
+ $location.hash(paragraph.id);
+ };
+
+ $scope.addQuery = function() {
const sz = $scope.notebook.paragraphs.length;
const paragraph = new Paragraph($animate, $timeout, {
name: 'Query' + (sz === 0 ? '' : sz),
query: '',
- pageSize: $scope.pageSizes[0],
+ pageSize: $scope.pageSizes[1],
timeLineSpan: $scope.timeLineSpans[0],
result: 'none',
rate: {
value: 1,
unit: 60000,
installed: false
- }
+ },
+ qryType: 'query'
});
- if ($scope.caches && $scope.caches.length > 0)
- paragraph.cacheName = $scope.caches[0].name;
-
- $scope.notebook.paragraphs.push(paragraph);
-
- $scope.notebook.expandedParagraphs.push(sz);
-
- $scope.rebuildScrollParagraphs();
-
- $location.hash(paragraph.id);
+ $scope.addParagraph(paragraph, sz);
$timeout(() => {
$anchorScroll();
@@ -970,6 +988,26 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
});
};
+ $scope.addScan = function() {
+ const sz = $scope.notebook.paragraphs.length;
+
+ const paragraph = new Paragraph($animate, $timeout, {
+ name: 'Scan' + (sz === 0 ? '' : sz),
+ query: '',
+ pageSize: $scope.pageSizes[1],
+ timeLineSpan: $scope.timeLineSpans[0],
+ result: 'none',
+ rate: {
+ value: 1,
+ unit: 60000,
+ installed: false
+ },
+ qryType: 'scan'
+ });
+
+ $scope.addParagraph(paragraph, sz);
+ };
+
function _saveChartSettings(paragraph) {
if (!_.isEmpty(paragraph.charts)) {
const chart = paragraph.charts[0].api.getScope().chart;
@@ -1010,7 +1048,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
};
$scope.removeParagraph = function(paragraph) {
- Confirm.confirm('Are you sure you want to remove: "' + paragraph.name + '"?')
+ Confirm.confirm('Are you sure you want to remove query: "' + paragraph.name + '"?')
.then(function() {
$scope.stopRefresh(paragraph);
@@ -1315,8 +1353,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return false;
};
- $scope.execute = (paragraph, nonCollocatedJoins = false) => {
- const local = !!paragraph.localQry;
+ $scope.execute = (paragraph, local = false) => {
+ const nonCollocatedJoins = !!paragraph.nonCollocatedJoins;
$scope.actionAvailable(paragraph, true) && _chooseNode(paragraph.cacheName, local)
.then((nid) => {
@@ -1330,16 +1368,16 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return _closeOldQuery(paragraph)
.then(() => {
const args = paragraph.queryArgs = {
+ type: 'QUERY',
cacheName: paragraph.cacheName,
- pageSize: paragraph.pageSize,
query: paragraph.query,
- firstPageOnly: paragraph.firstPageOnly,
+ pageSize: paragraph.pageSize,
+ maxPages: paragraph.maxPages,
nonCollocatedJoins,
- type: 'QUERY',
localNid: local ? nid : null
};
- const qry = args.firstPageOnly ? addLimit(args.query, args.pageSize) : paragraph.query;
+ const qry = args.maxPages ? addLimit(args.query, args.pageSize * args.maxPages) : paragraph.query;
return agentMonitor.query(nid, args.cacheName, qry, nonCollocatedJoins, local, args.pageSize);
})
@@ -1386,10 +1424,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
.then(() => _chooseNode(paragraph.cacheName, false))
.then((nid) => {
const args = paragraph.queryArgs = {
+ type: 'EXPLAIN',
cacheName: paragraph.cacheName,
- pageSize: paragraph.pageSize,
query: 'EXPLAIN ' + paragraph.query,
- type: 'EXPLAIN'
+ pageSize: paragraph.pageSize
};
return agentMonitor.query(nid, args.cacheName, args.query, false, false, args.pageSize);
@@ -1403,8 +1441,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
.then(() => paragraph.ace.focus());
};
- $scope.scan = (paragraph, query = null) => {
- const local = !!paragraph.localQry;
+ $scope.scan = (paragraph, local = false) => {
+ const {filter, caseSensitive} = paragraph;
+ const prefix = caseSensitive ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE : SCAN_CACHE_WITH_FILTER;
+ const query = `${prefix}${filter}`;
$scope.actionAvailable(paragraph, false) && _chooseNode(paragraph.cacheName, local)
.then((nid) => {
@@ -1418,45 +1458,22 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
_closeOldQuery(paragraph)
.then(() => {
const args = paragraph.queryArgs = {
+ type: 'SCAN',
cacheName: paragraph.cacheName,
- pageSize: paragraph.pageSize,
- firstPageOnly: paragraph.firstPageOnly,
query,
- type: 'SCAN',
+ filter,
+ pageSize: paragraph.pageSize,
localNid: local ? nid : null
};
return agentMonitor.query(nid, args.cacheName, query, false, local, args.pageSize);
})
- .then((res) => {
- if (paragraph.firstPageOnly) {
- res.hasMore = false;
-
- _processQueryResult(paragraph, true, res);
-
- _closeOldQuery(paragraph);
- }
- else
- _processQueryResult(paragraph, true, res);
- })
+ .then((res) => _processQueryResult(paragraph, true, res))
.catch((err) => {
paragraph.errMsg = err.message;
_showLoading(paragraph, false);
- })
- .then(() => paragraph.ace.focus());
- });
- };
-
- $scope.scanWithFilter = (paragraph) => {
- if (!$scope.actionAvailable(paragraph, false))
- return;
-
- ScanFilterInput.open()
- .then(({filter, caseSensitive}) => {
- const prefix = caseSensitive ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE : SCAN_CACHE_WITH_FILTER;
-
- $scope.scan(paragraph, `${prefix}${filter}`);
+ });
});
};
@@ -1511,25 +1528,23 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
_showLoading(paragraph, false);
})
- .then(() => paragraph.ace.focus());
+ .then(() => paragraph.ace && paragraph.ace.focus());
};
- const _export = (fileName, columnFilter, meta, rows) => {
+ const _export = (fileName, columnDefs, meta, rows) => {
let csvContent = '';
const cols = [];
const excludedCols = [];
- if (meta) {
- _.forEach(meta, (col, idx) => {
- if (columnFilter(col))
- cols.push(_fullColName(col));
- else
- excludedCols.push(idx);
- });
+ _.forEach(meta, (col, idx) => {
+ if (columnDefs[idx].visible)
+ cols.push(_fullColName(col));
+ else
+ excludedCols.push(idx);
+ });
- csvContent += cols.join(';') + '\n';
- }
+ csvContent += cols.join(';') + '\n';
_.forEach(rows, (row) => {
cols.length = 0;
@@ -1543,8 +1558,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
});
}
else {
- _.forEach(meta, (col) => {
- if (columnFilter(col)) {
+ _.forEach(columnDefs, (col) => {
+ if (col.visible) {
const elem = row[col.fieldName];
cols.push(_.isUndefined(elem) ? '' : JSON.stringify(elem));
@@ -1559,7 +1574,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
};
$scope.exportCsv = function(paragraph) {
- _export(paragraph.name + '.csv', paragraph.columnFilter, paragraph.meta, paragraph.rows);
+ _export(paragraph.name + '.csv', paragraph.gridOptions.columnDefs, paragraph.meta, paragraph.rows);
// paragraph.gridOptions.api.exporter.csvExport(uiGridExporterConstants.ALL, uiGridExporterConstants.VISIBLE);
};
@@ -1573,17 +1588,17 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return Promise.resolve(args.localNid || _chooseNode(args.cacheName, false))
.then((nid) => agentMonitor.queryGetAll(nid, args.cacheName, args.query, !!args.nonCollocatedJoins, !!args.localNid))
- .then((res) => _export(paragraph.name + '-all.csv', paragraph.columnFilter, res.columns, res.rows))
+ .then((res) => _export(paragraph.name + '-all.csv', paragraph.gridOptions.columnDefs, res.columns, res.rows))
.catch(Messages.showError)
- .then(() => paragraph.ace.focus());
+ .then(() => paragraph.ace && paragraph.ace.focus());
};
// $scope.exportPdfAll = function(paragraph) {
// $http.post('/api/v1/agent/query/getAll', {query: paragraph.query, cacheName: paragraph.cacheName})
- // .success(function(item) {
- // _export(paragraph.name + '-all.csv', item.meta, item.rows);
+ // .then(({data}) {
+ // _export(paragraph.name + '-all.csv', data.meta, data.rows);
// })
- // .error(Messages.showError);
+ // .catch(Messages.showError);
// };
$scope.rateAsString = function(paragraph) {
@@ -1652,9 +1667,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.dblclickMetadata = function(paragraph, node) {
paragraph.ace.insert(node.name);
- setTimeout(function() {
- paragraph.ace.focus();
- }, 1);
+ setTimeout(() => paragraph.ace.focus(), 1);
};
$scope.importMetadata = function() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/sql/sql.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.module.js b/modules/web-console/frontend/app/modules/sql/sql.module.js
index d615d28..a1ffde9 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.module.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.module.js
@@ -19,7 +19,6 @@ import angular from 'angular';
import NotebookData from './Notebook.data';
import Notebook from './Notebook.service';
-import ScanFilterInput from './scan-filter-input.service';
import notebook from './notebook.controller';
import sql from './sql.controller';
@@ -55,6 +54,5 @@ angular.module('ignite-console.sql', [
)
.service('IgniteNotebookData', NotebookData)
.service('IgniteNotebook', Notebook)
- .service('IgniteScanFilterInput', ScanFilterInput)
.controller('notebookController', notebook)
.controller('sqlController', sql);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration.state.js b/modules/web-console/frontend/app/modules/states/configuration.state.js
index 888c804..61dca13 100644
--- a/modules/web-console/frontend/app/modules/states/configuration.state.js
+++ b/modules/web-console/frontend/app/modules/states/configuration.state.js
@@ -24,12 +24,14 @@ import previewPanel from './configuration/preview-panel.directive.js';
import ConfigurationSummaryCtrl from './configuration/summary/summary.controller';
import ConfigurationResource from './configuration/Configuration.resource';
import summaryTabs from './configuration/summary/summary-tabs.directive';
+import IgniteSummaryZipper from './configuration/summary/summary-zipper.service';
angular.module('ignite-console.states.configuration', ['ui.router'])
.directive(...previewPanel)
// Summary screen
.directive(...summaryTabs)
// Services.
+ .service('IgniteSummaryZipper', IgniteSummaryZipper)
.service('IgniteConfigurationResource', ConfigurationResource)
// Configure state provider.
.config(['$stateProvider', 'AclRouteProvider', ($stateProvider, AclRoute) => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.jade b/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.jade
index b34aba0..bcac5ad 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/node-filter.jade
@@ -54,6 +54,6 @@ include /app/helpers/jade/mixins.jade
-var required = nodeFilterKind + ' === "Custom"'
+java-class('Class name:', customNodeFilter + '.className', '"customNodeFilter"',
- 'true', required, 'Class name of custom node filter implementation')
+ 'true', required, 'Class name of custom node filter implementation', required)
.col-sm-6
+preview-xml-java(model, 'cacheNodeFilter', 'igfss')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/caches/query.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/query.jade b/modules/web-console/frontend/app/modules/states/configuration/caches/query.jade
index 5062ce1..cfbaf12 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/query.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/query.jade
@@ -53,6 +53,9 @@ include /app/helpers/jade/mixins.jade
+number('Long query timeout:', model + '.longQueryWarningTimeout', '"longQueryWarningTimeout"', 'true', '3000', '0',
'Timeout in milliseconds after which long query warning will be printed')
.settings-row
+ +number('History size:', model + '.queryDetailMetricsSize', '"queryDetailMetricsSize"', 'true', '0', '0',
+ 'Size of queries detail metrics that will be stored in memory for monitoring purposes')
+ .settings-row
-var form = 'querySqlFunctionClasses';
-var sqlFunctionClasses = model + '.sqlFunctionClasses';
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/caches/store.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/store.jade b/modules/web-console/frontend/app/modules/states/configuration/caches/store.jade
index 1cf80b8..ea350f2 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/store.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/store.jade
@@ -102,9 +102,9 @@ mixin hibernateField(name, model, items, valid, save, newItem)
'Parallel load cache minimum threshold.<br/>\
If <b>0</b> then load sequentially.')
.details-row
- +java-class('Hasher', pojoStoreFactory + '.hasher', '"pojoHasher"', 'true', 'false', 'Hash calculator')
+ +java-class('Hasher', pojoStoreFactory + '.hasher', '"pojoHasher"', 'true', 'false', 'Hash calculator', required)
.details-row
- +java-class('Transformer', pojoStoreFactory + '.transformer', '"pojoTransformer"', 'true', 'false', 'Types transformer')
+ +java-class('Transformer', pojoStoreFactory + '.transformer', '"pojoTransformer"', 'true', 'false', 'Types transformer', required)
.details-row
+checkbox('Escape table and filed names', pojoStoreFactory + '.sqlEscapeAll', '"sqlEscapeAll"',
'If enabled than all schema, table and field names will be escaped with double quotes (for example: "tableName"."fieldName").<br/>\
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint.jade
index 5cc996d..259909e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint.jade
@@ -19,6 +19,7 @@ include /app/helpers/jade/mixins.jade
-var form = 'checkpoint'
-var model = 'backupItem.checkpointSpi'
-var CustomCheckpoint = 'model.kind === "Custom"'
+-var CacheCheckpoint = 'model.kind === "Cache"'
.panel.panel-default(ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click='ui.loadPanel("#{form}")')
@@ -44,7 +45,7 @@ include /app/helpers/jade/mixins.jade
.group-content(ng-show='#{model} && #{model}.length > 0' ng-repeat='model in #{model} track by $index')
hr(ng-if='$index != 0')
.settings-row
- +dropdown-required('Checkpoint SPI:', 'model.kind', '"checkpointKind" + $index', 'true', 'true', 'Choose checkpoint configuration variant', '[\
+ +dropdown-required-autofocus('Checkpoint SPI:', 'model.kind', '"checkpointKind" + $index', 'true', 'true', 'Choose checkpoint configuration variant', '[\
{value: "FS", label: "File System"},\
{value: "Cache", label: "Cache"},\
{value: "S3", label: "Amazon S3"},\
@@ -64,13 +65,13 @@ include /app/helpers/jade/mixins.jade
div(ng-show='model.kind === "FS"')
include ./checkpoint/fs.jade
- div(ng-show='model.kind === "Cache"')
+ div(ng-show=CacheCheckpoint)
.settings-row
- +dropdown-required-empty('Cache:', 'model.Cache.cache', '"checkpointCacheCache"+ $index', 'true', 'true',
+ +dropdown-required-empty('Cache:', 'model.Cache.cache', '"checkpointCacheCache"+ $index', 'true', CacheCheckpoint,
'Choose cache', 'No caches configured for current cluster', 'clusterCaches', 'Cache to use for storing checkpoints')
.settings-row
+java-class('Listener:', 'model.Cache.checkpointListener', '"checkpointCacheListener" + $index', 'true', 'false',
- 'Checkpoint listener implementation class name')
+ 'Checkpoint listener implementation class name', CacheCheckpoint)
div(ng-show='model.kind === "S3"')
include ./checkpoint/s3.jade
@@ -80,6 +81,6 @@ include /app/helpers/jade/mixins.jade
.settings-row(ng-show=CustomCheckpoint)
+java-class('Class name:', 'model.Custom.className', '"checkpointCustomClassName" + $index', 'true', CustomCheckpoint,
- 'Custom CheckpointSpi implementation class')
+ 'Custom CheckpointSpi implementation class', CustomCheckpoint)
.col-sm-6
+preview-xml-java('backupItem', 'clusterCheckpoint', 'caches')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/fs.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/fs.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/fs.jade
index efb6ad0..6ec4535 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/fs.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/fs.jade
@@ -36,13 +36,13 @@ include /app/helpers/jade/mixins.jade
-var valid = form + '[' + name + '].$valid'
-var save = dirPaths + '[$index] = ' + model
- div(ng-repeat='model in #{dirPaths} track by $index' ng-init='obj = {}')
+ div(ng-repeat='item in #{dirPaths} track by $index' ng-init='obj = {}')
label.col-xs-12.col-sm-12.col-md-12
.indexField
| {{ $index+1 }})
- +table-remove-conditional-button(dirPaths, 'true', 'Remove path')
+ +table-remove-conditional-button(dirPaths, 'true', 'Remove path', 'item')
span(ng-hide='field.edit')
- a.labelFormField(ng-click='(field.edit = true) && (#{model} = model)') {{ model }}
+ a.labelFormField(ng-click='(field.edit = true) && (#{model} = item)') {{ item }}
span(ng-if='field.edit')
+table-text-field(name, model, dirPaths, valid, save, 'Input directory path', false)
+table-save-button(valid, save, false)
@@ -63,4 +63,4 @@ include /app/helpers/jade/mixins.jade
.settings-row
+java-class('Listener:', 'model.FS.checkpointListener', '"checkpointFsListener" + $index', 'true', 'false',
- 'Checkpoint listener implementation class name')
+ 'Checkpoint listener implementation class name', 'model.kind === "FS"')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/jdbc.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/jdbc.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/jdbc.jade
index 874799c..5a13337 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/jdbc.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/jdbc.jade
@@ -16,15 +16,17 @@
include /app/helpers/jade/mixins.jade
+-var jdbcCheckpoint = 'model.kind === "JDBC"'
+
.settings-row
- +text('Data source bean name:', 'model.JDBC.dataSourceBean', '"checkpointJdbcDataSourceBean" + $index', 'model.kind === "JDBC"', 'Input bean name',
+ +text('Data source bean name:', 'model.JDBC.dataSourceBean', '"checkpointJdbcDataSourceBean" + $index', jdbcCheckpoint, 'Input bean name',
'Name of the data source bean in Spring context')
.settings-row
- +dialect('Dialect:', 'model.JDBC.dialect', '"checkpointJdbcDialect" + $index', 'model.kind === "JDBC"',
+ +dialect('Dialect:', 'model.JDBC.dialect', '"checkpointJdbcDialect" + $index', jdbcCheckpoint,
'Dialect of SQL implemented by a particular RDBMS:', 'Generic JDBC dialect', 'Choose JDBC dialect')
.settings-row
+java-class('Listener:', 'model.JDBC.checkpointListener', '"checkpointJdbcListener" + $index', 'true', 'false',
- 'Checkpoint listener implementation class name')
+ 'Checkpoint listener implementation class name', jdbcCheckpoint)
+showHideLink('jdbcExpanded', 'settings')
.details-row
+text('User:', 'model.JDBC.user', '"checkpointJdbcUser" + $index', 'false', 'Input user name', 'Checkpoint jdbc user name')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/s3.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/s3.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/s3.jade
index da28da7..6531897 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/s3.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/checkpoint/s3.jade
@@ -18,16 +18,17 @@ include /app/helpers/jade/mixins.jade
-var credentialsModel = 'model.S3.awsCredentials'
-var clientCfgModel = 'model.S3.clientConfiguration'
--var checkpointS3Path = 'model.S3.awsCredentials.kind === "Properties"'
--var checkpointS3Custom = 'model.S3.awsCredentials.kind === "Custom"'
+-var checkpointS3 = 'model.kind === "S3"'
+-var checkpointS3Path = checkpointS3 + ' && model.S3.awsCredentials.kind === "Properties"'
+-var checkpointS3Custom = checkpointS3 + ' && model.S3.awsCredentials.kind === "Custom"'
-var clientRetryModel = clientCfgModel + '.retryPolicy'
--var checkpointS3DefaultMaxRetry = clientRetryModel + '.kind === "DefaultMaxRetries"'
--var checkpointS3DynamoDbMaxRetry = clientRetryModel + '.kind === "DynamoDBMaxRetries"'
--var checkpointS3CustomRetry = clientRetryModel + '.kind === "Custom"'
+-var checkpointS3DefaultMaxRetry = checkpointS3 + ' && ' + clientRetryModel + '.kind === "DefaultMaxRetries"'
+-var checkpointS3DynamoDbMaxRetry = checkpointS3 + ' && ' + clientRetryModel + '.kind === "DynamoDBMaxRetries"'
+-var checkpointS3CustomRetry = checkpointS3 + ' && ' + clientRetryModel + '.kind === "Custom"'
.settings-row
- +dropdown-required('AWS credentials:', 'model.S3.awsCredentials.kind', '"checkpointS3AwsCredentials"', 'true', 'model.kind === "S3"', 'Custom', '[\
+ +dropdown-required('AWS credentials:', 'model.S3.awsCredentials.kind', '"checkpointS3AwsCredentials"', 'true', checkpointS3, 'Custom', '[\
{value: "Basic", label: "Basic"},\
{value: "Properties", label: "Properties"},\
{value: "Anonymous", label: "Anonymous"},\
@@ -51,12 +52,12 @@ include /app/helpers/jade/mixins.jade
.panel-details(ng-show=checkpointS3Custom)
.details-row
+java-class('Class name:', credentialsModel + '.Custom.className', '"checkpointS3CustomClassName" + $index', 'true', checkpointS3Custom,
- 'Custom AWS credentials provider implementation class')
+ 'Custom AWS credentials provider implementation class', checkpointS3Custom)
.settings-row
+text('Bucket name suffix:', 'model.S3.bucketNameSuffix', '"checkpointS3BucketNameSuffix"', 'false', 'default-bucket', 'Bucket name suffix')
.settings-row
+java-class('Listener:', 'model.S3.checkpointListener', '"checkpointS3Listener" + $index', 'true', 'false',
- 'Checkpoint listener implementation class name')
+ 'Checkpoint listener implementation class name', checkpointS3)
+showHideLink('s3Expanded', 'client configuration')
.details-row
+dropdown('Protocol:', clientCfgModel + '.protocol', '"checkpointS3Protocol"', 'true', 'HTTPS', '[\
@@ -121,10 +122,10 @@ include /app/helpers/jade/mixins.jade
.panel-details(ng-show=checkpointS3CustomRetry)
.details-row
+java-class('Retry condition:', clientRetryModel + '.Custom.retryCondition', '"checkpointS3CustomRetryPolicy" + $index', 'true', checkpointS3CustomRetry,
- 'Retry condition on whether a specific request and exception should be retried')
+ 'Retry condition on whether a specific request and exception should be retried', checkpointS3CustomRetry)
.details-row
+java-class('Backoff strategy:', clientRetryModel + '.Custom.backoffStrategy', '"checkpointS3CustomBackoffStrategy" + $index', 'true', checkpointS3CustomRetry,
- 'Back-off strategy for controlling how long the next retry should wait')
+ 'Back-off strategy for controlling how long the next retry should wait', checkpointS3CustomRetry)
.details-row
+number-required('Maximum retry attempts:', clientRetryModel + '.Custom.maxErrorRetry', '"checkpointS3CustomMaxErrorRetry"', 'true', checkpointS3CustomRetry, '-1', '1',
'Maximum number of retry attempts for failed requests')
@@ -159,13 +160,13 @@ include /app/helpers/jade/mixins.jade
'Maximum amount of time that an idle connection may sit in the connection pool and still be eligible for reuse')
.details-row
+java-class('DNS resolver:', clientCfgModel + '.dnsResolver', '"checkpointS3DnsResolver" + $index', 'true', 'false',
- 'DNS Resolver that should be used to for resolving AWS IP addresses')
+ 'DNS Resolver that should be used to for resolving AWS IP addresses', checkpointS3)
.details-row
+number('Response metadata cache size:', clientCfgModel + '.responseMetadataCacheSize', '"checkpointS3ResponseMetadataCacheSize"', 'true', '50', '0',
'Response metadata cache size')
.details-row
+java-class('SecureRandom class name:', clientCfgModel + '.secureRandom', '"checkpointS3SecureRandom" + $index', 'true', 'false',
- 'SecureRandom to be used by the SDK class name')
+ 'SecureRandom to be used by the SDK class name', checkpointS3)
.details-row
+checkbox('Use reaper', clientCfgModel + '.useReaper', '"checkpointS3UseReaper"', 'Checks if the IdleConnectionReaper is to be started')
.details-row
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/custom.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/custom.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/custom.jade
index 31a6be7..8e77ac4 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/custom.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/custom.jade
@@ -21,4 +21,4 @@ include /app/helpers/jade/mixins.jade
div
.details-row
- +java-class('Class:', model + '.class', '"collisionCustom"', 'true', required, 'CollisionSpi implementation class')
+ +java-class('Class:', model + '.class', '"collisionCustom"', 'true', required, 'CollisionSpi implementation class', required)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.jade
index d4e537a..dbe0478 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/collision/job-stealing.jade
@@ -37,7 +37,7 @@ div
'Node should attempt to steal jobs from other nodes')
.details-row
+java-class('External listener:', model + '.externalCollisionListener', '"jsExternalCollisionListener"', 'true', 'false',
- 'Listener to be set for notification of external collision events')
+ 'Listener to be set for notification of external collision events', 'backupItem.collision.kind === "JobStealing"')
.details-row
+ignite-form-group
ignite-form-field-label
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.jade
index 4cfd9f5..aa99b49 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/deployment.jade
@@ -18,8 +18,14 @@ include /app/helpers/jade/mixins.jade
-var form = 'deployment'
-var model = 'backupItem'
+-var modelDeployment = 'backupItem.deploymentSpi'
-var exclude = model + '.peerClassLoadingLocalClassPathExclude'
-var enabled = 'backupItem.peerClassLoadingEnabled'
+-var uriListModel = modelDeployment + '.URI.uriList'
+-var scannerModel = modelDeployment + '.URI.scanners'
+-var uriDeployment = modelDeployment + '.kind === "URI"'
+-var localDeployment = modelDeployment + '.kind === "Local"'
+-var customDeployment = modelDeployment + '.kind === "Custom"'
.panel.panel-default(ng-form=form novalidate)
.panel-heading(bs-collapse-toggle ng-click='ui.loadPanel("#{form}")')
@@ -57,7 +63,7 @@ include /app/helpers/jade/mixins.jade
.settings-row
+number('Pool size:', model + '.peerClassLoadingThreadPoolSize', '"peerClassLoadingThreadPoolSize"', enabled, '2', '1', 'Thread pool size to use for peer class loading')
.settings-row
- +ignite-form-group(ng-model=exclude ng-form=form)
+ +ignite-form-group
-var uniqueTip = 'Such package already exists'
ignite-form-field-label
@@ -81,7 +87,7 @@ include /app/helpers/jade/mixins.jade
| {{ $index+1 }})
+table-remove-button(exclude, 'Remove package name')
span(ng-hide='field.edit')
- a.labelFormField(ng-click='#{enabled} && (field.edit = true) && (#{model} = model)') {{ model }}
+ a.labelFormField(ng-click='(field.edit = true) && (#{model} = model)') {{ model }}
span(ng-if='field.edit')
+table-java-package-field(name, model, exclude, valid, save, false)
+table-save-button(valid, save, false)
@@ -107,8 +113,125 @@ include /app/helpers/jade/mixins.jade
+table-save-button(valid, save, true)
+unique-feedback(name, uniqueTip)
-
.group-content-empty(ng-if='!(#{exclude}.length) && !group.add.length')
| Not defined
+ .settings-row
+ +dropdown('Deployment variant:', modelDeployment + '.kind', '"deploymentKind"', 'true', 'Default',
+ '[\
+ {value: "URI", label: "URI"},\
+ {value: "Local", label: "Local"}, \
+ {value: "Custom", label: "Custom"},\
+ {value: undefined, label: "Default"}\
+ ]',
+ 'Grid deployment SPI is in charge of deploying tasks and classes from different sources:\
+ <ul>\
+ <li>URI - Deploy tasks from different sources like file system folders, email and HTTP</li>\
+ <li>Local - Only within VM deployment on local node</li>\
+ <li>Custom - Custom implementation of DeploymentSpi</li>\
+ <li>Default - Default configuration of LocalDeploymentSpi will be used</li>\
+ </ul>')
+ .panel-details(ng-show=uriDeployment)
+ .details-row
+ +ignite-form-group()
+ -var uniqueTip = 'Such URI already configured'
+
+ ignite-form-field-label
+ | URI list
+ ignite-form-group-tooltip
+ | List of URI which point to GAR file and which should be scanned by SPI for the new tasks
+ ignite-form-group-add(ng-click='(group.add = [{}])')
+ | Add URI.
+
+ .group-content(ng-if=uriListModel + '.length')
+ -var model = 'obj.model';
+ -var name = '"edit" + $index'
+ -var valid = form + '[' + name + '].$valid'
+ -var save = uriListModel + '[$index] = ' + model
+
+ div(ng-repeat='model in #{uriListModel} track by $index' ng-init='obj = {}')
+ label.col-xs-12.col-sm-12.col-md-12
+ .indexField
+ | {{ $index+1 }})
+ +table-remove-button(uriListModel, 'Remove URI')
+ span(ng-hide='field.edit')
+ a.labelFormField(ng-click='(field.edit = true) && (#{model} = model)') {{ model }}
+ span(ng-if='field.edit')
+ +table-url-field(name, model, uriListModel, valid, save, false)
+ +table-save-button(valid, save, false)
+ +unique-feedback(name, uniqueTip)
+
+ .group-content(ng-repeat='field in group.add')
+ -var model = 'new';
+ -var name = '"new"'
+ -var valid = form + '[' + name + '].$valid'
+ -var save = uriListModel + '.push(' + model + ')'
+
+ div(type='internal' name='URI')
+ label.col-xs-12.col-sm-12.col-md-12
+ +table-url-field(name, model, uriListModel, valid, save, true)
+ +table-save-button(valid, save, true)
+ +unique-feedback(name, uniqueTip)
+
+ .group-content-empty(ng-if='!(#{uriListModel}.length) && !group.add.length')
+ | Not defined
+ .details-row
+ +text('Temporary directory path:', modelDeployment + '.URI.temporaryDirectoryPath', '"DeploymentURITemporaryDirectoryPath"', 'false', 'Temporary directory path',
+ 'Absolute path to temporary directory which will be used by deployment SPI to keep all deployed classes in')
+ .details-row
+ +ignite-form-group()
+ -var uniqueTip = 'Such scanner already configured'
+
+ ignite-form-field-label
+ | Scanner list
+ ignite-form-group-tooltip
+ | List of URI deployment scanners
+ ignite-form-group-add(ng-click='(group.add = [{}])')
+ | Add scanner
+
+ .group-content(ng-if=scannerModel + '.length')
+ -var model = 'obj.model';
+ -var name = '"edit" + $index'
+ -var valid = form + '[' + name + '].$valid'
+ -var save = scannerModel + '[$index] = ' + model
+
+ div(ng-repeat='model in #{scannerModel} track by $index' ng-init='obj = {}')
+ label.col-xs-12.col-sm-12.col-md-12
+ .indexField
+ | {{ $index+1 }})
+ +table-remove-button(scannerModel, 'Remove scanner')
+ span(ng-hide='field.edit')
+ a.labelFormField(ng-click='(field.edit = true) && (#{model} = model)') {{ model }}
+ span(ng-if='field.edit')
+ +table-java-class-field('Scanner:', name, model, scannerModel, valid, save, false)
+ +table-save-button(valid, save, false)
+ +unique-feedback(name, uniqueTip)
+
+ .group-content(ng-repeat='field in group.add')
+ -var model = 'new';
+ -var name = '"new"'
+ -var valid = form + '[' + name + '].$valid'
+ -var save = scannerModel + '.push(' + model + ')'
+
+ div(type='internal' name='Scanner')
+ label.col-xs-12.col-sm-12.col-md-12
+ // (lbl, name, model, items, valid, save, newItem)
+ +table-java-class-field('Scanner:', name, model, scannerModel, valid, save, true)
+ +table-save-button(valid, save, true)
+ +unique-feedback(name, uniqueTip)
+
+ .group-content-empty(ng-if='!(#{scannerModel}.length) && !group.add.length')
+ | Not defined
+ .details-row
+ +java-class('Listener:', modelDeployment + '.URI.listener', '"DeploymentURIListener"', 'true', 'false', 'Deployment event listener', uriDeployment)
+ .details-row
+ +checkbox('Check MD5', modelDeployment + '.URI.checkMd5', '"DeploymentURICheckMd5"', 'Exclude files with same md5s from deployment')
+ .details-row
+ +checkbox('Encode URI', modelDeployment + '.URI.encodeUri', '"DeploymentURIEncodeUri"', 'URI must be encoded before usage')
+ .panel-details(ng-show=localDeployment)
+ .details-row
+ +java-class('Listener:', modelDeployment + '.Local.listener', '"DeploymentLocalListener"', 'true', 'false', 'Deployment event listener', localDeployment)
+ .panel-details(ng-show=customDeployment)
+ .details-row
+ +java-class('Class:', modelDeployment + '.Custom.className', '"DeploymentCustom"', 'true', customDeployment, 'DeploymentSpi implementation class', customDeployment)
.col-sm-6
+preview-xml-java(model, 'clusterDeployment')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/events.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/events.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/events.jade
index 3f2d6cb..643ea97 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/events.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/events.jade
@@ -59,10 +59,10 @@ include /app/helpers/jade/mixins.jade
.settings-row
+java-class('Filter:', modelEventStorage + '.Memory.filter', '"EventStorageFilter"', 'true', 'false',
'Filter for events to be recorded<br/>\
- Should be implementation of o.a.i.lang.IgnitePredicate<o.a.i.events.Event>')
+ Should be implementation of o.a.i.lang.IgnitePredicate<o.a.i.events.Event>', eventStorageMemory)
.settings-row(ng-show=eventStorageCustom)
- +java-class('Class:', modelEventStorage + '.Custom.className', '"EventStorageCustom"', 'true', eventStorageCustom, 'Event storage implementation class name')
+ +java-class('Class:', modelEventStorage + '.Custom.className', '"EventStorageCustom"', 'true', eventStorageCustom, 'Event storage implementation class name', eventStorageCustom)
.col-sm-6
+preview-xml-java(model, 'clusterEvents')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/failover.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/failover.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/failover.jade
index aaed8e9..1665659 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/failover.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/failover.jade
@@ -45,7 +45,7 @@ include /app/helpers/jade/mixins.jade
.group-content(ng-show='#{failoverSpi} && #{failoverSpi}.length > 0' ng-repeat='model in #{failoverSpi} track by $index')
hr(ng-if='$index != 0')
.settings-row
- +dropdown-required('Failover SPI:', 'model.kind', '"failoverKind" + $index', 'true', 'true', 'Choose Failover SPI', '[\
+ +dropdown-required-autofocus('Failover SPI:', 'model.kind', '"failoverKind" + $index', 'true', 'true', 'Choose Failover SPI', '[\
{value: "JobStealing", label: "Job stealing"},\
{value: "Never", label: "Never"},\
{value: "Always", label: "Always"},\
@@ -68,6 +68,6 @@ include /app/helpers/jade/mixins.jade
'Maximum number of attempts to execute a failed job on another node')
.settings-row(ng-show=failoverCustom)
+java-class('SPI implementation', 'model.Custom.class', '"failoverSpiClass" + $index', 'true', failoverCustom,
- 'Custom FailoverSpi implementation class name.')
+ 'Custom FailoverSpi implementation class name.', failoverCustom)
.col-sm-6
+preview-xml-java(model, 'clusterFailover')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.jade
index 2e567ed..48b1776 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper.jade
@@ -27,7 +27,7 @@ div
+java-class('Curator:', model + '.curator', '"curator"', 'true', 'false',
'The Curator framework in use<br/>\
By default generates curator of org.apache.curator. framework.imps.CuratorFrameworkImpl\
- class with configured connect string, retry policy, and default session and connection timeouts')
+ class with configured connect string, retry policy, and default session and connection timeouts', required)
.details-row
+text('Connect string:', model + '.zkConnectionString', '"' + discoveryKind + 'ConnectionString"', required, 'host:port[chroot][,host:port[chroot]]',
'When "IGNITE_ZK_CONNECTION_STRING" system property is not configured this property will be used')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.jade
index 5a03de8..5db89f5 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.jade
@@ -21,4 +21,4 @@ include /app/helpers/jade/mixins.jade
-var required = 'backupItem.discovery.kind === "ZooKeeper" && backupItem.discovery.ZooKeeper.retryPolicy.kind === "Custom"'
.details-row
- +java-class('Class name:', retry + '.className', '"customClassName"', 'true', required, 'Custom retry policy implementation class name')
+ +java-class('Class name:', retry + '.className', '"customClassName"', 'true', required, 'Custom retry policy implementation class name', required)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.jade
index 7fd78bf..9fa9fc9 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/load-balancing.jade
@@ -46,7 +46,7 @@ include /app/helpers/jade/mixins.jade
.group-content(ng-show='#{loadBalancingSpi} && #{loadBalancingSpi}.length > 0' ng-repeat='model in #{loadBalancingSpi} track by $index')
hr(ng-if='$index != 0')
.settings-row
- +dropdown-required('Load balancing:', 'model.kind', '"loadBalancingKind" + $index', 'true', 'true', 'Choose load balancing SPI', '[\
+ +dropdown-required-autofocus('Load balancing:', 'model.kind', '"loadBalancingKind" + $index', 'true', 'true', 'Choose load balancing SPI', '[\
{value: "RoundRobin", label: "Round-robin"},\
{value: "Adaptive", label: "Adaptive"},\
{value: "WeightedRandom", label: "Random"},\
@@ -78,27 +78,30 @@ include /app/helpers/jade/mixins.jade
<li>Default - Default load probing implementation</li>\
</ul>')
.settings-row(ng-show='model.kind === "Adaptive" && model.Adaptive.loadProbe.kind')
- .panel-details
- .details-row(ng-show='model.Adaptive.loadProbe.kind === "Job"')
+ .panel-details(ng-show='model.Adaptive.loadProbe.kind === "Job"')
+ .details-row
+checkbox('Use average', 'model.Adaptive.loadProbe.Job.useAverage', '"loadBalancingAdaptiveJobUseAverage" + $index', 'Use average CPU load vs. current')
- .details-row(ng-show='model.Adaptive.loadProbe.kind === "CPU"')
+ .panel-details(ng-show='model.Adaptive.loadProbe.kind === "CPU"')
+ .details-row
+checkbox('Use average', 'model.Adaptive.loadProbe.CPU.useAverage', '"loadBalancingAdaptiveCPUUseAverage" + $index', 'Use average CPU load vs. current')
- .details-row(ng-show='model.Adaptive.loadProbe.kind === "CPU"')
+ .details-row
+checkbox('Use processors', 'model.Adaptive.loadProbe.CPU.useProcessors', '"loadBalancingAdaptiveCPUUseProcessors" + $index', "divide each node's CPU load by the number of processors on that node")
- .details-row(ng-show='model.Adaptive.loadProbe.kind === "CPU"')
+ .details-row
+number-min-max-step('Processor coefficient:', 'model.Adaptive.loadProbe.CPU.processorCoefficient',
'"loadBalancingAdaptiveCPUProcessorCoefficient" + $index', 'true', '1', '0.001', '1', '0.05', 'Coefficient of every CPU')
- .details-row(ng-show='model.Adaptive.loadProbe.kind === "ProcessingTime"')
+ .panel-details(ng-show='model.Adaptive.loadProbe.kind === "ProcessingTime"')
+ .details-row
+checkbox('Use average', 'model.Adaptive.loadProbe.ProcessingTime.useAverage', '"loadBalancingAdaptiveJobUseAverage" + $index', 'Use average execution time vs. current')
- .details-row(ng-show=loadProbeCustom)
+ .panel-details(ng-show=loadProbeCustom)
+ .details-row
+java-class('Load brobe implementation:', 'model.Adaptive.loadProbe.Custom.className', '"loadBalancingAdaptiveJobUseClass" + $index', 'true', loadProbeCustom,
- 'Custom load balancing SPI implementation class name.')
+ 'Custom load balancing SPI implementation class name.', loadProbeCustom)
.settings-row(ng-show='model.kind === "WeightedRandom"')
+number('Node weight:', 'model.WeightedRandom.nodeWeight', '"loadBalancingWRNodeWeight" + $index', 'true', 10, '1', 'Weight of node')
.settings-row(ng-show='model.kind === "WeightedRandom"')
+checkbox('Use weights', 'model.WeightedRandom.useWeights', '"loadBalancingWRUseWeights" + $index', 'Node weights should be checked when doing random load balancing')
.settings-row(ng-show=loadBalancingCustom)
+java-class('Load balancing SPI implementation:', 'model.Custom.className', '"loadBalancingClass" + $index', 'true', loadBalancingCustom,
- 'Custom load balancing SPI implementation class name.')
+ 'Custom load balancing SPI implementation class name.', loadBalancingCustom)
.col-sm-6
+preview-xml-java(model, 'clusterLoadBalancing')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/custom.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/custom.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/custom.jade
index 385d647..87d2b7d 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/custom.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/logger/custom.jade
@@ -22,4 +22,4 @@ include /app/helpers/jade/mixins.jade
div
.details-row
- +java-class('Class:', model + '.class', '"customLogger"', 'true', required, 'Logger implementation class name')
+ +java-class('Class:', model + '.class', '"customLogger"', 'true', required, 'Logger implementation class name', required)
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/clusters/ssl.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/ssl.jade b/modules/web-console/frontend/app/modules/states/configuration/clusters/ssl.jade
index 85ec073..fbd979c 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/ssl.jade
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/ssl.jade
@@ -72,7 +72,7 @@ include /app/helpers/jade/mixins.jade
label.col-xs-12.col-sm-12.col-md-12
.indexField
| {{ $index+1 }})
- +table-remove-conditional-button(trust, enabled, 'Remove trust manager')
+ +table-remove-conditional-button(trust, enabled, 'Remove trust manager', 'model')
span(ng-hide='field.edit')
a.labelFormField(ng-click='#{enabled} && (field.edit = true) && (#{model} = model)') {{ model }}
span(ng-if='field.edit')
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
new file mode 100644
index 0000000..08cfa71
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+import Worker from 'worker?inline=true!./summary.worker';
+
+export default ['$q', function($q) {
+ return function({ cluster, data }) {
+ const defer = $q.defer();
+ const worker = new Worker();
+
+ worker.postMessage({ cluster, data });
+
+ worker.onmessage = (e) => {
+ defer.resolve(e.data);
+ };
+
+ worker.onerror = (err) => {
+ defer.reject(err);
+ };
+
+ return defer.promise;
+ };
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
index d739c43..cfc6df9 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
@@ -16,15 +16,19 @@
*/
import _ from 'lodash';
-import JSZip from 'jszip';
import saver from 'file-saver';
+const escapeFileName = (name) => name.replace(/[\\\/*\"\[\],\.:;|=<>?]/g, '-').replace(/ /g, '_');
+
export default [
- '$rootScope', '$scope', '$http', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteLoading', '$filter', 'IgniteConfigurationResource', 'JavaTypes', 'IgniteVersion', 'IgniteConfigurationGenerator', 'SpringTransformer', 'JavaTransformer', 'GeneratorDocker', 'GeneratorPom', 'IgnitePropertiesGenerator', 'IgniteReadmeGenerator', 'IgniteFormUtils',
- function($root, $scope, $http, LegacyUtils, Messages, Loading, $filter, Resource, JavaTypes, Version, generator, spring, java, docker, pom, propsGenerator, readme, FormUtils) {
+ '$rootScope', '$scope', '$http', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteLoading', '$filter', 'IgniteConfigurationResource', 'JavaTypes', 'IgniteVersion', 'IgniteConfigurationGenerator', 'SpringTransformer', 'JavaTransformer', 'IgniteDockerGenerator', 'IgniteMavenGenerator', 'IgnitePropertiesGenerator', 'IgniteReadmeGenerator', 'IgniteFormUtils', 'IgniteSummaryZipper',
+ function($root, $scope, $http, LegacyUtils, Messages, Loading, $filter, Resource, JavaTypes, Version, generator, spring, java, docker, pom, propsGenerator, readme, FormUtils, SummaryZipper) {
const ctrl = this;
- $scope.ui = { ready: false };
+ $scope.ui = {
+ isSafari: !!(/constructor/i.test(window.HTMLElement) || window.safari),
+ ready: false
+ };
Loading.start('summaryPage');
@@ -223,10 +227,6 @@ export default [
return false;
}
- function escapeFileName(name) {
- return name.replace(/[\\\/*\"\[\],\.:;|=<>?]/g, '-').replace(/ /g, '_');
- }
-
$scope.selectItem = (cluster) => {
delete ctrl.cluster;
@@ -297,84 +297,19 @@ export default [
// TODO IGNITE-2114: implemented as independent logic for download.
$scope.downloadConfiguration = function() {
- const cluster = $scope.cluster;
-
- const zip = new JSZip();
-
- if (!ctrl.data)
- ctrl.data = {};
-
- if (!ctrl.data.docker)
- ctrl.data.docker = docker.generate(cluster, 'latest');
-
- zip.file('Dockerfile', ctrl.data.docker);
- zip.file('.dockerignore', docker.ignoreFile());
-
- const cfg = generator.igniteConfiguration(cluster, false);
- const clientCfg = generator.igniteConfiguration(cluster, true);
- const clientNearCaches = _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled'));
-
- const secProps = propsGenerator.generate(cfg);
-
- if (secProps)
- zip.file('src/main/resources/secret.properties', secProps);
-
- const srcPath = 'src/main/java';
- const resourcesPath = 'src/main/resources';
-
- const serverXml = `${escapeFileName(cluster.name)}-server.xml`;
- const clientXml = `${escapeFileName(cluster.name)}-client.xml`;
-
- const metaPath = `${resourcesPath}/META-INF`;
-
- zip.file(`${metaPath}/${serverXml}`, spring.igniteConfiguration(cfg).asString());
- zip.file(`${metaPath}/${clientXml}`, spring.igniteConfiguration(clientCfg, clientNearCaches).asString());
-
- const cfgPath = `${srcPath}/config`;
-
- zip.file(`${cfgPath}/ServerConfigurationFactory.java`, java.igniteConfiguration(cfg, 'config', 'ServerConfigurationFactory').asString());
- zip.file(`${cfgPath}/ClientConfigurationFactory.java`, java.igniteConfiguration(clientCfg, 'config', 'ClientConfigurationFactory', clientNearCaches).asString());
-
- if (java.isDemoConfigured(cluster, $root.IgniteDemoMode)) {
- zip.file(`${srcPath}/demo/DemoStartup.java`, java.nodeStartup(cluster, 'demo.DemoStartup',
- 'ServerConfigurationFactory.createConfiguration()', 'config.ServerConfigurationFactory'));
- }
-
- // Generate loader for caches with configured store.
- const cachesToLoad = _.filter(cluster.caches, (cache) => _.nonNil(cache.cacheStoreFactory));
-
- if (_.nonEmpty(cachesToLoad))
- zip.file(`${srcPath}/load/LoadCaches.java`, java.loadCaches(cachesToLoad, 'load', 'LoadCaches', `"${clientXml}"`));
-
- const startupPath = `${srcPath}/startup`;
-
- zip.file(`${startupPath}/ServerNodeSpringStartup.java`, java.nodeStartup(cluster, 'startup.ServerNodeSpringStartup', `"${serverXml}"`));
- zip.file(`${startupPath}/ClientNodeSpringStartup.java`, java.nodeStartup(cluster, 'startup.ClientNodeSpringStartup', `"${clientXml}"`));
-
- zip.file(`${startupPath}/ServerNodeCodeStartup.java`, java.nodeStartup(cluster, 'startup.ServerNodeCodeStartup',
- 'ServerConfigurationFactory.createConfiguration()', 'config.ServerConfigurationFactory'));
- zip.file(`${startupPath}/ClientNodeCodeStartup.java`, java.nodeStartup(cluster, 'startup.ClientNodeCodeStartup',
- 'ClientConfigurationFactory.createConfiguration()', 'config.ClientConfigurationFactory', clientNearCaches));
-
- zip.file('pom.xml', pom.generate(cluster, Version.productVersion().ignite).asString());
-
- zip.file('README.txt', readme.generate());
- zip.file('jdbc-drivers/README.txt', readme.generateJDBC());
-
- if (_.isEmpty(ctrl.data.pojos))
- ctrl.data.pojos = java.pojos(cluster.caches);
-
- for (const pojo of ctrl.data.pojos) {
- if (pojo.keyClass && JavaTypes.nonBuiltInClass(pojo.keyType))
- zip.file(`${srcPath}/${pojo.keyType.replace(/\./g, '/')}.java`, pojo.keyClass);
+ if ($scope.isPrepareDownloading)
+ return;
- zip.file(`${srcPath}/${pojo.valueType.replace(/\./g, '/')}.java`, pojo.valueClass);
- }
+ const cluster = $scope.cluster;
- $generatorOptional.optionalContent(zip, cluster);
+ $scope.isPrepareDownloading = true;
- zip.generateAsync({type: 'blob', compression: 'DEFLATE', mimeType: 'application/octet-stream'})
- .then((blob) => saver.saveAs(blob, escapeFileName(cluster.name) + '-project.zip'));
+ return new SummaryZipper({ cluster, data: ctrl.data || {}, IgniteDemoMode: $root.IgniteDemoMode })
+ .then((data) => {
+ saver.saveAs(data, escapeFileName(cluster.name) + '-project.zip');
+ })
+ .catch((err) => Messages.showError('Failed to generate project files. ' + err.message))
+ .then(() => $scope.isPrepareDownloading = false);
};
/**
@@ -393,7 +328,7 @@ export default [
const dialects = $scope.dialects;
if (dialects.Oracle)
- window.open('http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html');
+ window.open('http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html');
if (dialects.DB2)
window.open('http://www-01.ibm.com/support/docview.wss?uid=swg21363866');
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
new file mode 100644
index 0000000..6b24001
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+import JSZip from 'jszip';
+
+import IgniteVersion from 'app/modules/configuration/Version.service';
+
+import MavenGenerator from 'app/modules/configuration/generator/Maven.service';
+import DockerGenerator from 'app/modules/configuration/generator/Docker.service';
+import ReadmeGenerator from 'app/modules/configuration/generator/Readme.service';
+import PropertiesGenerator from 'app/modules/configuration/generator/Properties.service';
+import ConfigurationGenerator from 'app/modules/configuration/generator/ConfigurationGenerator';
+
+import JavaTransformer from 'app/modules/configuration/generator/JavaTransformer.service';
+import SpringTransformer from 'app/modules/configuration/generator/SpringTransformer.service';
+
+const Version = new IgniteVersion();
+
+const maven = new MavenGenerator();
+const docker = new DockerGenerator();
+const readme = new ReadmeGenerator();
+const properties = new PropertiesGenerator();
+
+const java = new JavaTransformer[0]();
+const spring = new SpringTransformer[0]();
+
+const generator = new ConfigurationGenerator[0]();
+
+const escapeFileName = (name) => name.replace(/[\\\/*\"\[\],\.:;|=<>?]/g, '-').replace(/ /g, '_');
+
+// eslint-disable-next-line no-undef
+onmessage = function(e) {
+ const {cluster, data, demo} = e.data;
+
+ const zip = new JSZip();
+
+ if (!data.docker)
+ data.docker = docker.generate(cluster, 'latest');
+
+ zip.file('Dockerfile', data.docker);
+ zip.file('.dockerignore', docker.ignoreFile());
+
+ const cfg = generator.igniteConfiguration(cluster, false);
+ const clientCfg = generator.igniteConfiguration(cluster, true);
+ const clientNearCaches = _.filter(cluster.caches, (cache) => _.get(cache, 'clientNearConfiguration.enabled'));
+
+ const secProps = properties.generate(cfg);
+
+ if (secProps)
+ zip.file('src/main/resources/secret.properties', secProps);
+
+ const srcPath = 'src/main/java';
+ const resourcesPath = 'src/main/resources';
+
+ const serverXml = `${escapeFileName(cluster.name)}-server.xml`;
+ const clientXml = `${escapeFileName(cluster.name)}-client.xml`;
+
+ const metaPath = `${resourcesPath}/META-INF`;
+
+ zip.file(`${metaPath}/${serverXml}`, spring.igniteConfiguration(cfg).asString());
+ zip.file(`${metaPath}/${clientXml}`, spring.igniteConfiguration(clientCfg, clientNearCaches).asString());
+
+ const cfgPath = `${srcPath}/config`;
+
+ zip.file(`${cfgPath}/ServerConfigurationFactory.java`, java.igniteConfiguration(cfg, 'config', 'ServerConfigurationFactory').asString());
+ zip.file(`${cfgPath}/ClientConfigurationFactory.java`, java.igniteConfiguration(clientCfg, 'config', 'ClientConfigurationFactory', clientNearCaches).asString());
+
+ if (java.isDemoConfigured(cluster, demo)) {
+ zip.file(`${srcPath}/demo/DemoStartup.java`, java.nodeStartup(cluster, 'demo.DemoStartup',
+ 'ServerConfigurationFactory.createConfiguration()', 'config.ServerConfigurationFactory'));
+ }
+
+ // Generate loader for caches with configured store.
+ const cachesToLoad = _.filter(cluster.caches, (cache) => _.nonNil(cache.cacheStoreFactory));
+
+ if (_.nonEmpty(cachesToLoad))
+ zip.file(`${srcPath}/load/LoadCaches.java`, java.loadCaches(cachesToLoad, 'load', 'LoadCaches', `"${clientXml}"`));
+
+ const startupPath = `${srcPath}/startup`;
+
+ zip.file(`${startupPath}/ServerNodeSpringStartup.java`, java.nodeStartup(cluster, 'startup.ServerNodeSpringStartup', `"${serverXml}"`));
+ zip.file(`${startupPath}/ClientNodeSpringStartup.java`, java.nodeStartup(cluster, 'startup.ClientNodeSpringStartup', `"${clientXml}"`));
+
+ zip.file(`${startupPath}/ServerNodeCodeStartup.java`, java.nodeStartup(cluster, 'startup.ServerNodeCodeStartup',
+ 'ServerConfigurationFactory.createConfiguration()', 'config.ServerConfigurationFactory'));
+ zip.file(`${startupPath}/ClientNodeCodeStartup.java`, java.nodeStartup(cluster, 'startup.ClientNodeCodeStartup',
+ 'ClientConfigurationFactory.createConfiguration()', 'config.ClientConfigurationFactory', clientNearCaches));
+
+ zip.file('pom.xml', maven.generate(cluster, Version.productVersion().ignite).asString());
+
+ zip.file('README.txt', readme.generate());
+ zip.file('jdbc-drivers/README.txt', readme.generateJDBC());
+
+ if (_.isEmpty(data.pojos))
+ data.pojos = java.pojos(cluster.caches);
+
+ for (const pojo of data.pojos) {
+ if (pojo.keyClass)
+ zip.file(`${srcPath}/${pojo.keyType.replace(/\./g, '/')}.java`, pojo.keyClass);
+
+ zip.file(`${srcPath}/${pojo.valueType.replace(/\./g, '/')}.java`, pojo.valueClass);
+ }
+
+ zip.generateAsync({
+ type: 'blob',
+ compression: 'DEFLATE',
+ mimeType: 'application/octet-stream'
+ }).then((blob) => postMessage(blob));
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/modules/user/Auth.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/Auth.service.js b/modules/web-console/frontend/app/modules/user/Auth.service.js
index 43e2f92..e0f905d 100644
--- a/modules/web-console/frontend/app/modules/user/Auth.service.js
+++ b/modules/web-console/frontend/app/modules/user/Auth.service.js
@@ -20,12 +20,11 @@ export default ['Auth', ['$http', '$rootScope', '$state', '$window', 'IgniteErro
return {
forgotPassword(userInfo) {
$http.post('/api/v1/password/forgot', userInfo)
- .success(() => $state.go('password.send'))
- .error((err) => ErrorPopover.show('forgot_email', Messages.errorMessage(null, err)));
+ .then(() => $state.go('password.send'))
+ .cacth(({data}) => ErrorPopover.show('forgot_email', Messages.errorMessage(null, data)));
},
auth(action, userInfo) {
$http.post('/api/v1/' + action, userInfo)
- .catch(({data}) => Promise.reject(data))
.then(() => {
if (action === 'password/forgot')
return;
@@ -41,16 +40,16 @@ export default ['Auth', ['$http', '$rootScope', '$state', '$window', 'IgniteErro
$root.gettingStarted.tryShow();
});
})
- .catch((err) => ErrorPopover.show(action + '_email', Messages.errorMessage(null, err)));
+ .catch((res) => ErrorPopover.show(action + '_email', Messages.errorMessage(null, res)));
},
logout() {
$http.post('/api/v1/logout')
- .success(() => {
+ .then(() => {
User.clean();
$window.open($state.href('signin'), '_self');
})
- .error(Messages.showError);
+ .catch(Messages.showError);
}
};
}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/modules/web-console/frontend/app/services/JavaTypes.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/JavaTypes.service.js b/modules/web-console/frontend/app/services/JavaTypes.service.js
index 679914f..944fea5 100644
--- a/modules/web-console/frontend/app/services/JavaTypes.service.js
+++ b/modules/web-console/frontend/app/services/JavaTypes.service.js
@@ -40,7 +40,7 @@ const VALID_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-
* Utility service for various check on java types.
*/
export default class JavaTypes {
- static $inject = ['igniteClusterDefaults', 'igniteCacheDefaults', 'igniteIgfsDefaults'];
+ static $inject = ['IgniteClusterDefaults', 'IgniteCacheDefaults', 'IgniteIGFSDefaults'];
constructor(clusterDflts, cacheDflts, igfsDflts) {
this.enumClasses = _.uniq(this._enumClassesAcc(_.merge(clusterDflts, cacheDflts, igfsDflts), []));
@@ -101,14 +101,9 @@ export default class JavaTypes {
* @return {String} Class name.
*/
shortClassName(clsName) {
- if (this.isJavaPrimitive(clsName))
- return clsName;
+ const dotIdx = clsName.lastIndexOf('.');
- const fullClsName = this.fullClassName(clsName);
-
- const dotIdx = fullClsName.lastIndexOf('.');
-
- return dotIdx > 0 ? fullClsName.substr(dotIdx + 1) : fullClsName;
+ return dotIdx > 0 ? clsName.substr(dotIdx + 1) : clsName;
}
/**
@@ -163,7 +158,7 @@ export default class JavaTypes {
* @param {String} clsName Class name to check.
* @returns {boolean} 'true' if given class name is java primitive.
*/
- isJavaPrimitive(clsName) {
+ isPrimitive(clsName) {
return _.includes(JAVA_PRIMITIVES, clsName);
}
[15/37] ignite git commit: Web console beta-7.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b3a180f/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 5887832..8770bf6 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -19,1776 +19,1825 @@ import DFLT_DIALECTS from 'app/data/dialects.json';
import { EmptyBean, Bean } from './Beans';
-export default ['JavaTypes', 'igniteClusterDefaults', 'igniteCacheDefaults', 'igniteIgfsDefaults', (JavaTypes, clusterDflts, cacheDflts, igfsDflts) => {
- class ConfigurationGenerator {
- static igniteConfigurationBean(cluster) {
- return new Bean('org.apache.ignite.configuration.IgniteConfiguration', 'cfg', cluster, clusterDflts);
- }
+import IgniteClusterDefaults from './defaults/Cluster.service';
+import IgniteCacheDefaults from './defaults/Cache.service';
+import IgniteIGFSDefaults from './defaults/IGFS.service';
- static igfsConfigurationBean(igfs) {
- return new Bean('org.apache.ignite.configuration.FileSystemConfiguration', 'igfs', igfs, igfsDflts);
- }
+import JavaTypes from '../../../services/JavaTypes.service';
- static cacheConfigurationBean(cache) {
- return new Bean('org.apache.ignite.configuration.CacheConfiguration', 'ccfg', cache, cacheDflts);
- }
+const clusterDflts = new IgniteClusterDefaults();
+const cacheDflts = new IgniteCacheDefaults();
+const igfsDflts = new IgniteIGFSDefaults();
- static domainConfigurationBean(domain) {
- return new Bean('org.apache.ignite.cache.QueryEntity', 'qryEntity', domain, cacheDflts);
- }
+const javaTypes = new JavaTypes(clusterDflts, cacheDflts, igfsDflts);
- static discoveryConfigurationBean(discovery) {
- return new Bean('org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi', 'discovery', discovery, clusterDflts.discovery);
- }
+export default class IgniteConfigurationGenerator {
+ static igniteConfigurationBean(cluster) {
+ return new Bean('org.apache.ignite.configuration.IgniteConfiguration', 'cfg', cluster, clusterDflts);
+ }
- /**
- * Function to generate ignite configuration.
- *
- * @param {Object} cluster Cluster to process.
- * @param {Boolean} client
- * @return {Bean} Generated ignite configuration.
- */
- static igniteConfiguration(cluster, client) {
- const cfg = this.igniteConfigurationBean(cluster);
-
- this.clusterGeneral(cluster, cfg, client);
- this.clusterAtomics(cluster.atomicConfiguration, cfg);
- this.clusterBinary(cluster.binaryConfiguration, cfg);
- this.clusterCacheKeyConfiguration(cluster.cacheKeyConfiguration, cfg);
- this.clusterCheckpoint(cluster, cluster.caches, cfg);
- this.clusterCollision(cluster.collision, cfg);
- this.clusterCommunication(cluster, cfg);
- this.clusterConnector(cluster.connector, cfg);
- this.clusterDeployment(cluster, cfg);
- this.clusterEvents(cluster, cfg);
- this.clusterFailover(cluster, cfg);
- this.clusterLoadBalancing(cluster, cfg);
- this.clusterLogger(cluster.logger, cfg);
- this.clusterODBC(cluster.odbc, cfg);
- this.clusterMarshaller(cluster, cfg);
- this.clusterMetrics(cluster, cfg);
- this.clusterSwap(cluster, cfg);
- this.clusterTime(cluster, cfg);
- this.clusterPools(cluster, cfg);
- this.clusterTransactions(cluster.transactionConfiguration, cfg);
- this.clusterSsl(cluster, cfg);
- this.clusterUserAttributes(cluster, cfg);
-
- this.clusterCaches(cluster, cluster.caches, cluster.igfss, client, cfg);
-
- if (!client)
- this.clusterIgfss(cluster.igfss, cfg);
+ static igfsConfigurationBean(igfs) {
+ return new Bean('org.apache.ignite.configuration.FileSystemConfiguration', 'igfs', igfs, igfsDflts);
+ }
- return cfg;
- }
+ static cacheConfigurationBean(cache) {
+ return new Bean('org.apache.ignite.configuration.CacheConfiguration', 'ccfg', cache, cacheDflts);
+ }
- static dialectClsName(dialect) {
- return DFLT_DIALECTS[dialect] || 'Unknown database: ' + (dialect || 'Choose JDBC dialect');
- }
+ static domainConfigurationBean(domain) {
+ return new Bean('org.apache.ignite.cache.QueryEntity', 'qryEntity', domain, cacheDflts);
+ }
- static dataSourceBean(id, dialect) {
- let dsBean;
+ static discoveryConfigurationBean(discovery) {
+ return new Bean('org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi', 'discovery', discovery, clusterDflts.discovery);
+ }
- switch (dialect) {
- case 'Generic':
- dsBean = new Bean('com.mchange.v2.c3p0.ComboPooledDataSource', id, {})
- .property('jdbcUrl', `${id}.jdbc.url`, 'jdbc:your_database');
+ /**
+ * Function to generate ignite configuration.
+ *
+ * @param {Object} cluster Cluster to process.
+ * @param {Boolean} client
+ * @return {Bean} Generated ignite configuration.
+ */
+ static igniteConfiguration(cluster, client) {
+ const cfg = this.igniteConfigurationBean(cluster);
+
+ this.clusterGeneral(cluster, cfg, client);
+ this.clusterAtomics(cluster.atomicConfiguration, cfg);
+ this.clusterBinary(cluster.binaryConfiguration, cfg);
+ this.clusterCacheKeyConfiguration(cluster.cacheKeyConfiguration, cfg);
+ this.clusterCheckpoint(cluster, cluster.caches, cfg);
+ this.clusterCollision(cluster.collision, cfg);
+ this.clusterCommunication(cluster, cfg);
+ this.clusterConnector(cluster.connector, cfg);
+ this.clusterDeployment(cluster, cfg);
+ this.clusterEvents(cluster, cfg);
+ this.clusterFailover(cluster, cfg);
+ this.clusterLoadBalancing(cluster, cfg);
+ this.clusterLogger(cluster.logger, cfg);
+ this.clusterODBC(cluster.odbc, cfg);
+ this.clusterMarshaller(cluster, cfg);
+ this.clusterMetrics(cluster, cfg);
+ this.clusterSwap(cluster, cfg);
+ this.clusterTime(cluster, cfg);
+ this.clusterPools(cluster, cfg);
+ this.clusterTransactions(cluster.transactionConfiguration, cfg);
+ this.clusterSsl(cluster, cfg);
+ this.clusterUserAttributes(cluster, cfg);
+
+ this.clusterCaches(cluster, cluster.caches, cluster.igfss, client, cfg);
+
+ if (!client)
+ this.clusterIgfss(cluster.igfss, cfg);
+
+ return cfg;
+ }
- break;
- case 'Oracle':
- dsBean = new Bean('oracle.jdbc.pool.OracleDataSource', id, {})
- .property('URL', `${id}.jdbc.url`, 'jdbc:oracle:thin:@[host]:[port]:[database]');
+ static dialectClsName(dialect) {
+ return DFLT_DIALECTS[dialect] || 'Unknown database: ' + (dialect || 'Choose JDBC dialect');
+ }
- break;
- case 'DB2':
- dsBean = new Bean('com.ibm.db2.jcc.DB2DataSource', id, {})
- .property('serverName', `${id}.jdbc.server_name`, 'YOUR_DATABASE_SERVER_NAME')
- .propertyInt('portNumber', `${id}.jdbc.port_number`, 'YOUR_JDBC_PORT_NUMBER')
- .property('databaseName', `${id}.jdbc.database_name`, 'YOUR_DATABASE_NAME')
- .propertyInt('driverType', `${id}.jdbc.driver_type`, 'YOUR_JDBC_DRIVER_TYPE');
+ static dataSourceBean(id, dialect) {
+ let dsBean;
+
+ switch (dialect) {
+ case 'Generic':
+ dsBean = new Bean('com.mchange.v2.c3p0.ComboPooledDataSource', id, {})
+ .property('jdbcUrl', `${id}.jdbc.url`, 'jdbc:your_database');
+
+ break;
+ case 'Oracle':
+ dsBean = new Bean('oracle.jdbc.pool.OracleDataSource', id, {})
+ .property('URL', `${id}.jdbc.url`, 'jdbc:oracle:thin:@[host]:[port]:[database]');
+
+ break;
+ case 'DB2':
+ dsBean = new Bean('com.ibm.db2.jcc.DB2DataSource', id, {})
+ .property('serverName', `${id}.jdbc.server_name`, 'YOUR_DATABASE_SERVER_NAME')
+ .propertyInt('portNumber', `${id}.jdbc.port_number`, 'YOUR_JDBC_PORT_NUMBER')
+ .property('databaseName', `${id}.jdbc.database_name`, 'YOUR_DATABASE_NAME')
+ .propertyInt('driverType', `${id}.jdbc.driver_type`, 'YOUR_JDBC_DRIVER_TYPE');
+
+ break;
+ case 'SQLServer':
+ dsBean = new Bean('com.microsoft.sqlserver.jdbc.SQLServerDataSource', id, {})
+ .property('URL', `${id}.jdbc.url`, 'jdbc:sqlserver://[host]:[port][;databaseName=database]');
+
+ break;
+ case 'MySQL':
+ dsBean = new Bean('com.mysql.jdbc.jdbc2.optional.MysqlDataSource', id, {})
+ .property('URL', `${id}.jdbc.url`, 'jdbc:mysql://[host]:[port]/[database]');
+
+ break;
+ case 'PostgreSQL':
+ dsBean = new Bean('org.postgresql.ds.PGPoolingDataSource', id, {})
+ .property('url', `${id}.jdbc.url`, 'jdbc:postgresql://[host]:[port]/[database]');
+
+ break;
+ case 'H2':
+ dsBean = new Bean('org.h2.jdbcx.JdbcDataSource', id, {})
+ .property('URL', `${id}.jdbc.url`, 'jdbc:h2:tcp://[host]/[database]');
+
+ break;
+ default:
+ }
- break;
- case 'SQLServer':
- dsBean = new Bean('com.microsoft.sqlserver.jdbc.SQLServerDataSource', id, {})
- .property('URL', `${id}.jdbc.url`, 'jdbc:sqlserver://[host]:[port][;databaseName=database]');
+ if (dsBean) {
+ dsBean.property('user', `${id}.jdbc.username`, 'YOUR_USER_NAME')
+ .property('password', `${id}.jdbc.password`, 'YOUR_PASSWORD');
+ }
- break;
- case 'MySQL':
- dsBean = new Bean('com.mysql.jdbc.jdbc2.optional.MysqlDataSource', id, {})
- .property('URL', `${id}.jdbc.url`, 'jdbc:mysql://[host]:[port]/[database]');
+ return dsBean;
+ }
- break;
- case 'PostgreSQL':
- dsBean = new Bean('org.postgresql.ds.PGPoolingDataSource', id, {})
- .property('url', `${id}.jdbc.url`, 'jdbc:postgresql://[host]:[port]/[database]');
+ // Generate general section.
+ static clusterGeneral(cluster, cfg = this.igniteConfigurationBean(cluster), client = false) {
+ if (client)
+ cfg.prop('boolean', 'clientMode', true);
- break;
- case 'H2':
- dsBean = new Bean('org.h2.jdbcx.JdbcDataSource', id, {})
- .property('URL', `${id}.jdbc.url`, 'jdbc:h2:tcp://[host]/[database]');
+ cfg.stringProperty('name', 'gridName')
+ .stringProperty('localHost');
- break;
- default:
- }
-
- if (dsBean) {
- dsBean.property('user', `${id}.jdbc.username`, 'YOUR_USER_NAME')
- .property('password', `${id}.jdbc.password`, 'YOUR_PASSWORD');
- }
+ if (_.isNil(cluster.discovery))
+ return cfg;
- return dsBean;
- }
+ const discovery = new Bean('org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi', 'discovery',
+ cluster.discovery, clusterDflts.discovery);
- // Generate general section.
- static clusterGeneral(cluster, cfg = this.igniteConfigurationBean(cluster), client = false) {
- if (client)
- cfg.prop('boolean', 'clientMode', true);
+ let ipFinder;
- cfg.stringProperty('name', 'gridName')
- .stringProperty('localHost');
+ switch (discovery.valueOf('kind')) {
+ case 'Vm':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder',
+ 'ipFinder', cluster.discovery.Vm, clusterDflts.discovery.Vm);
- if (_.isNil(cluster.discovery))
- return cfg;
+ ipFinder.collectionProperty('addrs', 'addresses', cluster.discovery.Vm.addresses);
- const discovery = new Bean('org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi', 'discovery',
- cluster.discovery, clusterDflts.discovery);
+ break;
+ case 'Multicast':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder',
+ 'ipFinder', cluster.discovery.Multicast, clusterDflts.discovery.Multicast);
- let ipFinder;
+ ipFinder.stringProperty('multicastGroup')
+ .intProperty('multicastPort')
+ .intProperty('responseWaitTime')
+ .intProperty('addressRequestAttempts')
+ .stringProperty('localAddress')
+ .collectionProperty('addrs', 'addresses', cluster.discovery.Multicast.addresses);
- switch (discovery.valueOf('kind')) {
- case 'Vm':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder',
- 'ipFinder', cluster.discovery.Vm, clusterDflts.discovery.Vm);
+ break;
+ case 'S3':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder',
+ 'ipFinder', cluster.discovery.S3, clusterDflts.discovery.S3);
- ipFinder.collectionProperty('addrs', 'addresses', cluster.discovery.Vm.addresses);
+ ipFinder.stringProperty('bucketName');
- break;
- case 'Multicast':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder',
- 'ipFinder', cluster.discovery.Multicast, clusterDflts.discovery.Multicast);
+ break;
+ case 'Cloud':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder',
+ 'ipFinder', cluster.discovery.Cloud, clusterDflts.discovery.Cloud);
- ipFinder.stringProperty('multicastGroup')
- .intProperty('multicastPort')
- .intProperty('responseWaitTime')
- .intProperty('addressRequestAttempts')
- .stringProperty('localAddress')
- .collectionProperty('addrs', 'addresses', cluster.discovery.Multicast.addresses);
+ ipFinder.stringProperty('credential')
+ .pathProperty('credentialPath')
+ .stringProperty('identity')
+ .stringProperty('provider')
+ .collectionProperty('regions', 'regions', cluster.discovery.Cloud.regions)
+ .collectionProperty('zones', 'zones', cluster.discovery.Cloud.zones);
- break;
- case 'S3':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder',
- 'ipFinder', cluster.discovery.S3, clusterDflts.discovery.S3);
+ break;
+ case 'GoogleStorage':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder',
+ 'ipFinder', cluster.discovery.GoogleStorage, clusterDflts.discovery.GoogleStorage);
- ipFinder.stringProperty('bucketName');
+ ipFinder.stringProperty('projectName')
+ .stringProperty('bucketName')
+ .pathProperty('serviceAccountP12FilePath')
+ .stringProperty('serviceAccountId');
- break;
- case 'Cloud':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder',
- 'ipFinder', cluster.discovery.Cloud, clusterDflts.discovery.Cloud);
+ break;
+ case 'Jdbc':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder',
+ 'ipFinder', cluster.discovery.Jdbc, clusterDflts.discovery.Jdbc);
- ipFinder.stringProperty('credential')
- .pathProperty('credentialPath')
- .stringProperty('identity')
- .stringProperty('provider')
- .collectionProperty('regions', 'regions', cluster.discovery.Cloud.regions)
- .collectionProperty('zones', 'zones', cluster.discovery.Cloud.zones);
+ ipFinder.intProperty('initSchema');
- break;
- case 'GoogleStorage':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder',
- 'ipFinder', cluster.discovery.GoogleStorage, clusterDflts.discovery.GoogleStorage);
+ if (ipFinder.includes('dataSourceBean', 'dialect')) {
+ const id = ipFinder.valueOf('dataSourceBean');
- ipFinder.stringProperty('projectName')
- .stringProperty('bucketName')
- .pathProperty('serviceAccountP12FilePath')
- .stringProperty('serviceAccountId');
+ ipFinder.dataSource(id, 'dataSource', this.dataSourceBean(id, ipFinder.valueOf('dialect')));
+ }
- break;
- case 'Jdbc':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder',
- 'ipFinder', cluster.discovery.Jdbc, clusterDflts.discovery.Jdbc);
+ break;
+ case 'SharedFs':
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder',
+ 'ipFinder', cluster.discovery.SharedFs, clusterDflts.discovery.SharedFs);
+
+ ipFinder.pathProperty('path');
+
+ break;
+ case 'ZooKeeper':
+ const src = cluster.discovery.ZooKeeper;
+ const dflt = clusterDflts.discovery.ZooKeeper;
+
+ ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder',
+ 'ipFinder', src, dflt);
+
+ ipFinder.emptyBeanProperty('curator')
+ .stringProperty('zkConnectionString');
+
+ const kind = _.get(src, 'retryPolicy.kind');
+
+ if (kind) {
+ const policy = src.retryPolicy;
+
+ let retryPolicyBean;
+
+ switch (kind) {
+ case 'ExponentialBackoff':
+ retryPolicyBean = new Bean('org.apache.curator.retry.ExponentialBackoffRetry', null,
+ policy.ExponentialBackoff, dflt.ExponentialBackoff)
+ .intConstructorArgument('baseSleepTimeMs')
+ .intConstructorArgument('maxRetries')
+ .intConstructorArgument('maxSleepMs');
+
+ break;
+ case 'BoundedExponentialBackoff':
+ retryPolicyBean = new Bean('org.apache.curator.retry.BoundedExponentialBackoffRetry',
+ null, policy.BoundedExponentialBackoff, dflt.BoundedExponentialBackoffRetry)
+ .intConstructorArgument('baseSleepTimeMs')
+ .intConstructorArgument('maxSleepTimeMs')
+ .intConstructorArgument('maxRetries');
+
+ break;
+ case 'UntilElapsed':
+ retryPolicyBean = new Bean('org.apache.curator.retry.RetryUntilElapsed', null,
+ policy.UntilElapsed, dflt.UntilElapsed)
+ .intConstructorArgument('maxElapsedTimeMs')
+ .intConstructorArgument('sleepMsBetweenRetries');
+
+ break;
+
+ case 'NTimes':
+ retryPolicyBean = new Bean('org.apache.curator.retry.RetryNTimes', null,
+ policy.NTimes, dflt.NTimes)
+ .intConstructorArgument('n')
+ .intConstructorArgument('sleepMsBetweenRetries');
+
+ break;
+ case 'OneTime':
+ retryPolicyBean = new Bean('org.apache.curator.retry.RetryOneTime', null,
+ policy.OneTime, dflt.OneTime)
+ .intConstructorArgument('sleepMsBetweenRetry');
+
+ break;
+ case 'Forever':
+ retryPolicyBean = new Bean('org.apache.curator.retry.RetryForever', null,
+ policy.Forever, dflt.Forever)
+ .intConstructorArgument('retryIntervalMs');
+
+ break;
+ case 'Custom':
+ const className = _.get(policy, 'Custom.className');
+
+ if (_.nonEmpty(className))
+ retryPolicyBean = new EmptyBean(className);
+
+ break;
+ default:
+ // No-op.
+ }
- ipFinder.intProperty('initSchema');
+ if (retryPolicyBean)
+ ipFinder.beanProperty('retryPolicy', retryPolicyBean);
+ }
- if (ipFinder.includes('dataSourceBean', 'dialect')) {
- const id = ipFinder.valueOf('dataSourceBean');
+ ipFinder.pathProperty('basePath', '/services')
+ .stringProperty('serviceName')
+ .boolProperty('allowDuplicateRegistrations');
- ipFinder.dataSource(id, 'dataSource', this.dataSourceBean(id, ipFinder.valueOf('dialect')));
- }
+ break;
+ default:
+ // No-op.
+ }
- break;
- case 'SharedFs':
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder',
- 'ipFinder', cluster.discovery.SharedFs, clusterDflts.discovery.SharedFs);
+ if (ipFinder)
+ discovery.beanProperty('ipFinder', ipFinder);
- ipFinder.pathProperty('path');
+ this.clusterDiscovery(cluster.discovery, cfg, discovery);
- break;
- case 'ZooKeeper':
- const src = cluster.discovery.ZooKeeper;
- const dflt = clusterDflts.discovery.ZooKeeper;
+ return cfg;
+ }
- ipFinder = new Bean('org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder',
- 'ipFinder', src, dflt);
+ static igfsDataCache(igfs) {
+ return this.cacheConfiguration({
+ name: igfs.name + '-data',
+ cacheMode: 'PARTITIONED',
+ atomicityMode: 'TRANSACTIONAL',
+ writeSynchronizationMode: 'FULL_SYNC',
+ backups: 0,
+ igfsAffinnityGroupSize: igfs.affinnityGroupSize || 512
+ });
+ }
- ipFinder.emptyBeanProperty('curator')
- .stringProperty('zkConnectionString');
+ static igfsMetaCache(igfs) {
+ return this.cacheConfiguration({
+ name: igfs.name + '-meta',
+ cacheMode: 'REPLICATED',
+ atomicityMode: 'TRANSACTIONAL',
+ writeSynchronizationMode: 'FULL_SYNC'
+ });
+ }
- const kind = _.get(src, 'retryPolicy.kind');
+ static clusterCaches(cluster, caches, igfss, client, cfg = this.igniteConfigurationBean(cluster)) {
+ const ccfgs = _.map(caches, (cache) => this.cacheConfiguration(cache));
- if (kind) {
- const policy = src.retryPolicy;
+ if (!client) {
+ _.forEach(igfss, (igfs) => {
+ ccfgs.push(this.igfsDataCache(igfs));
+ ccfgs.push(this.igfsMetaCache(igfs));
+ });
+ }
- let retryPolicyBean;
+ cfg.varArgProperty('ccfgs', 'cacheConfiguration', ccfgs, 'org.apache.ignite.configuration.CacheConfiguration');
- switch (kind) {
- case 'ExponentialBackoff':
- retryPolicyBean = new Bean('org.apache.curator.retry.ExponentialBackoffRetry', null,
- policy.ExponentialBackoff, dflt.ExponentialBackoff)
- .intConstructorArgument('baseSleepTimeMs')
- .intConstructorArgument('maxRetries')
- .intConstructorArgument('maxSleepMs');
+ return cfg;
+ }
- break;
- case 'BoundedExponentialBackoff':
- retryPolicyBean = new Bean('org.apache.curator.retry.BoundedExponentialBackoffRetry',
- null, policy.BoundedExponentialBackoffRetry, dflt.BoundedExponentialBackoffRetry)
- .intConstructorArgument('baseSleepTimeMs')
- .intConstructorArgument('maxSleepTimeMs')
- .intConstructorArgument('maxRetries');
+ // Generate atomics group.
+ static clusterAtomics(atomics, cfg = this.igniteConfigurationBean()) {
+ const acfg = new Bean('org.apache.ignite.configuration.AtomicConfiguration', 'atomicCfg',
+ atomics, clusterDflts.atomics);
- break;
- case 'UntilElapsed':
- retryPolicyBean = new Bean('org.apache.curator.retry.RetryUntilElapsed', null,
- policy.UntilElapsed, dflt.UntilElapsed)
- .intConstructorArgument('maxElapsedTimeMs')
- .intConstructorArgument('sleepMsBetweenRetries');
+ acfg.enumProperty('cacheMode')
+ .intProperty('atomicSequenceReserveSize');
- break;
+ if (acfg.valueOf('cacheMode') === 'PARTITIONED')
+ acfg.intProperty('backups');
- case 'NTimes':
- retryPolicyBean = new Bean('org.apache.curator.retry.RetryNTimes', null,
- policy.NTimes, dflt.NTimes)
- .intConstructorArgument('n')
- .intConstructorArgument('sleepMsBetweenRetries');
+ if (acfg.isEmpty())
+ return cfg;
- break;
- case 'OneTime':
- retryPolicyBean = new Bean('org.apache.curator.retry.RetryOneTime', null,
- policy.OneTime, dflt.OneTime)
- .intConstructorArgument('sleepMsBetweenRetry');
+ cfg.beanProperty('atomicConfiguration', acfg);
- break;
- case 'Forever':
- retryPolicyBean = new Bean('org.apache.curator.retry.RetryForever', null,
- policy.Forever, dflt.Forever)
- .intConstructorArgument('retryIntervalMs');
+ return cfg;
+ }
- break;
- case 'Custom':
- if (_.nonEmpty(policy.Custom.className))
- retryPolicyBean = new EmptyBean(policy.Custom.className);
+ // Generate binary group.
+ static clusterBinary(binary, cfg = this.igniteConfigurationBean()) {
+ const binaryCfg = new Bean('org.apache.ignite.configuration.BinaryConfiguration', 'binaryCfg',
+ binary, clusterDflts.binary);
- break;
- default:
- // No-op.
- }
+ binaryCfg.emptyBeanProperty('idMapper')
+ .emptyBeanProperty('nameMapper')
+ .emptyBeanProperty('serializer');
- if (retryPolicyBean)
- ipFinder.beanProperty('retryPolicy', retryPolicyBean);
- }
+ const typeCfgs = [];
- ipFinder.pathProperty('basePath', '/services')
- .stringProperty('serviceName')
- .boolProperty('allowDuplicateRegistrations');
+ _.forEach(binary.typeConfigurations, (type) => {
+ const typeCfg = new Bean('org.apache.ignite.binary.BinaryTypeConfiguration',
+ javaTypes.toJavaName('binaryType', type.typeName), type, clusterDflts.binary.typeConfigurations);
- break;
- default:
- // No-op.
- }
+ typeCfg.stringProperty('typeName')
+ .emptyBeanProperty('idMapper')
+ .emptyBeanProperty('nameMapper')
+ .emptyBeanProperty('serializer')
+ .intProperty('enum');
- if (ipFinder)
- discovery.beanProperty('ipFinder', ipFinder);
+ if (typeCfg.nonEmpty())
+ typeCfgs.push(typeCfg);
+ });
- this.clusterDiscovery(cluster.discovery, cfg, discovery);
+ binaryCfg.collectionProperty('types', 'typeConfigurations', typeCfgs, 'org.apache.ignite.binary.BinaryTypeConfiguration')
+ .boolProperty('compactFooter');
+ if (binaryCfg.isEmpty())
return cfg;
- }
-
- static igfsDataCache(igfs) {
- return this.cacheConfiguration({
- name: igfs.name + '-data',
- cacheMode: 'PARTITIONED',
- atomicityMode: 'TRANSACTIONAL',
- writeSynchronizationMode: 'FULL_SYNC',
- backups: 0,
- igfsAffinnityGroupSize: igfs.affinnityGroupSize || 512
- });
- }
- static igfsMetaCache(igfs) {
- return this.cacheConfiguration({
- name: igfs.name + '-meta',
- cacheMode: 'REPLICATED',
- atomicityMode: 'TRANSACTIONAL',
- writeSynchronizationMode: 'FULL_SYNC'
- });
- }
+ cfg.beanProperty('binaryConfiguration', binaryCfg);
- static clusterCaches(cluster, caches, igfss, client, cfg = this.igniteConfigurationBean(cluster)) {
- const ccfgs = _.map(caches, (cache) => this.cacheConfiguration(cache));
+ return cfg;
+ }
- if (!client) {
- _.forEach(igfss, (igfs) => {
- ccfgs.push(this.igfsDataCache(igfs));
- ccfgs.push(this.igfsMetaCache(igfs));
- });
+ // Generate cache key configurations.
+ static clusterCacheKeyConfiguration(keyCfgs, cfg = this.igniteConfigurationBean()) {
+ const items = _.reduce(keyCfgs, (acc, keyCfg) => {
+ if (keyCfg.typeName && keyCfg.affinityKeyFieldName) {
+ acc.push(new Bean('org.apache.ignite.cache.CacheKeyConfiguration', null, keyCfg)
+ .stringConstructorArgument('typeName')
+ .stringConstructorArgument('affinityKeyFieldName'));
}
- cfg.varArgProperty('ccfgs', 'cacheConfiguration', ccfgs, 'org.apache.ignite.configuration.CacheConfiguration');
+ return acc;
+ }, []);
+ if (_.isEmpty(items))
return cfg;
- }
- // Generate atomics group.
- static clusterAtomics(atomics, cfg = this.igniteConfigurationBean()) {
- const acfg = new Bean('org.apache.ignite.configuration.AtomicConfiguration', 'atomicCfg',
- atomics, clusterDflts.atomics);
+ cfg.arrayProperty('cacheKeyConfiguration', 'cacheKeyConfiguration', items,
+ 'org.apache.ignite.cache.CacheKeyConfiguration');
- acfg.enumProperty('cacheMode')
- .intProperty('atomicSequenceReserveSize');
+ return cfg;
+ }
- if (acfg.valueOf('cacheMode') === 'PARTITIONED')
- acfg.intProperty('backups');
+ // Generate checkpoint configurations.
+ static clusterCheckpoint(cluster, caches, cfg = this.igniteConfigurationBean()) {
+ const cfgs = _.filter(_.map(cluster.checkpointSpi, (spi) => {
+ switch (_.get(spi, 'kind')) {
+ case 'FS':
+ const fsBean = new Bean('org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi',
+ 'checkpointSpiFs', spi.FS);
- if (acfg.isEmpty())
- return cfg;
+ fsBean.collectionProperty('directoryPaths', 'directoryPaths', _.get(spi, 'FS.directoryPaths'))
+ .emptyBeanProperty('checkpointListener');
- cfg.beanProperty('atomicConfiguration', acfg);
+ return fsBean;
- return cfg;
- }
+ case 'Cache':
+ const cacheBean = new Bean('org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi',
+ 'checkpointSpiCache', spi.Cache);
- // Generate binary group.
- static clusterBinary(binary, cfg = this.igniteConfigurationBean()) {
- const binaryCfg = new Bean('org.apache.ignite.configuration.BinaryConfiguration', 'binaryCfg',
- binary, clusterDflts.binary);
+ const curCache = _.get(spi, 'Cache.cache');
- binaryCfg.emptyBeanProperty('idMapper')
- .emptyBeanProperty('nameMapper')
- .emptyBeanProperty('serializer');
+ const cache = _.find(caches, (c) => curCache && (c._id === curCache || _.get(c, 'cache._id') === curCache));
- const typeCfgs = [];
+ if (cache)
+ cacheBean.prop('java.lang.String', 'cacheName', cache.name || cache.cache.name);
- _.forEach(binary.typeConfigurations, (type) => {
- const typeCfg = new Bean('org.apache.ignite.binary.BinaryTypeConfiguration',
- JavaTypes.toJavaName('binaryType', type.typeName), type, clusterDflts.binary.typeConfigurations);
+ cacheBean.stringProperty('cacheName')
+ .emptyBeanProperty('checkpointListener');
- typeCfg.stringProperty('typeName')
- .emptyBeanProperty('idMapper')
- .emptyBeanProperty('nameMapper')
- .emptyBeanProperty('serializer')
- .intProperty('enum');
+ return cacheBean;
- if (typeCfg.nonEmpty())
- typeCfgs.push(typeCfg);
- });
+ case 'S3':
+ const s3Bean = new Bean('org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpi',
+ 'checkpointSpiS3', spi.S3, clusterDflts.checkpointSpi.S3);
- binaryCfg.collectionProperty('types', 'typeConfigurations', typeCfgs, 'org.apache.ignite.binary.BinaryTypeConfiguration')
- .boolProperty('compactFooter');
+ let credentialsBean = null;
- if (binaryCfg.isEmpty())
- return cfg;
+ switch (_.get(spi.S3, 'awsCredentials.kind')) {
+ case 'Basic':
+ credentialsBean = new Bean('com.amazonaws.auth.BasicAWSCredentials', 'awsCredentials', {});
- cfg.beanProperty('binaryConfiguration', binaryCfg);
+ credentialsBean.propertyConstructorArgument('checkpoint.s3.credentials.accessKey', 'YOUR_S3_ACCESS_KEY')
+ .propertyConstructorArgument('checkpoint.s3.credentials.secretKey', 'YOUR_S3_SECRET_KEY');
- return cfg;
- }
+ break;
- // Generate cache key configurations.
- static clusterCacheKeyConfiguration(keyCfgs, cfg = this.igniteConfigurationBean()) {
- const items = _.reduce(keyCfgs, (acc, keyCfg) => {
- if (keyCfg.typeName && keyCfg.affinityKeyFieldName) {
- acc.push(new Bean('org.apache.ignite.cache.CacheKeyConfiguration', null, keyCfg)
- .stringConstructorArgument('typeName')
- .stringConstructorArgument('affinityKeyFieldName'));
- }
+ case 'Properties':
+ credentialsBean = new Bean('com.amazonaws.auth.PropertiesCredentials', 'awsCredentials', {});
- return acc;
- }, []);
+ const fileBean = new Bean('java.io.File', '', spi.S3.awsCredentials.Properties)
+ .pathConstructorArgument('path');
- if (_.isEmpty(items))
- return cfg;
+ if (fileBean.nonEmpty())
+ credentialsBean.beanConstructorArgument('file', fileBean);
- cfg.arrayProperty('cacheKeyConfiguration', 'cacheKeyConfiguration', items,
- 'org.apache.ignite.cache.CacheKeyConfiguration');
+ break;
- return cfg;
- }
+ case 'Anonymous':
+ credentialsBean = new Bean('com.amazonaws.auth.AnonymousAWSCredentials', 'awsCredentials', {});
- // Generate checkpoint configurations.
- static clusterCheckpoint(cluster, caches, cfg = this.igniteConfigurationBean()) {
- const cfgs = _.filter(_.map(cluster.checkpointSpi, (spi) => {
- switch (_.get(spi, 'kind')) {
- case 'FS':
- const fsBean = new Bean('org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi',
- 'checkpointSpiFs', spi.FS);
+ break;
- fsBean.collectionProperty('directoryPaths', 'directoryPaths', _.get(spi, 'FS.directoryPaths'))
- .emptyBeanProperty('checkpointListener');
+ case 'BasicSession':
+ credentialsBean = new Bean('com.amazonaws.auth.BasicSessionCredentials', 'awsCredentials', {});
- return fsBean;
+ // TODO 2054 Arguments in one line is very long string.
+ credentialsBean.propertyConstructorArgument('checkpoint.s3.credentials.accessKey')
+ .propertyConstructorArgument('checkpoint.s3.credentials.secretKey')
+ .propertyConstructorArgument('checkpoint.s3.credentials.sessionToken');
- case 'Cache':
- const cacheBean = new Bean('org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi',
- 'checkpointSpiCache', spi.Cache);
+ break;
- const curCache = _.get(spi, 'Cache.cache');
+ case 'Custom':
+ const className = _.get(spi.S3.awsCredentials, 'Custom.className');
- const cache = _.find(caches, (c) => curCache && (c._id === curCache || _.get(c, 'cache._id') === curCache));
+ if (className)
+ credentialsBean = new Bean(className, 'awsCredentials', {});
- if (cache)
- cacheBean.prop('java.lang.String', 'cacheName', cache.name || cache.cache.name);
+ break;
- cacheBean.stringProperty('cacheName')
- .emptyBeanProperty('checkpointListener');
+ default:
+ break;
+ }
- return cacheBean;
+ if (credentialsBean)
+ s3Bean.beanProperty('awsCredentials', credentialsBean);
- case 'S3':
- const s3Bean = new Bean('org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpi',
- 'checkpointSpiS3', spi.S3, clusterDflts.checkpointSpi.S3);
+ s3Bean.stringProperty('bucketNameSuffix');
- let credentialsBean = null;
+ const clientBean = new Bean('com.amazonaws.ClientConfiguration', 'clientCfg', spi.S3.clientConfiguration,
+ clusterDflts.checkpointSpi.S3.clientConfiguration);
- switch (_.get(spi.S3, 'awsCredentials.kind')) {
- case 'Basic':
- credentialsBean = new Bean('com.amazonaws.auth.BasicAWSCredentials', 'awsCredentials', {});
+ clientBean.enumProperty('protocol')
+ .intProperty('maxConnections')
+ .stringProperty('userAgent');
- credentialsBean.propertyConstructorArgument('checkpoint.s3.credentials.accessKey', 'YOUR_S3_ACCESS_KEY')
- .propertyConstructorArgument('checkpoint.s3.credentials.secretKey', 'YOUR_S3_SECRET_KEY');
+ const locAddr = new Bean('java.net.InetAddress', '', spi.S3.clientConfiguration)
+ .factoryMethod('getByName')
+ .stringConstructorArgument('localAddress');
- break;
+ if (locAddr.nonEmpty())
+ clientBean.beanProperty('localAddress', locAddr);
- case 'Properties':
- credentialsBean = new Bean('com.amazonaws.auth.PropertiesCredentials', 'awsCredentials', {});
+ clientBean.stringProperty('proxyHost')
+ .intProperty('proxyPort')
+ .stringProperty('proxyUsername');
- const fileBean = new Bean('java.io.File', '', spi.S3.awsCredentials.Properties)
- .pathConstructorArgument('path');
+ const userName = clientBean.valueOf('proxyUsername');
- if (fileBean.nonEmpty())
- credentialsBean.beanConstructorArgument('file', fileBean);
+ if (userName)
+ clientBean.property('proxyPassword', `checkpoint.s3.proxy.${userName}.password`);
- break;
+ clientBean.stringProperty('proxyDomain')
+ .stringProperty('proxyWorkstation');
- case 'Anonymous':
- credentialsBean = new Bean('com.amazonaws.auth.AnonymousAWSCredentials', 'awsCredentials', {});
+ const retryPolicy = spi.S3.clientConfiguration.retryPolicy;
- break;
+ if (retryPolicy) {
+ const kind = retryPolicy.kind;
- case 'BasicSession':
- credentialsBean = new Bean('com.amazonaws.auth.BasicSessionCredentials', 'awsCredentials', {});
+ const policy = retryPolicy[kind];
- // TODO 2054 Arguments in one line is very long string.
- credentialsBean.propertyConstructorArgument('checkpoint.s3.credentials.accessKey')
- .propertyConstructorArgument('checkpoint.s3.credentials.secretKey')
- .propertyConstructorArgument('checkpoint.s3.credentials.sessionToken');
+ let retryBean;
+
+ switch (kind) {
+ case 'Default':
+ retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
+ retryCondition: 'DEFAULT_RETRY_CONDITION',
+ backoffStrategy: 'DEFAULT_BACKOFF_STRATEGY',
+ maxErrorRetry: 'DEFAULT_MAX_ERROR_RETRY',
+ honorMaxErrorRetryInClientConfig: true
+ }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
+
+ retryBean.constantConstructorArgument('retryCondition')
+ .constantConstructorArgument('backoffStrategy')
+ .constantConstructorArgument('maxErrorRetry')
+ .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
break;
- case 'Custom':
- const className = _.get(spi.S3.awsCredentials, 'Custom.className');
+ case 'DefaultMaxRetries':
+ retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
+ retryCondition: 'DEFAULT_RETRY_CONDITION',
+ backoffStrategy: 'DEFAULT_BACKOFF_STRATEGY',
+ maxErrorRetry: _.get(policy, 'maxErrorRetry') || -1,
+ honorMaxErrorRetryInClientConfig: false
+ }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
- credentialsBean = new Bean(className, 'awsCredentials', {});
+ retryBean.constantConstructorArgument('retryCondition')
+ .constantConstructorArgument('backoffStrategy')
+ .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
+ .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
break;
- default:
- break;
- }
+ case 'DynamoDB':
+ retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
+ retryCondition: 'DEFAULT_RETRY_CONDITION',
+ backoffStrategy: 'DYNAMODB_DEFAULT_BACKOFF_STRATEGY',
+ maxErrorRetry: 'DYNAMODB_DEFAULT_MAX_ERROR_RETRY',
+ honorMaxErrorRetryInClientConfig: true
+ }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
- if (credentialsBean)
- s3Bean.beanProperty('awsCredentials', credentialsBean);
+ retryBean.constantConstructorArgument('retryCondition')
+ .constantConstructorArgument('backoffStrategy')
+ .constantConstructorArgument('maxErrorRetry')
+ .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
- s3Bean.stringProperty('bucketNameSuffix');
+ break;
- const clientBean = new Bean('com.amazonaws.ClientConfiguration', 'clientCfg', spi.S3.clientConfiguration,
- clusterDflts.checkpointSpi.S3.clientConfiguration);
+ case 'DynamoDBMaxRetries':
+ retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
+ retryCondition: 'DEFAULT_RETRY_CONDITION',
+ backoffStrategy: 'DYNAMODB_DEFAULT_BACKOFF_STRATEGY',
+ maxErrorRetry: _.get(policy, 'maxErrorRetry') || -1,
+ honorMaxErrorRetryInClientConfig: false
+ }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
- clientBean.enumProperty('protocol')
- .intProperty('maxConnections')
- .stringProperty('userAgent');
+ retryBean.constantConstructorArgument('retryCondition')
+ .constantConstructorArgument('backoffStrategy')
+ .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
+ .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
- const locAddr = new Bean('java.net.InetAddress', '', spi.S3.clientConfiguration)
- .factoryMethod('getByName')
- .stringConstructorArgument('localAddress');
+ break;
- if (locAddr.nonEmpty())
- clientBean.beanProperty('localAddress', locAddr);
+ case 'Custom':
+ retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', policy);
- clientBean.stringProperty('proxyHost')
- .intProperty('proxyPort')
- .stringProperty('proxyUsername');
+ retryBean.beanConstructorArgument('retryCondition', retryBean.valueOf('retryCondition') ? new EmptyBean(retryBean.valueOf('retryCondition')) : null)
+ .beanConstructorArgument('backoffStrategy', retryBean.valueOf('backoffStrategy') ? new EmptyBean(retryBean.valueOf('backoffStrategy')) : null)
+ .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
+ .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
- const userName = clientBean.valueOf('proxyUsername');
+ break;
- if (userName)
- clientBean.property('proxyPassword', `checkpoint.s3.proxy.${userName}.password`);
+ default:
+ break;
+ }
- clientBean.stringProperty('proxyDomain')
- .stringProperty('proxyWorkstation');
+ if (retryBean)
+ clientBean.beanProperty('retryPolicy', retryBean);
+ }
- const retryPolicy = spi.S3.clientConfiguration.retryPolicy;
+ clientBean.intProperty('maxErrorRetry')
+ .intProperty('socketTimeout')
+ .intProperty('connectionTimeout')
+ .intProperty('requestTimeout')
+ .intProperty('socketSendBufferSizeHints')
+ .stringProperty('signerOverride')
+ .intProperty('connectionTTL')
+ .intProperty('connectionMaxIdleMillis')
+ .emptyBeanProperty('dnsResolver')
+ .intProperty('responseMetadataCacheSize')
+ .emptyBeanProperty('secureRandom')
+ .boolProperty('useReaper')
+ .boolProperty('useGzip')
+ .boolProperty('preemptiveBasicProxyAuth')
+ .boolProperty('useTcpKeepAlive');
+
+ if (clientBean.nonEmpty())
+ s3Bean.beanProperty('clientConfiguration', clientBean);
+
+ s3Bean.emptyBeanProperty('checkpointListener');
+
+ return s3Bean;
+
+ case 'JDBC':
+ const jdbcBean = new Bean('org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi',
+ 'checkpointSpiJdbc', spi.JDBC, clusterDflts.checkpointSpi.JDBC);
+
+ const id = jdbcBean.valueOf('dataSourceBean');
+ const dialect = _.get(spi.JDBC, 'dialect');
+
+ jdbcBean.dataSource(id, 'dataSource', this.dataSourceBean(id, dialect));
+
+ if (!_.isEmpty(jdbcBean.valueOf('user'))) {
+ jdbcBean.stringProperty('user')
+ .property('pwd', `checkpoint.${jdbcBean.valueOf('dataSourceBean')}.${jdbcBean.valueOf('user')}.jdbc.password`, 'YOUR_PASSWORD');
+ }
- if (retryPolicy) {
- const kind = retryPolicy.kind;
+ jdbcBean.stringProperty('checkpointTableName')
+ .stringProperty('keyFieldName')
+ .stringProperty('keyFieldType')
+ .stringProperty('valueFieldName')
+ .stringProperty('valueFieldType')
+ .stringProperty('expireDateFieldName')
+ .stringProperty('expireDateFieldType')
+ .intProperty('numberOfRetries')
+ .emptyBeanProperty('checkpointListener');
- const policy = retryPolicy[kind];
+ return jdbcBean;
- let retryBean;
+ case 'Custom':
+ const clsName = _.get(spi, 'Custom.className');
- switch (kind) {
- case 'Default':
- retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
- retryCondition: 'DEFAULT_RETRY_CONDITION',
- backoffStrategy: 'DEFAULT_BACKOFF_STRATEGY',
- maxErrorRetry: 'DEFAULT_MAX_ERROR_RETRY',
- honorMaxErrorRetryInClientConfig: true
- }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
+ if (clsName)
+ return new Bean(clsName, 'checkpointSpiCustom', spi.Cache);
- retryBean.constantConstructorArgument('retryCondition')
- .constantConstructorArgument('backoffStrategy')
- .constantConstructorArgument('maxErrorRetry')
- .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
+ return null;
- break;
+ default:
+ return null;
+ }
+ }), (checkpointBean) => _.nonNil(checkpointBean));
- case 'DefaultMaxRetries':
- retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
- retryCondition: 'DEFAULT_RETRY_CONDITION',
- backoffStrategy: 'DEFAULT_BACKOFF_STRATEGY',
- maxErrorRetry: _.get(policy, 'maxErrorRetry') || -1,
- honorMaxErrorRetryInClientConfig: false
- }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
+ cfg.arrayProperty('checkpointSpi', 'checkpointSpi', cfgs, 'org.apache.ignite.spi.checkpoint.CheckpointSpi');
- retryBean.constantConstructorArgument('retryCondition')
- .constantConstructorArgument('backoffStrategy')
- .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
- .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
+ return cfg;
+ }
- break;
+ // Generate collision group.
+ static clusterCollision(collision, cfg = this.igniteConfigurationBean()) {
+ let colSpi;
+
+ switch (_.get(collision, 'kind')) {
+ case 'JobStealing':
+ colSpi = new Bean('org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi',
+ 'colSpi', collision.JobStealing, clusterDflts.collision.JobStealing);
+
+ colSpi.intProperty('activeJobsThreshold')
+ .intProperty('waitJobsThreshold')
+ .intProperty('messageExpireTime')
+ .intProperty('maximumStealingAttempts')
+ .boolProperty('stealingEnabled')
+ .emptyBeanProperty('externalCollisionListener')
+ .mapProperty('stealingAttrs', 'stealingAttributes');
+
+ break;
+ case 'FifoQueue':
+ colSpi = new Bean('org.apache.ignite.spi.collision.fifoqueue.FifoQueueCollisionSpi',
+ 'colSpi', collision.FifoQueue, clusterDflts.collision.FifoQueue);
+
+ colSpi.intProperty('parallelJobsNumber')
+ .intProperty('waitingJobsNumber');
+
+ break;
+ case 'PriorityQueue':
+ colSpi = new Bean('org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi',
+ 'colSpi', collision.PriorityQueue, clusterDflts.collision.PriorityQueue);
+
+ colSpi.intProperty('parallelJobsNumber')
+ .intProperty('waitingJobsNumber')
+ .intProperty('priorityAttributeKey')
+ .intProperty('jobPriorityAttributeKey')
+ .intProperty('defaultPriority')
+ .intProperty('starvationIncrement')
+ .boolProperty('starvationPreventionEnabled');
+
+ break;
+ case 'Custom':
+ if (_.nonNil(_.get(collision, 'Custom.class')))
+ colSpi = new EmptyBean(collision.Custom.class);
+
+ break;
+ default:
+ return cfg;
+ }
- case 'DynamoDB':
- retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
- retryCondition: 'DEFAULT_RETRY_CONDITION',
- backoffStrategy: 'DYNAMODB_DEFAULT_BACKOFF_STRATEGY',
- maxErrorRetry: 'DYNAMODB_DEFAULT_MAX_ERROR_RETRY',
- honorMaxErrorRetryInClientConfig: true
- }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
+ if (_.nonNil(colSpi))
+ cfg.beanProperty('collisionSpi', colSpi);
- retryBean.constantConstructorArgument('retryCondition')
- .constantConstructorArgument('backoffStrategy')
- .constantConstructorArgument('maxErrorRetry')
- .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
+ return cfg;
+ }
- break;
+ // Generate communication group.
+ static clusterCommunication(cluster, cfg = this.igniteConfigurationBean(cluster)) {
+ const commSpi = new Bean('org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi', 'communicationSpi',
+ cluster.communication, clusterDflts.communication);
+
+ commSpi.emptyBeanProperty('listener')
+ .stringProperty('localAddress')
+ .intProperty('localPort')
+ .intProperty('localPortRange')
+ .intProperty('sharedMemoryPort')
+ .intProperty('directBuffer')
+ .intProperty('directSendBuffer')
+ .intProperty('idleConnectionTimeout')
+ .intProperty('connectTimeout')
+ .intProperty('maxConnectTimeout')
+ .intProperty('reconnectCount')
+ .intProperty('socketSendBuffer')
+ .intProperty('socketReceiveBuffer')
+ .intProperty('messageQueueLimit')
+ .intProperty('slowClientQueueLimit')
+ .intProperty('tcpNoDelay')
+ .intProperty('ackSendThreshold')
+ .intProperty('unacknowledgedMessagesBufferSize')
+ .intProperty('socketWriteTimeout')
+ .intProperty('selectorsCount')
+ .emptyBeanProperty('addressResolver');
+
+ if (commSpi.nonEmpty())
+ cfg.beanProperty('communicationSpi', commSpi);
+
+ cfg.intProperty('networkTimeout')
+ .intProperty('networkSendRetryDelay')
+ .intProperty('networkSendRetryCount')
+ .intProperty('discoveryStartupDelay');
+
+ return cfg;
+ }
- case 'DynamoDBMaxRetries':
- retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', {
- retryCondition: 'DEFAULT_RETRY_CONDITION',
- backoffStrategy: 'DYNAMODB_DEFAULT_BACKOFF_STRATEGY',
- maxErrorRetry: _.get(policy, 'maxErrorRetry') || -1,
- honorMaxErrorRetryInClientConfig: false
- }, clusterDflts.checkpointSpi.S3.clientConfiguration.retryPolicy);
+ // Generate REST access configuration.
+ static clusterConnector(connector, cfg = this.igniteConfigurationBean()) {
+ const connCfg = new Bean('org.apache.ignite.configuration.ConnectorConfiguration',
+ 'connectorConfiguration', connector, clusterDflts.connector);
+
+ if (connCfg.valueOf('enabled')) {
+ connCfg.pathProperty('jettyPath')
+ .stringProperty('host')
+ .intProperty('port')
+ .intProperty('portRange')
+ .intProperty('idleTimeout')
+ .intProperty('idleQueryCursorTimeout')
+ .intProperty('idleQueryCursorCheckFrequency')
+ .intProperty('receiveBufferSize')
+ .intProperty('sendBufferSize')
+ .intProperty('sendQueueLimit')
+ .intProperty('directBuffer')
+ .intProperty('noDelay')
+ .intProperty('selectorCount')
+ .intProperty('threadPoolSize')
+ .emptyBeanProperty('messageInterceptor')
+ .stringProperty('secretKey');
+
+ if (connCfg.valueOf('sslEnabled')) {
+ connCfg.intProperty('sslClientAuth')
+ .emptyBeanProperty('sslFactory');
+ }
- retryBean.constantConstructorArgument('retryCondition')
- .constantConstructorArgument('backoffStrategy')
- .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
- .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
+ if (connCfg.nonEmpty())
+ cfg.beanProperty('connectorConfiguration', connCfg);
+ }
- break;
+ return cfg;
+ }
- case 'Custom':
- retryBean = new Bean('com.amazonaws.retry.RetryPolicy', 'retryPolicy', policy);
+ // Generate deployment group.
+ static clusterDeployment(cluster, cfg = this.igniteConfigurationBean(cluster)) {
+ cfg.enumProperty('deploymentMode')
+ .boolProperty('peerClassLoadingEnabled');
- retryBean.beanConstructorArgument('retryCondition', retryBean.valueOf('retryCondition') ? new EmptyBean(retryBean.valueOf('retryCondition')) : null)
- .beanConstructorArgument('backoffStrategy', retryBean.valueOf('backoffStrategy') ? new EmptyBean(retryBean.valueOf('backoffStrategy')) : null)
- .constructorArgument('java.lang.Integer', retryBean.valueOf('maxErrorRetry'))
- .constructorArgument('java.lang.Boolean', retryBean.valueOf('honorMaxErrorRetryInClientConfig'));
+ if (cfg.valueOf('peerClassLoadingEnabled')) {
+ cfg.intProperty('peerClassLoadingMissedResourcesCacheSize')
+ .intProperty('peerClassLoadingThreadPoolSize')
+ .varArgProperty('p2pLocClsPathExcl', 'peerClassLoadingLocalClassPathExclude',
+ cluster.peerClassLoadingLocalClassPathExclude);
+ }
- break;
+ let deploymentBean = null;
- default:
- break;
- }
+ switch (_.get(cluster, 'deploymentSpi.kind')) {
+ case 'URI':
+ const uriDeployment = cluster.deploymentSpi.URI;
- if (retryBean)
- clientBean.beanProperty('retryPolicy', retryBean);
- }
+ deploymentBean = new Bean('org.apache.ignite.spi.deployment.uri.UriDeploymentSpi', 'deploymentSpi', uriDeployment);
- clientBean.intProperty('maxErrorRetry')
- .intProperty('socketTimeout')
- .intProperty('connectionTimeout')
- .intProperty('requestTimeout')
- .intProperty('socketSendBufferSizeHints')
- .stringProperty('signerOverride')
- .intProperty('connectionTTL')
- .intProperty('connectionMaxIdleMillis')
- .emptyBeanProperty('dnsResolver')
- .intProperty('responseMetadataCacheSize')
- .emptyBeanProperty('secureRandom')
- .boolProperty('useReaper')
- .boolProperty('useGzip')
- .boolProperty('preemptiveBasicProxyAuth')
- .boolProperty('useTcpKeepAlive');
-
- if (clientBean.nonEmpty())
- s3Bean.beanProperty('clientConfiguration', clientBean);
-
- s3Bean.emptyBeanProperty('checkpointListener');
-
- return s3Bean;
-
- case 'JDBC':
- const jdbcBean = new Bean('org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi',
- 'checkpointSpiJdbc', spi.JDBC, clusterDflts.checkpointSpi.JDBC);
-
- const id = jdbcBean.valueOf('dataSourceBean');
- const dialect = _.get(spi.JDBC, 'dialect');
-
- jdbcBean.dataSource(id, 'dataSource', this.dataSourceBean(id, dialect));
-
- if (!_.isEmpty(jdbcBean.valueOf('user'))) {
- jdbcBean.stringProperty('user')
- .property('pwd', `checkpoint.${jdbcBean.valueOf('dataSourceBean')}.${jdbcBean.valueOf('user')}.jdbc.password`, 'YOUR_PASSWORD');
- }
+ const scanners = _.map(uriDeployment.scanners, (scanner) => new EmptyBean(scanner));
- jdbcBean.stringProperty('checkpointTableName')
- .stringProperty('keyFieldName')
- .stringProperty('keyFieldType')
- .stringProperty('valueFieldName')
- .stringProperty('valueFieldType')
- .stringProperty('expireDateFieldName')
- .stringProperty('expireDateFieldType')
- .intProperty('numberOfRetries')
- .emptyBeanProperty('checkpointListener');
+ deploymentBean.collectionProperty('uriList', 'uriList', uriDeployment.uriList)
+ .stringProperty('temporaryDirectoryPath')
+ .varArgProperty('scanners', 'scanners', scanners,
+ 'org.apache.ignite.spi.deployment.uri.scanners.UriDeploymentScanner')
+ .emptyBeanProperty('listener')
+ .boolProperty('checkMd5')
+ .boolProperty('encodeUri');
- return jdbcBean;
+ cfg.beanProperty('deploymentSpi', deploymentBean);
- case 'Custom':
- const clsName = _.get(spi, 'Custom.className');
+ break;
- if (clsName)
- return new Bean(clsName, 'checkpointSpiCustom', spi.Cache);
+ case 'Local':
+ deploymentBean = new Bean('org.apache.ignite.spi.deployment.local.LocalDeploymentSpi', 'deploymentSpi', cluster.deploymentSpi.Local);
- return null;
+ deploymentBean.emptyBeanProperty('listener');
- default:
- return null;
- }
- }), (checkpointBean) => _.nonNil(checkpointBean));
+ cfg.beanProperty('deploymentSpi', deploymentBean);
- cfg.arrayProperty('checkpointSpi', 'checkpointSpi', cfgs, 'org.apache.ignite.spi.checkpoint.CheckpointSpi');
+ break;
- return cfg;
- }
+ case 'Custom':
+ cfg.emptyBeanProperty('deploymentSpi.Custom.className');
- // Generate collision group.
- static clusterCollision(collision, cfg = this.igniteConfigurationBean()) {
- let colSpi;
+ break;
- switch (_.get(collision, 'kind')) {
- case 'JobStealing':
- colSpi = new Bean('org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi',
- 'colSpi', collision.JobStealing, clusterDflts.collision.JobStealing);
+ default:
+ // No-op.
+ }
- colSpi.intProperty('activeJobsThreshold')
- .intProperty('waitJobsThreshold')
- .intProperty('messageExpireTime')
- .intProperty('maximumStealingAttempts')
- .boolProperty('stealingEnabled')
- .emptyBeanProperty('externalCollisionListener')
- .mapProperty('stealingAttrs', 'stealingAttributes');
+ return cfg;
+ }
- break;
- case 'FifoQueue':
- colSpi = new Bean('org.apache.ignite.spi.collision.fifoqueue.FifoQueueCollisionSpi',
- 'colSpi', collision.FifoQueue, clusterDflts.collision.FifoQueue);
+ // Generate discovery group.
+ static clusterDiscovery(discovery, cfg = this.igniteConfigurationBean(), discoSpi = this.discoveryConfigurationBean(discovery)) {
+ discoSpi.stringProperty('localAddress')
+ .intProperty('localPort')
+ .intProperty('localPortRange')
+ .emptyBeanProperty('addressResolver')
+ .intProperty('socketTimeout')
+ .intProperty('ackTimeout')
+ .intProperty('maxAckTimeout')
+ .intProperty('networkTimeout')
+ .intProperty('joinTimeout')
+ .intProperty('threadPriority')
+ .intProperty('heartbeatFrequency')
+ .intProperty('maxMissedHeartbeats')
+ .intProperty('maxMissedClientHeartbeats')
+ .intProperty('topHistorySize')
+ .emptyBeanProperty('listener')
+ .emptyBeanProperty('dataExchange')
+ .emptyBeanProperty('metricsProvider')
+ .intProperty('reconnectCount')
+ .intProperty('statisticsPrintFrequency')
+ .intProperty('ipFinderCleanFrequency')
+ .emptyBeanProperty('authenticator')
+ .intProperty('forceServerMode')
+ .intProperty('clientReconnectDisabled');
+
+ if (discoSpi.nonEmpty())
+ cfg.beanProperty('discoverySpi', discoSpi);
+
+ return discoSpi;
+ }
- colSpi.intProperty('parallelJobsNumber')
- .intProperty('waitingJobsNumber');
+ // Generate events group.
+ static clusterEvents(cluster, cfg = this.igniteConfigurationBean(cluster)) {
+ const eventStorage = cluster.eventStorage;
- break;
- case 'PriorityQueue':
- colSpi = new Bean('org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi',
- 'colSpi', collision.PriorityQueue, clusterDflts.collision.PriorityQueue);
-
- colSpi.intProperty('parallelJobsNumber')
- .intProperty('waitingJobsNumber')
- .intProperty('priorityAttributeKey')
- .intProperty('jobPriorityAttributeKey')
- .intProperty('defaultPriority')
- .intProperty('starvationIncrement')
- .boolProperty('starvationPreventionEnabled');
+ let eventStorageBean = null;
- break;
- case 'Custom':
- if (_.nonNil(_.get(collision, 'Custom.class')))
- colSpi = new EmptyBean(collision.Custom.class);
+ switch (_.get(eventStorage, 'kind')) {
+ case 'Memory':
+ eventStorageBean = new Bean('org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi', 'eventStorage', eventStorage.Memory, clusterDflts.eventStorage.Memory);
- break;
- default:
- return cfg;
- }
+ eventStorageBean.intProperty('expireAgeMs')
+ .intProperty('expireCount')
+ .emptyBeanProperty('filter');
- if (_.nonNil(colSpi))
- cfg.beanProperty('collisionSpi', colSpi);
+ break;
- return cfg;
- }
+ case 'Custom':
+ const className = _.get(eventStorage, 'Custom.className');
- // Generate communication group.
- static clusterCommunication(cluster, cfg = this.igniteConfigurationBean(cluster)) {
- const commSpi = new Bean('org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi', 'communicationSpi',
- cluster.communication, clusterDflts.communication);
+ if (className)
+ eventStorageBean = new EmptyBean(className);
- commSpi.emptyBeanProperty('listener')
- .stringProperty('localAddress')
- .intProperty('localPort')
- .intProperty('localPortRange')
- .intProperty('sharedMemoryPort')
- .intProperty('directBuffer')
- .intProperty('directSendBuffer')
- .intProperty('idleConnectionTimeout')
- .intProperty('connectTimeout')
- .intProperty('maxConnectTimeout')
- .intProperty('reconnectCount')
- .intProperty('socketSendBuffer')
- .intProperty('socketReceiveBuffer')
- .intProperty('messageQueueLimit')
- .intProperty('slowClientQueueLimit')
- .intProperty('tcpNoDelay')
- .intProperty('ackSendThreshold')
- .intProperty('unacknowledgedMessagesBufferSize')
- .intProperty('socketWriteTimeout')
- .intProperty('selectorsCount')
- .emptyBeanProperty('addressResolver');
-
- if (commSpi.nonEmpty())
- cfg.beanProperty('communicationSpi', commSpi);
-
- cfg.intProperty('networkTimeout')
- .intProperty('networkSendRetryDelay')
- .intProperty('networkSendRetryCount')
- .intProperty('discoveryStartupDelay');
+ break;
- return cfg;
+ default:
+ // No-op.
}
- // Generate REST access configuration.
- static clusterConnector(connector, cfg = this.igniteConfigurationBean()) {
- const connCfg = new Bean('org.apache.ignite.configuration.ConnectorConfiguration',
- 'connectorConfiguration', connector, clusterDflts.connector);
-
- if (connCfg.valueOf('enabled')) {
- connCfg.pathProperty('jettyPath')
- .stringProperty('host')
- .intProperty('port')
- .intProperty('portRange')
- .intProperty('idleTimeout')
- .intProperty('idleQueryCursorTimeout')
- .intProperty('idleQueryCursorCheckFrequency')
- .intProperty('receiveBufferSize')
- .intProperty('sendBufferSize')
- .intProperty('sendQueueLimit')
- .intProperty('directBuffer')
- .intProperty('noDelay')
- .intProperty('selectorCount')
- .intProperty('threadPoolSize')
- .emptyBeanProperty('messageInterceptor')
- .stringProperty('secretKey');
-
- if (connCfg.valueOf('sslEnabled')) {
- connCfg.intProperty('sslClientAuth')
- .emptyBeanProperty('sslFactory');
- }
-
- if (connCfg.nonEmpty())
- cfg.beanProperty('connectorConfiguration', connCfg);
- }
+ if (eventStorageBean && eventStorageBean.nonEmpty())
+ cfg.beanProperty('eventStorageSpi', eventStorageBean);
- return cfg;
- }
+ if (_.nonEmpty(cluster.includeEventTypes))
+ cfg.eventTypes('evts', 'includeEventTypes', cluster.includeEventTypes);
- // Generate deployment group.
- static clusterDeployment(cluster, cfg = this.igniteConfigurationBean(cluster)) {
- cfg.enumProperty('deploymentMode')
- .boolProperty('peerClassLoadingEnabled');
+ return cfg;
+ }
- if (cfg.valueOf('peerClassLoadingEnabled')) {
- cfg.intProperty('peerClassLoadingMissedResourcesCacheSize')
- .intProperty('peerClassLoadingThreadPoolSize')
- .varArgProperty('p2pLocClsPathExcl', 'peerClassLoadingLocalClassPathExclude',
- cluster.peerClassLoadingLocalClassPathExclude);
- }
+ // Generate failover group.
+ static clusterFailover(cluster, cfg = this.igniteConfigurationBean(cluster)) {
+ const spis = [];
- return cfg;
- }
+ _.forEach(cluster.failoverSpi, (spi) => {
+ let failoverSpi;
- // Generate discovery group.
- static clusterDiscovery(discovery, cfg = this.igniteConfigurationBean(), discoSpi = this.discoveryConfigurationBean(discovery)) {
- discoSpi.stringProperty('localAddress')
- .intProperty('localPort')
- .intProperty('localPortRange')
- .emptyBeanProperty('addressResolver')
- .intProperty('socketTimeout')
- .intProperty('ackTimeout')
- .intProperty('maxAckTimeout')
- .intProperty('networkTimeout')
- .intProperty('joinTimeout')
- .intProperty('threadPriority')
- .intProperty('heartbeatFrequency')
- .intProperty('maxMissedHeartbeats')
- .intProperty('maxMissedClientHeartbeats')
- .intProperty('topHistorySize')
- .emptyBeanProperty('listener')
- .emptyBeanProperty('dataExchange')
- .emptyBeanProperty('metricsProvider')
- .intProperty('reconnectCount')
- .intProperty('statisticsPrintFrequency')
- .intProperty('ipFinderCleanFrequency')
- .emptyBeanProperty('authenticator')
- .intProperty('forceServerMode')
- .intProperty('clientReconnectDisabled');
-
- if (discoSpi.nonEmpty())
- cfg.beanProperty('discoverySpi', discoSpi);
-
- return discoSpi;
- }
+ switch (_.get(spi, 'kind')) {
+ case 'JobStealing':
+ failoverSpi = new Bean('org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi',
+ 'failoverSpi', spi.JobStealing, clusterDflts.failoverSpi.JobStealing);
- // Generate events group.
- static clusterEvents(cluster, cfg = this.igniteConfigurationBean(cluster)) {
- const eventStorage = cluster.eventStorage;
+ failoverSpi.intProperty('maximumFailoverAttempts');
- let eventStorageBean = null;
+ break;
+ case 'Never':
+ failoverSpi = new Bean('org.apache.ignite.spi.failover.never.NeverFailoverSpi',
+ 'failoverSpi', spi.Never);
- switch (_.get(eventStorage, 'kind')) {
- case 'Memory':
- eventStorageBean = new Bean('org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi', 'eventStorage', eventStorage.Memory, clusterDflts.eventStorage.Memory);
+ break;
+ case 'Always':
+ failoverSpi = new Bean('org.apache.ignite.spi.failover.always.AlwaysFailoverSpi',
+ 'failoverSpi', spi.Always, clusterDflts.failoverSpi.Always);
- eventStorageBean.intProperty('expireAgeMs')
- .intProperty('expireCount')
- .emptyBeanProperty('filter');
+ failoverSpi.intProperty('maximumFailoverAttempts');
break;
-
case 'Custom':
- const className = _.get(eventStorage, 'Custom.className');
+ const className = _.get(spi, 'Custom.class');
if (className)
- eventStorageBean = new EmptyBean(className);
+ failoverSpi = new EmptyBean(className);
break;
-
default:
// No-op.
}
- if (eventStorageBean && eventStorageBean.nonEmpty())
- cfg.beanProperty('eventStorageSpi', eventStorageBean);
-
- if (_.nonEmpty(cluster.includeEventTypes))
- cfg.eventTypes('evts', 'includeEventTypes', cluster.includeEventTypes);
-
- return cfg;
- }
-
- // Generate failover group.
- static clusterFailover(cluster, cfg = this.igniteConfigurationBean(cluster)) {
- const spis = [];
-
- _.forEach(cluster.failoverSpi, (spi) => {
- let failoverSpi;
+ if (failoverSpi)
+ spis.push(failoverSpi);
+ });
- switch (_.get(spi, 'kind')) {
- case 'JobStealing':
- failoverSpi = new Bean('org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi',
- 'failoverSpi', spi.JobStealing, clusterDflts.failoverSpi.JobStealing);
+ if (spis.length)
+ cfg.arrayProperty('failoverSpi', 'failoverSpi', spis, 'org.apache.ignite.spi.failover.FailoverSpi');
- failoverSpi.intProperty('maximumFailoverAttempts');
-
- break;
- case 'Never':
- failoverSpi = new Bean('org.apache.ignite.spi.failover.never.NeverFailoverSpi',
- 'failoverSpi', spi.Never);
-
- break;
- case 'Always':
- failoverSpi = new Bean('org.apache.ignite.spi.failover.always.AlwaysFailoverSpi',
- 'failoverSpi', spi.Always, clusterDflts.failoverSpi.Always);
+ return cfg;
+ }
- failoverSpi.intProperty('maximumFailoverAttempts');
+ // Generate load balancing configuration group.
+ static clusterLoadBalancing(cluster, cfg = this.igniteConfigurationBean(cluster)) {
+ const spis = [];
- break;
- case 'Custom':
- const className = _.get(spi, 'Custom.class');
+ _.forEach(cluster.loadBalancingSpi, (spi) => {
+ let loadBalancingSpi;
- if (className)
- failoverSpi = new EmptyBean(className);
+ switch (_.get(spi, 'kind')) {
+ case 'RoundRobin':
+ loadBalancingSpi = new Bean('org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi', 'loadBalancingSpiRR', spi.RoundRobin, clusterDflts.loadBalancingSpi.RoundRobin);
- break;
- default:
- // No-op.
- }
+ loadBalancingSpi.boolProperty('perTask');
- if (failoverSpi)
- spis.push(failoverSpi);
- });
+ break;
+ case 'Adaptive':
+ loadBalancingSpi = new Bean('org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveLoadBalancingSpi', 'loadBalancingSpiAdaptive', spi.Adaptive);
- if (spis.length)
- cfg.arrayProperty('failoverSpi', 'failoverSpi', spis, 'org.apache.ignite.spi.failover.FailoverSpi');
+ let probeBean;
- return cfg;
- }
+ switch (_.get(spi, 'Adaptive.loadProbe.kind')) {
+ case 'Job':
+ probeBean = new Bean('org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveJobCountLoadProbe', 'jobProbe', spi.Adaptive.loadProbe.Job, clusterDflts.loadBalancingSpi.Adaptive.loadProbe.Job);
- // Generate load balancing configuration group.
- static clusterLoadBalancing(cluster, cfg = this.igniteConfigurationBean(cluster)) {
- const spis = [];
+ probeBean.boolProperty('useAverage');
- _.forEach(cluster.loadBalancingSpi, (spi) => {
- let loadBalancingSpi;
+ break;
+ case 'CPU':
+ probeBean = new Bean('org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveCpuLoadProbe', 'cpuProbe', spi.Adaptive.loadProbe.CPU, clusterDflts.loadBalancingSpi.Adaptive
<TRUNCATED>
[23/37] ignite git commit: Fixed Visor queries for BinaryObjects.
Posted by vo...@apache.org.
Fixed Visor queries for BinaryObjects.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5769f443
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5769f443
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5769f443
Branch: refs/heads/ignite-2.0
Commit: 5769f44367cae5908cd291f226e9fccd68fe1c39
Parents: 9273e51
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Dec 27 15:14:13 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Dec 27 15:14:13 2016 +0700
----------------------------------------------------------------------
.../query/VisorQueryScanSubstringFilter.java | 5 +-
.../internal/visor/query/VisorQueryUtils.java | 60 ++++++++++++++++++++
2 files changed, 63 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5769f443/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
index 43eb6dd..171698b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.visor.query;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.lang.IgniteBiPredicate;
/**
@@ -52,8 +53,8 @@ public class VisorQueryScanSubstringFilter implements IgniteBiPredicate<Object,
* @return {@code true} when string presentation of key or value contain specified string.
*/
@Override public boolean apply(Object key, Object val) {
- String k = key.toString();
- String v = val.toString();
+ String k = key instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)key) : key.toString();
+ String v = val instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)val) : val.toString();
if (caseSensitive)
return k.contains(ptrn) || v.contains(ptrn);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5769f443/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
index 0b8cf83..5faeac0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
@@ -25,7 +25,13 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.cache.Cache;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.binary.BinaryObjectEx;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.SB;
/**
* Contains utility methods for Visor query tasks and jobs.
@@ -77,12 +83,19 @@ public class VisorQueryUtils {
private static String valueOf(Object o) {
if (o == null)
return "null";
+
if (o instanceof byte[])
return "size=" + ((byte[])o).length;
+
if (o instanceof Byte[])
return "size=" + ((Byte[])o).length;
+
if (o instanceof Object[])
return "size=" + ((Object[])o).length + ", values=[" + mkString((Object[])o, 120) + "]";
+
+ if (o instanceof BinaryObject)
+ return binaryToString((BinaryObject)o);
+
return o.toString();
}
@@ -168,6 +181,51 @@ public class VisorQueryUtils {
}
/**
+ * Convert Binary object to string.
+ *
+ * @param obj Binary object.
+ * @return String representation of Binary object.
+ */
+ public static String binaryToString(BinaryObject obj) {
+ int hash = obj.hashCode();
+
+ if (obj instanceof BinaryObjectEx) {
+ BinaryObjectEx objEx = (BinaryObjectEx)obj;
+
+ BinaryType meta;
+
+ try {
+ meta = ((BinaryObjectEx)obj).rawType();
+ }
+ catch (BinaryObjectException ignore) {
+ meta = null;
+ }
+
+ if (meta != null) {
+ SB buf = new SB(meta.typeName());
+
+ if (meta.fieldNames() != null) {
+ buf.a(" [hash=").a(hash);
+
+ for (String name : meta.fieldNames()) {
+ Object val = objEx.field(name);
+
+ buf.a(", ").a(name).a('=').a(val);
+ }
+
+ buf.a(']');
+
+ return buf.toString();
+ }
+ }
+ }
+
+ return S.toString(obj.getClass().getSimpleName(),
+ "hash", hash, false,
+ "typeId", obj.type().typeId(), true);
+ }
+
+ /**
* Collects rows from sql query future, first time creates meta and column names arrays.
*
* @param cur Query cursor to fetch rows from.
@@ -193,6 +251,8 @@ public class VisorQueryUtils {
row[i] = null;
else if (isKnownType(o))
row[i] = o;
+ else if (o instanceof BinaryObject)
+ row[i] = binaryToString((BinaryObject)o);
else
row[i] = o.getClass().isArray() ? "binary" : o.toString();
}
[26/37] ignite git commit: IGNITE-4504 .NET: Expose default
transaction settings on ITransactions
Posted by vo...@apache.org.
IGNITE-4504 .NET: Expose default transaction settings on ITransactions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/828b9b61
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/828b9b61
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/828b9b61
Branch: refs/heads/ignite-2.0
Commit: 828b9b614ba23d8316c8f0db173a2dc09a5bda27
Parents: 864af7e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Dec 28 17:06:57 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Dec 28 17:06:57 2016 +0300
----------------------------------------------------------------------
.../Cache/CacheAbstractTransactionalTest.cs | 9 +++++++++
.../Impl/Transactions/TransactionsImpl.cs | 18 ++++++++++++++++++
.../Transactions/ITransactions.cs | 19 ++++++++++++++++++-
3 files changed, 45 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/828b9b61/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
index e836ba2..5dcc560 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
@@ -399,6 +399,15 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
Assert.AreEqual(startTime3, tx.StartTime);
+
+ // Check defaults.
+ tx = Transactions.TxStart();
+
+ Assert.AreEqual(Transactions.DefaultTransactionConcurrency, tx.Concurrency);
+ Assert.AreEqual(Transactions.DefaultTransactionIsolation, tx.Isolation);
+ Assert.AreEqual(Transactions.DefaultTimeout, tx.Timeout);
+
+ tx.Commit();
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/828b9b61/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
index 6f8e5bf..5fa5db8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
@@ -158,6 +158,24 @@ namespace Apache.Ignite.Core.Impl.Transactions
DoOutInOp(OpResetMetrics);
}
+ /** <inheritDoc /> */
+ public TransactionConcurrency DefaultTransactionConcurrency
+ {
+ get { return _dfltConcurrency; }
+ }
+
+ /** <inheritDoc /> */
+ public TransactionIsolation DefaultTransactionIsolation
+ {
+ get { return _dfltIsolation; }
+ }
+
+ /** <inheritDoc /> */
+ public TimeSpan DefaultTimeout
+ {
+ get { return _dfltTimeout; }
+ }
+
/// <summary>
/// Commit transaction.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/828b9b61/modules/platforms/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
index ddd2b21..d3b98da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
@@ -28,7 +28,9 @@ namespace Apache.Ignite.Core.Transactions
public interface ITransactions
{
/// <summary>
- /// Starts a transaction with default isolation, concurrency, timeout, and invalidation policy.
+ /// Starts a transaction with default isolation (<see cref="DefaultTransactionIsolation"/>,
+ /// concurrency (<see cref="DefaultTransactionConcurrency"/>), timeout (<see cref="DefaultTimeout"/>),
+ /// and invalidation policy.
/// All defaults are set in CacheConfiguration at startup.
/// </summary>
/// <returns>New transaction.</returns>
@@ -62,6 +64,21 @@ namespace Apache.Ignite.Core.Transactions
ITransaction Tx { get; }
/// <summary>
+ /// Gets the default transaction concurrency.
+ /// </summary>
+ TransactionConcurrency DefaultTransactionConcurrency { get; }
+
+ /// <summary>
+ /// Gets the default transaction isolation.
+ /// </summary>
+ TransactionIsolation DefaultTransactionIsolation { get; }
+
+ /// <summary>
+ /// Gets the default transaction timeout.
+ /// </summary>
+ TimeSpan DefaultTimeout { get; }
+
+ /// <summary>
/// Gets the metrics.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",