Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 e45c00f4f -> 29a552926
IGNITE-843 Added properties file generator. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/29a55292 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/29a55292 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/29a55292 Branch: refs/heads/ignite-843 Commit: 29a5529260c36ad82223d624a4ec5c85fbccbcd2 Parents: e45c00f Author: AKuznetsov <akuznet...@gridgain.com> Authored: Thu Jul 9 10:43:29 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Thu Jul 9 10:43:29 2015 +0700 ---------------------------------------------------------------------- .../nodejs/generator/properties.js | 59 ++++++++++++++++++++ .../web-control-center/nodejs/generator/xml.js | 2 - 2 files changed, 59 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29a55292/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 new file mode 100644 index 0000000..21e13a4 --- /dev/null +++ b/modules/web-control-center/nodejs/generator/properties.js @@ -0,0 +1,59 @@ +/* + * 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(); +}; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29a55292/modules/web-control-center/nodejs/generator/xml.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/generator/xml.js b/modules/web-control-center/nodejs/generator/xml.js index cc8da9d..7f0d98f 100644 --- a/modules/web-control-center/nodejs/generator/xml.js +++ b/modules/web-control-center/nodejs/generator/xml.js @@ -399,8 +399,6 @@ function generateCacheConfiguration(cacheCfg, res) { addBeanWithProperties(res, storeFactory, 'cacheStoreFactory', data.className, data.fields, true); if (storeFactory.dialect) { - console.log("storeFactory.dataSourceBean = " + storeFactory.dataSourceBean); - if (_.findIndex(res.datasources, function (ds) { return ds.dataSourceBean == storeFactory.dataSourceBean; }) < 0) {