Repository: ignite Updated Branches: refs/heads/ignite-843 7e16ebdb6 -> bb8835b6d
IGNITE-1649 Added TCP discovery configuration. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb8835b6 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb8835b6 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb8835b6 Branch: refs/heads/ignite-843 Commit: bb8835b6dafd836b5d21541582bf0b4823689a7e Parents: 7e16ebd Author: vsisko <vsi...@gridgain.com> Authored: Mon Oct 12 17:04:29 2015 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Mon Oct 12 17:04:29 2015 +0700 ---------------------------------------------------------------------- .../main/js/controllers/clusters-controller.js | 22 ++ .../src/main/js/controllers/common-module.js | 18 +- .../main/js/controllers/models/clusters.json | 253 +++++++++++++++++++ .../main/js/controllers/summary-controller.js | 2 +- modules/control-center-web/src/main/js/db.js | 23 ++ .../main/js/routes/generator/generator-java.js | 61 +++++ .../main/js/routes/generator/generator-xml.js | 37 +++ 7 files changed, 406 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/controllers/clusters-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js index 20231f3..9afbbc6 100644 --- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js +++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js @@ -95,6 +95,7 @@ consoleModule.controller('clustersController', [ atomics: {xml: '', java: '', allDefaults: true}, communication: {xml: '', java: '', allDefaults: true}, deployment: {xml: '', java: '', allDefaults: true}, + discovery: {xml: '', java: '', allDefaults: true}, events: {xml: '', java: '', allDefaults: true}, marshaller: {xml: '', java: '', allDefaults: true}, metrics: {xml: '', java: '', allDefaults: true}, @@ -244,6 +245,10 @@ consoleModule.controller('clustersController', [ $scope.preview.deployment.java = $generatorJava.clusterDeployment(val).asString(); $scope.preview.deployment.allDefaults = $common.isEmptyString($scope.preview.deployment.xml); + $scope.preview.discovery.xml = $generatorXml.clusterDiscovery(val.discovery).asString(); + $scope.preview.discovery.java = $generatorJava.clusterDiscovery(val.discovery).asString(); + $scope.preview.discovery.allDefaults = $common.isEmptyString($scope.preview.discovery.xml); + $scope.preview.events.xml = $generatorXml.clusterEvents(val).asString(); $scope.preview.events.java = $generatorJava.clusterEvents(val).asString(); $scope.preview.events.allDefaults = $common.isEmptyString($scope.preview.events.xml); @@ -360,6 +365,23 @@ consoleModule.controller('clustersController', [ if ($common.isEmptyString(item.name)) return showPopoverMessage($scope.panels, 'general', 'clusterName', 'Name should not be empty'); + var d = item.discovery; + + if (!$common.isEmptyString(d.addressResolver) && !$common.isValidJavaClass('Address resolver', d.addressResolver, false, 'addressResolver', false, $scope.panels, 'discovery')) + return false; + + if (!$common.isEmptyString(d.listener) && !$common.isValidJavaClass('Discovery listener', d.listener, false, 'listener', false, $scope.panels, 'discovery')) + return false; + + if (!$common.isEmptyString(d.dataExchange) && !$common.isValidJavaClass('Data exchange', d.dataExchange, false, 'dataExchange', false, $scope.panels, 'discovery')) + return false; + + if (!$common.isEmptyString(d.metricsProvider) && !$common.isValidJavaClass('Metrics provider', d.metricsProvider, false, 'metricsProvider', false, $scope.panels, 'discovery')) + return false; + + if (!$common.isEmptyString(d.authenticator) && !$common.isValidJavaClass('Node authenticator', d.authenticator, false, 'authenticator', false, $scope.panels, 'discovery')) + return false; + if (item.discovery.kind == 'Vm' && item.discovery.Vm.addresses.length == 0) return showPopoverMessage($scope.panels, 'general', 'addresses', 'Addresses are not specified'); http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/controllers/common-module.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js index 720ac3c..59ad2e6 100644 --- a/modules/control-center-web/src/main/js/controllers/common-module.js +++ b/modules/control-center-web/src/main/js/controllers/common-module.js @@ -221,15 +221,15 @@ consoleModule.service('$common', [ var VALID_JAVA_IDENTIFIER = new RegExp('^[a-zA-Z_$][a-zA-Z\d_$]*'); - function isValidJavaIdentifier(msg, ident, elemId) { + function isValidJavaIdentifier(msg, ident, elemId, panels, panelId) { if (isEmptyString(ident)) - return showPopoverMessage(null, null, elemId, msg + ' is invalid!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' is invalid!'); if (_.contains(JAVA_KEYWORDS, ident)) - return showPopoverMessage(null, null, elemId, msg + ' could not contains reserved java keyword: "' + ident + '"!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' could not contains reserved java keyword: "' + ident + '"!'); if (!VALID_JAVA_IDENTIFIER.test(ident)) - return showPopoverMessage(null, null, elemId, msg + ' contains invalid identifier: "' + ident + '"!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' contains invalid identifier: "' + ident + '"!'); return true; } @@ -647,24 +647,24 @@ consoleModule.service('$common', [ javaBuildInClasses: javaBuildInClasses, isJavaBuildInClass: isJavaBuildInClass, isValidJavaIdentifier: isValidJavaIdentifier, - isValidJavaClass: function (msg, ident, allowBuildInClass, elemId, packageOnly) { + isValidJavaClass: function (msg, ident, allowBuildInClass, elemId, packageOnly, panels, panelId) { if (isEmptyString(ident)) - return showPopoverMessage(null, null, elemId, msg + ' could not be empty!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' could not be empty!'); var parts = ident.split('.'); var len = parts.length; if (!allowBuildInClass && isJavaBuildInClass(ident)) - return showPopoverMessage(null, null, elemId, msg + ' should not be the Java build-in class!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' should not be the Java build-in class!'); if (len < 2 && !isJavaBuildInClass(ident) && !packageOnly) - return showPopoverMessage(null, null, elemId, msg + ' does not have package specified!'); + return showPopoverMessage(panels, panelId, elemId, msg + ' does not have package specified!'); for (var i = 0; i < parts.length; i++) { var part = parts[i]; - if (!isValidJavaIdentifier(msg, part, elemId)) + if (!isValidJavaIdentifier(msg, part, elemId, panels, panelId)) return false; } http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/controllers/models/clusters.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json index 6901e81..a10e0c9 100644 --- a/modules/control-center-web/src/main/js/controllers/models/clusters.json +++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json @@ -483,6 +483,259 @@ ] }, { + "label": "Discovery", + "group": "discovery", + "tip": [ + "Discovery properties configuration" + ], + "fields": [ + { + "label": "Local address", + "id": "localAddress", + "type": "text", + "path": "discovery", + "model": "localAddress", + "placeholder": "228.1.2.4", + "tip": [ + "Local address" + ] + }, + { + "label": "Local port", + "id": "localPort", + "type": "number", + "path": "discovery", + "model": "localPort", + "placeholder": 47500, + "tip": [ + "Local port which node uses" + ] + }, + { + "label": "Local port range", + "id": "localPortRange", + "type": "number", + "path": "discovery", + "model": "localPortRange", + "placeholder": 100, + "tip": [ + "Local port range" + ] + }, + { + "label": "Address resolver", + "id": "addressResolver", + "type": "text", + "path": "discovery", + "model": "addressResolver", + "tip": [ + "Class name of resolution between external and internal addresses provider" + ] + }, + { + "label": "Socket timeout", + "id": "socketTimeout", + "type": "number", + "path": "discovery", + "model": "socketTimeout", + "tip": [ + "Socket operations timeout" + ] + }, + { + "label": "Acknowledgement timeout", + "id": "ackTimeout", + "type": "number", + "path": "discovery", + "model": "ackTimeout", + "tip": [ + "Message acknowledgement timeout" + ] + }, + { + "label": "Max acknowledgement timeout", + "id": "maxAckTimeout", + "type": "number", + "path": "discovery", + "model": "maxAckTimeout", + "placeholder": 600000, + "tip": [ + "Maximum message acknowledgement timeout" + ] + }, + { + "label": "Network timeout", + "id": "networkTimeout", + "type": "number", + "path": "discovery", + "model": "networkTimeout", + "placeholder": 5000, + "tip": [ + "Network timeout" + ] + }, + { + "label": "Join timeout", + "id": "joinTimeout", + "type": "number", + "path": "discovery", + "model": "joinTimeout", + "placeholder": 0, + "tip": [ + "Join timeout" + ] + }, + { + "label": "Thread priority", + "id": "threadPriority", + "type": "number", + "path": "discovery", + "model": "threadPriority", + "placeholder": 10, + "tip": [ + "Thread priority for all threads started by SPI" + ] + }, + { + "label": "Heartbeat frequency", + "id": "heartbeatFrequency", + "type": "number", + "path": "discovery", + "model": "heartbeatFrequency", + "placeholder": 2000, + "tip": [ + "Heartbeat messages issuing frequency" + ] + }, + { + "label": "Max heartbeats miss w/o init", + "id": "maxMissedClientHeartbeats", + "type": "number", + "path": "discovery", + "model": "maxMissedClientHeartbeats", + "placeholder": 1, + "tip": [ + "Max heartbeats count node can miss without initiating status check" + ] + }, + { + "label": "Max heartbeats miss w/o failing client node", + "id": "maxMissedClientHbs", + "type": "number", + "path": "discovery", + "model": "maxMissedClientHbs", + "placeholder": 5, + "tip": [ + "Max heartbeats count node can miss without failing client node" + ] + }, + { + "label": "Topology history", + "id": "topHistorySize", + "type": "number", + "path": "discovery", + "model": "topHistorySize", + "placeholder": 1000, + "tip": [ + "Size of topology snapshots history" + ] + }, + { + "label": "Discovery listener", + "id": "listener", + "type": "text", + "path": "discovery", + "model": "listener", + "tip": [ + "Grid discovery listener" + ] + }, + { + "label": "Data exchange", + "id": "dataExchange", + "type": "text", + "path": "discovery", + "model": "dataExchange", + "tip": [ + "Class name of handler for initial data exchange between Ignite nodes" + ] + }, + { + "label": "Metrics provider", + "id": "metricsProvider", + "type": "text", + "path": "discovery", + "model": "metricsProvider", + "tip": [ + "Class name of metric provider to discovery SPI" + ] + }, + { + "label": "Reconnect count", + "id": "reconnectCount", + "type": "number", + "path": "discovery", + "model": "reconnectCount", + "placeholder": 10, + "tip": [ + "Reconnect attempts count" + ] + }, + { + "label": "Statistics frequency", + "id": "statisticsPrintFrequency", + "type": "number", + "path": "discovery", + "model": "statisticsPrintFrequency", + "placeholder": 0, + "tip": [ + "Statistics print frequency" + ] + }, + { + "label": "IP finder clean frequency", + "id": "ipFinderCleanFrequency", + "type": "number", + "path": "discovery", + "model": "ipFinderCleanFrequency", + "placeholder": 60000, + "tip": [ + "IP finder clean frequency" + ] + }, + { + "label": "Node authenticator", + "id": "authenticator", + "type": "text", + "path": "discovery", + "model": "authenticator", + "tip": [ + "Node authenticator" + ] + }, + { + "label": "Force server mode", + "id": "forceServerMode", + "type": "check", + "path": "discovery", + "model": "forceServerMode", + "tip": [ + "Force server mode" + ] + }, + { + "label": "Client reconnect disabled", + "id": "clientReconnectDisabled", + "type": "check", + "path": "discovery", + "model": "clientReconnectDisabled", + "tip": [ + "Client reconnect disabled" + ] + } + ] + }, + { "label": "Events", "group": "events", "tip": [ http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/controllers/summary-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/summary-controller.js b/modules/control-center-web/src/main/js/controllers/summary-controller.js index b3ed15c..9247b14 100644 --- a/modules/control-center-web/src/main/js/controllers/summary-controller.js +++ b/modules/control-center-web/src/main/js/controllers/summary-controller.js @@ -92,7 +92,7 @@ consoleModule.controller('summaryController', [ }; function selectPojoClass(config) { - $generatorJava.metadatas.forEach(function(meta) { + _.forEach($generatorJava.metadatas, function(meta) { if (meta.keyType == config.pojoClass) return config.pojoClassBody = meta.keyClass; http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/db.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js index 1eee5e6..8df7167 100644 --- a/modules/control-center-web/src/main/js/db.js +++ b/modules/control-center-web/src/main/js/db.js @@ -224,6 +224,29 @@ var ClusterSchema = new Schema({ space: {type: ObjectId, ref: 'Space'}, name: String, discovery: { + localAddress: String, + localPort: Number, + localPortRange: Number, + addressResolver: String, + socketTimeout: Number, + ackTimeout: Number, + maxAckTimeout: Number, + networkTimeout: Number, + joinTimeout: Number, + threadPriority: Number, + heartbeatFrequency: Number, + maxMissedHeartbeats: Number, + maxMissedClientHeartbeats: Number, + topHistorySize: Number, + listener: String, + dataExchange: String, + metricsProvider: String, + reconnectCount: Number, + statisticsPrintFrequency: Number, + ipFinderCleanFrequency: Number, + authenticator: String, + forceServerMode: Boolean, + clientReconnectDisabled: Boolean, kind: {type: String, enum: ['Vm', 'Multicast', 'S3', 'Cloud', 'GoogleStorage', 'Jdbc', 'SharedFs']}, Vm: { addresses: [String] http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/routes/generator/generator-java.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-java.js b/modules/control-center-web/src/main/js/routes/generator/generator-java.js index 7140921..55aa0a4 100644 --- a/modules/control-center-web/src/main/js/routes/generator/generator-java.js +++ b/modules/control-center-web/src/main/js/routes/generator/generator-java.js @@ -461,6 +461,10 @@ $generatorJava.clusterGeneral = function (cluster, clientNearCfg, res) { res.line('Unknown discovery kind: ' + d.kind); } + res.needEmptyLine = false; + + $generatorJava.clusterDiscovery(d, res); + res.emptyLineIfNeeded(); res.line('cfg.setDiscoverySpi(discovery);'); @@ -536,6 +540,63 @@ $generatorJava.clusterDeployment = function (cluster, res) { return res; }; +// Generate discovery group. +$generatorJava.clusterDiscovery = function (disco, res) { + if (!res) + res = $generatorCommon.builder(); + + $generatorJava.property(res, 'discovery', disco, 'localAddress'); + $generatorJava.property(res, 'discovery', disco, 'localPort', undefined, undefined, 47500); + $generatorJava.property(res, 'discovery', disco, 'localPortRange', undefined, undefined, 100); + + if ($commonUtils.isDefinedAndNotEmpty(disco.addressResolver)) { + $generatorJava.beanProperty(res, 'discovery', disco, 'addressResolver', 'addressResolver', disco.addressResolver, {}, true); + res.needEmptyLine = false; + } + + $generatorJava.property(res, 'discovery', disco, 'socketTimeout'); + $generatorJava.property(res, 'discovery', disco, 'ackTimeout'); + $generatorJava.property(res, 'discovery', disco, 'maxAckTimeout', undefined, undefined, 600000); + $generatorJava.property(res, 'discovery', disco, 'networkTimeout', undefined, undefined, 5000); + $generatorJava.property(res, 'discovery', disco, 'joinTimeout', undefined, undefined, 0); + $generatorJava.property(res, 'discovery', disco, 'threadPriority', undefined, undefined, 10); + $generatorJava.property(res, 'discovery', disco, 'heartbeatFrequency', undefined, undefined, 2000); + $generatorJava.property(res, 'discovery', disco, 'maxMissedHeartbeats', undefined, undefined, 1); + $generatorJava.property(res, 'discovery', disco, 'maxMissedClientHeartbeats', undefined, undefined, 5); + $generatorJava.property(res, 'discovery', disco, 'topHistorySize', undefined, undefined, 100); + + if ($commonUtils.isDefinedAndNotEmpty(disco.listener)) { + $generatorJava.beanProperty(res, 'discovery', disco, 'listener', 'listener', disco.listener, {}, true); + res.needEmptyLine = false; + } + + if ($commonUtils.isDefinedAndNotEmpty(disco.dataExchange)) { + $generatorJava.beanProperty(res, 'discovery', disco, 'dataExchange', 'dataExchange', disco.dataExchange, {}, true); + res.needEmptyLine = false; + } + + if ($commonUtils.isDefinedAndNotEmpty(disco.metricsProvider)) { + $generatorJava.beanProperty(res, 'discovery', disco, 'metricsProvider', 'metricsProvider', disco.metricsProvider, {}, true); + res.needEmptyLine = false; + } + + $generatorJava.property(res, 'discovery', disco, 'reconnectCount', undefined, undefined, 10); + $generatorJava.property(res, 'discovery', disco, 'statisticsPrintFrequency', undefined, undefined, 0); + $generatorJava.property(res, 'discovery', disco, 'ipFinderCleanFrequency', undefined, undefined, 60000); + + if ($commonUtils.isDefinedAndNotEmpty(disco.authenticator)) { + $generatorJava.beanProperty(res, 'discovery', disco, 'authenticator', 'authenticator', disco.authenticator, {}, true); + res.needEmptyLine = false; + } + + $generatorJava.property(res, 'discovery', disco, 'forceServerMode', undefined, undefined, false); + $generatorJava.property(res, 'discovery', disco, 'clientReconnectDisabled', undefined, undefined, false); + + res.needEmptyLine = true; + + return res; +}; + // Generate events group. $generatorJava.clusterEvents = function (cluster, res) { if (!res) http://git-wip-us.apache.org/repos/asf/ignite/blob/bb8835b6/modules/control-center-web/src/main/js/routes/generator/generator-xml.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js index 892643d..4221c53 100644 --- a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js +++ b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js @@ -329,6 +329,9 @@ $generatorXml.clusterGeneral = function (cluster, res) { } res.endBlock('</property>'); + + $generatorXml.clusterDiscovery(d, res); + res.endBlock('</bean>'); res.endBlock('</property>'); @@ -404,6 +407,40 @@ $generatorXml.clusterDeployment = function (cluster, res) { return res; }; +// Generate discovery group. +$generatorXml.clusterDiscovery = function (disco, res) { + if (!res) + res = $generatorCommon.builder(); + + $generatorXml.property(res, disco, 'localAddress'); + $generatorXml.property(res, disco, 'localPort', undefined, 47500); + $generatorXml.property(res, disco, 'localPortRange', undefined, 100); + $generatorXml.beanProperty(res, disco, 'addressResolver', {className: disco.addressResolver}, true); + $generatorXml.property(res, disco, 'socketTimeout'); + $generatorXml.property(res, disco, 'ackTimeout'); + $generatorXml.property(res, disco, 'maxAckTimeout', undefined, 600000); + $generatorXml.property(res, disco, 'discoNetworkTimeout', 'setNetworkTimeout', 5000); + $generatorXml.property(res, disco, 'joinTimeout', undefined, 0); + $generatorXml.property(res, disco, 'threadPriority', undefined, 10); + $generatorXml.property(res, disco, 'heartbeatFrequency', undefined, 2000); + $generatorXml.property(res, disco, 'maxMissedHeartbeats', undefined, 1); + $generatorXml.property(res, disco, 'maxMissedClientHeartbeats', undefined, 5); + $generatorXml.property(res, disco, 'topHistorySize', undefined, 100); + $generatorXml.beanProperty(res, disco, 'listener', {className: disco.listener}, true); + $generatorXml.beanProperty(res, disco, 'dataExchange', {className: disco.dataExchange}, true); + $generatorXml.beanProperty(res, disco, 'metricsProvider', {className: disco.metricsProvider}, true); + $generatorXml.property(res, disco, 'reconnectCount', undefined, 10); + $generatorXml.property(res, disco, 'statisticsPrintFrequency', undefined, 0); + $generatorXml.property(res, disco, 'ipFinderCleanFrequency', undefined, 60000); + $generatorXml.beanProperty(res, disco, 'authenticator', {className: disco.authenticator}, true); + $generatorXml.property(res, disco, 'forceServerMode', undefined, false); + $generatorXml.property(res, disco, 'clientReconnectDisabled', undefined, false); + + res.needEmptyLine = true; + + return res; +}; + // Generate events group. $generatorXml.clusterEvents = function (cluster, res) { if (!res)