Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 7e4cf1edd -> 0b1db97ed
IGNITE-843 Fixed properties file generation. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/399310b8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/399310b8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/399310b8 Branch: refs/heads/ignite-843 Commit: 399310b88a34780b40161c0fa20fa57e11358d63 Parents: 7e4cf1e Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Jul 10 11:23:33 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Jul 10 11:23:33 2015 +0700 ---------------------------------------------------------------------- .../nodejs/routes/generator/common.js | 56 ++++++++++---------- .../nodejs/routes/generator/xml.js | 2 +- 2 files changed, 30 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/399310b8/modules/web-control-center/nodejs/routes/generator/common.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/routes/generator/common.js b/modules/web-control-center/nodejs/routes/generator/common.js index 716d18b..f4f10d4 100644 --- a/modules/web-control-center/nodejs/routes/generator/common.js +++ b/modules/web-control-center/nodejs/routes/generator/common.js @@ -17,19 +17,21 @@ var _ = require('lodash'); -exports.mainComment = function() { +exports.mainComment = mainComment; + +function mainComment() { return 'This configuration was generated by Ignite Control Center (' + formatDate(new Date()) + ')'; -}; +} function addLeadingZero(numberStr, minSize) { if (typeof (numberStr) != 'string') numberStr = '' + numberStr; - + while (numberStr.length < minSize) { numberStr = '0' + numberStr; } - + return numberStr; } @@ -38,7 +40,7 @@ exports.formatDate = formatDate; function formatDate(date) { var dd = addLeadingZero(date.getDate(), 2); var mm = addLeadingZero(date.getMonth() + 1, 2); - + var yyyy = date.getFullYear(); return mm + '/' + dd + '/' + yyyy + ' ' + addLeadingZero(date.getHours(), 2) + ':' + addLeadingZero(date.getMinutes(), 2); @@ -50,7 +52,7 @@ exports.builder = function () { res.deep = 0; res.lineStart = true; - res.append = function(s) { + res.append = function (s) { if (this.lineStart) { for (var i = 0; i < this.deep; i++) this.push(' '); @@ -63,7 +65,7 @@ exports.builder = function () { return this; }; - res.line = function(s) { + res.line = function (s) { if (s) this.append(s); @@ -73,7 +75,7 @@ exports.builder = function () { return this; }; - res.startBlock = function(s) { + res.startBlock = function (s) { if (s) this.append(s); @@ -84,7 +86,7 @@ exports.builder = function () { return this; }; - res.endBlock = function(s) { + res.endBlock = function (s) { this.deep--; if (s) @@ -96,12 +98,12 @@ exports.builder = function () { return this; }; - res.emptyLineIfNeeded = function() { + res.emptyLineIfNeeded = function () { if (this.needEmptyLine) { this.line(); this.needEmptyLine = false; - + return true; } @@ -109,17 +111,17 @@ exports.builder = function () { }; res.imports = {}; - - res.importClass = function(fullClassName) { + + res.importClass = function (fullClassName) { var dotIdx = fullClassName.lastIndexOf('.'); - + var shortName; - + if (dotIdx > 0) shortName = fullClassName.substr(dotIdx + 1); - else + else shortName = fullClassName; - + if (this.imports[shortName]) { if (this.imports[shortName] != fullClassName) throw "Class name conflict: " + this.imports[shortName] + ' and ' + fullClassName; @@ -127,21 +129,21 @@ exports.builder = function () { else { this.imports[shortName] = fullClassName; } - + return shortName; }; - - res.generateImports = function() { + + res.generateImports = function () { var res = []; - + for (var clsName in this.imports) { if (this.imports.hasOwnProperty(clsName)) res.push('import ' + this.imports[clsName] + ';'); } - + return res.join('\n') }; - + return res; }; @@ -231,7 +233,7 @@ exports.transactionConfiguration = new ClassDescriptor('org.apache.ignite.config txSerializableEnabled: null }); -exports.hasProperty = function(obj, props) { +exports.hasProperty = function (obj, props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { if (obj[propName]) @@ -248,7 +250,7 @@ exports.hasProperty = function(obj, props) { * @param name to convert. * @returns {string} Valid java name. */ -exports.toJavaName = function(name) { +exports.toJavaName = function (name) { var javaName = name.replace(/[^A-Za-z_0-9]+/, '_'); return javaName.charAt(0).toLocaleUpperCase() + javaName.slice(1); @@ -260,14 +262,14 @@ exports.toJavaName = function(name) { * @param cluster Configuration to process. * @returns {string} Generated content. */ -exports.generateProperties = function(cluster) { +exports.generateProperties = function (cluster) { var res = exports.builder(); var datasources = []; if (cluster.caches && cluster.caches.length > 0) { - _.foreach(cluster.caches, function (cache) { + _.forEach(cluster.caches, function (cache) { if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) { var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind]; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/399310b8/modules/web-control-center/nodejs/routes/generator/xml.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/routes/generator/xml.js b/modules/web-control-center/nodejs/routes/generator/xml.js index d926adc..a2598ba 100644 --- a/modules/web-control-center/nodejs/routes/generator/xml.js +++ b/modules/web-control-center/nodejs/routes/generator/xml.js @@ -285,7 +285,7 @@ exports.generateClusterConfiguration = function(cluster) { if (res.datasources.length > 0) { xml += ' <!-- Load external properties file. -->\n'; xml += ' <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\n'; - xml += ' <property name="location" value="classpath:ignite.properties"/>\n'; + xml += ' <property name="location" value="classpath:secret.properties"/>\n'; xml += ' </bean>\n\n'; xml += ' <!-- Data source beans will be initialized from external properties file. -->\n';