You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2016/12/28 14:04:55 UTC
[29/50] [abbrv] ignite git commit: Web console beta-7.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e7c852b/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/8e7c852b/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/8e7c852b/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/8e7c852b/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;