Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 29a552926 -> 6f91bb827
IGNITE-843 Moved properties file generator to common.js. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6f91bb82 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6f91bb82 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6f91bb82 Branch: refs/heads/ignite-843 Commit: 6f91bb827adc5c0567d4c63bef899004fbb9cbc6 Parents: 29a5529 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Thu Jul 9 10:52:15 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Thu Jul 9 10:52:15 2015 +0700 ---------------------------------------------------------------------- .../nodejs/generator/common.js | 41 ++++++++++++++ .../nodejs/generator/properties.js | 59 -------------------- 2 files changed, 41 insertions(+), 59 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6f91bb82/modules/web-control-center/nodejs/generator/common.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/generator/common.js b/modules/web-control-center/nodejs/generator/common.js index ed44282..763088c 100644 --- a/modules/web-control-center/nodejs/generator/common.js +++ b/modules/web-control-center/nodejs/generator/common.js @@ -15,6 +15,8 @@ * limitations under the License. */ +var _ = require('lodash'); + exports.mainComment = function() { return 'This configuration was generated by Ignite Control Center (' + formatDate(new Date()) + ')'; @@ -244,3 +246,42 @@ exports.toJavaName = function(name) { return javaName.charAt(0).toLocaleUpperCase() + javaName.slice(1); }; + +/** + * Generate properties file with properties stubs for stores data sources. + * + * @param cluster Configuration to process. + * @returns {string} Generated content. + */ +exports.generateProperties = function(cluster) { + var res = builder(); + + var datasources = []; + + if (cluster.caches && cluster.caches.length > 0) { + + _.foreach(cluster.caches, function (cache) { + if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) { + var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind]; + + if (storeFactory.dialect) { + var beanId = storeFactory.dataSourceBean; + + if (!_.contains(datasources, beanId)) { + datasources.push(beanId); + + res.line(beanId + '.jdbc.url=YOUR_JDBC_URL'); + res.line(beanId + '.jdbc.username=YOUR_USER_NAME'); + res.line(beanId + '.jdbc.password=YOUR_PASSWORD'); + res.line(); + } + } + } + }); + } + + if (datasources.length > 0) + return '# ' + mainComment() + '\n\n' + res.join(); + + return ''; +}; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6f91bb82/modules/web-control-center/nodejs/generator/properties.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/generator/properties.js b/modules/web-control-center/nodejs/generator/properties.js deleted file mode 100644 index 21e13a4..0000000 --- a/modules/web-control-center/nodejs/generator/properties.js +++ /dev/null @@ -1,59 +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. - */ - -var _ = require('lodash'); - -var generatorUtils = require("./common"); - -/** - * Generate properties file with properties stubs for stores data sources. - * - * @param cluster Configuration to process. - * @returns {string} Generated content. - */ -exports.generateProperties = function(cluster) { - var res = generatorUtils.builder(); - - res.line('# ' + generatorUtils.mainComment()); - res.line(); - - // Generate data sources properties. - if (cluster.caches && cluster.caches.length > 0) { - var datasources = []; - - _.foreach(cluster.caches, function (cache) { - if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) { - var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind]; - - if (storeFactory.dialect) { - var beanId = storeFactory.dataSourceBean; - - if (!_.contains(datasources, beanId)) { - datasources.push(beanId); - - res.line(beanId + '.jdbc.url=YOUR_JDBC_URL'); - res.line(beanId + '.jdbc.username=YOUR_USER_NAME'); - res.line(beanId + '.jdbc.password=YOUR_PASSWORD'); - res.line(); - } - } - } - }); - } - - return res.join(); -};